nixos/lxd: add ui.enable option to toggle ui feature

This commit is contained in:
Jon Seager 2023-07-03 17:57:08 +01:00
parent aecfcd8d46
commit 2fbb85e2c9
No known key found for this signature in database

View file

@ -85,6 +85,14 @@ in {
considered failed and systemd will attempt to restart it. considered failed and systemd will attempt to restart it.
''; '';
}; };
ui = {
enable = lib.mkEnableOption (lib.mdDoc ''
Enables the (experimental) LXD UI.
'');
package = mkPackageOption pkgs.lxd "ui" { };
};
}; };
}; };
@ -143,6 +151,10 @@ in {
path = [ pkgs.util-linux ] path = [ pkgs.util-linux ]
++ optional cfg.zfsSupport config.boot.zfs.package; ++ optional cfg.zfsSupport config.boot.zfs.package;
environment = mkIf (cfg.ui.enable) {
"LXD_UI" = cfg.ui.package;
};
serviceConfig = { serviceConfig = {
ExecStart = "@${cfg.package}/bin/lxd lxd --group lxd"; ExecStart = "@${cfg.package}/bin/lxd lxd --group lxd";
ExecStartPost = "${cfg.package}/bin/lxd waitready --timeout=${cfg.startTimeout}"; ExecStartPost = "${cfg.package}/bin/lxd waitready --timeout=${cfg.startTimeout}";