From 62e8b83df2b8516726ab7975ad8ea0e7c8fd04be Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 31 Jan 2025 11:00:29 +0000 Subject: [PATCH] Refactor dwm and thunar configuration --- nix/hosts/common/default.nix | 3 -- nix/hosts/t490/configuration.nix | 2 + nix/hosts/t490/services/dwm.nix | 53 ++++++++++++------- .../nixos/features/desktop/default.nix | 1 + nix/modules/nixos/features/desktop/thunar.nix | 25 +++++++++ nix/modules/nixos/i3.nix | 1 - 6 files changed, 61 insertions(+), 24 deletions(-) create mode 100644 nix/modules/nixos/features/desktop/thunar.nix diff --git a/nix/hosts/common/default.nix b/nix/hosts/common/default.nix index c8c62f1..24feaec 100644 --- a/nix/hosts/common/default.nix +++ b/nix/hosts/common/default.nix @@ -42,9 +42,6 @@ logseq shotwell vscode - xfce.thunar - xfce.thunar-volman - xfce.tumbler ]; home-manager = { diff --git a/nix/hosts/t490/configuration.nix b/nix/hosts/t490/configuration.nix index bae0cc7..ab4663d 100644 --- a/nix/hosts/t490/configuration.nix +++ b/nix/hosts/t490/configuration.nix @@ -18,8 +18,10 @@ features = { desktop = { autorandr.enable = true; + dwm.enable = true; gaming.enable = true; i3.enable = true; + thunar.enable = true; peek.enable = true; }; }; diff --git a/nix/hosts/t490/services/dwm.nix b/nix/hosts/t490/services/dwm.nix index f8bc108..cc09eb1 100644 --- a/nix/hosts/t490/services/dwm.nix +++ b/nix/hosts/t490/services/dwm.nix @@ -1,27 +1,40 @@ -{ pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: + +with lib; { - services = { - dwm-status = { - enable = true; + options.features.desktop.dwm.enable = mkEnableOption "Enable dwm"; - order = [ - "audio" - "backlight" - "battery" - "cpu_load" - "network" - "time" - ]; + config = mkIf config.features.desktop.dwm.enable { + services = { + dwm-status = { + enable = true; + + order = [ + "audio" + "backlight" + "battery" + "cpu_load" + "network" + "time" + ]; + }; + + xserver.windowManager.dwm.enable = true; }; - xserver.windowManager.dwm.enable = true; - }; + systemd.user.services.dwm-status.serviceConfig.Restart = "on-failure"; - environment.systemPackages = with pkgs; [ - dmenu - dmenu-bluetooth - networkmanager_dmenu - st - ]; + environment.systemPackages = with pkgs; [ + dmenu + dmenu-bluetooth + networkmanager_dmenu + st + ]; + }; } diff --git a/nix/modules/nixos/features/desktop/default.nix b/nix/modules/nixos/features/desktop/default.nix index 07ce9a0..d0851c6 100644 --- a/nix/modules/nixos/features/desktop/default.nix +++ b/nix/modules/nixos/features/desktop/default.nix @@ -3,5 +3,6 @@ ./autorandr.nix ./peek.nix ./screenkey.nix + ./thunar.nix ]; } diff --git a/nix/modules/nixos/features/desktop/thunar.nix b/nix/modules/nixos/features/desktop/thunar.nix new file mode 100644 index 0000000..96e8086 --- /dev/null +++ b/nix/modules/nixos/features/desktop/thunar.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + pkgs, + ... +}: + +with lib; + +{ + options.features.desktop.thunar.enable = mkEnableOption "Enable thunar"; + + config = mkIf config.features.desktop.thunar.enable { + programs.thunar = { + enable = true; + + plugins = with pkgs.xfce; [ + thunar-archive-plugin + thunar-volman + ]; + }; + + environment.systemPackages = with pkgs; [ xfce.tumbler ]; + }; +} diff --git a/nix/modules/nixos/i3.nix b/nix/modules/nixos/i3.nix index 624c9fe..b300f22 100644 --- a/nix/modules/nixos/i3.nix +++ b/nix/modules/nixos/i3.nix @@ -3,7 +3,6 @@ inputs, lib, pkgs, - self, username, ... }: