about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorAdam C. Stephens <2071575+adamcstephens@users.noreply.github.com>2024-04-26 16:26:14 -0400
committerGitHub <noreply@github.com>2024-04-26 16:26:14 -0400
commit2a899c07e422b6b2be8fad2d6a7c4e7eea99af2c (patch)
treec0da644355911750abb42da2c396986a839cbb14 /nixos/modules
parent566a19ed1330c712a1d7d78396c933c9ce00a79f (diff)
parent7e73ead5d0ab1fce66c3122c5e8b9c5bc5bb608a (diff)
Merge pull request #301564 from adamcstephens/lxc/6
lxc: 5.0.3 -> 6.0.0
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/virtualisation/incus.nix7
-rw-r--r--nixos/modules/virtualisation/lxc.nix9
-rw-r--r--nixos/modules/virtualisation/lxd.nix9
3 files changed, 16 insertions, 9 deletions
diff --git a/nixos/modules/virtualisation/incus.nix b/nixos/modules/virtualisation/incus.nix
index 5d0225a6a51d9..2d7ccac7d92c8 100644
--- a/nixos/modules/virtualisation/incus.nix
+++ b/nixos/modules/virtualisation/incus.nix
@@ -112,7 +112,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 7d7d48db924f8..1ef322588a68c 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 51d9a9482091d..4c94b3dfe946d 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 {