Change:
I just wanted networkmanager to know my VPN configuration declaratively. I did this with the following expression: "ETH-VPN" = { source = ./systemConfigFiles/networkManager/ETHZ-VPN; target = "NetworkManager/system-connections/ETHZ VPN"; }; with this configuration I got nixos to crash and to create a non bootable generation when I rebuilded and switched (sudo nixos-rebuild --upgrade switch"), the switch (almost certainly) was completed, however I immediately droped into a login prompt (I guess X just died). Logging in is not possible, as the keyboard doesn't work (ctr+alt+sysrq + reisub) still works when rebooting, I can choose the new generation. Doing that I, I get a lot of errormessages (see attached image). ! My Guess: These errors relate to the fact that several files in /etc are broken. When I remove the space in ETHZ VPN , everything works fine The NetworkManager/system-connections/ directory already existed, there was even a different vpn in it. There was no previous VPN with that name and also no file named NetworkManager/system-connections/ETHZ VPN existed. I tried to create a minimal bug report by replacing these highly custom bug to a more generic one like this: "test" = { source = ./foo; target = "NetworkManager/spaced filename"; }; For some reason this doesn't create the same behaviour. It still generates a corrupted generation and switches into it, but it doesn't log me out. Instead various config files in /etc seem to be broken; E.g. when i do sudo -s I get /etc/sudoers: syntax error near line 1: (and the same error for many other lines) Please run and paste the results. these paths will be fetched (0.75 MiB download, 4.33 MiB unpacked): /nix/store/5hszvi0hczzh25mmsz5rkb9qa758c10p-bash-4.4-p12-dev /nix/store/9bkj2zjc8jdzwgwdwb5d890hrhrk9d3g-bash-4.4-p12-dev /nix/store/bkx6rzqciq0sdn1z5liard33ffvv1n3s-bash-4.4-p12-doc /nix/store/d5ki460cwwydf93f31is95sqpcf334r4-bash-4.4-p12-info /nix/store/f1rp3j71id6g6zcmiafrksmw1cgydl9k-bash-4.4-p12-doc /nix/store/l3nz0167a4xhb78ldcjns5p4dwvlm1cw-stdenv copying path '/nix/store/bkx6rzqciq0sdn1z5liard33ffvv1n3s-bash-4.4-p12-doc' from ''... copying path '/nix/store/f1rp3j71id6g6zcmiafrksmw1cgydl9k-bash-4.4-p12-doc' from ''... copying path '/nix/store/d5ki460cwwydf93f31is95sqpcf334r4-bash-4.4-p12-info' from ''... copying path '/nix/store/5hszvi0hczzh25mmsz5rkb9qa758c10p-bash-4.4-p12-dev' from ''... copying path '/nix/store/9bkj2zjc8jdzwgwdwb5d890hrhrk9d3g-bash-4.4-p12-dev' from ''... copying path '/nix/store/l3nz0167a4xhb78ldcjns5p4dwvlm1cw-stdenv' from ''... system: host os: multi-user?: sandbox: version: channels(root): nixpkgs:
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly: for maintainers and people that previously touched the related code and @ mention them in a comment. on the . on the on .

Discussion:
done '' + concatMapStrings (name: optionalString (hasPrefix "tmpfiles.d/" name) '' rm -f $out/${removePrefix "tmpfiles.d/" name} <del> '') config.system.build.etc.targets; </del> <ins> '') config.system.build.etc.passthru.targets; </ins> }) + "/*"; "systemd/system-generators" = { source = hooks "generators" cfg.generators; };

etc' = filter (f: f.enable) (attrValues config.environment.etc); <del> etc = pkgs.stdenvNoCC.mkDerivation { name = "etc"; builder = ./make-etc.sh; </del> <ins> etc = pkgs.runCommand "etc" { </ins> preferLocalBuild = true; allowSubstitutes = false; <del> /* !!! Use toXML. */ sources = map (x: x.source) etc'; targets = map (x: x.target) etc'; modes = map (x: x.mode) etc'; users  = map (x: x.user) etc'; groups  = map (x: x.group) etc'; }; </del> <ins> # This is needed for the systemd module passthru.targets = map (x: x.target) etc'; } /* sh */ '' set -euo pipefail makeEtcEntry() { src="$1" target="$2" mode="$3" user="$4" group="$5" if [[ "$src" = *'*'* ]]; then # If the source name contains '*', perform globbing. mkdir -p "$out/etc/$target" for fn in $src; do ln -s "$fn" "$out/etc/$target/" done else mkdir -p "$out/etc/$(dirname "$target")" if ! [ -e "$out/etc/$target" ]; then ln -s "$src" "$out/etc/$target" else echo "duplicate entry $target -> $src" if [ "$(readlink "$out/etc/$target")" != "$src" ]; then echo "mismatched duplicate entry $(readlink "$out/etc/$target") <-> $src" ret=1 continue fi fi if [ "$mode" != symlink ]; then echo "$mode" > "$out/etc/$target.mode" echo "$user" > "$out/etc/$target.uid" echo "$group" > "$out/etc/$target.gid" fi fi } mkdir -p "$out/etc" ${concatMapStringsSep "n" (etcEntry: escapeShellArgs [ "makeEtcEntry" etcEntry.source etcEntry.target etcEntry.mode etcEntry.user etcEntry.group ]) etc'} ''; </ins> in

<del> source $stdenv/setup mkdir -p $out/etc set -f sources_=($sources) targets_=($targets) modes_=($modes) users_=($users) groups_=($groups) set +f for ((i = 0; i < ${#targets_[@]}; i++)); do source="${sources_[$i]}" target="${targets_[$i]}" if [[ "$source" =~ '*' ]]; then # If the source name contains '*', perform globbing. mkdir -p $out/etc/$target for fn in $source; do ln -s "$fn" $out/etc/$target/ done else mkdir -p $out/etc/$(dirname $target) if ! [ -e $out/etc/$target ]; then ln -s $source $out/etc/$target else echo "duplicate entry $target -> $source" if test "$(readlink $out/etc/$target)" != "$source"; then echo "mismatched duplicate entry $(readlink $out/etc/$target) <-> $source" exit 1 fi fi if test "${modes_[$i]}" != symlink; then echo "${modes_[$i]}"  > $out/etc/$target.mode echo "${users_[$i]}"  > $out/etc/$target.uid echo "${groups_[$i]}" > $out/etc/$target.gid fi fi done </del>