nixos/lxd: refactor to use zfs.package/enabled property
This commit is contained in:
parent
63178ae561
commit
9c6a9d0458
|
@ -368,8 +368,6 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
virtualisation.lxd.zfsSupport = true;
|
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
kernelModules = [ "zfs" ];
|
kernelModules = [ "zfs" ];
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,12 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.virtualisation.lxd;
|
cfg = config.virtualisation.lxd;
|
||||||
zfsCfg = config.boot.zfs;
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkRemovedOptionModule [ "virtualisation" "lxd" "zfsPackage" ] "Override zfs in an overlay instead to override it globally")
|
||||||
|
];
|
||||||
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
|
||||||
###### interface
|
###### interface
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
@ -51,18 +50,10 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
zfsPackage = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
default = with pkgs; if zfsCfg.enableUnstable then zfsUnstable else zfs;
|
|
||||||
defaultText = "pkgs.zfs";
|
|
||||||
description = ''
|
|
||||||
The ZFS package to use with LXD.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
zfsSupport = mkOption {
|
zfsSupport = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = config.boot.zfs.enabled;
|
||||||
|
defaultText = "config.boot.zfs.enabled";
|
||||||
description = ''
|
description = ''
|
||||||
Enables lxd to use zfs as a storage for containers.
|
Enables lxd to use zfs as a storage for containers.
|
||||||
|
|
||||||
|
@ -87,7 +78,6 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = [ cfg.package ];
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
|
@ -110,7 +100,7 @@ in
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "systemd-udev-settle.service" ];
|
after = [ "systemd-udev-settle.service" ];
|
||||||
|
|
||||||
path = lib.optional cfg.zfsSupport cfg.zfsPackage;
|
path = lib.optional config.boot.zfs.enabled config.boot.zfs.package;
|
||||||
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -m 0755 -p /var/lib/lxc/rootfs
|
mkdir -m 0755 -p /var/lib/lxc/rootfs
|
||||||
|
|
Loading…
Reference in a new issue