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:
Timothy DeHerrera 2020-12-19 18:11:21 -07:00
parent 70723403cc
commit 3a626b6cf2
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
2 changed files with 8 additions and 6 deletions

1
.envrc
View File

@ -1 +1,2 @@
watch_file shell.nix
use flake || use nix use flake || use nix

View File

@ -18,16 +18,17 @@ pkgs.mkShell {
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
git git
git-crypt git-crypt
nixFlakes
rebuild rebuild
]; ];
shellHook = '' shellHook = ''
mkdir -p secrets mkdir -p secrets
PATH=${ if ! nix flake show; then
pkgs.writeShellScriptBin "nix" '' PATH=${
${pkgs.nixFlakes}/bin/nix --option experimental-features "nix-command flakes ca-references" "$@" pkgs.writeShellScriptBin "nix" ''
'' ${pkgs.nixFlakes}/bin/nix --option experimental-features "nix-command flakes ca-references" "$@"
}/bin:$PATH ''
}/bin:$PATH
fi
''; '';
} }