diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2021-01-15 13:32:04 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2021-02-01 17:59:18 +0100 |
commit | 9c6a9d0458e32ca8e2ee373cb5644d951571b8bd (patch) | |
tree | 0e5cbf296818f5872ab5acfa475baad4affc6bb6 /nixos | |
parent | 63178ae5616f41be5fad6e92ac2c349c656d440e (diff) | |
download | nixpkgs-9c6a9d0458e32ca8e2ee373cb5644d951571b8bd.tar nixpkgs-9c6a9d0458e32ca8e2ee373cb5644d951571b8bd.tar.gz nixpkgs-9c6a9d0458e32ca8e2ee373cb5644d951571b8bd.tar.bz2 nixpkgs-9c6a9d0458e32ca8e2ee373cb5644d951571b8bd.tar.lz nixpkgs-9c6a9d0458e32ca8e2ee373cb5644d951571b8bd.tar.xz nixpkgs-9c6a9d0458e32ca8e2ee373cb5644d951571b8bd.tar.zst nixpkgs-9c6a9d0458e32ca8e2ee373cb5644d951571b8bd.zip |
nixos/lxd: refactor to use zfs.package/enabled property
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/tasks/filesystems/zfs.nix | 2 | ||||
-rw-r--r-- | nixos/modules/virtualisation/lxd.nix | 24 |
2 files changed, 7 insertions, 19 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix index df9d0fdc4d3..df867aa896f 100644 --- a/nixos/modules/tasks/filesystems/zfs.nix +++ b/nixos/modules/tasks/filesystems/zfs.nix @@ -368,8 +368,6 @@ in } ]; - virtualisation.lxd.zfsSupport = true; - boot = { kernelModules = [ "zfs" ]; diff --git a/nixos/modules/virtualisation/lxd.nix b/nixos/modules/virtualisation/lxd.nix index 103e689abae..4b2adf4cc69 100644 --- a/nixos/modules/virtualisation/lxd.nix +++ b/nixos/modules/virtualisation/lxd.nix @@ -5,13 +5,12 @@ with lib; let - cfg = config.virtualisation.lxd; - zfsCfg = config.boot.zfs; - -in +in { + imports = [ + (mkRemovedOptionModule [ "virtualisation" "lxd" "zfsPackage" ] "Override zfs in an overlay instead to override it globally") + ]; -{ ###### interface 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 { type = types.bool; - default = false; + default = config.boot.zfs.enabled; + defaultText = "config.boot.zfs.enabled"; description = '' Enables lxd to use zfs as a storage for containers. @@ -87,7 +78,6 @@ in }; ###### implementation - config = mkIf cfg.enable { environment.systemPackages = [ cfg.package ]; @@ -110,7 +100,7 @@ in wantedBy = [ "multi-user.target" ]; after = [ "systemd-udev-settle.service" ]; - path = lib.optional cfg.zfsSupport cfg.zfsPackage; + path = lib.optional config.boot.zfs.enabled config.boot.zfs.package; preStart = '' mkdir -m 0755 -p /var/lib/lxc/rootfs |