mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
fakeNss: move to toplevel
Make this reachable from pkgs.fakeNss. This is useful outside docker contexts, too. https://github.com/NixOS/nixpkgs/pull/164943#discussion_r833220769
This commit is contained in:
parent
5bfe213315
commit
76d05dfa62
@ -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.
|
||||
|
24
pkgs/build-support/fake-nss/default.nix
Normal file
24
pkgs/build-support/fake-nss/default.nix
Normal file
@ -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
|
||||
'')
|
||||
];
|
||||
}
|
@ -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 { };
|
||||
|
Loading…
Reference in New Issue
Block a user