···
{ config, lib, pkgs, ... }:
cfg = config.virtualisation.lxd;
11
-
(mkRemovedOptionModule [ "virtualisation" "lxd" "zfsPackage" ] "Override zfs in an overlay instead to override it globally")
9
+
(lib.mkRemovedOptionModule [ "virtualisation" "lxd" "zfsPackage" ] "Override zfs in an overlay instead to override it globally")
16
+
enable = lib.mkOption {
17
+
type = lib.types.bool;
description = lib.mdDoc ''
This option enables lxd, a daemon that manages
···
35
-
package = mkOption {
36
-
type = types.package;
33
+
package = lib.mkOption {
34
+
type = lib.types.package;
38
-
defaultText = literalExpression "pkgs.lxd";
36
+
defaultText = lib.literalExpression "pkgs.lxd";
description = lib.mdDoc ''
44
-
lxcPackage = mkOption {
45
-
type = types.package;
42
+
lxcPackage = lib.mkOption {
43
+
type = lib.types.package;
47
-
defaultText = literalExpression "pkgs.lxc";
45
+
defaultText = lib.literalExpression "pkgs.lxc";
description = lib.mdDoc ''
The LXC package to use with LXD (required for AppArmor profiles).
53
-
zfsSupport = mkOption {
51
+
zfsSupport = lib.mkOption {
52
+
type = lib.types.bool;
default = config.boot.zfs.enabled;
56
-
defaultText = literalExpression "config.boot.zfs.enabled";
54
+
defaultText = lib.literalExpression "config.boot.zfs.enabled";
description = lib.mdDoc ''
Enables lxd to use zfs as a storage for containers.
···
65
-
recommendedSysctlSettings = mkOption {
63
+
recommendedSysctlSettings = lib.mkOption {
64
+
type = lib.types.bool;
description = lib.mdDoc ''
Enables various settings to avoid common pitfalls when
···
78
-
startTimeout = mkOption {
76
+
startTimeout = lib.mkOption {
77
+
type = lib.types.int;
description = lib.mdDoc ''
···
Enables the (experimental) LXD UI.
94
-
package = mkPackageOption pkgs.lxd-unwrapped "ui" { };
92
+
package = lib.mkPackageOption pkgs.lxd-unwrapped "ui" { };
100
-
config = mkIf cfg.enable {
98
+
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
# Note: the following options are also declared in virtualisation.lxc, but
···
wantedBy = [ "multi-user.target" ];
142
-
(mkIf config.virtualisation.lxc.lxcfs.enable "lxcfs.service")
140
+
(lib.mkIf config.virtualisation.lxc.lxcfs.enable "lxcfs.service")
147
-
(mkIf config.virtualisation.lxc.lxcfs.enable "lxcfs.service")
145
+
(lib.mkIf config.virtualisation.lxc.lxcfs.enable "lxcfs.service")
documentation = [ "man:lxd(1)" ];
path = [ pkgs.util-linux ]
152
-
++ optional cfg.zfsSupport config.boot.zfs.package;
150
+
++ lib.optional cfg.zfsSupport config.boot.zfs.package;
154
-
environment = mkIf (cfg.ui.enable) {
152
+
environment = lib.mkIf (cfg.ui.enable) {
"LXD_UI" = cfg.ui.package;
···
# By default, `lxd` loads configuration files from hard-coded
# `/usr/share/lxc/config` - since this is a no-go for us, we have to
# explicitly tell it where the actual configuration files are
176
-
Environment = mkIf (config.virtualisation.lxc.lxcfs.enable)
174
+
Environment = lib.mkIf (config.virtualisation.lxc.lxcfs.enable)
"LXD_LXC_TEMPLATE_CONFIG=${pkgs.lxcfs}/share/lxc/config";
···
subGidRanges = [ { startGid = 1000000; count = 65536; } ];
188
-
boot.kernel.sysctl = mkIf cfg.recommendedSysctlSettings {
186
+
boot.kernel.sysctl = lib.mkIf cfg.recommendedSysctlSettings {
"fs.inotify.max_queued_events" = 1048576;
"fs.inotify.max_user_instances" = 1048576;
"fs.inotify.max_user_watches" = 1048576;
···
boot.kernelModules = [ "veth" "xt_comment" "xt_CHECKSUM" "xt_MASQUERADE" "vhost_vsock" ]
200
-
++ optionals (!config.networking.nftables.enable) [ "iptable_mangle" ];
198
+
++ lib.optionals (!config.networking.nftables.enable) [ "iptable_mangle" ];