From 72ea5ade11381d853e94ecbc66471295e0bbd246 Mon Sep 17 00:00:00 2001 From: alsaiduq-lab Date: Thu, 25 Sep 2025 17:52:36 -0600 Subject: [PATCH] refactored --- flake.lock | 49 ++++++- flake.nix | 7 + hosts/hardware-configuration.nix | 42 +----- hosts/modules/env.nix | 10 +- hosts/modules/gtk.nix | 52 +++++++ hosts/modules/i3-xfce.nix | 229 ------------------------------- hosts/modules/i3.nix | 69 ++++++++++ hosts/modules/settings.nix | 25 ++++ hosts/system-packages.nix | 4 +- 9 files changed, 208 insertions(+), 279 deletions(-) mode change 100644 => 120000 hosts/hardware-configuration.nix create mode 100644 hosts/modules/gtk.nix delete mode 100644 hosts/modules/i3-xfce.nix create mode 100644 hosts/modules/i3.nix create mode 100644 hosts/modules/settings.nix diff --git a/flake.lock b/flake.lock index f9ca476..4676669 100644 --- a/flake.lock +++ b/flake.lock @@ -61,11 +61,11 @@ "zon2nix": "zon2nix" }, "locked": { - "lastModified": 1758616426, - "narHash": "sha256-pPzbbpuh44gGHtA/diB5pv8w8qe9w6+TZLWm1qPUjwk=", + "lastModified": 1758653744, + "narHash": "sha256-y0B40QQ//4fpTAUfhZjoDEiUejhb2hXl5LcpNenRpYM=", "owner": "ghostty-org", "repo": "ghostty", - "rev": "3eb646ea6baf5eb45bbd39cd7ad624cda0264554", + "rev": "f97518cc100599186846282457be520fda11f467", "type": "github" }, "original": { @@ -95,6 +95,24 @@ "type": "github" } }, + "hu-tao-cursor": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1758727127, + "narHash": "sha256-FdeiMlPVyu6tANl/EQatvVOEyX8d6rNMD31Emiaz8UQ=", + "ref": "refs/heads/master", + "rev": "d8d1da400e3835dfc211bfa67fb359e06bfff130", + "revCount": 4, + "type": "git", + "url": "ssh://git@github.com/alsaiduq-lab/Hu-Tao-Animated-Cursor" + }, + "original": { + "type": "git", + "url": "ssh://git@github.com/alsaiduq-lab/Hu-Tao-Animated-Cursor" + } + }, "i3-dotfiles": { "flake": false, "locked": { @@ -119,11 +137,11 @@ ] }, "locked": { - "lastModified": 1758420014, - "narHash": "sha256-a7IGWXPRppgXMRpBosBl2Afr5DICt21ogeZL45uVkX0=", + "lastModified": 1758678659, + "narHash": "sha256-Ff5IFCEABf3CStKvf8MqJe7jwrHk2J8swdYTrwOj9dk=", "owner": "fufexan", "repo": "nix-gaming", - "rev": "cd931e08409954b2e3595b1532039f8052dd8198", + "rev": "6418c314274a8ce27078402ab1fbac7c06da7a36", "type": "github" }, "original": { @@ -189,13 +207,30 @@ "type": "github" } }, + "nixpkgs_4": { + "locked": { + "lastModified": 1758589230, + "narHash": "sha256-zMTCFGe8aVGTEr2RqUi/QzC1nOIQ0N1HRsbqB4f646k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d1d883129b193f0b495d75c148c2c3a7d95789a0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "ghostty": "ghostty", "home-manager": "home-manager", + "hu-tao-cursor": "hu-tao-cursor", "i3-dotfiles": "i3-dotfiles", "nix-gaming": "nix-gaming", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "unstable": "unstable" } }, diff --git a/flake.nix b/flake.nix index c45e63f..13a99c2 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,9 @@ url = "git+ssh://git@github.com/alsaiduq-lab/i3-dotfiles"; flake = false; }; + hu-tao-cursor = { + url = "git+ssh://git@github.com/alsaiduq-lab/Hu-Tao-Animated-Cursor"; + }; }; outputs = { @@ -33,6 +36,7 @@ nix-gaming, unstable, ghostty, + hu-tao-cursor, ... } @ inputs: let system = "x86_64-linux"; @@ -85,6 +89,9 @@ binary-font = prev.binary-font.binary-clock-font; }) (final: prev: {ghostty = inputs.ghostty.packages.${system}.default;}) + (final: prev: { + hu-tao-animated-cursor = inputs.hu-tao-cursor.packages.${system}.default; + }) ]; }; } diff --git a/hosts/hardware-configuration.nix b/hosts/hardware-configuration.nix deleted file mode 100644 index 36e368b..0000000 --- a/hosts/hardware-configuration.nix +++ /dev/null @@ -1,41 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "uas" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/042fab51-5d9c-454f-bd8f-315af4060a7d"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/5830-C7C5"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/68153c66-e234-49a8-9ec3-7e9af73efd1c"; } - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp6s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/hardware-configuration.nix b/hosts/hardware-configuration.nix new file mode 120000 index 0000000..4dde6be --- /dev/null +++ b/hosts/hardware-configuration.nix @@ -0,0 +1 @@ +/etc/nixos/hardware-configuration.nix \ No newline at end of file diff --git a/hosts/modules/env.nix b/hosts/modules/env.nix index 4c3a8d6..e651cda 100644 --- a/hosts/modules/env.nix +++ b/hosts/modules/env.nix @@ -1,8 +1,11 @@ { pkgs, lib, + config, ... -}: { +}: let + t = config.theme; +in { environment.shellInit = '' if [ -d "$HOME/.cargo/bin" ]; then export PATH="$PATH:$HOME/.cargo/bin" @@ -13,6 +16,9 @@ EDITOR = "nvim"; VISUAL = "nvim"; TERM = "ghostty"; + BROWSER = "thorium"; + XCURSOR_THEME = t.cursorName; + XCURSOR_SIZE = toString t.cursorSize; CC = "${pkgs.gcc}/bin/gcc"; LUA_PATH = "${pkgs.luajit}/share/lua/5.1/?.lua;${pkgs.luajit}/share/lua/5.1/?/init.lua;;"; LUA_CPATH = "${pkgs.luajit}/lib/lua/5.1/?.so;;"; @@ -54,6 +60,8 @@ environment.pathsToLink = [ "/share/fish" "/bin" + "/share/icons" + "/share/pixmaps" ]; programs.direnv = { diff --git a/hosts/modules/gtk.nix b/hosts/modules/gtk.nix new file mode 100644 index 0000000..7a627c0 --- /dev/null +++ b/hosts/modules/gtk.nix @@ -0,0 +1,52 @@ +{ + config, + pkgs, + ... +}: let + t = config.theme; + cursorName = t.cursorName; + cursorSize = toString t.cursorSize; + gtkTheme = t.gtkTheme; + iconTheme = t.iconTheme; + fontName = t.fontName; +in { + environment.etc = { + "gtk-2.0/gtkrc".text = '' + gtk-theme-name=${gtkTheme} + gtk-icon-theme-name=${iconTheme} + gtk-font-name=${fontName} + gtk-cursor-theme-name=${cursorName} + gtk-cursor-theme-size=${cursorSize} + ''; + "gtk-3.0/settings.ini".text = '' + [Settings] + gtk-application-prefer-dark-theme=1 + gtk-theme-name=${gtkTheme} + gtk-icon-theme-name=${iconTheme} + gtk-font-name=${fontName} + gtk-cursor-theme-name=${cursorName} + gtk-cursor-theme-size=${cursorSize} + ''; + "gtk-4.0/settings.ini".text = '' + [Settings] + gtk-application-prefer-dark-theme=1 + gtk-theme-name=${gtkTheme} + gtk-icon-theme-name=${iconTheme} + gtk-font-name=${fontName} + gtk-cursor-theme-name=${cursorName} + gtk-cursor-theme-size=${cursorSize} + ''; + }; + + programs.dconf.enable = true; + programs.dconf.profiles.user.databases = [ + { + settings."org/gnome/desktop/interface" = { + gtk-theme = gtkTheme; + icon-theme = iconTheme; + cursor-theme = cursorName; + font-name = fontName; + }; + } + ]; +} diff --git a/hosts/modules/i3-xfce.nix b/hosts/modules/i3-xfce.nix deleted file mode 100644 index c8ae0e4..0000000 --- a/hosts/modules/i3-xfce.nix +++ /dev/null @@ -1,229 +0,0 @@ -{ - pkgs, - i3dotfiles, - ... -}: let - wallpaperDir = "/home/cobray/wallpapers"; - - randomWallpaper = pkgs.writeShellScript "wallpaper.sh" '' - #!${pkgs.runtimeShell} - set -e - BG_DIR="/var/lib/lightdm-background" - BG_LINK="''$BG_DIR/random-wallpaper.png" - LAST_WALLPAPER="''$BG_DIR/.last-wallpaper" - WALLPAPER_DIR="${wallpaperDir}" - - mkdir -p "''$BG_DIR" - 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 - 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]} - cp -f "''$SELECT" "''$BG_LINK" - echo "''$SELECT" > "''$LAST_WALLPAPER" - chown lightdm:lightdm "''$BG_LINK" "''$LAST_WALLPAPER" - ''; -in { - services.xserver.enable = true; - services.xserver.xkb = { - layout = "us"; - variant = ""; - }; - - services.xserver.windowManager.i3 = { - enable = true; - package = pkgs.i3-gaps; - 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" - ${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface cursor-theme "capitaine-cursors" - cat > $HOME/.config/xsettingsd << EOF - Net/ThemeName "Tokyonight-Dark" - Net/IconThemeName "candy-icons" - Gtk/CursorThemeName "capitaine-cursors" - EOF - killall xsettingsd || true - ${pkgs.xsettingsd}/bin/xsettingsd & - ''; - }; - - services.xserver.desktopManager.xfce = { - enable = true; - noDesktop = true; - enableXfwm = false; - }; - - services.xserver.displayManager.lightdm = { - enable = true; - background = "/var/lib/lightdm-background/random-wallpaper.png"; - greeters.gtk = { - enable = true; - theme = { - package = pkgs.tokyonight-gtk-theme; - name = "Tokyonight-Dark"; - }; - iconTheme = { - package = pkgs.candy-icons; - name = "candy-icons"; - }; - cursorTheme = { - package = pkgs.capitaine-cursors; - name = "capitaine-cursors"; - }; - extraConfig = '' - [greeter] - greeting = Welcome back, Traveller - font-name=Clear Sans 10 - cursor-theme-name=capitaine-cursors - icon-theme-name=candy-icons - ''; - }; - }; - - systemd.tmpfiles.rules = [ - "d /var/lib/lightdm-background 0755 lightdm lightdm - -" - "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"]; - timerConfig = { - OnCalendar = "daily"; - Persistent = true; - }; - }; - - services.displayManager.defaultSession = "xfce+i3"; - services.displayManager.autoLogin = { - enable = true; - user = "cobray"; - }; - - qt = { - enable = true; - platformTheme = "qt5ct"; - }; - - environment.etc = { - "xdg/i3/config" = { - source = "${i3dotfiles}/i3/config"; - mode = "0644"; - }; - "gtk-2.0/gtkrc".text = '' - gtk-theme-name="Tokyonight-Dark" - gtk-icon-theme-name="candy-icons" - gtk-font-name="Clear Sans 10" - gtk-cursor-theme-name="capitaine-cursors" - gtk-cursor-theme-size=24 - ''; - "gtk-3.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-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-cursor-theme-size=24 - ''; - }; - - environment.systemPackages = with pkgs; [ - dmenu - i3status - i3lock-color - i3blocks - picom - feh - rofi - dunst - polybar - i3-auto-layout - mpv - yt-dlp - flameshot - imagemagick - slop - ghostscript - via - arandr - xclip - xsettingsd - lxappearance - gsettings-desktop-schemas - adwaita-qt - candy-icons - capitaine-cursors - tokyonight-gtk-theme - hicolor-icon-theme - adwaita-icon-theme - kdePackages.breeze-icons - gnome-themes-extra - findutils - coreutils - ]; - - environment.pathsToLink = [ - "/share/icons" - "/share/pixmaps" - ]; - - services.xserver.desktopManager.session = [ - { - 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 - ''; - } - ]; - - programs.dconf.enable = true; - programs.dconf.profiles.user.databases = [ - { - settings = { - "org/gnome/desktop/interface" = { - icon-theme = "candy-icons"; - gtk-theme = "Tokyonight-Dark"; - cursor-theme = "capitaine-cursors"; - }; - }; - } - ]; -} diff --git a/hosts/modules/i3.nix b/hosts/modules/i3.nix new file mode 100644 index 0000000..d550fde --- /dev/null +++ b/hosts/modules/i3.nix @@ -0,0 +1,69 @@ +{pkgs, ...}: { + services.xserver = { + enable = true; + xkb = { + layout = "us"; + variant = ""; + }; + + windowManager.i3 = { + enable = true; + package = pkgs.i3-gaps; + extraSessionCommands = '' + if [ -f /var/lib/lightdm-background/.last-wallpaper ]; then + ${pkgs.feh}/bin/feh --bg-fill "$(cat /var/lib/lightdm-background/.last-wallpaper)" + fi + ''; + }; + + # this is actually here because i get peeved personally when I see a none in "none+i3" + desktopManager.xfce = { + enable = true; + noDesktop = true; + enableXfwm = false; + }; + + desktopManager.session = [ + { + 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 + ''; + } + ]; + }; + + environment.systemPackages = with pkgs; [ + dmenu + i3status + i3lock-color + i3blocks + picom + feh + i3-auto-layout + yt-dlp + flameshot + imagemagick + slop + ghostscript + via + arandr + xsettingsd + lxappearance + gsettings-desktop-schemas + adwaita-qt + candy-icons + tokyonight-gtk-theme + hicolor-icon-theme + adwaita-icon-theme + gnome-themes-extra + findutils + coreutils + hu-tao-animated-cursor + ]; +} diff --git a/hosts/modules/settings.nix b/hosts/modules/settings.nix new file mode 100644 index 0000000..c864434 --- /dev/null +++ b/hosts/modules/settings.nix @@ -0,0 +1,25 @@ +{lib, ...}: +with lib; { + options.theme = { + cursorName = mkOption { + type = types.str; + default = "Hu-Tao-Animated-Cursor"; + }; + cursorSize = mkOption { + type = types.int; + default = 24; + }; + gtkTheme = mkOption { + type = types.str; + default = "Tokyonight-Dark"; + }; + iconTheme = mkOption { + type = types.str; + default = "candy-icons"; + }; + fontName = mkOption { + type = types.str; + default = "Clear Sans 10"; + }; + }; +} diff --git a/hosts/system-packages.nix b/hosts/system-packages.nix index d2a10b4..57de6f0 100644 --- a/hosts/system-packages.nix +++ b/hosts/system-packages.nix @@ -1,6 +1,9 @@ {pkgs, ...}: { imports = [ ./cachix.nix + ./modules/settings.nix + ./modules/i3.nix + ./modules/gtk.nix ./modules/audio.nix ./modules/bluetooth.nix ./modules/boot.nix @@ -18,7 +21,6 @@ ./modules/tailscale.nix ./modules/ld.nix ./modules/x11.nix - ./modules/i3-xfce.nix ./modules/ollama.nix ./modules/cups.nix ./modules/rust.nix