diff options
-rw-r--r-- | pkgs/build-support/docker/default.nix | 21 | ||||
-rw-r--r-- | pkgs/build-support/fake-nss/default.nix | 24 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 3 |
3 files changed, 29 insertions, 19 deletions
diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix index 5718cadd4ffa4..96ea363c811e0 100644 --- a/pkgs/build-support/docker/default.nix +++ b/pkgs/build-support/docker/default.nix @@ -6,6 +6,7 @@ , coreutils , e2fsprogs , fakechroot +, fakeNss , fakeroot , findutils , go @@ -747,25 +748,7 @@ rec { # Useful when packaging binaries that insist on using nss to look up # username/groups (like nginx). # /bin/sh is fine to not exist, and provided by another shim. - fakeNss = symlinkJoin { - name = "fake-nss"; - paths = [ - (writeTextDir "etc/passwd" '' - root:x:0:0:root user:/var/empty:/bin/sh - nobody:x:65534:65534:nobody:/var/empty:/bin/sh - '') - (writeTextDir "etc/group" '' - root:x:0: - nobody:x:65534: - '') - (writeTextDir "etc/nsswitch.conf" '' - hosts: files dns - '') - (runCommand "var-empty" { } '' - mkdir -p $out/var/empty - '') - ]; - }; + inherit fakeNss; # alias # This provides a /usr/bin/env, for shell scripts using the # "#!/usr/bin/env executable" shebang. diff --git a/pkgs/build-support/fake-nss/default.nix b/pkgs/build-support/fake-nss/default.nix new file mode 100644 index 0000000000000..9e0b60133e00f --- /dev/null +++ b/pkgs/build-support/fake-nss/default.nix @@ -0,0 +1,24 @@ +# Provide a /etc/passwd and /etc/group that contain root and nobody. +# Useful when packaging binaries that insist on using nss to look up +# username/groups (like nginx). +# /bin/sh is fine to not exist, and provided by another shim. +{ symlinkJoin, writeTextDir, runCommand }: +symlinkJoin { + name = "fake-nss"; + paths = [ + (writeTextDir "etc/passwd" '' + root:x:0:0:root user:/var/empty:/bin/sh + nobody:x:65534:65534:nobody:/var/empty:/bin/sh + '') + (writeTextDir "etc/group" '' + root:x:0: + nobody:x:65534: + '') + (writeTextDir "etc/nsswitch.conf" '' + hosts: files dns + '') + (runCommand "var-empty" { } '' + mkdir -p $out/var/empty + '') + ]; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 011cd9b0b5276..7b013701d97fe 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -436,6 +436,9 @@ with pkgs; dockerTools = callPackage ../build-support/docker { writePython3 = buildPackages.writers.writePython3; }; + + fakeNss = callPackage ../build-support/fake-nss { }; + tarsum = callPackage ../build-support/docker/tarsum.nix { }; snapTools = callPackage ../build-support/snap { }; |