diff --git a/nix/.gitignore b/nix/.gitignore index 5a89bf48..117ba42c 100644 --- a/nix/.gitignore +++ b/nix/.gitignore @@ -1,2 +1,3 @@ .go/ .tmp/ +/bins/ \ No newline at end of file diff --git a/shell.nix b/shell.nix index 57b99aee..bcdce055 100644 --- a/shell.nix +++ b/shell.nix @@ -21,13 +21,29 @@ pkgs.mkShell { cacert util-linux musl - ] ++ pkgs.lib.optional (builtins.getEnv "IN_NIX_SHELL" == "pure") docker; + jq + lvm2 + ] ++ pkgs.lib.optional (builtins.getEnv "IN_NIX_SHELL" == "pure") [ docker ]; shellHook = '' export GOPATH=$(pwd)/nix/.go export GOCACHE=$(pwd)/nix/.go/cache export TMPDIR=$(pwd)/nix/.tmp export PATH=$GOPATH/bin:$PATH mkdir -p "$TMPDIR" + + if [ "$IN_NIX_SHELL" = "pure" ]; then + # working sudo within a pure nix-shell + for sudo in /run/wrappers/bin/sudo /usr/bin/sudo /usr/local/bin/sudo /sbin/sudo /bin/sudo; do + mkdir -p $(pwd)/nix/bins + ln -sf $sudo $(pwd)/nix/bins/sudo + export PATH=$(pwd)/nix/bins:$PATH + break + done + else + rm $(pwd)/nix/bins/sudo 2>/dev/null || : + rmdir $(pwd)/nix/bins 2>/dev/null || : + fi + make bootstrap ''; }