From 79ae4eb9979bf89a6d5e6f0804a216b3b86106a5 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Fri, 13 May 2022 16:59:22 +0200 Subject: [PATCH] fake-nss: Add support for extra passwd and group lines --- pkgs/build-support/fake-nss/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/fake-nss/default.nix b/pkgs/build-support/fake-nss/default.nix index 9e0b60133e00..7d85ec5fc0a5 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