3
0
Fork 0
forked from mirrors/nixpkgs

fake-nss: Add support for extra passwd and group lines

This commit is contained in:
Silvan Mosberger 2022-05-13 16:59:22 +02:00
parent 052662fab4
commit 79ae4eb997

View file

@ -2,17 +2,17 @@
# Useful when packaging binaries that insist on using nss to look up # Useful when packaging binaries that insist on using nss to look up
# username/groups (like nginx). # username/groups (like nginx).
# /bin/sh is fine to not exist, and provided by another shim. # /bin/sh is fine to not exist, and provided by another shim.
{ symlinkJoin, writeTextDir, runCommand }: { lib, symlinkJoin, writeTextDir, runCommand, extraPasswdLines ? [], extraGroupLines ? [] }:
symlinkJoin { symlinkJoin {
name = "fake-nss"; name = "fake-nss";
paths = [ paths = [
(writeTextDir "etc/passwd" '' (writeTextDir "etc/passwd" ''
root:x:0:0:root user:/var/empty:/bin/sh root:x:0:0:root user:/var/empty:/bin/sh
nobody:x:65534:65534:nobody:/var/empty:/bin/sh ${lib.concatStrings (map (line: line + "\n") extraPasswdLines)}nobody:x:65534:65534:nobody:/var/empty:/bin/sh
'') '')
(writeTextDir "etc/group" '' (writeTextDir "etc/group" ''
root:x:0: root:x:0:
nobody:x:65534: ${lib.concatStrings (map (line: line + "\n") extraGroupLines)}nobody:x:65534:
'') '')
(writeTextDir "etc/nsswitch.conf" '' (writeTextDir "etc/nsswitch.conf" ''
hosts: files dns hosts: files dns