nixos-module/server/lxc-containers: revert lxc to 4.0.6
This commit is contained in:
parent
5267e4ab32
commit
97bd7bc7d5
|
@ -1,6 +1,16 @@
|
|||
{ hostName, self, config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
# Downgrade: lxc-4.0.9 names network interfaces in containers eth0,
|
||||
# and eth1 despite configured differently.
|
||||
lxc = pkgs.lxc.overrideAttrs (_: rec {
|
||||
version = "4.0.6";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://linuxcontainers.org/downloads/lxc/lxc-${version}.tar.gz";
|
||||
sha256 = "0qz4l7mlhq7hx53q606qgvkyzyr01glsw290v8ppzvxn1fydlrci";
|
||||
};
|
||||
});
|
||||
|
||||
# Containers that are run on this host
|
||||
containers =
|
||||
lib.filterAttrs (_: { role, model, location, ... }:
|
||||
|
@ -134,7 +144,7 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.lxc build-script ];
|
||||
environment.systemPackages = [ lxc build-script ];
|
||||
|
||||
# Create lxc.container.conf files
|
||||
environment.etc =
|
||||
|
@ -175,7 +185,7 @@ in
|
|||
'';
|
||||
};
|
||||
}) {
|
||||
"lxc/common.conf".source = "${pkgs.lxc}/share/lxc/config/common.conf";
|
||||
"lxc/common.conf".source = "${lxc}/share/lxc/config/common.conf";
|
||||
} (builtins.attrNames containers);
|
||||
|
||||
# Systemd service template for LXC containers
|
||||
|
@ -185,15 +195,15 @@ in
|
|||
unitConfig.ConditionPathExists = "/var/lib/lxc/%i/rootfs/init";
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.lxc}/bin/lxc-start -F -C -n %i";
|
||||
ExecStop = "${pkgs.lxc}/bin/lxc-stop -n %i";
|
||||
ExecStart = "${lxc}/bin/lxc-start -F -C -n %i";
|
||||
ExecStop = "${lxc}/bin/lxc-stop -n %i";
|
||||
ExecReload =
|
||||
let
|
||||
script = pkgs.writeScript "reload-lxc-container.sh" ''
|
||||
#! ${pkgs.runtimeShell} -e
|
||||
|
||||
SYSTEM=$(dirname $(readlink /var/lib/lxc/$1/rootfs/init))
|
||||
exec ${pkgs.lxc}/bin/lxc-attach -n $1 $SYSTEM/bin/switch-to-configuration switch
|
||||
exec ${lxc}/bin/lxc-attach -n $1 $SYSTEM/bin/switch-to-configuration switch
|
||||
'';
|
||||
in
|
||||
"${script} %i";
|
||||
|
|
Loading…
Reference in New Issue