13 node = evalMinimalConfig ({ config, ... }: {
14 imports = [ pkgsModule ../etc/etc.nix ];
15 environment.etc."passwd" = {
18 environment.etc."hosts" = {
24 root:x:0:0:System administrator:/root:/run/current-system/sw/bin/bash
32 lib.recurseIntoAttrs {
34 vmTools.runInLinuxVM (runCommand "test-etc-vm" { } ''
36 ${node.config.system.build.etcActivationCommands}
39 diff /etc/passwd ${writeText "expected-passwd" passwdText}
40 [[ 751 = $(stat --format %a /etc/hosts) ]]
41 diff /etc/hosts ${writeText "expected-hosts" hostsText}
46 # fakeroot is behaving weird
55 # fakechroot needs getopt, which is provided by util-linux
60 ${node.config.system.build.etcActivationCommands}
61 diff /etc/hosts ${writeText "expected-hosts" hostsText}
66 export FAKECHROOT_EXCLUDE_PATH=/dev:/proc:/sys:${builtins.storeDir}:$out
67 if [ -e "$NIX_ATTRS_SH_FILE" ]; then
68 export FAKECHROOT_EXCLUDE_PATH=$FAKECHROOT_EXCLUDE_PATH:$NIX_ATTRS_SH_FILE
70 fakechroot fakeroot chroot $PWD/fake-root bash -e -c '
71 if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; fi
73 eval "$fakeRootCommands"