nixos/virtualisation.virtualbox.guest: remove with lib;

This commit is contained in:
Felix Buehler
2024-08-28 21:19:12 +02:00
committed by Jörg Thalheim
parent 3cd35f7830
commit 49fe5ca12c

View File

@@ -1,9 +1,5 @@
# Module for VirtualBox guests. # Module for VirtualBox guests.
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.virtualisation.virtualbox.guest; cfg = config.virtualisation.virtualbox.guest;
kernel = config.boot.kernelPackages; kernel = config.boot.kernelPackages;
@@ -32,38 +28,38 @@ let
in in
{ {
imports = [ imports = [
(mkRenamedOptionModule [ "virtualisation" "virtualbox" "guest" "draganddrop" ] [ "virtualisation" "virtualbox" "guest" "dragAndDrop" ]) (lib.mkRenamedOptionModule [ "virtualisation" "virtualbox" "guest" "draganddrop" ] [ "virtualisation" "virtualbox" "guest" "dragAndDrop" ])
]; ];
options.virtualisation.virtualbox.guest = { options.virtualisation.virtualbox.guest = {
enable = mkOption { enable = lib.mkOption {
default = false; default = false;
type = types.bool; type = lib.types.bool;
description = "Whether to enable the VirtualBox service and other guest additions."; description = "Whether to enable the VirtualBox service and other guest additions.";
}; };
clipboard = mkOption { clipboard = lib.mkOption {
default = true; default = true;
type = types.bool; type = lib.types.bool;
description = "Whether to enable clipboard support."; description = "Whether to enable clipboard support.";
}; };
seamless = mkOption { seamless = lib.mkOption {
default = true; default = true;
type = types.bool; type = lib.types.bool;
description = "Whether to enable seamless mode. When activated windows from the guest appear next to the windows of the host."; description = "Whether to enable seamless mode. When activated windows from the guest appear next to the windows of the host.";
}; };
dragAndDrop = mkOption { dragAndDrop = lib.mkOption {
default = true; default = true;
type = types.bool; type = lib.types.bool;
description = "Whether to enable drag and drop support."; description = "Whether to enable drag and drop support.";
}; };
}; };
###### implementation ###### implementation
config = mkIf cfg.enable (mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [
{ {
assertions = [{ assertions = [{
assertion = pkgs.stdenv.hostPlatform.isx86; assertion = pkgs.stdenv.hostPlatform.isx86;
@@ -104,17 +100,17 @@ in
systemd.user.services.virtualboxClientVmsvga = mkVirtualBoxUserService "--vmsvga-session"; systemd.user.services.virtualboxClientVmsvga = mkVirtualBoxUserService "--vmsvga-session";
} }
( (
mkIf cfg.clipboard { lib.mkIf cfg.clipboard {
systemd.user.services.virtualboxClientClipboard = mkVirtualBoxUserService "--clipboard"; systemd.user.services.virtualboxClientClipboard = mkVirtualBoxUserService "--clipboard";
} }
) )
( (
mkIf cfg.seamless { lib.mkIf cfg.seamless {
systemd.user.services.virtualboxClientSeamless = mkVirtualBoxUserService "--seamless"; systemd.user.services.virtualboxClientSeamless = mkVirtualBoxUserService "--seamless";
} }
) )
( (
mkIf cfg.dragAndDrop { lib.mkIf cfg.dragAndDrop {
systemd.user.services.virtualboxClientDragAndDrop = mkVirtualBoxUserService "--draganddrop"; systemd.user.services.virtualboxClientDragAndDrop = mkVirtualBoxUserService "--draganddrop";
} }
) )