From ad08a4fa5ce8658185bb11f8175b4334c2355b47 Mon Sep 17 00:00:00 2001 From: Jonas Hahn Date: Sun, 31 Aug 2025 15:00:59 +0200 Subject: [PATCH] Cleanup of code and modules. Fully modular config now. Cleanup unused and redundant packages. Fix shell alias --- hosts/minoxy-workstation/configuration.nix | 35 ++- hosts/nixyos-asus/configuration.nix | 19 +- hosts/thinix-thinkpad/configuration.nix | 15 +- modules/hardware/boot.nix | 26 ++ modules/hardware/nvidia.nix | 10 +- modules/{hardware => laptop}/battery.nix | 0 modules/laptop/powersave.nix | 9 + user/home.nix | 161 ++++++------ user/packages.nix | 281 +++++++++------------ 9 files changed, 253 insertions(+), 303 deletions(-) create mode 100644 modules/hardware/boot.nix rename modules/{hardware => laptop}/battery.nix (100%) create mode 100644 modules/laptop/powersave.nix diff --git a/hosts/minoxy-workstation/configuration.nix b/hosts/minoxy-workstation/configuration.nix index 3a753ab..a26586d 100644 --- a/hosts/minoxy-workstation/configuration.nix +++ b/hosts/minoxy-workstation/configuration.nix @@ -1,31 +1,30 @@ { ... }: { - imports = [ - ./hardware-configuration.nix + imports = [ + ./hardware-configuration.nix - ./../../user/users.nix + ./../../user/users.nix - ./../../modules/common.nix + ./../../modules/common.nix - ./../../modules/hardware/xremap.nix - ./../../modules/services/webdav.nix - ./../../modules/graphics/workstation.nix + ./../../modules/services/webdav.nix - ./../../modules/hardware/nvidia.nix - ]; + ./../../modules/graphics/workstation.nix - networking.hostName = "minoxy"; + ./../../modules/hardware/nvidia.nix + ./../../modules/hardware/boot.nix + ./../../modules/hardware/xremap.nix + ]; - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; + networking.hostName = "minoxy"; - systemd.targets.sleep.enable = true; - systemd.targets.suspend.enable = true; + systemd.targets.sleep.enable = true; + systemd.targets.suspend.enable = true; - virtualisation.docker.enable = true; - virtualisation.docker.storageDriver = "btrfs"; + virtualisation.docker.enable = true; + virtualisation.docker.storageDriver = "btrfs"; - # Never change this! - system.stateVersion = "25.05"; + # Never change this! + system.stateVersion = "25.05"; } diff --git a/hosts/nixyos-asus/configuration.nix b/hosts/nixyos-asus/configuration.nix index 85159df..2a7d4a8 100644 --- a/hosts/nixyos-asus/configuration.nix +++ b/hosts/nixyos-asus/configuration.nix @@ -9,25 +9,18 @@ ./../../modules/common.nix ./../../modules/hardware/xremap.nix - ./../../modules/hardware/battery.nix + ./../../modules/hardware/boot.nix + + ./../../modules/laptop/powersave.nix + ./../../modules/laptop/battery.nix ./../../modules/graphics/workstation.nix - ./../../modules/services/webdav.nix.nix - ./../../modules/services/scanning.nix.nix + ./../../modules/services/webdav.nix + ./../../modules/services/scanning.nix ]; networking.hostName = "nixyos"; - batMode = "single"; - - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking = { - networkmanager = { - wifi.powersave = true; - }; - }; # Older machine system.stateVersion = "24.11"; diff --git a/hosts/thinix-thinkpad/configuration.nix b/hosts/thinix-thinkpad/configuration.nix index 76b7e42..37abbf5 100644 --- a/hosts/thinix-thinkpad/configuration.nix +++ b/hosts/thinix-thinkpad/configuration.nix @@ -9,10 +9,13 @@ ./../../modules/common.nix ./../../modules/hardware/xremap.nix - ./../../modules/hardware/battery.nix + ./../../modules/hardware/boot.nix ./../../modules/graphics/workstation.nix + ./../../modules/laptop/powersave.nix + ./../../modules/laptop/battery.nix + ./../../modules/services/webdav.nix.nix ./../../modules/services/scanning.nix.nix ]; @@ -20,21 +23,12 @@ networking.hostName = "thinix"; batMode = "double"; - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - programs.gnupg.agent = { enable = true; pinentryPackage = with pkgs; pinentry-all; enableSSHSupport = true; }; - networking = { - networkmanager = { - wifi.powersave = true; - }; - }; - swapDevices = [ { device = "/swapfile"; @@ -42,6 +36,5 @@ } ]; - # Older machine system.stateVersion = "24.11"; } diff --git a/modules/hardware/boot.nix b/modules/hardware/boot.nix new file mode 100644 index 0000000..89787cb --- /dev/null +++ b/modules/hardware/boot.nix @@ -0,0 +1,26 @@ +{ config, lib, ... }: + +let + inherit (lib) mkOption types; +in { + options.bootMode = mkOption { + type = types.enum [ "uefi" "legacy" ]; + default = "uefi"; + }; + + config = { + boot.consoleLogLevel = 0; + boot.kernelParams = [ "quiet" "udev.log_level=3" ]; + + boot.loader = if config.bootMode == "uefi" then { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; + timeout = 0; + } else { + grub.enable = true; + grub.device = "/dev/sda"; + timeout = 0; + }; + }; +} + diff --git a/modules/hardware/nvidia.nix b/modules/hardware/nvidia.nix index 6618007..454c971 100644 --- a/modules/hardware/nvidia.nix +++ b/modules/hardware/nvidia.nix @@ -13,11 +13,11 @@ package = config.boot.kernelPackages.nvidiaPackages.stable; }; - environment.systemPackages = with pkgs; [ - (blender.override { - cudaSupport = true; - }) - ]; + #environment.systemPackages = with pkgs; [ + # (blender.override { + # cudaSupport = true; + # }) + #]; # This causes very long build times #nixpkgs.config.cudaSupport = true; diff --git a/modules/hardware/battery.nix b/modules/laptop/battery.nix similarity index 100% rename from modules/hardware/battery.nix rename to modules/laptop/battery.nix diff --git a/modules/laptop/powersave.nix b/modules/laptop/powersave.nix new file mode 100644 index 0000000..1e8cf4b --- /dev/null +++ b/modules/laptop/powersave.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + networking = { + networkmanager = { + wifi.powersave = true; + }; + }; +} diff --git a/user/home.nix b/user/home.nix index 1eada9e..53dfeb5 100644 --- a/user/home.nix +++ b/user/home.nix @@ -1,102 +1,87 @@ { pkgs, ... }: { - imports = [ - ./packages.nix - ]; + imports = [ ./packages.nix ]; - services.gnome-keyring.enable = true; + services.gnome-keyring.enable = true; - xdg.mimeApps = { - enable = true; - defaultApplications = { - "text/html" = "firefox.desktop"; - "x-scheme-handler/http" = "firefox.desktop"; - "x-scheme-handler/https" = "firefox.desktop"; - "x-scheme-handler/about" = "firefox.desktop"; - "x-scheme-handler/unknown" = "firefox.desktop"; - "application/pdf" = "sioyek.desktop"; - "application/rnote" = "rnote.desktop"; - "video/mp4" = "mpv.desktop"; - "image/*" = "fehcustom.desktop"; - }; - }; + xdg.mimeApps = { + enable = true; + defaultApplications = { + "text/html" = "firefox.desktop"; + "x-scheme-handler/http" = "firefox.desktop"; + "x-scheme-handler/https" = "firefox.desktop"; + "x-scheme-handler/about" = "firefox.desktop"; + "x-scheme-handler/unknown" = "firefox.desktop"; + "application/pdf" = "sioyek.desktop"; + "application/rnote" = "rnote.desktop"; + "video/mp4" = "mpv.desktop"; + "image/*" = "fehcustom.desktop"; + }; + }; - xdg.desktopEntries.fehcustom = { - name = "FehCustom"; - terminal = false; - exec = "${pkgs.feh}/bin/feh -d --keep-zoom-vp --draw-exif --start-at %u"; - }; + xdg.desktopEntries.fehcustom = { + name = "FehCustom"; + terminal = false; + exec = "${pkgs.feh}/bin/feh -d --keep-zoom-vp --draw-exif --start-at %u"; + }; - home = { - username = "jonas"; - homeDirectory = "/home/jonas"; - sessionVariables = { - EDITOR = "nvim"; - HTTP_HOME = "duckduckgo.com"; - MANPAGER="nvim +Man!"; - }; - shellAliases = { - fla = "sudo nixos-rebuild switch --flake '~/nixos#'"; - }; - pointerCursor = { - gtk.enable = true; - name = "catppuccin-frappe-rosewater-cursors"; - package = pkgs.catppuccin-cursors.frappeRosewater; - size = 18; - }; - }; + home = { + username = "jonas"; + homeDirectory = "/home/jonas"; + pointerCursor = { + gtk.enable = true; + name = "catppuccin-frappe-rosewater-cursors"; + package = pkgs.catppuccin-cursors.frappeRosewater; + size = 18; + }; + }; - gtk = { - enable = true; - iconTheme = { - package = pkgs.papirus-icon-theme; - name = "Papirus-Dark"; - }; - theme = { - name = "Adwaita-dark"; - package = pkgs.gnome-themes-extra; - }; - }; + gtk = { + enable = true; + iconTheme = { + package = pkgs.papirus-icon-theme; + name = "Papirus-Dark"; + }; + theme = { + name = "Adwaita-dark"; + package = pkgs.gnome-themes-extra; + }; + }; - qt = { - enable = true; - platformTheme.name = "qtct"; - style.name = "Kvantum"; - }; - xdg.configFile."Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini { }).generate "kvantum.kvconfig" { - General.theme = "Catppuccin-Frappe-Rosewater"; - }; - xdg.configFile."qt6ct/qt6ct.conf".source = pkgs.writeTextFile { - name = "qt6ct.conf"; - text = '' - [Appearance] - color_scheme_path=${pkgs.qt6ct}/share/qt6ct/colors/airy.conf - custom_palette=false - icon_theme=Papirus-Dark - standard_dialogs=default - style=kvantum - ''; - }; + qt = { + enable = true; + platformTheme.name = "qtct"; + style.name = "Kvantum"; + }; - programs.starship = { - enable = true; - settings = { - add_newline = false; - aws.disabled = true; - gcloud.disabled = true; - line_break.disabled = true; + xdg.configFile."Kvantum/kvantum.kvconfig".source = + (pkgs.formats.ini { }).generate "kvantum.kvconfig" { + General.theme = "Catppuccin-Frappe-Rosewater"; + }; + xdg.configFile."qt6ct/qt6ct.conf".source = pkgs.writeTextFile { + name = "qt6ct.conf"; + text = + " [Appearance]\n color_scheme_path=${pkgs.qt6ct}/share/qt6ct/colors/airy.conf\n custom_palette=false\n icon_theme=Papirus-Dark\n standard_dialogs=default\n style=kvantum\n"; + }; - sudo = { - disabled = false; - symbol = "SUDO "; - style = "bold red"; - }; + programs.starship = { + enable = true; + settings = { + add_newline = false; + aws.disabled = true; + gcloud.disabled = true; + line_break.disabled = true; + sudo = { + disabled = false; + symbol = "SUDO "; + style = "bold red"; + }; - }; - }; + }; + }; - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - home.stateVersion = "24.11"; + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + home.stateVersion = "24.11"; } diff --git a/user/packages.nix b/user/packages.nix index 34ea54a..64a89e3 100644 --- a/user/packages.nix +++ b/user/packages.nix @@ -1,190 +1,135 @@ -{ pkgs, ...}: +{ pkgs, ... }: { - home.packages = with pkgs; [ - weechat - just - iamb - wiki-tui + home.packages = with pkgs; [ + weechat + just + iamb + wiki-tui - vscode + vscode - simple-scan - obsidian - rclone + simple-scan + obsidian + rclone - #jujutsu + unstable.spotify-player - unstable.spotify-player + sops + gimp + audio-recorder + cheese + age + git-lfs - sops - gimp - audio-recorder - cheese - age - git-lfs + tor + torsocks + w3m + timer + qbittorrent + discord + blender + audacity + zoom-us + vlc + thunderbird + obsidian + obs-studio + prismlauncher + inkscape - tor - torsocks - w3m - timer - qbittorrent - discord - blender - audacity - zoom-us - vlc - thunderbird - obsidian - obs-studio - prismlauncher - inkscape + shotcut - shotcut + todo-txt-cli + systemctl-tui + acpi + feh - papirus-folders - todo-txt-cli - systemctl-tui - acpi - zsh - feh + watson + slides - watson - slides + imagemagick + xdragon - imagemagick - xdragon + luarocks - luarocks - lua + gradle + openjdk - gradle - openjdk + findutils.locate + ethtool + qalculate-qt + wl-clip-persist + btop + fastfetch + zathura + eza + fuzzel - findutils.locate - ethtool - qalculate-qt - wl-clip-persist - btop - fastfetch - zathura - eza - fuzzel - catppuccin-cursors - networkmanagerapplet - gdu - hyprpaper - tokei - fzf - gcc - gnumake - lazygit - nodejs - ripgrep - signal-desktop - unison - trash-cli - starship - python3 - fd - ttyper - zoxide - vim - tofi - bat - clipse - dunst - killall - libreoffice - perl - pipx - wpgtk - waybar - stow - brightnessctl - anki - unstable.typst - dnsmasq - davfs2 - mediainfo - powertop - #midori - exiftool - gtk4.dev - curl - sioyek - qt6.qtbase + networkmanagerapplet + gdu + hyprpaper + tokei + fzf + gcc + gnumake + lazygit + nodejs + ripgrep + signal-desktop + unison + trash-cli + python3 + fd + ttyper + zoxide + vim + tofi + bat + dunst + killall + libreoffice + perl + pipx + waybar + stow + brightnessctl + anki + unstable.typst + mediainfo + powertop + exiftool + curl + sioyek - libpulseaudio - xournalpp - rnote - libinput - libGL - libglvnd - emacs - cargo - hyprshot - hyprpicker - hyprsunset - wl-clipboard - mpv - gitui - keepassxc - kitty - wlsunset - unstable.yazi - neovim - htop - alpine - wget - tmux + xournalpp + rnote + emacs + cargo + hyprshot + hyprpicker + hyprsunset - zip - xz - unzip - p7zip + wl-clipboard - jq - yq-go + mpv + gitui + keepassxc + kitty + unstable.yazi + neovim + htop + alpine + wget + tmux - mtr - iperf3 - dnsutils - ldns - aria2 - socat - nmap - ipcalc + zip + xz + unzip - # Misc - cowsay - file - which - gnused - gnutar - gawk - zstd - gnupg + file + gnupg - nix-output-monitor - - # Productivity - hugo - glow - - iotop - iftop - - # System call monitoring - strace - ltrace - lsof - - # System tools - sysstat - lm_sensors - pciutils - usbutils - ]; + nix-output-monitor + ]; } -