From eae459d8faf874610372ec489816bb2738e1a247 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Thu, 3 Mar 2022 10:46:24 -0500 Subject: [PATCH] autostart vmware-usbarbitrator --- hosts/cube/default.nix | 6 +----- hosts/hp/default.nix | 3 +-- hosts/lenny/default.nix | 3 +-- modules/horizon.nix | 23 +++++++++++++++++++++++ 4 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 modules/horizon.nix diff --git a/hosts/cube/default.nix b/hosts/cube/default.nix index 042fb95..de5dfdb 100644 --- a/hosts/cube/default.nix +++ b/hosts/cube/default.nix @@ -8,6 +8,7 @@ gnome = true; profile = "desktop"; gaming.enable = true; + horizon.enable = true; }; environment.etc = @@ -19,11 +20,6 @@ "ssh/ssh_host_rsa_key" ]); - environment.systemPackages = with pkgs; [ - wine - vmware-horizon-client - ]; - services.openssh.enable = true; users.mutableUsers = false; diff --git a/hosts/hp/default.nix b/hosts/hp/default.nix index e9edba4..8b7b702 100644 --- a/hosts/hp/default.nix +++ b/hosts/hp/default.nix @@ -23,10 +23,9 @@ sconfig = { gnome = true; profile = "desktop"; + horizon.enable = true; }; - environment.systemPackages = [ pkgs.vmware-horizon-client ]; - boot = { loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = false; diff --git a/hosts/lenny/default.nix b/hosts/lenny/default.nix index 334ba32..4924dbc 100644 --- a/hosts/lenny/default.nix +++ b/hosts/lenny/default.nix @@ -23,6 +23,7 @@ sconfig = { gnome = true; profile = "desktop"; + horizon.enable = true; }; zramSwap.enable = false; @@ -31,8 +32,6 @@ randomEncryption.enable = true; }]; - environment.systemPackages = [ pkgs.vmware-horizon-client ]; - boot = { loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; diff --git a/modules/horizon.nix b/modules/horizon.nix new file mode 100644 index 0000000..b1ec9cb --- /dev/null +++ b/modules/horizon.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.sconfig.horizon; +in +{ + options.sconfig.horizon.enable = lib.mkEnableOption "Enable vmware-horizon"; + + config = lib.mkIf cfg.enable + { + systemd.services.vmware-usbarbitrator = { + serviceConfig.Type = "forking"; + wantedBy = [ "multi-user.target" ]; + script = "${pkgs.vmware-horizon-client}/bin/vmware-usbarbitrator"; + preStart = '' + vdir="/var/run/vmware/$(id -u sean)" + mkdir -p $vdir + chmod 700 $vdir + chown sean $vdir + ''; + }; + environment.systemPackages = [ pkgs.vmware-horizon-client ]; + }; +}