summary refs log tree commit diff
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2022-05-13 16:59:22 +0200
committerSilvan Mosberger <contact@infinisil.com>2022-10-04 00:05:34 +0200
commit79ae4eb9979bf89a6d5e6f0804a216b3b86106a5 (patch)
tree38324011a366201fbdd63f9460511780fa06144f
parent052662fab431c89e1e8f611aa37983c7bb3cbdac (diff)
downloadnixpkgs-79ae4eb9979bf89a6d5e6f0804a216b3b86106a5.tar
nixpkgs-79ae4eb9979bf89a6d5e6f0804a216b3b86106a5.tar.gz
nixpkgs-79ae4eb9979bf89a6d5e6f0804a216b3b86106a5.tar.bz2
nixpkgs-79ae4eb9979bf89a6d5e6f0804a216b3b86106a5.tar.lz
nixpkgs-79ae4eb9979bf89a6d5e6f0804a216b3b86106a5.tar.xz
nixpkgs-79ae4eb9979bf89a6d5e6f0804a216b3b86106a5.tar.zst
nixpkgs-79ae4eb9979bf89a6d5e6f0804a216b3b86106a5.zip
fake-nss: Add support for extra passwd and group lines
-rw-r--r--pkgs/build-support/fake-nss/default.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/build-support/fake-nss/default.nix b/pkgs/build-support/fake-nss/default.nix
index 9e0b60133e0..7d85ec5fc0a 100644
--- a/pkgs/build-support/fake-nss/default.nix
+++ b/pkgs/build-support/fake-nss/default.nix
@@ -2,17 +2,17 @@
 # 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 }:
+{ lib, symlinkJoin, writeTextDir, runCommand, extraPasswdLines ? [], extraGroupLines ? [] }:
 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
+      ${lib.concatStrings (map (line: line + "\n") extraPasswdLines)}nobody:x:65534:65534:nobody:/var/empty:/bin/sh
     '')
     (writeTextDir "etc/group" ''
       root:x:0:
-      nobody:x:65534:
+      ${lib.concatStrings (map (line: line + "\n") extraGroupLines)}nobody:x:65534:
     '')
     (writeTextDir "etc/nsswitch.conf" ''
       hosts: files dns