diff options
author | Adrian Kummerlaender | 2020-02-18 11:25:34 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2020-02-18 11:25:34 +0100 |
commit | 18d2edf330e6932c177e71b1c7831a7a5ad77e38 (patch) | |
tree | 6e5193103b12070249105d370432c5f84f72961a | |
parent | 832b80a68a42ef3ee3f96b9d16c2c37376ed023b (diff) | |
download | pkgs-18d2edf330e6932c177e71b1c7831a7a5ad77e38.tar pkgs-18d2edf330e6932c177e71b1c7831a7a5ad77e38.tar.gz pkgs-18d2edf330e6932c177e71b1c7831a7a5ad77e38.tar.bz2 pkgs-18d2edf330e6932c177e71b1c7831a7a5ad77e38.tar.lz pkgs-18d2edf330e6932c177e71b1c7831a7a5ad77e38.tar.xz pkgs-18d2edf330e6932c177e71b1c7831a7a5ad77e38.tar.zst pkgs-18d2edf330e6932c177e71b1c7831a7a5ad77e38.zip |
Add plain persistent nix-shell wrapper
Automatically adds GC roots, including a fix for an implicit interactiveBash dependency
-rw-r--r-- | default.nix | 2 | ||||
-rw-r--r-- | pkgs/persistent-nix-shell/default.nix | 20 | ||||
-rw-r--r-- | web/tree/info.md | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/default.nix b/default.nix index 1552309..0e44786 100644 --- a/default.nix +++ b/default.nix @@ -15,5 +15,7 @@ let build-xslt = callPackage ./pkgs/xslt/build-xslt { }; static-xslt = callPackage ./pkgs/xslt/static-xslt { }; make-xslt = callPackage ./pkgs/xslt/make-xslt { }; + + persistent-nix-shell = callPackage ./pkgs/persistent-nix-shell { }; }; in custom diff --git a/pkgs/persistent-nix-shell/default.nix b/pkgs/persistent-nix-shell/default.nix new file mode 100644 index 0000000..8a74eb4 --- /dev/null +++ b/pkgs/persistent-nix-shell/default.nix @@ -0,0 +1,20 @@ +{ stdenv, pkgs, ... }: + +pkgs.writeTextFile { + name = "persistent-nix-shell"; + executable = true; + destination = "/bin/persistent-nix-shell"; + + text = '' + #!/bin/sh -eu + + mkdir -p .gcroots + + nix-instantiate shell.nix --indirect --add-root $PWD/.gcroots/shell.drv > /dev/null + nix-store -r $(nix-store --query --references $PWD/.gcroots/shell.drv) --indirect --add-root $PWD/.gcroots/shell.dep > /dev/null + + # Fix to prevent implicit interactiveBash dependency + export NIX_BUILD_SHELL=/run/current-system/sw/bin/bash + exec nix-shell $(readlink $PWD/.gcroots/shell.drv) "$@" + ''; +} diff --git a/web/tree/info.md b/web/tree/info.md index cd1d773..1f95af9 100644 --- a/web/tree/info.md +++ b/web/tree/info.md @@ -32,6 +32,7 @@ Projects of my own: Configurations of my own: * [custom-neovim](https://code.kummerlaender.eu/pkgs/tree/pkgs/custom-neovim) +* [persistent-nix-shell](https://code.kummerlaender.eu/pkgs/tree/pkgs/persistent-nix-shell) Projects neither of my own nor of my configuration: |