diff --git a/flake.lock b/flake.lock index 67ff2a5c..09b9b6ae 100644 --- a/flake.lock +++ b/flake.lock @@ -171,6 +171,24 @@ "inputs": { "systems": "systems" }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { "lastModified": 1710146030, "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", @@ -185,9 +203,9 @@ "type": "github" } }, - "flake-utils_2": { + "flake-utils_3": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1731533236, @@ -287,7 +305,7 @@ "crane": "crane", "flake-compat": "flake-compat", "flake-parts": "flake-parts", - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": [ "stable" ], @@ -336,7 +354,7 @@ "minecraft": { "inputs": { "flake-compat": "flake-compat_3", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "nixpkgs": "nixpkgs_2" }, "locked": { @@ -490,6 +508,7 @@ "inputs": { "blender": "blender", "disko": "disko", + "flake-utils": "flake-utils", "hm": "hm", "impermanence": "impermanence", "jovian": "jovian", @@ -571,6 +590,21 @@ "type": "github" } }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 48728d61..756073b5 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,9 @@ stable.url = "nixpkgs/nixos-24.11"; unstable.url = "nixpkgs/nixos-unstable"; + # Flake helpers + flake-utils.url = "github:numtide/flake-utils"; + # System inputs disko = { url = "github:nix-community/disko"; @@ -48,6 +51,8 @@ stable, unstable, + flake-utils, + disko, impermanence, lanzaboote, @@ -63,34 +68,31 @@ ... }@inputs: - let - mkNix = modules: channel: channel.lib.nixosSystem { - inherit modules; - specialArgs = inputs; - }; - mkHome = modules: channel: arch: hm.lib.homeManagerConfiguration { - inherit modules; - pkgs = builtins.getAttr arch channel.legacyPackages; - extraSpecialArgs = inputs; - }; - in { - # nh os switch /path -H host - nixosConfigurations = { - tower = mkNix [ ./hosts/tower ] stable; # Main Desktop + inputs.flake-utils.lib.eachDefaultSystemPassThrough (system: + let + mkNix = modules: channel: channel.lib.nixosSystem { + inherit modules; + specialArgs = inputs; + }; + mkHome = modules: channel: hm.lib.homeManagerConfiguration { + inherit modules; + pkgs = channel.legacyPackages.${system}; + extraSpecialArgs = inputs; + }; + in { + nixosConfigurations = { + tower = mkNix [ ./hosts/tower ] stable; - intuos = mkNix [ ./hosts/intuos ] stable; # Wacom Intuos Tablet - jupiter = mkNix [ ./hosts/jupiter ] unstable; # Steam Deck - redmond = mkNix [ ./hosts/redmond ] stable; # Lenovo Dual-Boot + intuos = mkNix [ ./hosts/intuos ] stable; + jupiter = mkNix [ ./hosts/jupiter ] unstable; + redmond = mkNix [ ./hosts/redmond ] stable; - midas = mkNix [ ./hosts/midas ] stable; # Dell Optiplex 5040 - kitty = mkNix [ ./hosts/kitty ] stable; # Dell Optiplex 7010 - prophet = mkNix [ ./hosts/prophet ] stable; # Oracle Neoverse-N1 - }; - - # nh home switch /path -c arch - homeConfigurations = { - x86 = mkHome [ ./modules/home ] stable "x86_64-linux"; - aarch = mkHome [ ./modules/home ] stable "aarch64-linux"; - }; - }; + midas = mkNix [ ./hosts/midas ] stable; + kitty = mkNix [ ./hosts/kitty ] stable; + prophet = mkNix [ ./hosts/prophet ] stable; + }; + + homeConfigurations.bun = mkHome [ ./modules/home ] stable; + } + ); } diff --git a/hosts/jupiter/jovian/default.nix b/hosts/jupiter/jovian/default.nix index fa5ecf0c..f827574b 100644 --- a/hosts/jupiter/jovian/default.nix +++ b/hosts/jupiter/jovian/default.nix @@ -24,11 +24,7 @@ boot.kernelPackages = lib.mkForce pkgs.linuxPackages_jovian; - programs.steam = { - extest.enable = true; - localNetworkGameTransfers.openFirewall = true; - remotePlay.openFirewall = true; - }; + programs.steam.extest.enable = true; services = { keyd.enable = lib.mkForce false; @@ -36,6 +32,8 @@ xserver.desktopManager.gnome.enable = true; }; + hardware.xone.enable = true; + networking = { networkmanager.enable = true; wireless.enable = lib.mkForce false; @@ -94,6 +92,7 @@ "steam-jupiter-unwrapped" "steamdeck-firmware" "steamdeck-hw-theme" + "xow_dongle-firmware" ]; specialisation.desktop.configuration.config.system.steamdeck.enable = lib.mkForce false; diff --git a/modules/home/programs/misc/school/default.nix b/modules/home/programs/misc/school/default.nix index 35452156..d46dc396 100644 --- a/modules/home/programs/misc/school/default.nix +++ b/modules/home/programs/misc/school/default.nix @@ -8,6 +8,9 @@ remmina teams-for-linux ]; + + shellAliases.seneca = "ssh jhampton1@matrix.senecapolytechnic.ca"; + persistence."/persist${config.home.homeDirectory}".directories = [ ".cache/gpclient" ".config/com.yuezk.qt" diff --git a/modules/home/programs/terminal/direnv/default.nix b/modules/home/programs/terminal/direnv/default.nix index b71ece6d..1ccc3c68 100644 --- a/modules/home/programs/terminal/direnv/default.nix +++ b/modules/home/programs/terminal/direnv/default.nix @@ -1,7 +1,9 @@ -{ ... }: +{ config, ... }: { programs.direnv = { enable = true; nix-direnv.enable = true; }; + + home.persistence."/persist${config.home.homeDirectory}".directories = [ ".local/share/direnv" ]; } diff --git a/modules/home/programs/terminal/fastfetch/default.nix b/modules/home/programs/terminal/fastfetch/default.nix index ecaf8e3b..a89c46fa 100644 --- a/modules/home/programs/terminal/fastfetch/default.nix +++ b/modules/home/programs/terminal/fastfetch/default.nix @@ -2,7 +2,10 @@ { programs.fastfetch.enable = true; - home.packages = with pkgs; [ (writeScriptBin "smallfetch" "fastfetch --config ~/.config/fastfetch/small.jsonc") ]; + home = { + shellAliases.ff = "clear && fastfetch"; + packages = with pkgs; [ (writeScriptBin "smallfetch" "fastfetch --config ~/.config/fastfetch/small.jsonc") ]; + }; xdg.configFile."fastfetch".source = ./configs; } diff --git a/modules/home/programs/terminal/nh/default.nix b/modules/home/programs/terminal/nh/default.nix index 52aa9908..387f8bd8 100644 --- a/modules/home/programs/terminal/nh/default.nix +++ b/modules/home/programs/terminal/nh/default.nix @@ -4,4 +4,9 @@ enable = true; flake = "${config.home.homeDirectory}/Projects/nixos-config"; }; + + home.shellAliases = { + nhs = "nh os switch"; + nht = "nh os test"; + }; } diff --git a/modules/home/settings/aliases/default.nix b/modules/home/settings/aliases/default.nix index ff62e202..ea6336c7 100644 --- a/modules/home/settings/aliases/default.nix +++ b/modules/home/settings/aliases/default.nix @@ -2,12 +2,10 @@ { home.shellAliases = { # NixOS - nhs = "nh os switch"; nixclean = "nix store gc; nix store optimise"; nixpurge = "sudo nix-collect-garbage --delete-old"; # Shortcuts - ff = "clear && fastfetch"; myip = "curl ifconfig.co"; seneca = "ssh jhampton1@matrix.senecapolytechnic.ca"; }; diff --git a/modules/home/settings/fonts/packages/default.nix b/modules/home/settings/fonts/packages/default.nix index d7cae882..9107f0b5 100644 --- a/modules/home/settings/fonts/packages/default.nix +++ b/modules/home/settings/fonts/packages/default.nix @@ -2,10 +2,10 @@ { home.packages = lib.mkIf config.home.desktop.enable (with pkgsStable; [ liberation_ttf - twitter-color-emoji noto-fonts sarasa-gothic - ubuntu_font_family + twitter-color-emoji + ubuntu-classic (nerdfonts.override { fonts = [ "UbuntuMono" ]; }) ]); } diff --git a/modules/home/wms/programs/rofi/scripts/default.nix b/modules/home/wms/programs/rofi/scripts/default.nix index 95efb373..cfc82d5b 100644 --- a/modules/home/wms/programs/rofi/scripts/default.nix +++ b/modules/home/wms/programs/rofi/scripts/default.nix @@ -2,18 +2,26 @@ { home.packages = with pkgs; lib.mkIf config.programs.rofi.enable [ (writeScriptBin "rofiscratch" '' + #!/bin/sh + SCRATCHPADS=$(echo -e "Btop\nMusic\nSound\nEasyEffects" | rofi -dmenu -i -p "Scratchpads") + case $SCRATCHPADS in Btop) foot -a btop -T Btop btop;; Music) foot -a music -T Music ncmpcpp;; Sound) foot -a sound -T Sound pulsemixer;; esac '') + (writeScriptBin "rofipower" '' + #!/bin/sh + POWER=$(echo -e "Shutdown\nReboot\nLock\nSleep\nKill" | rofi -dmenu -i -p "Power") + case $POWER in Shutdown) poweroff;; Reboot) reboot;; + Lock) swaylock;; Sleep) systemctl suspend;; Kill) pkill -9 $XDG_CURRENT_DESKTOP;; esac diff --git a/modules/home/wms/programs/waybar/default.nix b/modules/home/wms/programs/waybar/default.nix index da9d4eff..05db4928 100644 --- a/modules/home/wms/programs/waybar/default.nix +++ b/modules/home/wms/programs/waybar/default.nix @@ -21,7 +21,7 @@ }; }; - pulseModule = { + pulseModule = with pkgs; { format = "{icon} {volume}%"; format-bluetooth = "{icon} {volume}%"; format-muted = " muted"; @@ -33,9 +33,9 @@ " " ]; }; - on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; - on-click-middle = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%"; - on-click-right = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 60%"; + on-click = "${wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + on-click-middle = "${wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%"; + on-click-right = "${wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 60%"; ignored-sinks = [ "Easy Effects Sink" ]; }; @@ -52,32 +52,42 @@ }; vramModule = { - exec = pkgs.writeScript "vramScript" '' - # Don't run the script if running on integrated graphics - gpu_driver=$(${pkgs.pciutils}/bin/lspci -k | grep -Eo "in use: (nvidia|amdgpu)" | awk '{print $3}') + exec = with pkgs; pkgs.writeScript "vramScript.sh" '' + #!/bin/sh - if [ -n "$gpu_driver" ]; then - if [ "$gpu_driver" == "nvidia" ]; then - vram_usage_mb=$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits) - temperature=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits) + LSPCI="${pciutils}/bin/lspci" + GREP="${gnugrep}/bin/grep" + AWK="${gawk}/bin/awk" + BC="${bc}/bin/bc" + HEAD="${uutils-coreutils-noprefix}/bin/head" + CAT="${uutils-coreutils-noprefix}/bin/cat" - elif [ "$gpu_driver" == "amdgpu" ]; then - vram_usage_mb=$(echo "$(cat /sys/class/drm/card0/device/mem_info_vram_used || cat /sys/class/drm/card1/device/mem_info_vram_used) / 1024 / 1024" | bc) - temperature=$(${pkgs.lm_sensors}/bin/sensors | grep 'edge' | awk '{print $2}' | sed 's/[^0-9.-]//g') - fi - - # Check if VRAM usage is under 1GB - if [ $vram_usage_mb -lt 1024 ]; then - vram_usage_display="$(echo $vram_usage_mb)M" - else - # Convert MB to GiB - vram_usage_gib=$(bc <<< "scale=2; $vram_usage_mb / 1024") - vram_usage_display="$(echo $vram_usage_gib)G" - fi - - # Print the VRAM usage and temperature - echo "{\"text\":\"󰢮 $(echo $vram_usage_display)\",\"tooltip\":\"$(echo $temperature)°C\"}" + # Detect the active GPU driver + gpu_driver="$($LSPCI -k | $GREP -Eo 'in use: (nvidia|amdgpu)' | $AWK '{print $3}')" + + # Exit if no supported GPU driver is in use + if [[ -z "$gpu_driver" ]]; then + exit 0 fi + + # Get VRAM usage in MB + if [[ "$gpu_driver" == "nvidia" ]]; then + vram_usage_mb="$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits | $HEAD -n1)" + elif [[ "$gpu_driver" == "amdgpu" ]]; then + vram_bytes="$($CAT /sys/class/drm/card*/device/mem_info_vram_used 2>/dev/null | $HEAD -n1)" + vram_usage_mb="$($BC <<< "$vram_bytes / 1024 / 1024")" + fi + + # Format VRAM usage for display + if [[ "$vram_usage_mb" -lt 1024 ]]; then + vram_usage_display="''${vram_usage_mb}M" + else + vram_usage_gib="$($BC <<< "scale=2; $vram_usage_mb / 1024")" + vram_usage_display="''${vram_usage_gib}G" + fi + + # Output the VRAM usage + echo "{\"text\": \"󰢮 ''${vram_usage_display}\"}" ''; format = "{}"; return-type = "json"; @@ -94,6 +104,7 @@ # Misc trayModule.spacing = 5; + # Wireless networkModule = { format-ethernet = "󰈀"; format-wifi = ""; @@ -144,21 +155,28 @@ icon-size = 15; }; - mpdModule = { + mprisModule = { + player = "mpd"; format = " {title}"; format-paused = " {artist}"; format-stopped = ""; - format-disconnected = ""; - tooltip-format = "{artist} - {title}"; + tooltip-format = lib.concatStrings [ + "{title} - {artist} - {album}\n" + "{position}/{length}" + ]; interval = 2; max-length = 30; - on-click = "playerctl -p mpd play-pause"; }; - notificationModule = { - exec = pkgs.writeScript "notificationScript" '' + notificationModule = with pkgs; { + exec = pkgs.writeScript "notificationScript.sh" '' + #!/bin/sh + + SED="${gnused}/bin/sed" + MAKOCTL="${mako}/bin/makoctl" + # Extract the second line after "default" - mode=$(echo "$(makoctl mode)" | sed -n '/default/{n;p}') + mode=$(echo "$($MAKOCTL mode)" | $SED -n '/default/{n;p}') # Print the notification status with the tooltip if [[ "$mode" == "do-not-disturb" ]]; then @@ -170,7 +188,17 @@ format = "{}"; return-type = "json"; interval = 2; - on-click = "makotoggle"; + on-click = "${mako}/bin/makoctl mode -t do-not-disturb"; + }; + + idleModule = { + format = "{icon}"; + format-icons = { + activated = " On"; + deactivated = "󰾫 Off"; + tooltip-format-activated = "Sleep inhibited."; + tooltip-format-deactivated = "Sleep uninhibited."; + }; }; weatherModule = { @@ -208,6 +236,7 @@ }; in { enable = config.home.desktop.enable; + systemd.enable = true; settings = { displayPrimary = { name = "bar1"; @@ -225,9 +254,10 @@ ]; modules-right = [ "pulseaudio" - "mpd" + "mpris" "custom/notifs" - "custom/weather2" + "idle_inhibitor" + "custom/weather" "cpu" "memory" "custom/vram" @@ -244,9 +274,10 @@ "sway/workspaces" = workspaceModule; "sway/window" = windowModule; "pulseaudio" = pulseModule; - "mpd" = mpdModule; + "mpris" = mprisModule; "custom/notifs" = notificationModule; - "custom/weather2" = weatherModule; + "idle_inhibitor" = idleModule; + "custom/weather" = weatherModule; "cpu" = cpuModule; "memory" = ramModule; "custom/vram" = vramModule; @@ -283,8 +314,6 @@ "sway/workspaces" = workspaceModule; "sway/window" = windowModule; "pulseaudio" = pulseModule; - "mpd" = mpdModule; - "custom/notifs" = notificationModule; "cpu" = cpuModule; "memory" = ramModule; "custom/vram" = vramModule; @@ -297,7 +326,7 @@ border: 0; border-radius: 0; min-height: 0; - font-family: ${config.look.fonts.main}, ${config.look.fonts.mono}; + font-family: ${config.look.fonts.main}, ${config.look.fonts.mono}; font-size: 15.5px; color: #${config.look.colors.text}; } @@ -313,9 +342,6 @@ #network { padding: 0 10px 0 4px; } - #network.disconnected,#bluetooth.off { - color: #424242; - } #bluetooth { margin: 0 6px 0 4px; font-size: 13.4px; @@ -337,17 +363,34 @@ box-shadow: none; background: #${config.look.colors.light}; } - #scratchpad { + #scratchpad, #privacy { margin-left: 4px; } - #privacy { - margin-left: 4px; - } - #cpu, #memory, #custom-vram, #mpd, #backlight, #battery, #custom-weather, #custom-weather2, #custom-notifs { + #mpris, #custom-notifs, #idle_inhibitor, #custom-weather, #cpu, #memory, #custom-vram, #backlight, #battery { margin: 0 5px 0 2px; } - #clock { - margin: 0 2px 0 2px; + #pulseaudio { + margin-right: 5px; + } + + #mpris.paused, #custom-notifs.disabled, #idle_inhibitor.deactivated { + color: #888; + } + #pulseaudio.muted, #network.disconnected, #bluetooth.off { + color: #424242; + } + + #mpris { + border-bottom: 3px solid #ffb066; + } + #custom-notifs { + border-bottom: 3px solid #3823C4; + } + #idle_inhibitor { + border-bottom: 3px solid #941efc; + } + #custom-weather { + border-bottom: 3px solid #c75bd3; } #cpu { border-bottom: 3px solid #f90000; @@ -358,38 +401,15 @@ #custom-vram { border-bottom: 3px solid #33FF00; } - #mpd { - border-bottom: 3px solid #ffb066; - } - #mpd.paused { - color: #888; - } - #clock { - border-bottom: 3px solid #0a6cf5; - } #backlight { border-bottom: 3px solid #5ffca3; } #battery { border-bottom: 3px solid #fcfc16; } - #custom-weather { - border-bottom: 3px solid #3823C4; - } - #custom-weather2 { - border-bottom: 3px solid #c75bd3; - } - #custom-notifs { - border-bottom: 3px solid #3823C4; - } - #custom-notifs.disabled { - color: #888; - } - #pulseaudio { - margin-right: 5px; - } - #pulseaudio.muted { - color: #424242; + #clock { + border-bottom: 3px solid #0a6cf5; + margin: 0 2px 0 2px; } ''; }; diff --git a/modules/home/wms/sway/autostart/default.nix b/modules/home/wms/sway/autostart/default.nix index ddb9303e..f0570187 100644 --- a/modules/home/wms/sway/autostart/default.nix +++ b/modules/home/wms/sway/autostart/default.nix @@ -1,24 +1,17 @@ { ... }: { - wayland.windowManager.sway.config = { - bars = [{ command = "waybar"; }]; + wayland.windowManager.sway.config.startup = [ + # Scratchpads + { command = "foot -a btop -T Gotop btop"; } + { command = "foot -a music -T Music ncmpcpp"; } + { command = "foot -a sound -T Sound pulsemixer"; } - startup = [ - # Scratchpads - { command = "foot -a btop -T Gotop btop"; } - { command = "foot -a music -T Music ncmpcpp"; } - { command = "foot -a sound -T Sound pulsemixer"; } + # Daemons and tray + { command = "kanshictl reload"; always = true; } + { command = "wayland-pipewire-idle-inhibit"; } - # Daemons and tray - { - command = "kanshictl reload"; - always = true; - } - { command = "wayland-pipewire-idle-inhibit"; } - - # Foreground - { command = "thunderbird"; } - { command = "vesktop"; } - ]; - }; + # Foreground + { command = "thunderbird"; } + { command = "vesktop"; } + ]; } diff --git a/modules/home/wms/sway/outputs/default.nix b/modules/home/wms/sway/outputs/default.nix index a287851f..eddb7965 100644 --- a/modules/home/wms/sway/outputs/default.nix +++ b/modules/home/wms/sway/outputs/default.nix @@ -38,11 +38,11 @@ (assign "${config.displays.tower1}" workspaces1) ++ (assign "${config.displays.tower2}" workspaces2) ++ (assign "${config.displays.tower3}" workspaces3) ++ - (assign "${config.displays.tower3}" workspaces4) ++ + (assign "${config.displays.tower4}" workspaces4) ++ (assign "${config.displays.estradiol1}" workspaces1) ++ (assign "${config.displays.estradiol1}" workspaces2) ++ - (assign "${config.displays.estradiol1}" workspaces4) ++ - (assign "${config.displays.estradiol2}" workspaces3); + (assign "${config.displays.estradiol2}" workspaces3) ++ + (assign "${config.displays.estradiol2}" workspaces4); }; } diff --git a/modules/home/wms/sway/theme/default.nix b/modules/home/wms/sway/theme/default.nix index a5eb5980..f50c87dc 100644 --- a/modules/home/wms/sway/theme/default.nix +++ b/modules/home/wms/sway/theme/default.nix @@ -32,6 +32,8 @@ }; }; + bars = [ ]; + fonts = { names = [ config.look.fonts.main ]; size = 10.5;