From 3a626b6cf2e18ebf16a7808972dfd643494cc1a7 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sat, 19 Dec 2020 18:11:21 -0700 Subject: [PATCH] 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. --- .envrc | 1 + shell.nix | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.envrc b/.envrc index 8dfc6aa7..77ce6204 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ +watch_file shell.nix use flake || use nix diff --git a/shell.nix b/shell.nix index 3d3f1512..18ea0e41 100644 --- a/shell.nix +++ b/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 ''; }