From 61e8781e600a916e51fd663c4d8cd5d93bb894cb Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 24 Nov 2019 20:39:26 +0100 Subject: persistent-nix-shell --- persistent-nix-shell | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 persistent-nix-shell (limited to 'persistent-nix-shell') diff --git a/persistent-nix-shell b/persistent-nix-shell new file mode 100755 index 0000000..a17f6de --- /dev/null +++ b/persistent-nix-shell @@ -0,0 +1,20 @@ +#!@zsh@/bin/zsh + +set -e + +gcrootsDir=${PWD}/.nix-gc-roots + +if [[ ${#@} -ge 1 ]]; then + shellFile=${1} + shift +else + shellFile=${PWD}/shell.nix +fi + +set -x +mkdir -p ${gcrootsDir} +nix-instantiate ${shellFile} --indirect --add-root ${gcrootsDir}/shell.drv +nix-store --indirect --add-root ${gcrootsDir}/shell.dep --realise $(nix-store --query --references ${gcrootsDir}/shell.drv) +set +x + +exec nix-shell $(readlink ${gcrootsDir}/shell.drv) ${@} -- cgit v1.2.3