From ea7bf809fc91daaf5f8f94c39ce6dc48bcecbf54 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 23 Jan 2025 20:42:22 -0500 Subject: [PATCH] Do not install the launch keyboard configurator on neelix or non-graphical installs. --- nix/configuration/hosts/odo/default.nix | 1 + .../roles/launch_keyboard/default.nix | 57 ++++++++++++------- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/nix/configuration/hosts/odo/default.nix b/nix/configuration/hosts/odo/default.nix index 829ecbe..8297768 100644 --- a/nix/configuration/hosts/odo/default.nix +++ b/nix/configuration/hosts/odo/default.nix @@ -43,5 +43,6 @@ me.kanshi.enable = true; me.kubernetes.enable = true; me.latex.enable = true; + me.launch_keyboard.enable = true; me.sway.enable = true; } diff --git a/nix/configuration/roles/launch_keyboard/default.nix b/nix/configuration/roles/launch_keyboard/default.nix index 650853a..0587ccb 100644 --- a/nix/configuration/roles/launch_keyboard/default.nix +++ b/nix/configuration/roles/launch_keyboard/default.nix @@ -8,28 +8,41 @@ { imports = [ ]; - config = lib.mkIf config.me.graphical { - environment.systemPackages = with pkgs; [ - system76-keyboard-configurator - dfu-programmer # For flashing keyboard https://support.system76.com/articles/launch_2-firmware-update/ - avrdude # For flashing keyboard https://support.system76.com/articles/launch_2-firmware-update/ - lxqt.lxqt-policykit # Need a polkit agent to launch the keyboard configurator - ]; - - systemd = { - user.services.lxqt-policykit-agent = { - description = "lxqt-policykit-agent"; - wantedBy = [ "graphical-session.target" ]; - wants = [ "graphical-session.target" ]; - after = [ "graphical-session.target" ]; - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.lxqt.lxqt-policykit}/bin/lxqt-policykit-agent"; - Restart = "on-failure"; - RestartSec = 1; - TimeoutStopSec = 10; - }; - }; + options.me = { + launch_keyboard.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install launch_keyboard."; }; }; + + config = lib.mkIf config.me.launch_keyboard.enable ( + lib.mkMerge [ + (lib.mkIf config.me.graphical { + environment.systemPackages = with pkgs; [ + system76-keyboard-configurator + dfu-programmer # For flashing keyboard https://support.system76.com/articles/launch_2-firmware-update/ + avrdude # For flashing keyboard https://support.system76.com/articles/launch_2-firmware-update/ + lxqt.lxqt-policykit # Need a polkit agent to launch the keyboard configurator + ]; + + systemd = { + user.services.lxqt-policykit-agent = { + description = "lxqt-policykit-agent"; + wantedBy = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.lxqt.lxqt-policykit}/bin/lxqt-policykit-agent"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + }; + }) + ] + ); }