diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2020-02-29 12:18:11 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2020-02-29 12:18:11 +0100 |
commit | b02413acfbbb1e541fcb9218d6930dbf283c7211 (patch) | |
tree | e6d1827123cefea4c25e83874fe4f2f6f2381a5e /persistent-nix-shell | |
parent | aa58927f86322757cc85fa469564e8b05ddcdcda (diff) | |
parent | c39a6086a83c2547534d943e3611c4ce0524fafa (diff) | |
download | utils-b02413acfbbb1e541fcb9218d6930dbf283c7211.tar utils-b02413acfbbb1e541fcb9218d6930dbf283c7211.tar.gz utils-b02413acfbbb1e541fcb9218d6930dbf283c7211.tar.bz2 utils-b02413acfbbb1e541fcb9218d6930dbf283c7211.tar.xz utils-b02413acfbbb1e541fcb9218d6930dbf283c7211.zip |
Merge branch 'master' of git.yggdrasil.li:utils
Diffstat (limited to 'persistent-nix-shell')
-rwxr-xr-x | persistent-nix-shell | 20 |
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 | |||
3 | set -e | ||
4 | |||
5 | gcrootsDir=${PWD}/.nix-gc-roots | ||
6 | |||
7 | if [[ ${#@} -ge 1 ]]; then | ||
8 | shellFile=${1} | ||
9 | shift | ||
10 | else | ||
11 | shellFile=${PWD}/shell.nix | ||
12 | fi | ||
13 | |||
14 | set -x | ||
15 | mkdir -p ${gcrootsDir} | ||
16 | nix-instantiate ${shellFile} --indirect --add-root ${gcrootsDir}/shell.drv | ||
17 | nix-store --indirect --add-root ${gcrootsDir}/shell.dep --realise $(nix-store --query --references ${gcrootsDir}/shell.drv) | ||
18 | set +x | ||
19 | |||
20 | exec nix-shell $(readlink ${gcrootsDir}/shell.drv) ${@} | ||