From 05fa2b59f2ac01784f01895acde75aea0a41c5e1 Mon Sep 17 00:00:00 2001 From: alsaiduq-lab Date: Thu, 29 May 2025 20:01:47 -0600 Subject: [PATCH] Squash merge redo into master --- flake.lock | 24 +++--- home-manager/cobray.nix | 1 + home-manager/modules/dunst.nix | 146 +++++++++++++++++++++++++++++++- home-manager/modules/ffmpeg.nix | 26 +++++- hosts/local-packages.nix | 3 - modules/boot.nix | 22 +++-- modules/default.nix | 1 + modules/env.nix | 2 +- modules/i3-xfce.nix | 59 ++++++++----- modules/ld.nix | 5 ++ modules/net.nix | 1 - modules/nixos.nix | 3 + modules/python.nix | 84 ++++++------------ modules/steam.nix | 3 - pkgs/rpcs3/default.nix | 2 +- 15 files changed, 268 insertions(+), 114 deletions(-) create mode 100644 modules/ld.nix diff --git a/flake.lock b/flake.lock index 34d1bde..b9dea90 100644 --- a/flake.lock +++ b/flake.lock @@ -25,11 +25,11 @@ ] }, "locked": { - "lastModified": 1747556831, - "narHash": "sha256-Qb84nbYFFk0DzFeqVoHltS2RodAYY5/HZQKE8WnBDsc=", + "lastModified": 1748487945, + "narHash": "sha256-e9zc/rHdoH9i+sFFhhQiKoF6IuD+T2rB/nUyPaO7CCg=", "owner": "nix-community", "repo": "home-manager", - "rev": "d0bbd221482c2713cccb80220f3c9d16a6e20a33", + "rev": "0d13ea58d565d3c1c1468ddae1f623316dc395d9", "type": "github" }, "original": { @@ -47,11 +47,11 @@ ] }, "locked": { - "lastModified": 1747965612, - "narHash": "sha256-koAXv7H+cZBMOZkOekO7AIan0e75/ptPqkiOkO3x9lM=", + "lastModified": 1748397391, + "narHash": "sha256-g2quQIkkDOHFMipUOBs7+D3xr490slZp9qiamOkPzO4=", "owner": "fufexan", "repo": "nix-gaming", - "rev": "10e16d55b14d6d2f86d636d546be5130c0827933", + "rev": "39bae253dc201cfe03ee53bd90ed813f89afa9cd", "type": "github" }, "original": { @@ -62,11 +62,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1747953325, - "narHash": "sha256-y2ZtlIlNTuVJUZCqzZAhIw5rrKP4DOSklev6c8PyCkQ=", + "lastModified": 1748302896, + "narHash": "sha256-ixMT0a8mM091vSswlTORZj93WQAJsRNmEvqLL+qwTFM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "55d1f923c480dadce40f5231feb472e81b0bab48", + "rev": "7848cd8c982f7740edf76ddb3b43d234cb80fc4d", "type": "github" }, "original": { @@ -102,11 +102,11 @@ "rpcs3_latest": { "flake": false, "locked": { - "lastModified": 1748103898, - "narHash": "sha256-HlLFleqkEVs2StNBw1WG9lVuH5kNaZyYFpgMVOvQCMc=", + "lastModified": 1748477272, + "narHash": "sha256-PTjLS+vIo/K+Eggib4u6LzAidTFiHNh2ALAE3bpylA4=", "owner": "RPCS3", "repo": "rpcs3", - "rev": "3e674a896f9e70ee7112c89c0a2a07f0df4d2326", + "rev": "a9df046f21d11b4e7758401bed47d2cad402c294", "type": "github" }, "original": { diff --git a/home-manager/cobray.nix b/home-manager/cobray.nix index e7049e9..f103373 100644 --- a/home-manager/cobray.nix +++ b/home-manager/cobray.nix @@ -35,5 +35,6 @@ btop nvtopPackages.full arandr + inputs.nix-gaming.packages.${pkgs.system}.wine-discord-ipc-bridge ]; } diff --git a/home-manager/modules/dunst.nix b/home-manager/modules/dunst.nix index 765bad9..5ef762c 100644 --- a/home-manager/modules/dunst.nix +++ b/home-manager/modules/dunst.nix @@ -1,7 +1,145 @@ -{ - pkgs, - ... -}: { +{pkgs, ...}: let + urgencyLowBackground = "#1a1b26"; + urgencyLowForeground = "#c0caf5"; + urgencyLowFrameColor = "#7aa2f7"; + urgencyNormalBackground = "#24283b"; + urgencyNormalForeground = "#c0caf5"; + urgencyNormalFrameColor = "#7aa2f7"; + urgencyCriticalBackground = "#f7768e"; + urgencyCriticalForeground = "#1a1b26"; + urgencyCriticalFrameColor = "#ff757f"; + + volumeHighlight = "#f5c2e7"; + volumeFrameColor = "#eba0ac"; + volumeBackground = "#45475a"; + volumeForeground = "#f5e0dc"; + + brightnessHighlight = "#94e2d5"; + brightnessFrameColor = "#74c7ec"; + brightnessBackground = "#313244"; + brightnessForeground = "#a6e3a1"; + + networkHighlight = "#f9e2af"; + networkFrameColor = "#f38ba8"; + networkBackground = "#1e1e2e"; + networkForeground = "#fab387"; + + globalFrameColor = "#7aa2f7"; + globalCornerRadius = 10; + globalMargin = 8; + globalPadding = 12; + globalBorderWidth = 2; + globalFont = "0xProto Nerd Font Bold 10"; + globalIconPath = "/usr/share/icons/Candy/16x16/status/:/usr/share/icons/Candy/16x16/devices/:/usr/share/icons/Candy/16x16/apps/"; +in { + services.dunst = { + enable = true; + settings = { + global = { + monitor = 0; + follow = "mouse"; + width = "(300, 400)"; + height = 300; + origin = "top-right"; + offset = "15x50"; + scale = 0; + notification_limit = 0; + + progress_bar = true; + progress_bar_height = 10; + progress_bar_frame_width = 1; + progress_bar_min_width = 150; + progress_bar_max_width = 300; + + transparency = 5; + padding = globalPadding; + horizontal_padding = globalPadding; + text_icon_padding = 12; + frame_width = globalBorderWidth; + frame_color = globalFrameColor; + separator_color = "frame"; + separator_height = 2; + corner_radius = globalCornerRadius; + gap_size = globalMargin; + line_height = 0; + + font = globalFont; + markup = "full"; + format = "%s\n%b"; + alignment = "left"; + vertical_alignment = "center"; + show_age_threshold = 60; + ellipsize = "middle"; + ignore_newline = "no"; + stack_duplicates = true; + hide_duplicate_count = false; + show_indicators = true; + + enable_recursive_icon_lookup = true; + icon_position = "left"; + min_icon_size = 32; + max_icon_size = 128; + icon_path = globalIconPath; + + sticky_history = "yes"; + history_length = 20; + + mouse_left_click = "do_action, close_current"; + mouse_middle_click = "close_all"; + mouse_right_click = "close_current"; + }; + + urgency_low = { + background = urgencyLowBackground; + foreground = urgencyLowForeground; + frame_color = urgencyLowFrameColor; + timeout = 5; + }; + + urgency_normal = { + background = urgencyNormalBackground; + foreground = urgencyNormalForeground; + frame_color = urgencyNormalFrameColor; + timeout = 5; + }; + + urgency_critical = { + background = urgencyCriticalBackground; + foreground = urgencyCriticalForeground; + frame_color = urgencyCriticalFrameColor; + timeout = 0; + }; + + volume = { + appname = "Volume"; + summary = "*"; + format = "%s\n%b"; + highlight = volumeHighlight; + frame_color = volumeFrameColor; + background = volumeBackground; + foreground = volumeForeground; + }; + brightness = { + appname = "Brightness"; + summary = "*"; + format = "%s\n%b"; + highlight = brightnessHighlight; + frame_color = brightnessFrameColor; + background = brightnessBackground; + foreground = brightnessForeground; + }; + network = { + appname = "Network"; + summary = "*"; + format = "%s\n%b"; + highlight = networkHighlight; + frame_color = networkFrameColor; + background = networkBackground; + foreground = networkForeground; + }; + }; + }; + home.packages = with pkgs; [ dunst ]; diff --git a/home-manager/modules/ffmpeg.nix b/home-manager/modules/ffmpeg.nix index 7e99a26..fcaf9c5 100644 --- a/home-manager/modules/ffmpeg.nix +++ b/home-manager/modules/ffmpeg.nix @@ -1,5 +1,25 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - ffmpeg_7-full +{pkgs, ...}: let + x11ffmpeg = pkgs.ffmpeg-full.overrideAttrs (old: { + buildInputs = + (old.buildInputs or []) + ++ [ + pkgs.xorg.libxcb + pkgs.xorg.libX11 + pkgs.xorg.xcbutil + pkgs.xorg.xcbutilimage + pkgs.xorg.xcbutilkeysyms + pkgs.xorg.xcbutilwm + ]; + configureFlags = + (old.configureFlags or []) + ++ [ + "--enable-libxcb" + "--enable-libxcb-shm" + "--enable-libxcb-xfixes" + ]; + }); +in { + home.packages = [ + x11ffmpeg ]; } diff --git a/hosts/local-packages.nix b/hosts/local-packages.nix index 6b32c76..99d35bf 100644 --- a/hosts/local-packages.nix +++ b/hosts/local-packages.nix @@ -1,8 +1,5 @@ # TODO: cleanout and repopulate individual packages better {pkgs, ...}: { - python.enable = true; - npm.enable = true; - environment.systemPackages = with pkgs; [ brave # TODO: make a module to save browser stuff vesktop diff --git a/modules/boot.nix b/modules/boot.nix index 9059bea..2807ad0 100644 --- a/modules/boot.nix +++ b/modules/boot.nix @@ -1,11 +1,19 @@ {pkgs, ...}: { - # Bootloader - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.systemd-boot.memtest86.enable = true; - boot.loader.systemd-boot.configurationLimit = 5; - boot.loader.timeout = 5; - # Create the traditional /bin directory with a symlink to bash for scripts + boot = { + loader = { + systemd-boot = { + enable = true; + configurationLimit = 5; + }; + efi.canTouchEfiVariables = true; + timeout = 5; + }; + tmp = { + cleanOnBoot = true; + }; + kernelPackages = pkgs.linuxPackages_xanmod_latest; + }; + system.activationScripts.binbash = { deps = []; text = '' diff --git a/modules/default.nix b/modules/default.nix index 52f38a6..225a19f 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -17,6 +17,7 @@ ./npm.nix ./tailscale.nix ./udiskie.nix + ./ld.nix ]; services.ollama = { diff --git a/modules/env.nix b/modules/env.nix index ba50b91..2919ff7 100644 --- a/modules/env.nix +++ b/modules/env.nix @@ -34,7 +34,7 @@ ]; LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.libglvnd - pkgs.mesa.drivers + pkgs.mesa pkgs.gcc-unwrapped.lib pkgs.linuxPackages.nvidia_x11 pkgs.cudatoolkit diff --git a/modules/i3-xfce.nix b/modules/i3-xfce.nix index 0c6b9c1..0a58d77 100644 --- a/modules/i3-xfce.nix +++ b/modules/i3-xfce.nix @@ -1,22 +1,29 @@ {pkgs, ...}: let - wallpapers = [ - "${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/backgrounds/nixos/nixos-wallpaper.png" - "${pkgs.nixos-artwork.wallpapers.gnome-dark}/share/backgrounds/gnome/gnome-dark.png" - "${pkgs.nixos-artwork.wallpapers.nineish-dark-gray}/share/backgrounds/nixos/nixos-wallpaper.png" - ]; + wallpaperDir = "/home/cobray/wallpapers"; randomWallpaper = pkgs.writeShellScript "wallpaper.sh" '' #!${pkgs.runtimeShell} set -e BG_DIR="/var/lib/lightdm-background" - BG_LINK="$BG_DIR/current-wallpaper.png" + BG_LINK="$BG_DIR/random-wallpaper.png" + LAST_WALLPAPER="$BG_DIR/.last-wallpaper" + WALLPAPER_DIR="${wallpaperDir}" + mkdir -p "$BG_DIR" - WALLPAPERS=( ${builtins.concatStringsSep " " (map (w: "\"${w}\"") wallpapers)} ) + rm -f "$BG_LINK" + mapfile -t WALLPAPERS < <(${pkgs.findutils}/bin/find "$WALLPAPER_DIR" -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \)) COUNT=''${#WALLPAPERS[@]} - if [[ "$COUNT" -eq 0 ]]; then exit 1; fi - RAND=$(shuf -i 0-$(($COUNT - 1)) -n 1) + if [[ "$COUNT" -eq 0 ]]; then + cp -f "${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/backgrounds/nixos/nixos-wallpaper.png" "$BG_LINK" + echo "${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/backgrounds/nixos/nixos-wallpaper.png" > "$LAST_WALLPAPER" + chown lightdm:lightdm "$BG_LINK" "$LAST_WALLPAPER" + exit 0 + fi + RAND=$(${pkgs.coreutils}/bin/shuf -i 0-$(($COUNT - 1)) -n 1) SELECT=''${WALLPAPERS[$RAND]} - ln -sf "$SELECT" "$BG_LINK" + cp -f "$SELECT" "$BG_LINK" + echo "$SELECT" > "$LAST_WALLPAPER" + chown lightdm:lightdm "$BG_LINK" "$LAST_WALLPAPER" ''; in { services.xserver.enable = true; @@ -31,7 +38,7 @@ in { extraPackages = with pkgs; [ dmenu i3status - i3lock + i3lock-color i3blocks picom feh @@ -42,6 +49,10 @@ in { xsettingsd ]; extraSessionCommands = '' + if [ -f /var/lib/lightdm-background/.last-wallpaper ]; then + ${pkgs.feh}/bin/feh --bg-fill "$(cat /var/lib/lightdm-background/.last-wallpaper)" + fi + export GSETTINGS_SCHEMA_DIR="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas" ${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface gtk-theme "Tokyonight-Dark" ${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface icon-theme "candy-icons" @@ -64,7 +75,7 @@ in { services.xserver.displayManager.lightdm = { enable = true; - background = "/var/lib/lightdm-background/current-wallpaper.png"; + background = "/var/lib/lightdm-background/random-wallpaper.png"; greeters.gtk = { enable = true; theme = { @@ -91,17 +102,21 @@ in { systemd.tmpfiles.rules = [ "d /var/lib/lightdm-background 0755 lightdm lightdm - -" - "L+ /var/lib/lightdm-background/current-wallpaper.png - - - - ${builtins.elemAt wallpapers 0}" + "d ${wallpaperDir} 0755 cobray users - -" + "f /var/log/random-wallpaper.log 0644 root root - -" ]; systemd.services.random-wallpaper = { description = "Update wallpaper to a random image"; + before = ["display-manager.service"]; + wantedBy = ["display-manager.service"]; serviceConfig = { Type = "oneshot"; ExecStart = "${randomWallpaper}"; User = "root"; }; }; + systemd.timers.random-wallpaper = { description = "Daily wallpaper refresh for LightDM"; wantedBy = ["timers.target"]; @@ -134,18 +149,18 @@ in { [Settings] gtk-application-prefer-dark-theme=1 gtk-theme-name=Tokyonight-Dark - gtk-icon-theme-name="candy-icons" - gtk-font-name="Clear Sans 10" - gtk-cursor-theme-name="capitaine-cursors" + gtk-icon-theme-name=candy-icons + gtk-font-name=Clear Sans 10 + gtk-cursor-theme-name=capitaine-cursors gtk-cursor-theme-size=24 ''; "gtk-4.0/settings.ini".text = '' [Settings] gtk-application-prefer-dark-theme=1 gtk-theme-name=Tokyonight-Dark - gtk-icon-theme-name="candy-icons" - gtk-font-name="Clear Sans 10" - gtk-cursor-theme-name="capitaine-cursors" + gtk-icon-theme-name=candy-icons + gtk-font-name=Clear Sans 10 + gtk-cursor-theme-name=capitaine-cursors gtk-cursor-theme-size=24 ''; }; @@ -164,6 +179,9 @@ in { adwaita-icon-theme kdePackages.breeze-icons gnome-themes-extra + findutils + coreutils + feh ]; environment.pathsToLink = [ @@ -175,6 +193,9 @@ in { { name = "xfce+i3"; start = '' + if [ -f /var/lib/lightdm-background/.last-wallpaper ]; then + ${pkgs.feh}/bin/feh --bg-fill "$(cat /var/lib/lightdm-background/.last-wallpaper)" + fi export XDG_DATA_DIRS="${pkgs.tokyonight-gtk-theme}/share:${pkgs.candy-icons}/share:${pkgs.hicolor-icon-theme}/share:${pkgs.adwaita-icon-theme}/share:$XDG_DATA_DIRS" ${pkgs.xfce.xfce4-session}/bin/xfce4-session --with-ck-launch & ${pkgs.i3-gaps}/bin/i3 diff --git a/modules/ld.nix b/modules/ld.nix new file mode 100644 index 0000000..6d7f349 --- /dev/null +++ b/modules/ld.nix @@ -0,0 +1,5 @@ +{ + programs.nix-ld = { + enable = true; + }; +} diff --git a/modules/net.nix b/modules/net.nix index 90b9e80..9dee852 100644 --- a/modules/net.nix +++ b/modules/net.nix @@ -1,6 +1,5 @@ {pkgs, ...}: { environment.systemPackages = with pkgs; [ - networkmanager_dmenu networkmanagerapplet ]; diff --git a/modules/nixos.nix b/modules/nixos.nix index 3391ba1..e0bfb38 100644 --- a/modules/nixos.nix +++ b/modules/nixos.nix @@ -2,14 +2,17 @@ nixpkgs.config.allowUnfree = true; programs.nix-index.enable = true; programs.command-not-found.enable = false; + nix.settings = { auto-optimise-store = true; experimental-features = ["nix-command" "flakes"]; substituters = [ "https://cache.nixos.org" + "https://nix-gaming.cachix.org" ]; trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" ]; }; } diff --git a/modules/python.nix b/modules/python.nix index 2c2bcc6..b33a726 100644 --- a/modules/python.nix +++ b/modules/python.nix @@ -1,61 +1,25 @@ -{ - config, - pkgs, - lib, - ... -}: let - py = pkgs.python311Packages; - gccLibPath = "${pkgs.gcc-unwrapped.lib}/lib"; - nvidiaLibPath = "${pkgs.linuxPackages.nvidia_x11}/lib"; - cudaLibPath = "${pkgs.cudatoolkit}/lib"; - glvndLibPath = "${pkgs.libglvnd}/lib"; - ldLibraryPath = "${gccLibPath}:${nvidiaLibPath}:${cudaLibPath}:${glvndLibPath}"; - pythonEnv = pkgs.python311.buildEnv.override { - extraLibs = with py; [ - numpy - i3ipc - requests - ipython - six - psutil - pynvml - pyqtgraph - pyqt6 - pyyaml - pillow - jedi - libcst - wheel - jupyterlab - ]; - extraOutputsToInstall = ["out"]; - postBuild = '' - wrapProgram $out/bin/python \ - --prefix LD_LIBRARY_PATH : "${ldLibraryPath}" - ''; - }; - custom-UV = pkgs.symlinkJoin { - name = "uv"; - paths = [pkgs.uv]; - buildInputs = [pkgs.makeWrapper]; - postBuild = '' - wrapProgram $out/bin/uv \ - --prefix LD_LIBRARY_PATH : "${ldLibraryPath}" \ - --set PYTHONPATH "" - ''; - }; -in { - options.python = { - enable = lib.mkEnableOption "System Python Environment"; - }; - config = lib.mkIf config.python.enable { - environment.systemPackages = with pkgs; [ - pythonEnv - isort - custom-UV - git - stdenv.cc.cc.lib - python311 - ]; - }; +{pkgs, ...}: { + environment.systemPackages = with pkgs; [ + (python311.withPackages (ps: + with ps; [ + i3ipc + requests + ipython + six + psutil + pynvml + pyqtgraph + pyqt6 + pyyaml + pillow + jedi + libcst + wheel + jupyterlab + datasets + ])) + isort + uv + python311 + ]; } diff --git a/modules/steam.nix b/modules/steam.nix index 74a2bff..654ebf1 100644 --- a/modules/steam.nix +++ b/modules/steam.nix @@ -1,8 +1,6 @@ {pkgs, ...}: { programs.steam = { enable = true; - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; # apparently enabling this makes big picture boot up, does not work on nvidia however # gamescopeSession.enable = true; extraCompatPackages = [ @@ -28,7 +26,6 @@ piper portaudio alsa-lib - stdenv.cc.cc.lib libglvnd ]; } diff --git a/pkgs/rpcs3/default.nix b/pkgs/rpcs3/default.nix index 9da3e21..66d510d 100644 --- a/pkgs/rpcs3/default.nix +++ b/pkgs/rpcs3/default.nix @@ -37,7 +37,7 @@ src = pkgs.fetchgit { url = "https://github.com/RPCS3/rpcs3.git"; rev = rpcs3_latest.rev; - sha256 = "sha256-0TDxSNMk9L4+ouxYzWFNi3XxPAyD43Xl32hz1T4lFIc="; + sha256 = "sha256-l7ewWWbFWaziBGrWUMdmSn79tq1Sumnqvjcqr1LYfhU="; fetchSubmodules = true; }; patches = [];