From 0baed7e6f63b04fc1cd8fbb7dcd6ed9020c9f8c7 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 26 Nov 2024 08:27:14 +0000 Subject: [PATCH] Make other desktop Home Manager modules togglable --- nix/home/opdavies/default.nix | 18 +---------- nix/home/opdavies/desktop.nix | 12 ------- nix/home/opdavies/hosts/PW05CH3L.nix | 4 +++ nix/home/opdavies/hosts/lemp11.nix | 9 ++++++ nix/hosts/lemp11/configuration.nix | 1 - nix/modules/home-manager/bluetuith.nix | 45 +++++++++++++++++--------- nix/modules/home-manager/copyq.nix | 10 +++++- nix/modules/home-manager/default.nix | 5 +++ nix/modules/home-manager/direnv.nix | 14 +++++--- nix/modules/home-manager/espanso.nix | 24 ++++++++------ nix/modules/home-manager/flameshot.nix | 30 +++++++++++------ nix/modules/home-manager/gtk.nix | 29 +++++++++++++---- 12 files changed, 124 insertions(+), 77 deletions(-) delete mode 100644 nix/home/opdavies/desktop.nix diff --git a/nix/home/opdavies/default.nix b/nix/home/opdavies/default.nix index d31fe80..c76fa34 100644 --- a/nix/home/opdavies/default.nix +++ b/nix/home/opdavies/default.nix @@ -30,15 +30,6 @@ let inherit (pkgs) lib; - desktop-config = import ./desktop.nix { - inherit - config - inputs - pkgs - username - ; - }; - shared-config = import "${self}/nix/lib/shared/home-manager.nix" { inherit config @@ -61,14 +52,7 @@ let }; in { - imports = - if desktop then - [ - desktop-config - shared-config - ] - else - [ shared-config ]; + imports = [ shared-config ]; home.packages = shared-packages diff --git a/nix/home/opdavies/desktop.nix b/nix/home/opdavies/desktop.nix deleted file mode 100644 index 2569256..0000000 --- a/nix/home/opdavies/desktop.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ ... }: - -{ - imports = [ - ../../modules/home-manager/copyq.nix - ../../modules/home-manager/bluetuith.nix - ../../modules/home-manager/espanso.nix - ../../modules/home-manager/gtk.nix - ../../modules/home-manager/flameshot.nix - ../../modules/home-manager/gtk.nix - ]; -} diff --git a/nix/home/opdavies/hosts/PW05CH3L.nix b/nix/home/opdavies/hosts/PW05CH3L.nix index 391fcad..063122e 100644 --- a/nix/home/opdavies/hosts/PW05CH3L.nix +++ b/nix/home/opdavies/hosts/PW05CH3L.nix @@ -1,5 +1,9 @@ { features = { + cli = { + direnv.enable = true; + }; + desktop = { alacritty.enable = false; }; diff --git a/nix/home/opdavies/hosts/lemp11.nix b/nix/home/opdavies/hosts/lemp11.nix index 4f1c16d..f71044b 100644 --- a/nix/home/opdavies/hosts/lemp11.nix +++ b/nix/home/opdavies/hosts/lemp11.nix @@ -2,7 +2,16 @@ { features = { + cli = { + bluetuith.enable = true; + direnv.enable = true; + }; + desktop = { + copyq.enable = true; + espanso.enable = true; + flameshot.enable = true; + gtk.enable = true; mpv.enable = true; }; }; diff --git a/nix/hosts/lemp11/configuration.nix b/nix/hosts/lemp11/configuration.nix index d0b2a7e..47cfbb2 100644 --- a/nix/hosts/lemp11/configuration.nix +++ b/nix/hosts/lemp11/configuration.nix @@ -185,7 +185,6 @@ ++ pkgs.lib.optionals desktop [ acpi arandr - bluetuith brightnessctl cpufrequtils libnotify diff --git a/nix/modules/home-manager/bluetuith.nix b/nix/modules/home-manager/bluetuith.nix index e5567c6..f13fb00 100644 --- a/nix/modules/home-manager/bluetuith.nix +++ b/nix/modules/home-manager/bluetuith.nix @@ -1,19 +1,34 @@ { - xdg.configFile."bluetuith/bluetuith.conf" = { - text = '' - { - adapter: "" - adapter-states: "" - connect-bdaddr: "" - gsm-apn: "" - gsm-number: "" - keybindings: { - NavigateDown: j - NavigateUp: k + config, + lib, + pkgs, + ... +}: + +{ + options.features.cli.bluetuith.enable = lib.mkEnableOption "Enable bluetuith"; + + config = lib.mkIf config.features.cli.bluetuith.enable { + home.packages = with pkgs; [ + bluetuith + ]; + + xdg.configFile."bluetuith/bluetuith.conf" = { + text = '' + { + adapter: "" + adapter-states: "" + connect-bdaddr: "" + gsm-apn: "" + gsm-number: "" + keybindings: { + NavigateDown: j + NavigateUp: k + } + receive-dir: "" + theme: {} } - receive-dir: "" - theme: {} - } - ''; + ''; + }; }; } diff --git a/nix/modules/home-manager/copyq.nix b/nix/modules/home-manager/copyq.nix index 6735c70..fba783e 100644 --- a/nix/modules/home-manager/copyq.nix +++ b/nix/modules/home-manager/copyq.nix @@ -1 +1,9 @@ -{ services.copyq.enable = true; } +{ config, lib, ... }: + +{ + options.features.desktop.copyq.enable = lib.mkEnableOption "Enable copyq"; + + config = lib.mkIf config.features.desktop.copyq.enable { + services.copyq.enable = true; + }; +} diff --git a/nix/modules/home-manager/default.nix b/nix/modules/home-manager/default.nix index 6aa1816..d3e5d8a 100644 --- a/nix/modules/home-manager/default.nix +++ b/nix/modules/home-manager/default.nix @@ -20,9 +20,14 @@ ./alacritty.nix ./bat.nix ./bin.nix + ./bluetuith.nix + ./copyq.nix ./direnv.nix + ./espanso.nix + ./flameshot.nix ./fzf.nix ./git.nix + ./gtk.nix ./htop.nix ./lsd.nix ./mpv.nix diff --git a/nix/modules/home-manager/direnv.nix b/nix/modules/home-manager/direnv.nix index fb7dffc..59b4b76 100644 --- a/nix/modules/home-manager/direnv.nix +++ b/nix/modules/home-manager/direnv.nix @@ -1,7 +1,13 @@ +{ config, lib, ... }: + { - programs.direnv = { - enable = true; - enableZshIntegration = true; - nix-direnv.enable = true; + options.features.cli.direnv.enable = lib.mkEnableOption "Enable direnv"; + + config = lib.mkIf config.features.cli.direnv.enable { + programs.direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; + }; }; } diff --git a/nix/modules/home-manager/espanso.nix b/nix/modules/home-manager/espanso.nix index 8867fe9..8619a29 100644 --- a/nix/modules/home-manager/espanso.nix +++ b/nix/modules/home-manager/espanso.nix @@ -1,18 +1,22 @@ -{ lib, ... }: +{ config, lib, ... }: { - services.espanso = { - enable = true; + options.features.desktop.espanso.enable = lib.mkEnableOption "Enable espanso"; - configs = { - default = { - show_notifications = false; - toggle_key = "LEFT_ALT"; + config = lib.mkIf config.features.desktop.espanso.enable { + services.espanso = { + enable = true; + + configs = { + default = { + show_notifications = false; + toggle_key = "LEFT_ALT"; + }; }; - }; - matches = { - base = import ./espanso/matches/base.nix { inherit lib; }; + matches = { + base = import ./espanso/matches/base.nix { inherit lib; }; + }; }; }; } diff --git a/nix/modules/home-manager/flameshot.nix b/nix/modules/home-manager/flameshot.nix index c27e345..c5540fd 100644 --- a/nix/modules/home-manager/flameshot.nix +++ b/nix/modules/home-manager/flameshot.nix @@ -1,15 +1,25 @@ -{ username, ... }: { - services.flameshot = { - enable = true; + config, + lib, + username, + ... +}: - settings = { - General = { - disabledTrayIcon = false; - saveAfterCopy = true; - savePath = "/home/${username}/Pictures/Screenshots"; - showHelp = false; - uiColor = "#60a5fa"; +{ + options.features.desktop.flameshot.enable = lib.mkEnableOption "Enable flameshot"; + + config = lib.mkIf config.features.desktop.flameshot.enable { + services.flameshot = { + enable = true; + + settings = { + General = { + disabledTrayIcon = false; + saveAfterCopy = true; + savePath = "/home/${username}/Pictures/Screenshots"; + showHelp = false; + uiColor = "#60a5fa"; + }; }; }; }; diff --git a/nix/modules/home-manager/gtk.nix b/nix/modules/home-manager/gtk.nix index bce482c..3042a56 100644 --- a/nix/modules/home-manager/gtk.nix +++ b/nix/modules/home-manager/gtk.nix @@ -1,11 +1,26 @@ -{ pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { - gtk = { - enable = true; - theme.package = pkgs.arc-theme; - theme.name = "Arc-Dark"; - iconTheme.package = pkgs.arc-icon-theme; - iconTheme.name = "Arc"; + options.features.desktop.gtk.enable = lib.mkEnableOption "Enable gtk"; + + config = lib.mkIf config.features.desktop.gtk.enable { + gtk = { + enable = true; + + theme = { + name = "Arc-Dark"; + package = pkgs.arc-theme; + }; + + iconTheme = { + name = "Arc"; + package = pkgs.arc-icon-theme; + }; + }; }; }