From 5b18428ab024e47bbc8fafba0786d8382c56bf4f Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 21 Jul 2024 15:11:55 +0200 Subject: [PATCH] refactoring complete --- hosts/vali/temperance/configuration.nix | 7 +- modules/cli/beets.nix | 5 +- modules/gui/mpv.nix | 10 +- modules/options/style/module.nix | 11 +- modules/options/style/stylix.nix | 47 +++++ modules/options/system/programs/default.nix | 2 +- modules/runners/anyrun/anyrun.nix | 3 +- modules/styling/stylix.nix | 54 +----- modules/tui/ncmpcpp.nix | 4 +- modules/wms/wayland/hypr/land.nix | 182 ++++++++++---------- 10 files changed, 164 insertions(+), 161 deletions(-) diff --git a/hosts/vali/temperance/configuration.nix b/hosts/vali/temperance/configuration.nix index 3082572..98865bb 100644 --- a/hosts/vali/temperance/configuration.nix +++ b/hosts/vali/temperance/configuration.nix @@ -30,11 +30,16 @@ programs.dconf.enable = true; boot.kernelPackages = pkgs.linuxPackages_xanmod_latest; modules = { + system = { + }; + usrEnv = { + desktop.hyprland.enable = true; + }; other = { system = { hostname = "temperance"; username = "vali"; - gitPath = "/home/vali/repos/nichts"; + gitPath = "/home/vali/projects/nichts"; }; home-manager = { enable = true; diff --git a/modules/cli/beets.nix b/modules/cli/beets.nix index ffb70fc..17ad8b8 100644 --- a/modules/cli/beets.nix +++ b/modules/cli/beets.nix @@ -3,12 +3,11 @@ lib, ... }: let - cfg = config.modules.programs.beets; - inherit (lib) mkIf mkEnableOption; + cfg = config.modules.usrEnv.programs.media.beets; inherit (config.modules.other.system) username; inherit (config.modules.services.mpd) musicDirectory; + inherit (lib) mkIf; in { - options.modules.programs.beets.enable = mkEnableOption "beets"; config = mkIf cfg.enable { home-manager.users.${username} = { programs.beets = { diff --git a/modules/gui/mpv.nix b/modules/gui/mpv.nix index 50a3f2c..9312f28 100644 --- a/modules/gui/mpv.nix +++ b/modules/gui/mpv.nix @@ -3,13 +3,11 @@ lib, pkgs, ... -}: -with lib; let - cfg = config.modules.programs.mpv; - username = config.modules.other.system.username; +}: let + cfg = config.modules.usrEnv.programs.media.mpv; + inherit (config.modules.other.system) username; + inherit (lib) mkIf; in { - options.modules.programs.mpv.enable = mkEnableOption "mpv"; - config = mkIf cfg.enable { home-manager.users.${username} = { programs.mpv = { diff --git a/modules/options/style/module.nix b/modules/options/style/module.nix index 915a080..b63d7b4 100644 --- a/modules/options/style/module.nix +++ b/modules/options/style/module.nix @@ -1,12 +1,7 @@ -{ - lib, - pkgs, - config, -}: let -in { +_: { imports = [ ./stylix.nix - ./qt.nix - ./gtk.nix + # ./qt.nix + # ./gtk.nix ]; } diff --git a/modules/options/style/stylix.nix b/modules/options/style/stylix.nix index e69de29..ed6a023 100644 --- a/modules/options/style/stylix.nix +++ b/modules/options/style/stylix.nix @@ -0,0 +1,47 @@ +{ + config, + lib, + ... +}: let + inherit (lib) types mkEnableOption mkOption; +in { + options.modules.usrEnv.style.stylix = { + enable = mkEnableOption "Stylix style Manager"; + scheme = mkOption { + description = "Color Scheme"; + type = types.str; + }; + image = mkOption { + description = "Image"; + type = types.path; + }; + cursor = { + size = mkOption { + description = "Cursor Size"; + type = types.int; + }; + package = mkOption { + description = "Cursor Package"; + type = types.package; + }; + name = mkOption { + description = "Cursor Name"; + type = types.str; + }; + }; + fontsizes = { + terminal = mkOption { + description = "Terminal font size"; + type = types.int; + }; + popups = mkOption { + description = "Popup font size"; + type = types.int; + }; + applications = mkOption { + description = "Application font size"; + type = types.int; + }; + }; + }; +} diff --git a/modules/options/system/programs/default.nix b/modules/options/system/programs/default.nix index b89c976..2a18c33 100644 --- a/modules/options/system/programs/default.nix +++ b/modules/options/system/programs/default.nix @@ -23,7 +23,7 @@ in { git = { signingKey = mkOption { type = types.str; - default = ""; + default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILPiRe9OH/VtWFWyy5QbAVcN7CLxr4zUtRCwmxD6aeN6"; description = "The default gpg key used for signing commits"; }; }; diff --git a/modules/runners/anyrun/anyrun.nix b/modules/runners/anyrun/anyrun.nix index bafb125..46db3e4 100644 --- a/modules/runners/anyrun/anyrun.nix +++ b/modules/runners/anyrun/anyrun.nix @@ -7,9 +7,8 @@ }: with lib; let inherit (config.modules.other.system) username; - cfg = config.modules.programs.anyrun; + cfg = config.modules.usrEnv.programs.launchers.anyrun; in { - options.modules.programs.anyrun.enable = mkEnableOption "anyrun"; config = mkIf cfg.enable { home-manager.users.${username} = { imports = [inputs.anyrun.homeManagerModules.default]; diff --git a/modules/styling/stylix.nix b/modules/styling/stylix.nix index 00ffff1..97f7367 100644 --- a/modules/styling/stylix.nix +++ b/modules/styling/stylix.nix @@ -6,51 +6,11 @@ ... }: let cfg = config.modules.theming.stylix; - inherit (config.modules.theming.stylix) scheme image; - inherit (config.modules.theming.stylix.cursor) size; - inherit (config.modules.theming.stylix.fontsizes) terminal popups applications; + inherit (config.modules.usrEnv.style.stylix) scheme image cursor fontsizes; + inherit (lib) mkIf; in { imports = [inputs.stylix.nixosModules.stylix]; - options.modules.theming.stylix = { - enable = lib.mkEnableOption "stylix"; - scheme = lib.mkOption { - description = " Color Scheme"; - type = lib.types.str; - }; - image = lib.mkOption { - description = "Image"; - type = lib.types.path; - }; - cursor = { - size = lib.mkOption { - description = "Cursor Size"; - type = lib.types.int; - }; - package = lib.mkOption { - description = "Cursor Package"; - type = lib.types.package; - }; - name = lib.mkOption { - description = "Cursor Name"; - type = lib.types.str; - }; - }; - fontsizes = { - terminal = lib.mkOption { - description = "Terminal font size"; - type = lib.types.int; - }; - popups = lib.mkOption { - description = "Popup font size"; - type = lib.types.int; - }; - applications = lib.mkOption { - description = "Application font size"; - type = lib.types.int; - }; - }; - }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { stylix = { enable = true; homeManagerIntegration.followSystem = true; @@ -59,13 +19,13 @@ in { polarity = "dark"; autoEnable = true; cursor = { - inherit size; - package = pkgs.bibata-cursors; - name = "Bibata-Modern-Classic"; + inherit (cursor) size package name; + # package = pkgs.bibata-cursors; + # name = "Bibata-Modern-Classic"; }; fonts = { sizes = { - inherit terminal popups applications; + inherit (fontsizes) terminal popups applications; }; monospace = { package = diff --git a/modules/tui/ncmpcpp.nix b/modules/tui/ncmpcpp.nix index 38ec9e0..143713f 100644 --- a/modules/tui/ncmpcpp.nix +++ b/modules/tui/ncmpcpp.nix @@ -5,12 +5,10 @@ ... }: with lib; let - cfg = config.modules.programs.ncmpcpp; + cfg = config.modules.usrEnv.programs.media.ncmpcpp; inherit (config.modules.other.system) username; inherit (config.modules.services.mpd) musicDirectory; in { - options.modules.programs.ncmpcpp.enable = mkEnableOption "ncmpcpp"; - config = mkIf cfg.enable { home-manager.users.${username} = { programs.ncmpcpp = { diff --git a/modules/wms/wayland/hypr/land.nix b/modules/wms/wayland/hypr/land.nix index 3c018ec..f23c34a 100644 --- a/modules/wms/wayland/hypr/land.nix +++ b/modules/wms/wayland/hypr/land.nix @@ -24,7 +24,7 @@ in { xdg.portal = { enable = true; configPackages = [ - # hyprland # TODO Fix hyprland package + cfg.package # TODO Fix hyprland package ]; extraPortals = [ pkgs.xdg-desktop-portal-gtk @@ -35,7 +35,7 @@ in { home-manager.users.${username} = { wayland.windowManager.hyprland = { enable = true; - # package = hyprland; TODO Fix hyprland package + inherit (cfg) package; # Split-monitor-workspaces provides awesome-like workspace behaviour plugins = [ split-monitor-workspaces @@ -54,58 +54,58 @@ in { # Monitor config monitor = [ - "eDP-1,1920x1080,0x0,1" - # "DP-2,1920x1080,0x0,1" - # "HDMI-A-2,1920x1080,1920x0,1" - # "HDMI-A-1,1920x1080,3840x0,1" + # "eDP-1,1920x1080,0x0,1" + "DP-2,1920x1080,0x0,1" + "HDMI-A-2,1920x1080,1920x0,1" + "HDMI-A-1,1920x1080,3840x0,1" # Had the shadow monitor bug, so had to disable all unknown monitors. "Unknown-1,disable" ]; # Workspace config workspace = [ - "1,monitor:eDP-1, default:true" - "2,monitor:eDP-1" - "3,monitor:eDP-1" - "4,monitor:eDP-1" - "5,monitor:eDP-1" - "6,monitor:eDP-1" - "7,monitor:eDP-1" - "8,monitor:eDP-1" - "9,monitor:eDP-1" - "10,monitor:eDP-1" + # "1,monitor:eDP-1, default:true" + # "2,monitor:eDP-1" + # "3,monitor:eDP-1" + # "4,monitor:eDP-1" + # "5,monitor:eDP-1" + # "6,monitor:eDP-1" + # "7,monitor:eDP-1" + # "8,monitor:eDP-1" + # "9,monitor:eDP-1" + # "10,monitor:eDP-1" - # "1,monitor:HDMI-A-1, default:true" - # "2,monitor:HDMI-A-1" - # "3,monitor:HDMI-A-1" - # "4,monitor:HDMI-A-1" - # "5,monitor:HDMI-A-1" - # "6,monitor:HDMI-A-1" - # "7,monitor:HDMI-A-1" - # "8,monitor:HDMI-A-1" - # "9,monitor:HDMI-A-1" - # "10,monitor:HDMI-A-1" + "1,monitor:HDMI-A-1, default:true" + "2,monitor:HDMI-A-1" + "3,monitor:HDMI-A-1" + "4,monitor:HDMI-A-1" + "5,monitor:HDMI-A-1" + "6,monitor:HDMI-A-1" + "7,monitor:HDMI-A-1" + "8,monitor:HDMI-A-1" + "9,monitor:HDMI-A-1" + "10,monitor:HDMI-A-1" - #"11, monitor:HDMI-A-2, default:true" - #"12, monitor:HDMI-A-2" - #"13, monitor:HDMI-A-2" - #"14, monitor:HDMI-A-2" - #"15, monitor:HDMI-A-2" - #"16, monitor:HDMI-A-2" - #"17, monitor:HDMI-A-2" - #"18, monitor:HDMI-A-2" - #"19, monitor:HDMI-A-2" - #"20, monitor:HDMI-A-2" - # - #"21, monitor:DP-2, default:true" - #"22, monitor:DP-2" - #"23, monitor:DP-2" - #"24, monitor:DP-2" - #"25, monitor:DP-2" - #"26, monitor:DP-2" - #"27, monitor:DP-2" - #"28, monitor:DP-2" - #"29, monitor:DP-2" - #"30, monitor:DP-2" + "11, monitor:HDMI-A-2, default:true" + "12, monitor:HDMI-A-2" + "13, monitor:HDMI-A-2" + "14, monitor:HDMI-A-2" + "15, monitor:HDMI-A-2" + "16, monitor:HDMI-A-2" + "17, monitor:HDMI-A-2" + "18, monitor:HDMI-A-2" + "19, monitor:HDMI-A-2" + "20, monitor:HDMI-A-2" + + "21, monitor:DP-2, default:true" + "22, monitor:DP-2" + "23, monitor:DP-2" + "24, monitor:DP-2" + "25, monitor:DP-2" + "26, monitor:DP-2" + "27, monitor:DP-2" + "28, monitor:DP-2" + "29, monitor:DP-2" + "30, monitor:DP-2" # scratchpads "special:btop, decorate:false" @@ -205,59 +205,61 @@ in { "$mainMod, F, fullscreen, 0" "$mainMod, D, exec, ${pkgs.procps}/bin/pkill anyrun || ${anyrun}/bin/anyrun" "$mainMod, SPACE, togglefloating, active" - "$mainMod, O, exec, obsidian --ozone-platform=wayland --enable-features=UseOzonePlatform --enable-features=WaylandWindowDecorations --enable-features=WebRTCPipeWireCpaturer --disable-gpu" # workspaces - # split-workspace is because of the split-workspace plugin - "$mainMod, 1, workspace, 1" - "$mainMod, 2, workspace, 2" - "$mainMod, 3, workspace, 3" - "$mainMod, 4, workspace, 4" - "$mainMod, 5, workspace, 5" - "$mainMod, 6, workspace, 6" - "$mainMod, 7, workspace, 7" - "$mainMod, 8, workspace, 8" - "$mainMod, 9, workspace, 9" - "$mainMod, 0, workspace, 10" - "$mainMod SHIFT, 1, movetoworkspacesilent, 1" - "$mainMod SHIFT, 2, movetoworkspacesilent, 2" - "$mainMod SHIFT, 3, movetoworkspacesilent, 3" - "$mainMod SHIFT, 4, movetoworkspacesilent, 4" - "$mainMod SHIFT, 5, movetoworkspacesilent, 5" - "$mainMod SHIFT, 6, movetoworkspacesilent, 6" - "$mainMod SHIFT, 7, movetoworkspacesilent, 7" - "$mainMod SHIFT, 8, movetoworkspacesilent, 8" - "$mainMod SHIFT, 9, movetoworkspacesilent, 9" - "$mainMod SHIFT, 0, movetoworkspacesilent, 10" # split-workspace is because of the split-workspace plugin - # "$mainMod, 1, split-workspace, 1" - # "$mainMod, 2, split-workspace, 2" - # "$mainMod, 3, split-workspace, 3" - # "$mainMod, 4, split-workspace, 4" - # "$mainMod, 5, split-workspace, 5" - # "$mainMod, 6, split-workspace, 6" - # "$mainMod, 7, split-workspace, 7" - # "$mainMod, 8, split-workspace, 8" - # "$mainMod, 9, split-workspace, 9" - # "$mainMod, 0, split-workspace, 10" - # "$mainMod SHIFT, 1, split-movetoworkspacesilent, 1" - # "$mainMod SHIFT, 2, split-movetoworkspacesilent, 2" - # "$mainMod SHIFT, 3, split-movetoworkspacesilent, 3" - # "$mainMod SHIFT, 4, split-movetoworkspacesilent, 4" - # "$mainMod SHIFT, 5, split-movetoworkspacesilent, 5" - # "$mainMod SHIFT, 6, split-movetoworkspacesilent, 6" - # "$mainMod SHIFT, 7, split-movetoworkspacesilent, 7" - # "$mainMod SHIFT, 8, split-movetoworkspacesilent, 8" - # "$mainMod SHIFT, 9, split-movetoworkspacesilent, 9" - # "$mainMod SHIFT, 0, split-movetoworkspacesilent, 10" + # "$mainMod, 1, workspace, 1" + # "$mainMod, 2, workspace, 2" + # "$mainMod, 3, workspace, 3" + # "$mainMod, 4, workspace, 4" + # "$mainMod, 5, workspace, 5" + # "$mainMod, 6, workspace, 6" + # "$mainMod, 7, workspace, 7" + # "$mainMod, 8, workspace, 8" + # "$mainMod, 9, workspace, 9" + # "$mainMod, 0, workspace, 10" + # "$mainMod SHIFT, 1, movetoworkspacesilent, 1" + # "$mainMod SHIFT, 2, movetoworkspacesilent, 2" + # "$mainMod SHIFT, 3, movetoworkspacesilent, 3" + # "$mainMod SHIFT, 4, movetoworkspacesilent, 4" + # "$mainMod SHIFT, 5, movetoworkspacesilent, 5" + # "$mainMod SHIFT, 6, movetoworkspacesilent, 6" + # "$mainMod SHIFT, 7, movetoworkspacesilent, 7" + # "$mainMod SHIFT, 8, movetoworkspacesilent, 8" + # "$mainMod SHIFT, 9, movetoworkspacesilent, 9" + # "$mainMod SHIFT, 0, movetoworkspacesilent, 10" + + # split-workspace is because of the split-workspace plugin + "$mainMod, 1, split-workspace, 1" + "$mainMod, 2, split-workspace, 2" + "$mainMod, 3, split-workspace, 3" + "$mainMod, 4, split-workspace, 4" + "$mainMod, 5, split-workspace, 5" + "$mainMod, 6, split-workspace, 6" + "$mainMod, 7, split-workspace, 7" + "$mainMod, 8, split-workspace, 8" + "$mainMod, 9, split-workspace, 9" + "$mainMod, 0, split-workspace, 10" + "$mainMod SHIFT, 1, split-movetoworkspacesilent, 1" + "$mainMod SHIFT, 2, split-movetoworkspacesilent, 2" + "$mainMod SHIFT, 3, split-movetoworkspacesilent, 3" + "$mainMod SHIFT, 4, split-movetoworkspacesilent, 4" + "$mainMod SHIFT, 5, split-movetoworkspacesilent, 5" + "$mainMod SHIFT, 6, split-movetoworkspacesilent, 6" + "$mainMod SHIFT, 7, split-movetoworkspacesilent, 7" + "$mainMod SHIFT, 8, split-movetoworkspacesilent, 8" + "$mainMod SHIFT, 9, split-movetoworkspacesilent, 9" + "$mainMod SHIFT, 0, split-movetoworkspacesilent, 10" # Move Windows "$mainMod SHIFT, H, movewindow, l" "$mainMod SHIFT, J, movewindow, d" "$mainMod SHIFT, K, movewindow, u" "$mainMod SHIFT, L, movewindow, r" + # Screenshotting "$mainMod, S, exec, ${pkgs.grimblast}/bin/grimblast copy area" + # File manager "$mainMod, E, exec, ${pkgs.gnome.nautilus}/bin/nautilus" # Toggle the four different special workspaces. @@ -267,7 +269,7 @@ in { "$mainMod, X, togglespecialworkspace, keepassxc" # Reload hyprland - "$mainMod, R, exec, ${hyprland}/bin/hyprctl reload" + "$mainMod, R, exec, ${cfg.package}/bin/hyprctl reload" # Restart waybar "$mainMod CONTROL, B, exec, ${pkgs.procps}/bin/pkill waybar || ${pkgs.waybar}/bin/waybar" ];