Skip to content

Commit

Permalink
nixos/modules/virtualisation/vmware-guest.nix: remove with lib;
Browse files Browse the repository at this point in the history
  • Loading branch information
Stunkymonkey committed Aug 29, 2024
1 parent 9616b9a commit aaf69cb
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions nixos/modules/virtualisation/vmware-guest.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
{ config, lib, pkgs, ... }:

with lib;

let
cfg = config.virtualisation.vmware.guest;
open-vm-tools = if cfg.headless then pkgs.open-vm-tools-headless else pkgs.open-vm-tools;
xf86inputvmmouse = pkgs.xorg.xf86inputvmmouse;
in
{
imports = [
(mkRenamedOptionModule [ "services" "vmwareGuest" ] [ "virtualisation" "vmware" "guest" ])
(lib.mkRenamedOptionModule [ "services" "vmwareGuest" ] [ "virtualisation" "vmware" "guest" ])
];

options.virtualisation.vmware.guest = {
enable = mkEnableOption "VMWare Guest Support";
headless = mkOption {
type = types.bool;
enable = lib.mkEnableOption "VMWare Guest Support";
headless = lib.mkOption {
type = lib.types.bool;
default = !config.services.xserver.enable;
defaultText = "!config.services.xserver.enable";
description = "Whether to disable X11-related features.";
};
};

config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
assertions = [ {
assertion = pkgs.stdenv.hostPlatform.isx86 || pkgs.stdenv.hostPlatform.isAarch64;
message = "VMWare guest is not currently supported on ${pkgs.stdenv.hostPlatform.system}";
Expand All @@ -42,7 +39,7 @@ in
};

# Mount the vmblock for drag-and-drop and copy-and-paste.
systemd.mounts = mkIf (!cfg.headless) [
systemd.mounts = lib.mkIf (!cfg.headless) [
{
description = "VMware vmblock fuse mount";
documentation = [ "https://github.com/vmware/open-vm-tools/blob/master/open-vm-tools/vmblock-fuse/design.txt" ];
Expand All @@ -55,7 +52,7 @@ in
}
];

security.wrappers.vmware-user-suid-wrapper = mkIf (!cfg.headless) {
security.wrappers.vmware-user-suid-wrapper = lib.mkIf (!cfg.headless) {
setuid = true;
owner = "root";
group = "root";
Expand All @@ -64,7 +61,7 @@ in

environment.etc.vmware-tools.source = "${open-vm-tools}/etc/vmware-tools/*";

services.xserver = mkIf (!cfg.headless) {
services.xserver = lib.mkIf (!cfg.headless) {
modules = [ xf86inputvmmouse ];

config = ''
Expand Down

0 comments on commit aaf69cb

Please sign in to comment.