From 9436e1504f82906af8abb2ce15625baea2424fbe Mon Sep 17 00:00:00 2001 From: Nate Anderson Date: Mon, 11 Aug 2025 14:53:04 -0600 Subject: [PATCH] Updates to git delta config, waybar config, and others --- flake.lock | 33 ++++++++-- flake.nix | 11 +++- nate-work/desktop-configuration.nix | 7 +- nate-work/dotfiles/waybar/config | 86 ++++++++++++++----------- nate-work/dotfiles/waybar/style.css | 52 +++++++++++---- nate-work/modules/home-manager/home.nix | 18 ++++-- nate-work/modules/hypr/hypr_home.nix | 25 ++++--- nate-work/modules/hypr/hyprland.nix | 2 +- shared/modules/system/power_manager.nix | 78 ++++++++++++++++++++++ 9 files changed, 239 insertions(+), 73 deletions(-) create mode 100644 shared/modules/system/power_manager.nix diff --git a/flake.lock b/flake.lock index 4ba2926..b66c097 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "auto-cpufreq": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1752998173, + "narHash": "sha256-ZlYpBp2WOe03UrpjJGz5KTOL/pp7A452hJO/Vc8C4/0=", + "owner": "AdnanHodzic", + "repo": "auto-cpufreq", + "rev": "562278377ffa96f3c1af49c7b499df028ce8d8bd", + "type": "github" + }, + "original": { + "owner": "AdnanHodzic", + "repo": "auto-cpufreq", + "type": "github" + } + }, "catppuccin": { "inputs": { "nixpkgs": "nixpkgs" @@ -78,11 +98,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1754214453, - "narHash": "sha256-Q/I2xJn/j1wpkGhWkQnm20nShYnG7TI99foDBpXm1SY=", + "lastModified": 1754725699, + "narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5b09dc45f24cf32316283e62aec81ffee3c3e376", + "rev": "85dbfc7aaf52ecb755f87e577ddbe6dbbdbc1054", "type": "github" }, "original": { @@ -94,11 +114,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1754028485, - "narHash": "sha256-IiiXB3BDTi6UqzAZcf2S797hWEPCRZOwyNThJIYhUfk=", + "lastModified": 1754767907, + "narHash": "sha256-8OnUzRQZkqtUol9vuUuQC30hzpMreKptNyET2T9lB6g=", "owner": "nixos", "repo": "nixpkgs", - "rev": "59e69648d345d6e8fef86158c555730fa12af9de", + "rev": "c5f08b62ed75415439d48152c2a784e36909b1bc", "type": "github" }, "original": { @@ -146,6 +166,7 @@ }, "root": { "inputs": { + "auto-cpufreq": "auto-cpufreq", "catppuccin": "catppuccin", "home-manager": "home-manager", "nixpkgs": "nixpkgs_2", diff --git a/flake.nix b/flake.nix index 5f676ff..dba9840 100644 --- a/flake.nix +++ b/flake.nix @@ -8,17 +8,23 @@ url = "github:nix-community/home-manager/release-25.05"; inputs.nixpkgs.follows = "nixpkgs"; }; + # bonus inputs catppuccin.url = "github:catppuccin/nix"; nur.url = "github:nix-community/NUR"; + auto-cpufreq = { + url = "github:AdnanHodzic/auto-cpufreq"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, nixpkgs-unstable, catppuccin, nur, home-manager, ... } @ inputs: + outputs = { self, nixpkgs, nixpkgs-unstable, catppuccin, nur, home-manager, auto-cpufreq, ... } @ inputs: let inherit (self) outputs; system = "x86_64-linux"; timeZone = "America/Denver"; pkgs = nixpkgs.legacyPackages.${system}; - unstablePkgs = import nixpkgs-unstable { system = system; config = { allowUnfree = true; }; }; + unstablePkgs = import nixpkgs-unstable { system = system; config = { allowUnfree = true; }; }; + # pkgs23 = import nixpkgs-23 { system = system; config = { allowUnfree = true; }; }; in { @@ -65,6 +71,7 @@ }; modules = [ catppuccin.nixosModules.catppuccin + auto-cpufreq.nixosModules.default # Setup home manager inputs.home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/nate-work/desktop-configuration.nix b/nate-work/desktop-configuration.nix index f98f0ee..3c3918a 100644 --- a/nate-work/desktop-configuration.nix +++ b/nate-work/desktop-configuration.nix @@ -30,7 +30,7 @@ in modules/user/main_user.nix modules/sway/sway_conf.nix modules/hypr/hyprland.nix - + ../shared/modules/system/power_manager.nix # inputs.nur.hmModules.nur ]; @@ -67,6 +67,11 @@ in brscan5.enable = true; }; + power_manager = { + enable = true; + useFlake = true; + }; + main_user = { enable = true; userName = deskCfg.userName; diff --git a/nate-work/dotfiles/waybar/config b/nate-work/dotfiles/waybar/config index 1f712b5..a538a40 100644 --- a/nate-work/dotfiles/waybar/config +++ b/nate-work/dotfiles/waybar/config @@ -1,11 +1,11 @@ // Global { - "layer": "top", + "layer": "bottom", "position": "top", - "margin-top": 0, - "margin-left": 10, - "margin-right": 10, - "margin-bottom": 0, + "margin-top": 3, + "margin-left": 3, + "margin-right": 3, + "margin-bottom": 3, // If height property would be not present, it'd be calculated dynamically // "height": 60, @@ -26,16 +26,16 @@ ], "modules-right": [ - "network", - "idle_inhibitor", + "clock", + // "network", // using network applet in tray + // "idle_inhibitor", + "custom/storage", "memory", "cpu", "pulseaudio", "custom/keyboard-layout", "battery", - "backlight#icon", - "backlight#value", - "clock", + "backlight", "tray", //"custom/weather", "custom/power", @@ -57,7 +57,7 @@ "warning": 30, "critical": 15 }, - "format": "{capacity}% {icon}", + "format": "{icon} {capacity}%", "format-charging": "{capacity}% 󰂄", "format-plugged": "{capacity}% ", // "format-good": "", // An empty format will hide the module @@ -79,13 +79,13 @@ "warning": 70, "critical": 90, }, - "on-click": "foot -e 'htop'", + "on-click": "ghostty -e 'htop'", }, "memory": { "interval": 5, "format": " {}%", // Icon: memory - "on-click": "foot -e 'htop'", + "on-click": "ghostty -e 'htop'", "states": { "warning": 70, "critical": 90 @@ -94,17 +94,17 @@ "network": { "interval": 5, - "format-wifi": " {essid} ({signalStrength}%)", // Icon: wifi + "format-wifi": "", // Icon: wifi "format-ethernet": " {ifname}: {ipaddr}/{cidr}", // Icon: ethernet "format-disconnected": "⚠ Disconnected", - "tooltip-format": "{ifname}: {ipaddr}", - "on-click": "foot -e 'nmtui'", + "tooltip-format": "{essid} - {ifname}:{ipaddr} {bandwidthUpBytes} {bandwidthDownBytes}", + "on-click": "ghostty -e 'nmtui'", }, "network#vpn": { "interface": "tun0", - "format": " {essid} ({signalStrength}%)", + "format": " {signalStrength}%", "format-disconnected": "⚠ Disconnected", - "tooltip-format": "{ifname}: {ipaddr}/{cidr}", + "tooltip-format": "{essid} - {ifname}:{ipaddr} {bandwidthUpBytes} {bandwidthDownBytes}", }, "hyprland/window": { @@ -114,21 +114,21 @@ "icon_size": 30, "rewrite": { // Firefox - "(.*) — Mozilla Firefox": "󰖟 $1", - "(.*) - Mozilla Firefox": "󰖟 $1", - "Mozilla Firefox": "󰖟 Firefox", + "(.*) — Mozilla Firefox": " $1", + "(.*) - Mozilla Firefox": " $1", + "Mozilla Firefox": " Firefox", // Chrome/Chromium - "(.*) - Google Chrome": "󰖟 $1", - "(.*) - Chromium": "󰖟 $1", - "Google Chrome": "󰖟 Chrome", - "Chromium": "󰖟 Chromium", + "(.*) - Google Chrome": " $1", + "(.*) - Chromium": " $1", + "Google Chrome": " Chrome", + "Chromium": " Chromium", // Terminal applications "(.*) - zsh": " $1", "(.*) - bash": " $1", "(.*) - fish": " $1", - "foot": " Terminal", + "ghostty": " Terminal", "kitty": " Terminal", "alacritty": " Terminal", "ghostty": " Terminal", @@ -209,20 +209,20 @@ "pulseaudio": { "scroll-step": 1, // %, can be a float - "format": "{volume}% {icon}", + "format": "{icon} {volume}%", "format-bluetooth": "{volume}% {icon}  {format_source}", "format-bluetooth-muted": " {icon}  {format_source}", "format-muted": " {format_source}", "format-source": "{volume}% ", "format-source-muted": "", "format-icons": { - "headphone": "", + "headphone": ["", "", "", "", ""], "hands-free": "", "headset": "", "phone": "", "portable": "", "car": "", - "default": [""] + "default": ["", "", ""] }, "on-click": "pavucontrol", "on-scroll-up": "pactl set-sink-volume @DEFAULT_SINK@ +2%", @@ -236,24 +236,32 @@ // }, "tray": { - "icon-size": 18, + "icon-size": 20, "spacing":10, }, - "backlight#icon": { - "format": "{icon}", - "format-icons": [""], + "backlight": { + "format": "{icon} {percent}%", + "format-icons": ["󰹐", "󱩏", "󱩑", "󱩓", "󱩕", "󰛨"], "on-scroll-down": "brightnessctl -c backlight set 1%-", - "on-scroll-up": "brightnessctl -c backlight set +1%" + "on-scroll-up": "brightnessctl -c backlight set +1%", + "min-brightness": 1 }, - "backlight#value" :{ - "format": "{percent}%", - "on-scroll-down": "brightnessctl -c backlight set 1%-", - "on-scroll-up": "brightnessctl -c backlight set +1%" + "custom/storage": { + "format": "{icon} {percentage}%", + "format-icons": { + "default": "", + "warning": "", + "critical": "", + }, + "exec": "usage=$(df / --output=pcent | tail -n1 | tr -d ' %'); if [ $usage -ge 90 ]; then class=\"critical\"; elif [ $usage -ge 75 ]; then class=\"warning\"; else class=\"default\"; fi; echo \"{\\\"percentage\\\":$usage,\\\"class\\\":\\\"$class\\\"}\"", + "return-type": "json", + "interval": 30, + "tooltip-format": "Root filesystem: {percentage}% used", }, - "custom/signal": { + "custom/signal": { "format": "  ", "on-click": "exec signal", "tooltip": false, diff --git a/nate-work/dotfiles/waybar/style.css b/nate-work/dotfiles/waybar/style.css index 04cc0c0..871e33a 100644 --- a/nate-work/dotfiles/waybar/style.css +++ b/nate-work/dotfiles/waybar/style.css @@ -68,8 +68,8 @@ border: none; border-radius: 0; min-height: 40px; - margin: 1px; - padding: 0; + margin: 0px; + padding: 0px; } /* The whole bar */ @@ -77,7 +77,7 @@ background: transparent; background-color: transparent; font-family: Overpass Nerd Font; - font-size: 20px; + font-size: 22px; color: @text; } @@ -112,25 +112,49 @@ border-color: @surface0; } +/* Add gaps for middle module so they space out and dont touch */ +.modules-center { + margin: 0px 100px; +} + /* Every modules */ +#backlight, #battery, #clock, -#backlight, #cpu, +#custom-storage, #custom-keyboard-layout, +#custom-PBPbattery, +#custom-weather, +#idle_inhibitor, #memory, #mode, -#custom-weather, #network, #pulseaudio, #temperature, -#tray, -#idle_inhibitor, -#custom-PBPbattery { +#tray { padding: 0.5rem 0.6rem; margin: 1px 0px; } +#clock { + margin-left: 5px; + margin-right: 5px; + min-width: 140px; +} + +#backlight, +#battery, +#cpu, +#custom-storage, +#memory, +#network, +#pulseaudio, +#temperature { + min-width: 90px; +} + + /* ----------------------------------------------------------------------------- * Modules styles * -------------------------------------------------------------------------- */ @@ -141,11 +165,13 @@ animation-direction: alternate; } -#battery.warning { +#battery.warning, +#custom-storage.warning { color: @flamingo; } -#battery.critical { +#battery.critical, +#custom-storage.critical { color: @red; } @@ -212,6 +238,8 @@ #window { font-weight: bold; + margin-left: 20px; + margin-right: 10px; } #workspaces { @@ -296,7 +324,7 @@ #custom-power { margin-left: 15px; margin-right: 15px; - font-size: 15px; + font-size: 20px; color: @flamingo; } @@ -308,5 +336,5 @@ #backlight.icon { padding-right: 1px; - font-size: 13px; + font-size: 20px; } \ No newline at end of file diff --git a/nate-work/modules/home-manager/home.nix b/nate-work/modules/home-manager/home.nix index 60c2336..c169a86 100644 --- a/nate-work/modules/home-manager/home.nix +++ b/nate-work/modules/home-manager/home.nix @@ -213,14 +213,24 @@ extraConfig = { include = { path = "${config.xdg.configHome}/macchiato.gitconfig"; }; init = { defaultBranch = "main"; }; - pull = { ff = "only"; }; merge = { conflictStyle="zdiff3"; }; + pull = { ff = "only"; }; push = { autoSetupRemote="true"; }; - "url \"git@github.com:\"" = { - insteadOf = "https://github.com/"; + url = { + "git@github.com" = { + insteadOf = "https://github.com/"; + }; }; }; - delta.enable = true; + delta = { + enable = true; + navigate = true; + options = { + side-by-side = true; + hyperlinks = true; + }; + }; + }; programs = { diff --git a/nate-work/modules/hypr/hypr_home.nix b/nate-work/modules/hypr/hypr_home.nix index 45e3bc2..d45dfe4 100644 --- a/nate-work/modules/hypr/hypr_home.nix +++ b/nate-work/modules/hypr/hypr_home.nix @@ -39,6 +39,8 @@ in # May need to kill mako if nwg-panel starts it "swaync" "keepassxc" + "flatpak run org.signal.Signal" + "flatpak run com.slack.Slack" # set gsettings # "dconf write /org/gnome/desktop/interface/cursor-theme \"'catppuccin-macchiato-lavender-cursors'\"" # "dconf write /org/gnome/desktop/interface/cursor-size 24" @@ -168,18 +170,25 @@ in ", switch:off:Lid Switch, exec, hyprctl keyword monitor 'eDP-1, 2560x1600@165, 0x0, 1.00'" ]; windowrulev2 = [ + # float keepass windows, put main window in scratch "float, class:^(org.keepassxc.KeePassXC)$" - "workspace special:scratch silent, class:^(org.keepassxc.KeePassXC)$ title:\[Locked\]" + "workspace special:scratch silent, class:^(org.keepassxc.KeePassXC)$" + "workspace special:scratch silent, class:^(org.signal.Signal)$" - # float music windows and move to music workspace - # "tag +fmusic, class:^(firefox)$, title:^(YouTube — Mozilla Firefox)$" - # "float, tag:^(fmusic)$"# class:^(firefox)$, title:YouTube" - # "workspace special:music silent, tag:^(fmusic)$"# class:^(firefox)$, title:YouTube" - # "size 800 400, tag:^(fmusic)$"# class:^(firefox)$, title:YouTube" - # "move 100%-w-20 100%-h-20, tag:^(fmusic)$"# class:^(firefox)$, title:YouTube" - + # Firefox to workspace 2 + "workspace 2 silent, class:^(firefox)$" + + # Slack to workspace 3 + "workspace 3 silent, class:^(com.slack.Slack)$" + + # Zoom to workspace 4 + "workspace 4 silent, class:^(zoom)$" + "fullscreen, class:^(zoom)$, title:^(Meeting)$" + # Float all other zoom windows (not meetings) + "float, class:^(zoom)$, title:!^(Meeting)$" ]; + monitor = [ "eDP-1, 2560x1600@165, 0x0, 1.00" # At home monitor setup, 144 for hdmi bandwidth diff --git a/nate-work/modules/hypr/hyprland.nix b/nate-work/modules/hypr/hyprland.nix index 3bd8781..9b050d7 100644 --- a/nate-work/modules/hypr/hyprland.nix +++ b/nate-work/modules/hypr/hyprland.nix @@ -251,7 +251,7 @@ in # Fine-grained power management. Turns off GPU when not in use. # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; + powerManagement.finegrained = true; # Use the NVidia open source kernel module (not to be confused with the # independent third-party "nouveau" open source driver). diff --git a/shared/modules/system/power_manager.nix b/shared/modules/system/power_manager.nix new file mode 100644 index 0000000..11bf70c --- /dev/null +++ b/shared/modules/system/power_manager.nix @@ -0,0 +1,78 @@ +{ config, lib, pkgs, inputs ? null, ... }: + +with lib; + +let + cfg = config.power_manager; +in +{ + options.power_manager = { + enable = mkEnableOption "power management with auto-cpufreq"; + + useFlake = mkOption { + type = types.bool; + default = true; + description = '' + Whether to use the auto-cpufreq flake input for the latest version. + If false, uses the nixpkgs version (may be outdated). + ''; + }; + + settings = mkOption { + type = types.attrs; + default = { + battery = { + governor = "powersave"; + turbo = "never"; + }; + charger = { + governor = "performance"; + turbo = "auto"; + }; + }; + description = "Auto-cpufreq configuration settings"; + }; + + enableThermald = mkOption { + type = types.bool; + default = true; + description = "Enable thermald for Intel CPU thermal management"; + }; + + enableUpower = mkOption { + type = types.bool; + default = true; + description = "Enable UPower for battery monitoring"; + }; + }; + + config = mkIf cfg.enable { + # Auto-cpufreq configuration - use flake version if available, otherwise nixpkgs + programs.auto-cpufreq = mkIf (cfg.useFlake && inputs ? auto-cpufreq) { + enable = true; + settings = cfg.settings; + }; + + services.auto-cpufreq = mkIf (!cfg.useFlake || !(inputs ? auto-cpufreq)) { + enable = true; + settings = cfg.settings; + }; + + # Supporting services + services.upower.enable = mkIf cfg.enableUpower true; + services.thermald.enable = mkIf cfg.enableThermald true; + powerManagement.enable = mkIf cfg.enable true; + + # Disable conflicting power management services + services.tlp.enable = mkForce false; + services.power-profiles-daemon.enable = mkForce false; + powerManagement.powertop.enable = mkForce false; + + # Don't set a static CPU governor (let auto-cpufreq handle it) + powerManagement.cpuFreqGovernor = mkForce null; + }; + + # # Warning if flake input is missing when expected + # warnings = optional (cfg.useFlake && !(inputs ? auto-cpufreq)) + # "power_manager: useFlake is enabled but auto-cpufreq flake input not found. Using nixpkgs version instead."; +}