Skip to content

Commit

Permalink
remove let opens
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGibb committed Jul 18, 2024
1 parent 8bd2466 commit 09cb58d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/state/opamEnv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,7 @@ let compute_updates ?(force_path=false) st =
List.map resolve_separator_and_format updates
in
let nix_env =
let open OpamFilename in
create (OpamPath.Switch.meta OpamStateConfig.(!r.root_dir) st.switch) (basename (raw "nix.env"))
OpamFilename.create (OpamPath.Switch.meta OpamStateConfig.(!r.root_dir) st.switch) (OpamFilename.basename (OpamFilename.raw "nix.env"))
|> OpamFile.make
|> OpamFile.Environment.read_opt
|> Option.fold ~none:[] ~some:(List.map resolve_separator_and_format)
Expand Down
7 changes: 3 additions & 4 deletions src/state/opamSysInteract.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1106,14 +1106,13 @@ let install_packages_commands_t ?(env=OpamVariable.Map.empty) switch config sys_
"-Su"::"--noconfirm"::packages], None
| Netbsd -> [`AsAdmin "pkgin", yes ["-y"] ("install" :: packages)], None
| Nix ->
let open OpamFilename in
(match switch with
| None ->
log "Nix depext must be passed switch";
[], None
| Some switch ->
let dir = OpamPath.Switch.meta OpamStateConfig.(!r.root_dir) switch in
let drvFile = create dir (basename (raw "env.nix")) in
let drvFile = OpamFilename.create dir (OpamFilename.basename (OpamFilename.raw "env.nix")) in
let packages = String.concat " "
(OpamSysPkg.Set.fold (fun p l -> OpamSysPkg.to_string p :: l)
OpamSysPkg.Set.Op.(sys_packages ++ required) [])
Expand All @@ -1139,8 +1138,8 @@ echo "PATH += $PATH Nix" >> "$out"
preferLocalBuild = true;
}
|} in
write drvFile contents;
let envFile = create dir (basename (raw "nix.env")) |> OpamFilename.to_string in
OpamFilename.write drvFile contents;
let envFile = OpamFilename.create dir (OpamFilename.basename (OpamFilename.raw "nix.env")) |> OpamFilename.to_string in
[`AsUser "nix-build", [ OpamFilename.to_string drvFile; "--out-link"; envFile ] ], None)
| Openbsd -> [`AsAdmin "pkg_add", yes ~no:["-i"] ["-I"] packages], None
| Suse -> [`AsAdmin "zypper", yes ["--non-interactive"] ("install"::packages)], None
Expand Down

0 comments on commit 09cb58d

Please sign in to comment.