nixos/containers: Remove workaround for systemd-nspawn@ drop-in
This commit is contained in:
parent
1b083d298b
commit
bc9f266ef0
@ -123,18 +123,7 @@ in
|
|||||||
(n: _: "ve-${n}")
|
(n: _: "ve-${n}")
|
||||||
(filterAttrs (_: c: c.networking.bridge == null) cfg.instances);
|
(filterAttrs (_: c: c.networking.bridge == null) cfg.instances);
|
||||||
|
|
||||||
systemd = mkMerge ([
|
systemd = mkMerge (mapAttrsToList (n: c: {
|
||||||
{
|
|
||||||
# By symlinking to the original systemd-nspawn@.service for every instance we force the unit generator to
|
|
||||||
# create overrides instead of replacing the unit entirely
|
|
||||||
packages = [
|
|
||||||
(pkgs.linkFarm "systemd-nspawn-containers" (map (n: {
|
|
||||||
name = "etc/systemd/system/systemd-nspawn@${n}.service";
|
|
||||||
path = "${pkgs.systemd}/example/systemd/system/systemd-nspawn@.service";
|
|
||||||
}) (attrNames cfg.instances)))
|
|
||||||
];
|
|
||||||
}
|
|
||||||
] ++ (mapAttrsToList (n: c: {
|
|
||||||
nspawn."${n}" = {
|
nspawn."${n}" = {
|
||||||
execConfig = {
|
execConfig = {
|
||||||
Boot = true;
|
Boot = true;
|
||||||
@ -182,6 +171,9 @@ in
|
|||||||
c.containerSystem;
|
c.containerSystem;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
# To prevent creating a whole new unit file
|
||||||
|
overrideStrategy = "asDropin";
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
# systemd.nspawn units can't set the root directory directly, but /run/machines/${n} is one of the search paths
|
# systemd.nspawn units can't set the root directory directly, but /run/machines/${n} is one of the search paths
|
||||||
root = "/run/machines/${n}";
|
root = "/run/machines/${n}";
|
||||||
@ -247,7 +239,7 @@ in
|
|||||||
Bridge = c.networking.bridge;
|
Bridge = c.networking.bridge;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}) cfg.instances));
|
}) cfg.instances);
|
||||||
})
|
})
|
||||||
|
|
||||||
# Inside container
|
# Inside container
|
||||||
|
Loading…
Reference in New Issue
Block a user