summaryrefslogtreecommitdiff
path: root/persistent-nix-shell
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2019-11-24 20:39:26 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2019-11-24 20:39:26 +0100
commit61e8781e600a916e51fd663c4d8cd5d93bb894cb (patch)
tree15a8e9abf15f5ebd8e2e692a9fc43a7124fae93e /persistent-nix-shell
parentf55aa62c7dd25d44b37985ef5f109eb8212f5ae7 (diff)
downloadutils-61e8781e600a916e51fd663c4d8cd5d93bb894cb.tar
utils-61e8781e600a916e51fd663c4d8cd5d93bb894cb.tar.gz
utils-61e8781e600a916e51fd663c4d8cd5d93bb894cb.tar.bz2
utils-61e8781e600a916e51fd663c4d8cd5d93bb894cb.tar.xz
utils-61e8781e600a916e51fd663c4d8cd5d93bb894cb.zip
persistent-nix-shell
Diffstat (limited to 'persistent-nix-shell')
-rwxr-xr-xpersistent-nix-shell20
1 files changed, 20 insertions, 0 deletions
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 @@
1#!@zsh@/bin/zsh
2
3set -e
4
5gcrootsDir=${PWD}/.nix-gc-roots
6
7if [[ ${#@} -ge 1 ]]; then
8 shellFile=${1}
9 shift
10else
11 shellFile=${PWD}/shell.nix
12fi
13
14set -x
15mkdir -p ${gcrootsDir}
16nix-instantiate ${shellFile} --indirect --add-root ${gcrootsDir}/shell.drv
17nix-store --indirect --add-root ${gcrootsDir}/shell.dep --realise $(nix-store --query --references ${gcrootsDir}/shell.drv)
18set +x
19
20exec nix-shell $(readlink ${gcrootsDir}/shell.drv) ${@}