From 3937656ce1bbdd074285239334ec5520aca9be4d Mon Sep 17 00:00:00 2001 From: unexplrd Date: Sun, 13 Jul 2025 12:02:59 +0300 Subject: [PATCH] cleanup the mess Signed-off-by: unexplrd --- modules/home/desktop/niri/default.nix | 76 ++++++------- modules/home/desktop/niri/niri.nix | 11 +- .../desktop/niri/programs/fuzzel/default.nix | 4 +- .../desktop/niri/programs/waybar/default.nix | 15 ++- .../home/desktop/niri/services/default.nix | 10 +- modules/shared/user/programs.nix | 103 +++++++++--------- 6 files changed, 106 insertions(+), 113 deletions(-) diff --git a/modules/home/desktop/niri/default.nix b/modules/home/desktop/niri/default.nix index 63e1b55..c9bb819 100644 --- a/modules/home/desktop/niri/default.nix +++ b/modules/home/desktop/niri/default.nix @@ -1,21 +1,24 @@ { - perSystem, - osConfig, config, inputs, - pkgs, lib, + osConfig, + # perSystem, + pkgs, ... }: let - # inherit (lib.strings) removeSuffix; inherit (lib) mkIf mkEnableOption mkDefault mkForce getExe; - inherit (config.lib.stylix) colors; - # inherit (osConfig.module.stylix) theme; inherit (osConfig.networking) hostName; + cfg = config.desktop.niri; + ifLaptop = mkIf (hostName != "dunamis"); - launcher = getExe pkgs.walker; - lockscreen = getExe pkgs.gtklock; + + commonArgs = { + inherit config inputs lib osConfig pkgs; + launcher = getExe pkgs.walker; + lockscreen = getExe pkgs.gtklock; + }; in { imports = with inputs; [ walker.homeManagerModules.default @@ -30,6 +33,24 @@ in { wpaperd.enable = true; qt.enable = false; }; + stylix.iconTheme = { + enable = true; + light = "Papirus-Light"; + dark = "Papirus-Dark"; + package = let + inherit (lib.strings) hasPrefix; + inherit (osConfig.module.stylix) theme; + color = + if (hasPrefix "rose-pine" theme) + then "indigo" + else if (hasPrefix "nord" theme) + then "nordic" + else if (hasPrefix "s" theme) + then "teal" + else null; + in + pkgs.papirus-icon-theme.override {inherit color;}; + }; dconf.settings = { "org/gnome/desktop/wm/preferences" = { button-layout = "icon:close"; @@ -42,40 +63,14 @@ in { else lib.mkDefault "prefer-light"; }; }; - gtk = { - enable = true; - iconTheme = let - name = - if (lib.strings.hasPrefix "gruvbox" osConfig.module.stylix.theme) - then "Gruvbox-Plus-Dark" - else if config.stylix.polarity == "dark" - then "Papirus-Dark" - else "Papirus-Light"; - package = let - inherit (osConfig.module.stylix) theme; - in - if (lib.strings.hasPrefix "gruvbox" theme) - then pkgs.gruvbox-plus-icons - else if (lib.strings.hasPrefix "rose-pine" theme) - then pkgs.papirus-icon-theme.override {color = "indigo";} - else if (lib.strings.hasPrefix "nord" theme) - then pkgs.papirus-icon-theme.override {color = "nordic";} - else if (lib.strings.hasPrefix "s" theme) - then pkgs.papirus-icon-theme.override {color = "teal";} - else pkgs.papirus-icon-theme; - in {inherit name package;}; - }; qt = { enable = true; platformTheme.name = "gtk3"; }; - programs = { - walker = import ./programs/walker {inherit config inputs pkgs;}; - waybar = import ./programs/waybar {inherit config colors getExe ifLaptop launcher pkgs;}; - }; - - services = import ./services {inherit pkgs lockscreen getExe perSystem osConfig;}; + programs.walker = import ./programs/walker commonArgs; + programs.waybar = import ./programs/waybar commonArgs; + services = import ./services commonArgs; home.packages = with pkgs; [ @@ -85,13 +80,9 @@ in { helvum # pipewire patchbay in rust junction # app chooser loupe # image viewer and editor in rust - mission-center # task manager in rust (partly) nautilus # file manager - overskride # bluetooth gui in rust papers # pdf reader in rust - pika-backup # borg gui in rust pwvucontrol # pipewire gui in rust - sonusmix # pipewire routing tool in rust wdisplays # wlroots display configurator ] ++ [ @@ -105,7 +96,7 @@ in { xdg = { configFile = { - niri = import ./niri.nix {inherit config hostName launcher lockscreen;}; + niri = import ./niri.nix commonArgs; "mimeapps.list".force = true; }; mime.enable = true; @@ -136,7 +127,6 @@ in { }; systemd.user = { settings.Manager.DefaultEnvironment = { - QT_QPA_PLATFORM = "wayland"; DISPLAY = ":123"; }; targets.tray.Unit.Description = "Home Manager System Tray"; # workaround for udiskie diff --git a/modules/home/desktop/niri/niri.nix b/modules/home/desktop/niri/niri.nix index 65079ce..c009478 100644 --- a/modules/home/desktop/niri/niri.nix +++ b/modules/home/desktop/niri/niri.nix @@ -1,12 +1,14 @@ { config, - hostName, + osConfig, launcher, lockscreen, ... }: let inherit (config.lib.stylix) colors; inherit (config.stylix) cursor; + inherit (osConfig.networking) hostName; + keyboard = if hostName == "eldrid" then "chromeos" @@ -91,14 +93,13 @@ in { in '' environment { DISPLAY ":123" - QT_QPA_PLATFORMTHEME "gtk3" + CLUTTER_BACKEND "wayland" + GDK_BACKEND "wayland" MOZ_ENABLE_WAYLAND "1" MOZ_WEBRENDER "1" - GDK_BACKEND "wayland" QT_QPA_PLATFORM "wayland" - XDG_SESSION_TYPE "wayland" - CLUTTER_BACKEND "wayland" SDL_VIDEODRIVER "wayland" + XDG_SESSION_TYPE "wayland" } input { diff --git a/modules/home/desktop/niri/programs/fuzzel/default.nix b/modules/home/desktop/niri/programs/fuzzel/default.nix index 392d616..0758613 100644 --- a/modules/home/desktop/niri/programs/fuzzel/default.nix +++ b/modules/home/desktop/niri/programs/fuzzel/default.nix @@ -1,6 +1,6 @@ { config, - mkDefault, + lib, }: { enable = true; settings = { @@ -15,7 +15,7 @@ match-mode = "fuzzy"; icon-theme = config.dconf.settings."org/gnome/desktop/interface".icon-theme; }; - border = mkDefault { + border = lib.mkDefault { width = 3; radius = 12; }; diff --git a/modules/home/desktop/niri/programs/waybar/default.nix b/modules/home/desktop/niri/programs/waybar/default.nix index 96b4fb9..5a02b96 100644 --- a/modules/home/desktop/niri/programs/waybar/default.nix +++ b/modules/home/desktop/niri/programs/waybar/default.nix @@ -1,12 +1,17 @@ { - colors, config, - getExe, - ifLaptop, - launcher, + lib, + osConfig, pkgs, + launcher, ... -}: { +}: let + inherit (lib) mkIf getExe; + inherit (config.lib.stylix) colors; + inherit (osConfig.networking) hostName; + + ifLaptop = mkIf (hostName != "dunamis"); +in { enable = true; systemd = { enable = true; diff --git a/modules/home/desktop/niri/services/default.nix b/modules/home/desktop/niri/services/default.nix index b5ffc3c..3ffa80c 100644 --- a/modules/home/desktop/niri/services/default.nix +++ b/modules/home/desktop/niri/services/default.nix @@ -1,9 +1,9 @@ { - getExe, - lockscreen, + # perSystem, + lib, osConfig, - perSystem, pkgs, + lockscreen, ... }: { blueman-applet.enable = osConfig.services.blueman.enable; @@ -14,7 +14,7 @@ wpaperd.enable = true; copyq = { enable = true; - package = perSystem.nixpkgs-stable.copyq; + # package = perSystem.nixpkgs-stable.copyq; }; gnome-keyring = { enable = true; @@ -56,7 +56,7 @@ } { timeout = 601; - on-timeout = getExe pkgs.niri + " msg action power-off-monitors"; + on-timeout = lib.getExe pkgs.niri + " msg action power-off-monitors"; } ]; }; diff --git a/modules/shared/user/programs.nix b/modules/shared/user/programs.nix index 4075cb4..cbfaf6a 100644 --- a/modules/shared/user/programs.nix +++ b/modules/shared/user/programs.nix @@ -1,10 +1,13 @@ { config, lib, + osConfig, pkgs, ... }: let inherit (lib) mkIf; + inherit (osConfig.virtualisation) libvirtd; + inherit (osConfig.hardware) bluetooth; in { console.yazi.enable = true; editor.helix.enable = true; @@ -24,42 +27,42 @@ in { ssh-agent.enable = true; }; - programs = { - bat.enable = true; # cat in rust - btop = { - enable = true; - settings.update_ms = 200; - }; - # direnv.enable = true; - # direnv.silent = true; - eza.enable = true; # ls in rust - fd.enable = true; # find in rust - fzf.enable = true; # fuzzy finder in rust - git = { - enable = true; - delta.enable = true; # diff in rust - signing.format = "ssh"; - aliases = { - cl = "clone"; - co = "checkout"; - pom = "push origin main"; + programs = + lib.attrsets.recursiveUpdate + { + bat.enable = true; # cat in rust + btop.enable = true; + # direnv.enable = true; + eza.enable = true; # ls in rust + fd.enable = true; # find in rust + fzf.enable = true; # fuzzy finder in rust + git.enable = true; + gitui.enable = true; # git ui in rust + jujutsu.enable = true; # vcs in rust + keychain.enable = true; + nix-index-database.comma.enable = true; + nix-index.enable = true; + nix-your-shell.enable = true; + pay-respects.enable = true; # thefuck in rust + ripgrep.enable = true; # grep in rust + zellij.enable = true; + zk.enable = true; + zoxide.enable = true; # fuzzy cd in rust + } + { + btop.settings.update_ms = 200; + # direnv.silent = true; + git = { + delta.enable = true; # diff in rust + signing.format = "ssh"; + aliases = { + cl = "clone"; + co = "checkout"; + pom = "push origin main"; + }; }; + keychain.keys = ["id_ed25519"]; }; - gitui.enable = true; # git ui in rust - jujutsu.enable = true; # vcs in rust - keychain = { - enable = true; - keys = ["id_ed25519"]; - }; - nix-index-database.comma.enable = true; - nix-index.enable = true; - nix-your-shell.enable = true; - pay-respects.enable = true; # thefuck in rust - ripgrep.enable = true; # grep in rust - zk.enable = true; - zoxide.enable = true; # fuzzy cd in rust - zellij.enable = true; - }; home.packages = with pkgs; [ @@ -89,7 +92,7 @@ in { adwaita-icon-theme # vial # qmk keyboard configuring app pinentry-qt # pinentry for rbw - virt-manager # libvirt gui + (mkIf libvirtd.enable virt-manager) # libvirt gui # waycheck # check wayland protocols gpu-screen-recorder-gtk ] @@ -99,28 +102,22 @@ in { # gnome-text-editor helvum # pipewire patchbay in rust junction # app chooser - # loupe # image viewer and editor in rust mission-center # task manager in rust (partly) - # nautilus # file manager - overskride # bluetooth gui in rust - papers # pdf reader in rust + (mkIf bluetooth.enable overskride) # bluetooth gui in rust pika-backup # borg gui in rust pwvucontrol # pipewire gui in rust sonusmix # pipewire routing tool in rust - # wdisplays # wlroots display configurator ]; - xdg.desktopEntries = { - uni = { - actions."Copy".exec = "fish -c \"~/.local/bin/uni --copy\""; - categories = ["Utility" "X-Launch" "Network"]; - comment = "Select and open or copy URLs from a list."; - exec = "fish -c \"~/.local/bin/uni\""; - icon = "web-browser"; - name = "Uni URL Handler"; - startupNotify = true; - terminal = false; - type = "Application"; - }; - }; + # xdg.desktopEntries.uni = { + # actions."Copy".exec = "fish -c \"~/.local/bin/uni --copy\""; + # categories = ["Utility" "X-Launch" "Network"]; + # comment = "Select and open or copy URLs from a list."; + # exec = "fish -c \"~/.local/bin/uni\""; + # icon = "web-browser"; + # name = "Uni URL Handler"; + # startupNotify = true; + # terminal = false; + # type = "Application"; + # }; }