diff --git a/nixos/modules/virtualisation/incus.nix b/nixos/modules/virtualisation/incus.nix index 08e8288fb203..261af794c0ab 100644 --- a/nixos/modules/virtualisation/incus.nix +++ b/nixos/modules/virtualisation/incus.nix @@ -111,7 +111,12 @@ in package = lib.mkPackageOption pkgs "incus-lts" { }; - lxcPackage = lib.mkPackageOption pkgs "lxc" { }; + lxcPackage = lib.mkOption { + type = lib.types.package; + default = config.virtualisation.lxc.package; + defaultText = lib.literalExpression "config.virtualisation.lxc.package"; + description = "The lxc package to use."; + }; clientPackage = lib.mkOption { type = lib.types.package; diff --git a/nixos/modules/virtualisation/lxc.nix b/nixos/modules/virtualisation/lxc.nix index 7d7d48db924f..1ef322588a68 100644 --- a/nixos/modules/virtualisation/lxc.nix +++ b/nixos/modules/virtualisation/lxc.nix @@ -32,6 +32,7 @@ in {manpage}`lxc.system.conf(5)`. ''; }; + package = lib.mkPackageOption pkgs "lxc" { }; defaultConfig = lib.mkOption { @@ -57,19 +58,19 @@ in ###### implementation config = lib.mkIf cfg.enable { - environment.systemPackages = [ pkgs.lxc ]; + environment.systemPackages = [ cfg.package ]; environment.etc."lxc/lxc.conf".text = cfg.systemConfig; environment.etc."lxc/lxc-usernet".text = cfg.usernetConfig; environment.etc."lxc/default.conf".text = cfg.defaultConfig; systemd.tmpfiles.rules = [ "d /var/lib/lxc/rootfs 0755 root root -" ]; - security.apparmor.packages = [ pkgs.lxc ]; + security.apparmor.packages = [ cfg.package ]; security.apparmor.policies = { "bin.lxc-start".profile = '' - include ${pkgs.lxc}/etc/apparmor.d/usr.bin.lxc-start + include ${cfg.package}/etc/apparmor.d/usr.bin.lxc-start ''; "lxc-containers".profile = '' - include ${pkgs.lxc}/etc/apparmor.d/lxc-containers + include ${cfg.package}/etc/apparmor.d/lxc-containers ''; }; }; diff --git a/nixos/modules/virtualisation/lxd.nix b/nixos/modules/virtualisation/lxd.nix index 51d9a9482091..4c94b3dfe946 100644 --- a/nixos/modules/virtualisation/lxd.nix +++ b/nixos/modules/virtualisation/lxd.nix @@ -35,10 +35,11 @@ in { package = lib.mkPackageOption pkgs "lxd-lts" { }; - lxcPackage = lib.mkPackageOption pkgs "lxc" { - extraDescription = '' - Required for AppArmor profiles. - ''; + lxcPackage = lib.mkOption { + type = lib.types.package; + default = config.virtualisation.lxc.package; + defaultText = lib.literalExpression "config.virtualisation.lxc.package"; + description = "The lxc package to use."; }; zfsSupport = lib.mkOption {