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