shell: don't overwrite nix by default
For users who already have nix-command setup, we don't want to override the `nix` in their path.
This commit is contained in:
parent
70723403cc
commit
3a626b6cf2
2 changed files with 8 additions and 6 deletions
1
.envrc
1
.envrc
|
@ -1 +1,2 @@
|
|||
watch_file shell.nix
|
||||
use flake || use nix
|
||||
|
|
13
shell.nix
13
shell.nix
|
@ -18,16 +18,17 @@ pkgs.mkShell {
|
|||
nativeBuildInputs = with pkgs; [
|
||||
git
|
||||
git-crypt
|
||||
nixFlakes
|
||||
rebuild
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
mkdir -p secrets
|
||||
PATH=${
|
||||
pkgs.writeShellScriptBin "nix" ''
|
||||
${pkgs.nixFlakes}/bin/nix --option experimental-features "nix-command flakes ca-references" "$@"
|
||||
''
|
||||
}/bin:$PATH
|
||||
if ! nix flake show; then
|
||||
PATH=${
|
||||
pkgs.writeShellScriptBin "nix" ''
|
||||
${pkgs.nixFlakes}/bin/nix --option experimental-features "nix-command flakes ca-references" "$@"
|
||||
''
|
||||
}/bin:$PATH
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue