Change:
See title. It also may fail to correctly parse comments within such blocks as well, but unsure. a systemd unit in config e.g. to switch configuration (though this might only happen on the second switch, trying to parse existing config?) with Per , this is valid syntax: The value of should thus be parsed to (I may have gotten the spaces wrong there) If applicable, add screenshots to help explain your problem. Patch for failing example test case (may not be perfect): also due to authoring Please run and paste the result. I was running dry-activate to a config using nixpkgs @ Add a :+1: [reaction] to [issues you find important]. [reaction]: [issues you find important]:
thanks for the report! I've looked a little into this so far and switch-to-configuration doesn't actually use that much of the unit file contents, which could be fine considering that systemd's DBus interface exposes almost all of their unit properties as DBus properties. However, since NixOS uses some custom unit properties (think ), these aren't exposed as DBus properties. So instead I've gone the route of adding support for multi-line values in the INI parser used for switch-to-configuration-ng, with the eventual goal of upstreaming this support to that crate. This isn't going to be something that's immediately ready though, I should have a PR for review within the coming days. For now, I would recommend opting out of the switch-to-configuration-ng implementation with the following config until it's fixed:
The problem with INI in general is that there is no standard. The systemd syntax, after all, “is inspired by XDG Desktop Entry Specification .desktop files, which are in turn inspired by Microsoft Windows .ini files”.

Discussion:
systemd.services."escapedx2ddash".serviceConfig.X-Test = "test"; }; <ins> unitWithMultilineValue.configuration = { systemd.services.test.serviceConfig.ExecStart = '' ${pkgs.coreutils}/bin/true  # ignored ; ignored blah blah ''; }; </ins> unitStartingWithDash.configuration = { systemd.services."-" = { wantedBy = [ "multi-user.target" ];

machine.succeed("! test -e /run/current-system/dry-activate") machine.succeed("! test -e /run/current-system/bin/switch-to-configuration") <ins> # Ensure units with multiline values work out = switch_to_specialisation("${machine}", "unitWithMultilineValue") assert_lacks(out, "NOT restarting the following changed units:") assert_lacks(out, "reloading the following units:") assert_lacks(out, "restarting the following units:") assert_lacks(out, "the following new units were started:") assert_contains(out, "starting the following units: test.service") </ins> # Ensure  works in unit names out = switch_to_specialisation("${machine}", "unitWithBackslash") <del> assert_contains(out, "stopping the following units: test.servicen") </del> assert_lacks(out, "NOT restarting the following changed units:") assert_lacks(out, "reloading the following units:") assert_lacks(out, "nrestarting the following units:")

src = ./src; <del> cargoLock.lockFile = ./src/Cargo.lock; </del> <ins> cargoLock = { lockFile = ./src/Cargo.lock; outputHashes."rust-ini-0.21.1" = "sha256-0nSBhme/g+mVsYdiq0Ash0ek9WEdvbf/b9FRxA7sauk="; }; </ins> nativeBuildInputs = [ pkg-config ]; buildInputs = [ dbus ];

[[package]] name = "rust-ini" <del> version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d625ed57d8f49af6cfa514c42e1a71fadcff60eb0b1c517ff82fe41aa025b41" </del> <ins> version = "0.21.1" source = "git+https://github.com/zonyitoo/rust-ini?rev=5748ae57a178216a920b88dfac1296618e967447#5748ae57a178216a920b88dfac1296618e967447" </ins> dependencies = [ "cfg-if", "ordered-multimap",

log = "0.4.21" nix = { version = "0.28.0", features = ["fs", "signal"] } regex = "1.10.4" <del> rust-ini = "0.21.0" </del> <ins> rust-ini = { git = "https://github.com/zonyitoo/rust-ini", rev = "5748ae57a178216a920b88dfac1296618e967447", features = [ "inline-comment", ] } </ins> syslog = "6.1.1" [build-dependencies]