mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
nixos/lxc: add package option and use for incus/lxd
This commit is contained in:
parent
ee1428c654
commit
f171f4ffd4
@ -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;
|
||||
|
@ -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
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user