-
Notifications
You must be signed in to change notification settings - Fork 107
/
Copy pathshell.nix
46 lines (45 loc) · 1.04 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
in
pkgs.mkShell {
name = "scripts-shell";
buildInputs = with pkgs; [
chart-testing
ginkgo
git
go_1_20
golint
kubectl
kubernetes-helm
gnumake
minikube
semver-tool
yq-go
which
curl
cacert
util-linux
jq
zfs
] ++ 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
'';
}