nixos/nixos-containers: fix interface name escaping in systemd.device unit name

systemd escapes interface names in generated .device units.
e.g. dummy-test -> dummy\x2dtest
This commit is contained in:
Rvfg
2026-01-09 16:55:42 +08:00
parent d9f0b9cb3d
commit cbe6c1767d
@@ -2,6 +2,7 @@
config,
lib,
pkgs,
utils,
...
}@host:
@@ -1052,8 +1053,8 @@ in
}
// (optionalAttrs containerConfig.autoStart {
wantedBy = [ "machines.target" ];
wants = [ "network.target" ] ++ (map (i: "sys-subsystem-net-devices-${i}.device") cfg.interfaces);
after = [ "network.target" ] ++ (map (i: "sys-subsystem-net-devices-${i}.device") cfg.interfaces);
wants = [ "network.target" ] ++ (map (i: "sys-subsystem-net-devices-${utils.escapeSystemdPath i}.device") cfg.interfaces);
after = [ "network.target" ] ++ (map (i: "sys-subsystem-net-devices-${utils.escapeSystemdPath i}.device") cfg.interfaces);
restartTriggers = [
containerConfig.path
config.environment.etc."${configurationDirectoryName}/${name}.conf".source