From c4cd70fd20b75dfff8aa4825d2ec77441bbdcfb6 Mon Sep 17 00:00:00 2001 From: Melvin Ragusa Date: Wed, 4 Feb 2026 22:53:00 +0100 Subject: [PATCH] complete restructure --- configuration.nix | 264 +------------------------------ modules/apps.nix | 99 ------------ modules/audio.nix | 62 -------- modules/boot-plymouth.nix | 57 ------- modules/core/boot.nix | 45 ++++++ modules/core/default.nix | 10 ++ modules/core/localization.nix | 27 ++++ modules/core/networking.nix | 16 ++ modules/core/system.nix | 32 ++++ modules/core/users.nix | 27 ++++ modules/default.nix | 12 ++ modules/desktop.nix | 103 ------------ modules/desktop/apps.nix | 104 ++++++++++++ modules/desktop/default.nix | 9 ++ modules/desktop/niri.nix | 21 +++ modules/desktop/portals.nix | 71 +++++++++ modules/desktop/theming.nix | 57 +++++++ modules/dev.nix | 86 ---------- modules/dev/default.nix | 8 + modules/dev/docker.nix | 25 +++ modules/dev/shell.nix | 93 +++++++++++ modules/dev/tools.nix | 46 ++++++ modules/gaming.nix | 96 ----------- modules/gaming/default.nix | 8 + modules/gaming/gamemode.nix | 38 +++++ modules/gaming/steam.nix | 23 +++ modules/gaming/wine.nix | 23 +++ modules/gpu-amd.nix | 69 -------- modules/hardware/audio.nix | 70 ++++++++ modules/hardware/default.nix | 9 ++ modules/hardware/gpu-amd.nix | 38 +++++ modules/hardware/power.nix | 17 ++ modules/hardware/storage.nix | 52 ++++++ modules/navidrome.nix | 61 ------- modules/power.nix | 32 ---- modules/services.nix | 86 ---------- modules/services/avahi.nix | 22 +++ modules/services/default.nix | 9 ++ modules/services/maintenance.nix | 26 +++ modules/services/navidrome.nix | 32 ++++ modules/services/printing.nix | 12 ++ modules/shell.nix | 133 ---------------- modules/theming.nix | 84 ---------- 43 files changed, 985 insertions(+), 1229 deletions(-) delete mode 100644 modules/apps.nix delete mode 100644 modules/audio.nix delete mode 100644 modules/boot-plymouth.nix create mode 100644 modules/core/boot.nix create mode 100644 modules/core/default.nix create mode 100644 modules/core/localization.nix create mode 100644 modules/core/networking.nix create mode 100644 modules/core/system.nix create mode 100644 modules/core/users.nix create mode 100644 modules/default.nix delete mode 100644 modules/desktop.nix create mode 100644 modules/desktop/apps.nix create mode 100644 modules/desktop/default.nix create mode 100644 modules/desktop/niri.nix create mode 100644 modules/desktop/portals.nix create mode 100644 modules/desktop/theming.nix delete mode 100644 modules/dev.nix create mode 100644 modules/dev/default.nix create mode 100644 modules/dev/docker.nix create mode 100644 modules/dev/shell.nix create mode 100644 modules/dev/tools.nix delete mode 100644 modules/gaming.nix create mode 100644 modules/gaming/default.nix create mode 100644 modules/gaming/gamemode.nix create mode 100644 modules/gaming/steam.nix create mode 100644 modules/gaming/wine.nix delete mode 100644 modules/gpu-amd.nix create mode 100644 modules/hardware/audio.nix create mode 100644 modules/hardware/default.nix create mode 100644 modules/hardware/gpu-amd.nix create mode 100644 modules/hardware/power.nix create mode 100644 modules/hardware/storage.nix delete mode 100644 modules/navidrome.nix delete mode 100644 modules/power.nix delete mode 100644 modules/services.nix create mode 100644 modules/services/avahi.nix create mode 100644 modules/services/default.nix create mode 100644 modules/services/maintenance.nix create mode 100644 modules/services/navidrome.nix create mode 100644 modules/services/printing.nix delete mode 100644 modules/shell.nix delete mode 100644 modules/theming.nix diff --git a/configuration.nix b/configuration.nix index 9a734c0..51ab466 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,5 +1,5 @@ # configuration.nix -# Main NixOS configuration - imports modular components +# Main NixOS configuration entry point { config, pkgs, @@ -11,266 +11,8 @@ { imports = [ - # Hardware ./hardware-configuration.nix - - # Modular configuration - ./modules/desktop.nix # Portal, polkit, launcher, lock, wallpaper - ./modules/boot-plymouth.nix # Plymouth boot splash - ./modules/gpu-amd.nix # AMD graphics, Vulkan, VA-API - ./modules/audio.nix # Bluetooth, audio controls - ./modules/gaming.nix # Steam, Gamemode, Lutris, etc. - ./modules/apps.nix # User applications - ./modules/dev.nix # Docker, dev tools - ./modules/theming.nix # Fonts, themes, cursors - ./modules/power.nix # Power management, CPU governors - ./modules/shell.nix # Fish shell configuration - ./modules/services.nix # System services (fstrim, zram, avahi, psd) - ./modules/navidrome.nix # Music streaming server - ./modules/limine-custom-labels.nix # Custom boot entry labels with kernel version + ./modules + ./modules/limine-custom-labels.nix ]; - - # ═══════════════════════════════════════════════════════════════ - # SECONDARY STORAGE - # ═══════════════════════════════════════════════════════════════ - fileSystems."/mnt/Intenso-SSD" = { - device = "/dev/disk/by-uuid/51c56376-8384-4762-a8e9-8151fe91173b"; - fsType = "ext4"; - options = [ - "defaults" - "nofail" - "x-gvfs-show" - ]; - }; - - fileSystems."/mnt/Samsung-SSD" = { - device = "/dev/disk/by-uuid/343ea612-9305-4fb6-9d4c-7a7ca8b0e72c"; - fsType = "ext4"; - options = [ - "defaults" - "nofail" - "x-gvfs-show" - ]; - }; - - fileSystems."/mnt/Extern-SSD" = { - device = "/dev/disk/by-uuid/4e233c88-e91b-480c-b795-6fffc1fbdc69"; - fsType = "ext4"; - options = [ - "defaults" - "nofail" - "x-gvfs-show" - ]; - }; - - # ═══════════════════════════════════════════════════════════════ - # BOOT - # ═══════════════════════════════════════════════════════════════ - - # ─── Bootloader: Limine with Secure Boot ─── - boot.loader.systemd-boot.enable = false; # Disabled - using Limine - boot.loader.limine = { - enable = true; - style.wallpapers = [ ./wallpaper/nix.png ]; - maxGenerations = 5; - }; - - boot.loader.limine.secureBoot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # ─── Kernel ─── - boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest-x86_64-v3; - - # Kernel parameters (consolidated from modules) - boot.kernelParams = [ - "amd_pstate=active" # Modern Ryzen power management (from power.nix) - "amdgpu.ppfeaturemask=0xffffffff" # Full AMD GPU power features (from gpu-amd.nix) - ]; - - # ─── Scheduler ─── - # sched-ext scheduler for gaming performance - services.scx.enable = true; - services.scx.scheduler = "scx_lavd"; # Low-latency scheduler, good for gaming - - # ─── Hibernation ─── - # Resume from encrypted swap (cryptswap must be unlocked before resume) - boot.resumeDevice = "/dev/mapper/cryptswap"; - - # ═══════════════════════════════════════════════════════════════ - # NETWORKING - # ═══════════════════════════════════════════════════════════════ - networking.hostName = "nix"; - networking.networkmanager.enable = true; - - # ═══════════════════════════════════════════════════════════════ - # LOCALIZATION - # ═══════════════════════════════════════════════════════════════ - time.timeZone = "Europe/Berlin"; - - i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - }; - - console.keyMap = "de-latin1-nodeadkeys"; - - # ═══════════════════════════════════════════════════════════════ - # DISPLAY & INPUT - # ═══════════════════════════════════════════════════════════════ - services.xserver.enable = true; - services.displayManager.ly.enable = true; - services.displayManager.defaultSession = "niri"; - - services.xserver.xkb = { - layout = "de"; - variant = "nodeadkeys"; - }; - - # ═══════════════════════════════════════════════════════════════ - # AUDIO (PipeWire) - # ═══════════════════════════════════════════════════════════════ - services.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; # For pro audio apps - }; - - # ═══════════════════════════════════════════════════════════════ - # BLUETOOTH - # ═══════════════════════════════════════════════════════════════ - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - settings = { - General = { - Enable = "Source,Sink,Media,Socket"; - Experimental = false; - KernelExperimental = false; - }; - Policy = { - AutoEnable = true; - }; - }; - }; - - # ═══════════════════════════════════════════════════════════════ - # PRINTING - # ═══════════════════════════════════════════════════════════════ - services.printing.enable = true; - - # ═══════════════════════════════════════════════════════════════ - # USER - # ═══════════════════════════════════════════════════════════════ - users.users.${username} = { - isNormalUser = true; - description = "Melvin Ragusa"; - extraGroups = [ - "wheel" # Sudo access - "networkmanager" # Network configuration - ]; - shell = pkgs.fish; # Fish shell (migrated from Arch) - }; - - # ═══════════════════════════════════════════════════════════════ - # PROGRAMS - # ═══════════════════════════════════════════════════════════════ - programs.zsh.enable = true; # Keep zsh available as fallback - programs.yazi.enable = true; - programs.firefox.enable = true; - programs.niri.enable = true; - - # ═══════════════════════════════════════════════════════════════ - # NIX SETTINGS - # ═══════════════════════════════════════════════════════════════ - nix.settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - - # Optimize storage - auto-optimise-store = true; - - # Trust users for substituters - trusted-users = [ - "root" - "@wheel" - ]; - }; - - # Garbage collection - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 14d"; - }; - - nixpkgs.config.allowUnfree = true; - - # ═══════════════════════════════════════════════════════════════ - # SYSTEM PACKAGES (Base essentials) - # ═══════════════════════════════════════════════════════════════ - environment.systemPackages = with pkgs; [ - # Core utilities - gnupg - fastfetch - micro - wget - curl - - # Secure Boot management - sbctl - - # Nix tools - nil # Nix LSP - nixd - - # Wayland - xwayland-satellite - grim - slurp - - # File management - nautilus - - # Editors - zed-editor - - # Browser - inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default - - # Flake inputs (desktop shell) - inputs.noctalia.packages.${pkgs.stdenv.hostPlatform.system}.default - inputs.opencode.packages.${pkgs.stdenv.hostPlatform.system}.default - - # Terminal - ghostty - - # AI coding - claude-code - ]; - - # ═══════════════════════════════════════════════════════════════ - # SERVICES - # ═══════════════════════════════════════════════════════════════ - services.openssh.enable = true; - services.tailscale.enable = true; - services.gnome.gnome-online-accounts.enable = true; - - # ═══════════════════════════════════════════════════════════════ - # SYSTEM - # ═══════════════════════════════════════════════════════════════ - system.stateVersion = "26.05"; } diff --git a/modules/apps.nix b/modules/apps.nix deleted file mode 100644 index 9774184..0000000 --- a/modules/apps.nix +++ /dev/null @@ -1,99 +0,0 @@ -# modules/apps.nix -# User applications: media, productivity, communication, system utilities -{ - config, - pkgs, - lib, - ... -}: - -{ - environment.systemPackages = with pkgs; [ - # ═══════════════════════════════════════════════════════════════ - # MEDIA VIEWERS - # ═══════════════════════════════════════════════════════════════ - loupe # GNOME image viewer - evince # PDF/document viewer - celluloid # MPV frontend (GTK video player) - mpv # Powerful CLI video player - vlc # Video player - - # ═══════════════════════════════════════════════════════════════ - # MUSIC - # ═══════════════════════════════════════════════════════════════ - feishin # Navidrome/Jellyfin client - picard # MusicBrainz Picard - music tagger - beets # Music library manager - cava # Audio visualizer - - # ═══════════════════════════════════════════════════════════════ - # COMMUNICATION - # ═══════════════════════════════════════════════════════════════ - vesktop # Discord client (Wayland-native, with Vencord) - thunderbird # Email client - signal-desktop # Encrypted messaging - telegram-desktop # Telegram client - - # ═══════════════════════════════════════════════════════════════ - # OFFICE & PRODUCTIVITY - # ═══════════════════════════════════════════════════════════════ - onlyoffice-desktopeditors # Office suite (latest) - obsidian # Note-taking with Markdown - - # ═══════════════════════════════════════════════════════════════ - # SYSTEM UTILITIES - # ═══════════════════════════════════════════════════════════════ - btop # Modern system monitor (terminal) - mission-center # GNOME system monitor (GUI, like Windows Task Manager) - - # ═══════════════════════════════════════════════════════════════ - # FILE MANAGEMENT - # ═══════════════════════════════════════════════════════════════ - file-roller # Archive manager (GUI) - gnome-disk-utility # Disk management - - # Archive tools (for file-roller and CLI) - unzip - zip - p7zip - unrar - - # ═══════════════════════════════════════════════════════════════ - # SCREENSHOTS & RECORDING - # ═══════════════════════════════════════════════════════════════ - # Screen recording - gpu-screen-recorder # Lightweight GPU-accelerated recorder (AMD/NVIDIA/Intel) - - # ═══════════════════════════════════════════════════════════════ - # SECURITY & PASSWORDS - # ═══════════════════════════════════════════════════════════════ - bitwarden-desktop # Password manager - seahorse # GNOME Keyring GUI - - # ═══════════════════════════════════════════════════════════════ - # UTILITIES - # ═══════════════════════════════════════════════════════════════ - gnome-calculator # Calculator - gnome-clocks # World clocks, alarms, timers - baobab # Disk usage analyzer - localsend # AirDrop-like file sharing (cross-platform) - protonvpn-gui # ProtonVPN GUI - protonmail-bridge-gui # ProtonMail Bridge GUI - - # ═══════════════════════════════════════════════════════════════ - # SYSTEM TOOLS - # ═══════════════════════════════════════════════════════════════ - rclone # Cloud storage sync (Google Drive, Dropbox, etc.) - ]; - - # GNOME Keyring for secrets storage - services.gnome.gnome-keyring.enable = true; - - # Enable Flatpak for additional apps (Feishin, etc.) - services.flatpak.enable = true; - - # Automatically add Flathub repository on system activation - system.activationScripts.flatpak-flathub.text = '' - ${pkgs.flatpak}/bin/flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo || true - ''; -} diff --git a/modules/audio.nix b/modules/audio.nix deleted file mode 100644 index 2246451..0000000 --- a/modules/audio.nix +++ /dev/null @@ -1,62 +0,0 @@ -# modules/audio.nix -# Audio and Bluetooth configuration: volume control, media keys -{ - config, - pkgs, - lib, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # AUDIO PACKAGES - # ═══════════════════════════════════════════════════════════════ - environment.systemPackages = with pkgs; [ - # PipeWire volume control - pwvucontrol # Modern PipeWire volume control (Qt) - pavucontrol # Classic PulseAudio volume control (GTK) - as backup - - # Media player control - playerctl # Control media players via D-Bus (for media keys) - - # Bluetooth audio codecs are handled by PipeWire automatically - ]; - - # ═══════════════════════════════════════════════════════════════ - # BLUETOOTH CODECS - # ═══════════════════════════════════════════════════════════════ - # Ensure PipeWire has good Bluetooth codec support - # This is already configured in your main config, but we ensure AAC/LDAC support - services.pipewire.wireplumber.extraConfig = { - "10-bluez" = { - "monitor.bluez.properties" = { - # Enable all Bluetooth codecs - "bluez5.enable-sbc-xq" = true; - "bluez5.enable-msbc" = true; - "bluez5.enable-hw-volume" = true; - - # Bluetooth headset roles - "bluez5.roles" = [ - "a2dp_sink" - "a2dp_source" - "bap_sink" - "bap_source" - "hsp_hs" - "hsp_ag" - "hfp_hf" - "hfp_ag" - ]; - - # Codec preference order (highest quality first) - "bluez5.codecs" = [ - "ldac" - "aac" - "aptx_hd" - "aptx" - "sbc_xq" - "sbc" - ]; - }; - }; - }; -} diff --git a/modules/boot-plymouth.nix b/modules/boot-plymouth.nix deleted file mode 100644 index c9abefa..0000000 --- a/modules/boot-plymouth.nix +++ /dev/null @@ -1,57 +0,0 @@ -# modules/boot-plymouth.nix -# Plymouth boot splash with NixOS branding -{ - config, - pkgs, - lib, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # SYSTEMD IN INITRD (REQUIRED FOR PLYMOUTH + LUKS) - # ═══════════════════════════════════════════════════════════════ - - # Enable systemd-based initramfs instead of legacy stage-1 init. - # This allows Plymouth to integrate with systemd's password agent, - # displaying the LUKS encryption password prompt within the boot - # animation instead of falling back to text mode. - boot.initrd.systemd.enable = true; - - # ═══════════════════════════════════════════════════════════════ - # PLYMOUTH BOOT SPLASH - # ═══════════════════════════════════════════════════════════════ - - boot.plymouth = { - enable = true; - theme = "nixos-bgrt"; - themePackages = [ pkgs.nixos-bgrt-plymouth ]; - }; - - # ═══════════════════════════════════════════════════════════════ - # SILENT BOOT KERNEL PARAMETERS - # ═══════════════════════════════════════════════════════════════ - - boot.kernelParams = [ - # Plymouth boot splash - "quiet" - "splash" - - # Reduce console log verbosity - "loglevel=3" - "rd.udev.log_level=3" - - # Hide systemd status messages - "systemd.show_status=auto" - - # Hide blinking cursor - "vt.global_cursor_default=0" - ]; - - # ═══════════════════════════════════════════════════════════════ - # CONSOLE SETTINGS - # ═══════════════════════════════════════════════════════════════ - - # Keep console blank during boot - boot.consoleLogLevel = 3; -} diff --git a/modules/core/boot.nix b/modules/core/boot.nix new file mode 100644 index 0000000..2f1f929 --- /dev/null +++ b/modules/core/boot.nix @@ -0,0 +1,45 @@ +# modules/core/boot.nix +# Bootloader, kernel, and boot-time configuration +{ + config, + pkgs, + lib, + ... +}: + +{ + boot.loader.systemd-boot.enable = false; + boot.loader.limine = { + enable = true; + style.wallpapers = [ ../../wallpaper/nix.png ]; + maxGenerations = 5; + }; + boot.loader.limine.secureBoot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest-x86_64-v3; + + boot.kernelParams = [ + "amd_pstate=active" + "amdgpu.ppfeaturemask=0xffffffff" + "quiet" + "splash" + "loglevel=3" + "rd.udev.log_level=3" + "systemd.show_status=auto" + "vt.global_cursor_default=0" + ]; + + boot.consoleLogLevel = 3; + boot.resumeDevice = "/dev/mapper/cryptswap"; + + boot.initrd.systemd.enable = true; + boot.plymouth = { + enable = true; + theme = "nixos-bgrt"; + themePackages = [ pkgs.nixos-bgrt-plymouth ]; + }; + + services.scx.enable = true; + services.scx.scheduler = "scx_lavd"; +} diff --git a/modules/core/default.nix b/modules/core/default.nix new file mode 100644 index 0000000..5d8124c --- /dev/null +++ b/modules/core/default.nix @@ -0,0 +1,10 @@ +# modules/core/default.nix +{ + imports = [ + ./boot.nix + ./system.nix + ./networking.nix + ./users.nix + ./localization.nix + ]; +} diff --git a/modules/core/localization.nix b/modules/core/localization.nix new file mode 100644 index 0000000..b60a154 --- /dev/null +++ b/modules/core/localization.nix @@ -0,0 +1,27 @@ +# modules/core/localization.nix +# Timezone, locale, and keyboard settings +{ + config, + pkgs, + lib, + ... +}: + +{ + time.timeZone = "Europe/Berlin"; + + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + console.keyMap = "de-latin1-nodeadkeys"; +} diff --git a/modules/core/networking.nix b/modules/core/networking.nix new file mode 100644 index 0000000..7d72b0f --- /dev/null +++ b/modules/core/networking.nix @@ -0,0 +1,16 @@ +# modules/core/networking.nix +# Network configuration and services +{ + config, + pkgs, + lib, + ... +}: + +{ + networking.hostName = "nix"; + networking.networkmanager.enable = true; + + services.openssh.enable = true; + services.tailscale.enable = true; +} diff --git a/modules/core/system.nix b/modules/core/system.nix new file mode 100644 index 0000000..d9bdedf --- /dev/null +++ b/modules/core/system.nix @@ -0,0 +1,32 @@ +# modules/core/system.nix +# Nix settings and system configuration +{ + config, + pkgs, + lib, + ... +}: + +{ + nix.settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + auto-optimise-store = true; + trusted-users = [ + "root" + "@wheel" + ]; + }; + + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 14d"; + }; + + nixpkgs.config.allowUnfree = true; + + system.stateVersion = "26.05"; +} diff --git a/modules/core/users.nix b/modules/core/users.nix new file mode 100644 index 0000000..0a040f7 --- /dev/null +++ b/modules/core/users.nix @@ -0,0 +1,27 @@ +# modules/core/users.nix +# User accounts and shell configuration +{ + config, + pkgs, + lib, + username, + ... +}: + +{ + users.users.${username} = { + isNormalUser = true; + description = "Melvin Ragusa"; + extraGroups = [ + "wheel" + "networkmanager" + "docker" + "gamemode" + "corectrl" + ]; + shell = pkgs.fish; + }; + + programs.fish.enable = true; + programs.zsh.enable = true; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..d3b0016 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,12 @@ +# modules/default.nix +# Auto-import all module categories +{ + imports = [ + ./core + ./hardware + ./desktop + ./services + ./dev + ./gaming + ]; +} diff --git a/modules/desktop.nix b/modules/desktop.nix deleted file mode 100644 index 6c213e9..0000000 --- a/modules/desktop.nix +++ /dev/null @@ -1,103 +0,0 @@ -# modules/desktop.nix -# Core desktop infrastructure: portals, polkit, launcher, screen lock, wallpaper, idle -{ - config, - pkgs, - inputs, - lib, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # XDG PORTALS - # ═══════════════════════════════════════════════════════════════ - # Required for screen sharing, file pickers, etc. - xdg.portal = { - enable = true; - extraPortals = [ - pkgs.xdg-desktop-portal-gtk - ]; - config.common = { - default = [ "gtk" ]; - "org.freedesktop.impl.portal.FileChooser" = [ "gtk" ]; - }; - }; - - # ═══════════════════════════════════════════════════════════════ - # POLKIT - # ═══════════════════════════════════════════════════════════════ - # GUI privilege escalation - security.polkit.enable = true; - - # Polkit authentication agent - systemd.user.services.polkit-gnome-agent = { - description = "Polkit GNOME Authentication Agent"; - wantedBy = [ "graphical-session.target" ]; - wants = [ "graphical-session.target" ]; - after = [ "graphical-session.target" ]; - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; - Restart = "on-failure"; - RestartSec = 1; - TimeoutStopSec = 10; - }; - }; - - # ═══════════════════════════════════════════════════════════════ - # DESKTOP PACKAGES - # ═══════════════════════════════════════════════════════════════ - environment.systemPackages = with pkgs; [ - # Polkit agent - polkit_gnome - - # Portal helpers - xdg-utils - xdg-user-dirs - - # Wayland utilities - wl-clipboard - wtype # Wayland keyboard automation - wlr-randr # Display configuration - wayland-utils # Debug utilities - - # ─── Additional Desktop Utilities ─── - cliphist # Clipboard history for Wayland - wlsunset # Blue light filter / night mode - brightnessctl # Brightness control (even for desktop monitors via DDC) - wlogout # Logout menu / session manager - bazaar # App Store - matugen - ]; - - # ═══════════════════════════════════════════════════════════════ - # WAYLAND ENVIRONMENT - # ═══════════════════════════════════════════════════════════════ - # Environment variables for Wayland compatibility - environment.sessionVariables = { - # Wayland defaults - NIXOS_OZONE_WL = "1"; # Electron apps use Wayland - MOZ_ENABLE_WAYLAND = "1"; # Firefox Wayland - QT_QPA_PLATFORM = "wayland"; # Qt apps use Wayland - SDL_VIDEODRIVER = "wayland"; # SDL games use Wayland - _JAVA_AWT_WM_NONREPARENTING = "1"; # Java apps fix - GIO_EXTRA_MODULES = [ "${pkgs.gvfs}/lib/gio/modules" ]; - - # XDG - XDG_SESSION_TYPE = "wayland"; - XDG_CURRENT_DESKTOP = "niri"; - - # Theming (consolidated from theming.nix) - QT_QPA_PLATFORMTHEME = "qt6ct"; - XCURSOR_THEME = "default"; - XCURSOR_SIZE = "24"; - }; - - # ═══════════════════════════════════════════════════════════════ - # GNOME SERVICES - # ═══════════════════════════════════════════════════════════════ - # Better desktop integration - services.gvfs.enable = true; # Virtual filesystem (trash, MTP, SMB) - services.udisks2.enable = true; # Disk mounting -} diff --git a/modules/desktop/apps.nix b/modules/desktop/apps.nix new file mode 100644 index 0000000..4e4734a --- /dev/null +++ b/modules/desktop/apps.nix @@ -0,0 +1,104 @@ +# modules/desktop/apps.nix +# GUI applications and system packages +{ + config, + pkgs, + inputs, + lib, + ... +}: + +{ + environment.systemPackages = with pkgs; [ + # Core utilities + gnupg + fastfetch + micro + wget + curl + sbctl + nil + nixd + + # Wayland + xwayland-satellite + grim + slurp + + # File management + nautilus + + # Editors and browsers + zed-editor + inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default + + # Desktop shell + inputs.noctalia.packages.${pkgs.stdenv.hostPlatform.system}.default + inputs.opencode.packages.${pkgs.stdenv.hostPlatform.system}.default + + # Terminal + ghostty + claude-code + + # Media viewers + loupe + evince + celluloid + mpv + vlc + + # Music + feishin + picard + beets + cava + + # Communication + vesktop + thunderbird + signal-desktop + telegram-desktop + + # Office + onlyoffice-desktopeditors + obsidian + + # System utilities + btop + mission-center + file-roller + gnome-disk-utility + unzip + zip + p7zip + unrar + + # Recording + gpu-screen-recorder + + # Security + bitwarden-desktop + seahorse + + # Utilities + gnome-calculator + gnome-clocks + baobab + localsend + protonvpn-gui + protonmail-bridge-gui + + # Cloud sync + rclone + ]; + + services.gnome.gnome-keyring.enable = true; + + services.flatpak.enable = true; + system.activationScripts.flatpak-flathub.text = '' + ${pkgs.flatpak}/bin/flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo || true + ''; + + programs.yazi.enable = true; + programs.firefox.enable = true; +} diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix new file mode 100644 index 0000000..730f6f5 --- /dev/null +++ b/modules/desktop/default.nix @@ -0,0 +1,9 @@ +# modules/desktop/default.nix +{ + imports = [ + ./niri.nix + ./portals.nix + ./theming.nix + ./apps.nix + ]; +} diff --git a/modules/desktop/niri.nix b/modules/desktop/niri.nix new file mode 100644 index 0000000..683148d --- /dev/null +++ b/modules/desktop/niri.nix @@ -0,0 +1,21 @@ +# modules/desktop/niri.nix +# Window manager and display configuration +{ + config, + pkgs, + lib, + ... +}: + +{ + services.xserver.enable = true; + services.displayManager.ly.enable = true; + services.displayManager.defaultSession = "niri"; + + services.xserver.xkb = { + layout = "de"; + variant = "nodeadkeys"; + }; + + programs.niri.enable = true; +} diff --git a/modules/desktop/portals.nix b/modules/desktop/portals.nix new file mode 100644 index 0000000..30ce3d7 --- /dev/null +++ b/modules/desktop/portals.nix @@ -0,0 +1,71 @@ +# modules/desktop/portals.nix +# XDG portals and polkit authentication +{ + config, + pkgs, + lib, + ... +}: + +{ + xdg.portal = { + enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + config.common = { + default = [ "gtk" ]; + "org.freedesktop.impl.portal.FileChooser" = [ "gtk" ]; + }; + }; + + security.polkit.enable = true; + + systemd.user.services.polkit-gnome-agent = { + description = "Polkit GNOME Authentication Agent"; + wantedBy = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + + services.gvfs.enable = true; + services.udisks2.enable = true; + services.gnome.gnome-online-accounts.enable = true; + + environment.systemPackages = with pkgs; [ + polkit_gnome + xdg-utils + xdg-user-dirs + wl-clipboard + wtype + wlr-randr + wayland-utils + cliphist + wlsunset + brightnessctl + wlogout + bazaar + matugen + ]; + + environment.sessionVariables = { + NIXOS_OZONE_WL = "1"; + MOZ_ENABLE_WAYLAND = "1"; + QT_QPA_PLATFORM = "wayland"; + SDL_VIDEODRIVER = "wayland"; + _JAVA_AWT_WM_NONREPARENTING = "1"; + GIO_EXTRA_MODULES = [ "${pkgs.gvfs}/lib/gio/modules" ]; + XDG_SESSION_TYPE = "wayland"; + XDG_CURRENT_DESKTOP = "niri"; + QT_QPA_PLATFORMTHEME = "qt6ct"; + XCURSOR_THEME = "default"; + XCURSOR_SIZE = "24"; + }; + + environment.pathsToLink = [ "/share/icons" ]; +} diff --git a/modules/desktop/theming.nix b/modules/desktop/theming.nix new file mode 100644 index 0000000..4b81a60 --- /dev/null +++ b/modules/desktop/theming.nix @@ -0,0 +1,57 @@ +# modules/desktop/theming.nix +# Fonts, themes, and visual configuration +{ + config, + pkgs, + lib, + ... +}: + +{ + fonts = { + packages = with pkgs; [ + jetbrains-mono + nerd-fonts.jetbrains-mono + inter + noto-fonts + noto-fonts-cjk-sans + noto-fonts-color-emoji + source-sans + source-serif + source-code-pro + fira-code + ]; + + fontconfig = { + enable = true; + defaultFonts = { + sansSerif = [ + "Inter" + "Noto Sans" + ]; + serif = [ "Noto Serif" ]; + monospace = [ + "JetBrainsMono Nerd Font" + "JetBrains Mono" + ]; + emoji = [ "Noto Color Emoji" ]; + }; + hinting = { + enable = true; + style = "slight"; + }; + antialias = true; + subpixel.rgba = "rgb"; + }; + }; + + environment.systemPackages = with pkgs; [ + adw-gtk3 + adwaita-icon-theme + papirus-icon-theme + libsForQt5.qt5ct + kdePackages.qt6ct + dconf-editor + nwg-look + ]; +} diff --git a/modules/dev.nix b/modules/dev.nix deleted file mode 100644 index 49d71ba..0000000 --- a/modules/dev.nix +++ /dev/null @@ -1,86 +0,0 @@ -# modules/dev.nix -# Development tools: Docker, Node.js, direnv, build tools -{ - config, - pkgs, - lib, - username, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # DOCKER - # ═══════════════════════════════════════════════════════════════ - virtualisation.docker = { - enable = true; - - # Recommended settings - autoPrune = { - enable = true; - dates = "weekly"; - flags = [ "--all" ]; - }; - }; - - # Add user to docker group - users.users.${username}.extraGroups = [ "docker" ]; - - # ═══════════════════════════════════════════════════════════════ - # DIRENV - # ═══════════════════════════════════════════════════════════════ - # Per-project environments - programs.direnv = { - enable = true; - nix-direnv.enable = true; # Faster direnv for Nix - }; - - # ═══════════════════════════════════════════════════════════════ - # DEVELOPMENT PACKAGES - # ═══════════════════════════════════════════════════════════════ - environment.systemPackages = with pkgs; [ - # ─── Containers ─── - docker-compose # Docker Compose v2 - lazydocker - - # ─── Languages & Runtimes ─── - bun - pnpm - nodejs - python3 - rustup - - # ─── Build Tools ─── - gcc - gnumake - cmake - pkg-config - - # ─── Version Control ─── - git - gh - delta - lazygit - - # ─── Editors & LSP ─── - nil - nixfmt - - # ─── CLI Utilities ─── - jq # JSON processor - yq # YAML processor - ripgrep # Fast grep - fd # Fast find - fzf # Fuzzy finder - eza # Modern ls - bat # Cat with syntax highlighting - broot # TUI Folder Tree - - # Additional CLI tools - tealdeer # tldr - simplified man pages - duf # Better df (disk usage) - sd # Better sed (find & replace) - pv # Pipe viewer (progress bar for pipes) - parallel # GNU parallel (run commands in parallel) - ]; -} diff --git a/modules/dev/default.nix b/modules/dev/default.nix new file mode 100644 index 0000000..496c325 --- /dev/null +++ b/modules/dev/default.nix @@ -0,0 +1,8 @@ +# modules/dev/default.nix +{ + imports = [ + ./docker.nix + ./shell.nix + ./tools.nix + ]; +} diff --git a/modules/dev/docker.nix b/modules/dev/docker.nix new file mode 100644 index 0000000..7b20150 --- /dev/null +++ b/modules/dev/docker.nix @@ -0,0 +1,25 @@ +# modules/dev/docker.nix +# Docker container runtime +{ + config, + pkgs, + lib, + ... +}: + +{ + virtualisation.docker = { + enable = true; + + autoPrune = { + enable = true; + dates = "weekly"; + flags = [ "--all" ]; + }; + }; + + environment.systemPackages = with pkgs; [ + docker-compose + lazydocker + ]; +} diff --git a/modules/dev/shell.nix b/modules/dev/shell.nix new file mode 100644 index 0000000..1fc832e --- /dev/null +++ b/modules/dev/shell.nix @@ -0,0 +1,93 @@ +# modules/dev/shell.nix +# Fish shell with plugins and aliases +{ + config, + pkgs, + lib, + ... +}: + +{ + programs.fish = { + enable = true; + + interactiveShellInit = '' + set -g fish_greeting + + if set -q GHOSTTY_RESOURCES_DIR + source "$GHOSTTY_RESOURCES_DIR/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish" + end + + set -g pure_show_system_time false + set -g pure_enable_single_line_prompt true + set -g fish_prompt_pwd_dir_length 3 + + clear && fastfetch + ''; + + shellAliases = { + ll = "eza -la --icons --git"; + ls = "eza --icons"; + la = "eza -la --icons"; + lt = "eza --tree --icons --level=2"; + cat = "bat"; + find = "fd"; + grep = "rg"; + df = "duf"; + du = "dust"; + sed = "sd"; + dc = "docker compose"; + dps = "docker ps"; + dpa = "docker ps -a"; + dl = "docker logs -f"; + dex = "docker exec -it"; + gs = "git status"; + gd = "git diff"; + gds = "git diff --staged"; + gl = "git log --oneline -20"; + glo = "git log --oneline --graph --all"; + ga = "git add"; + gc = "git commit"; + gp = "git push"; + gpu = "git pull"; + gco = "git checkout"; + gb = "git branch"; + gst = "git stash"; + rebuild = "sudo nixos-rebuild switch --flake ."; + rebuild-boot = "sudo nixos-rebuild boot --flake ."; + rebuild-test = "sudo nixos-rebuild test --flake ."; + update = "nix flake update"; + search = "nix search nixpkgs"; + gc-nix = "sudo nix-collect-garbage -d"; + update-apps = "nix profile upgrade '.*'"; + list-apps = "nix profile list"; + ports = "ss -tulanp"; + myip = "curl -s ifconfig.me"; + ".." = "cd .."; + "..." = "cd ../.."; + "...." = "cd ../../.."; + rm = "rm -i"; + mv = "mv -i"; + cp = "cp -i"; + }; + + shellAbbrs = { + g = "git"; + d = "docker"; + n = "nix"; + v = "nvim"; + c = "code"; + z = "zeditor"; + }; + }; + + environment.systemPackages = with pkgs; [ + fishPlugins.pure + fishPlugins.autopair + fishPlugins.fzf-fish + fishPlugins.done + fishPlugins.grc + grc + dust + ]; +} diff --git a/modules/dev/tools.nix b/modules/dev/tools.nix new file mode 100644 index 0000000..e4cf06c --- /dev/null +++ b/modules/dev/tools.nix @@ -0,0 +1,46 @@ +# modules/dev/tools.nix +# Development tools and CLI utilities +{ + config, + pkgs, + lib, + ... +}: + +{ + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + + environment.systemPackages = with pkgs; [ + bun + pnpm + nodejs + python3 + rustup + gcc + gnumake + cmake + pkg-config + git + gh + delta + lazygit + nil + nixfmt + jq + yq + ripgrep + fd + fzf + eza + bat + broot + tealdeer + duf + sd + pv + parallel + ]; +} diff --git a/modules/gaming.nix b/modules/gaming.nix deleted file mode 100644 index 2e4fd67..0000000 --- a/modules/gaming.nix +++ /dev/null @@ -1,96 +0,0 @@ -# modules/gaming.nix -# Full gaming setup: Steam, Gamemode, Lutris, Heroic, Wine, Proton -{ - config, - pkgs, - lib, - username, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # STEAM - # ═══════════════════════════════════════════════════════════════ - programs.steam = { - enable = true; - remotePlay.openFirewall = true; # Steam Remote Play - dedicatedServer.openFirewall = true; # Dedicated servers - localNetworkGameTransfers.openFirewall = true; # LAN game transfers - - # Extra compatibility packages for Proton - extraCompatPackages = with pkgs; [ - proton-ge-bin # GloriousEggroll's Proton fork - better compatibility - ]; - }; - - # Steam hardware support (controllers, VR, etc.) - hardware.steam-hardware.enable = true; - - # ═══════════════════════════════════════════════════════════════ - # GAMEMODE - # ═══════════════════════════════════════════════════════════════ - # Optimize system for gaming - programs.gamemode = { - enable = true; - enableRenice = true; # Allow renice for priority boost - settings = { - general = { - renice = 10; - softrealtime = "auto"; - inhibit_screensaver = 1; - }; - gpu = { - apply_gpu_optimisations = "accept-responsibility"; - gpu_device = 0; - amd_performance_level = "high"; - }; - }; - }; - - # ═══════════════════════════════════════════════════════════════ - # GAMING PACKAGES - # ═══════════════════════════════════════════════════════════════ - # NOTE: Game launchers (lutris, heroic, protonup-qt) are in `nix profile` - environment.systemPackages = with pkgs; [ - # Wine for non-Steam games - wineWowPackages.stagingFull # Latest Wine with all features - winetricks # Wine helper scripts - protontricks # Proton helper scripts (like winetricks for Proton) - - # Gaming utilities (system integration) - gamemode # CLI tool to trigger gamemode - gamescope # Micro-compositor for games (fixes some issues) - - # Launchers - faugus-launcher - lutris - heroic - ]; - - # ═══════════════════════════════════════════════════════════════ - # KERNEL TWEAKS - # ═══════════════════════════════════════════════════════════════ - boot.kernel.sysctl = { - # Increase file watchers for large games - "fs.inotify.max_user_watches" = 524288; - - # Better memory management for gaming - "vm.swappiness" = 10; - "vm.vfs_cache_pressure" = 50; - }; - - # ═══════════════════════════════════════════════════════════════ - # CONTROLLER SUPPORT - # ═══════════════════════════════════════════════════════════════ - # Udev rules for game controllers - services.udev.packages = with pkgs; [ - game-devices-udev-rules # Support for various game controllers - ]; - - # ═══════════════════════════════════════════════════════════════ - # USER PERMISSIONS - # ═══════════════════════════════════════════════════════════════ - # Add user to gamemode group - users.users.${username}.extraGroups = [ "gamemode" ]; -} diff --git a/modules/gaming/default.nix b/modules/gaming/default.nix new file mode 100644 index 0000000..fe1911f --- /dev/null +++ b/modules/gaming/default.nix @@ -0,0 +1,8 @@ +# modules/gaming/default.nix +{ + imports = [ + ./steam.nix + ./gamemode.nix + ./wine.nix + ]; +} diff --git a/modules/gaming/gamemode.nix b/modules/gaming/gamemode.nix new file mode 100644 index 0000000..1a14224 --- /dev/null +++ b/modules/gaming/gamemode.nix @@ -0,0 +1,38 @@ +# modules/gaming/gamemode.nix +# Gaming performance optimizations +{ + config, + pkgs, + lib, + ... +}: + +{ + programs.gamemode = { + enable = true; + enableRenice = true; + settings = { + general = { + renice = 10; + softrealtime = "auto"; + inhibit_screensaver = 1; + }; + gpu = { + apply_gpu_optimisations = "accept-responsibility"; + gpu_device = 0; + amd_performance_level = "high"; + }; + }; + }; + + boot.kernel.sysctl = { + "fs.inotify.max_user_watches" = 524288; + "vm.swappiness" = 10; + "vm.vfs_cache_pressure" = 50; + }; + + environment.systemPackages = with pkgs; [ + gamemode + gamescope + ]; +} diff --git a/modules/gaming/steam.nix b/modules/gaming/steam.nix new file mode 100644 index 0000000..5dc05cb --- /dev/null +++ b/modules/gaming/steam.nix @@ -0,0 +1,23 @@ +# modules/gaming/steam.nix +# Steam and Proton configuration +{ + config, + pkgs, + lib, + ... +}: + +{ + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + localNetworkGameTransfers.openFirewall = true; + + extraCompatPackages = with pkgs; [ + proton-ge-bin + ]; + }; + + hardware.steam-hardware.enable = true; +} diff --git a/modules/gaming/wine.nix b/modules/gaming/wine.nix new file mode 100644 index 0000000..24a6b3e --- /dev/null +++ b/modules/gaming/wine.nix @@ -0,0 +1,23 @@ +# modules/gaming/wine.nix +# Wine, launchers, and controller support +{ + config, + pkgs, + lib, + ... +}: + +{ + environment.systemPackages = with pkgs; [ + wineWowPackages.stagingFull + winetricks + protontricks + faugus-launcher + lutris + heroic + ]; + + services.udev.packages = with pkgs; [ + game-devices-udev-rules + ]; +} diff --git a/modules/gpu-amd.nix b/modules/gpu-amd.nix deleted file mode 100644 index fb69025..0000000 --- a/modules/gpu-amd.nix +++ /dev/null @@ -1,69 +0,0 @@ -# modules/gpu-amd.nix -# AMD GPU configuration: drivers, Vulkan, VA-API hardware acceleration, CoreCtrl -{ - config, - pkgs, - lib, - username, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # AMD GPU DRIVERS - # ═══════════════════════════════════════════════════════════════ - # Enable OpenGL/Vulkan - hardware.graphics = { - enable = true; - enable32Bit = true; # For Steam and 32-bit games - - extraPackages = with pkgs; [ - # VA-API for hardware video acceleration - libva-vdpau-driver # Renamed from vaapiVdpau - libvdpau-va-gl - - # OpenCL support (optional, for compute workloads) - rocmPackages.clr.icd - ]; - - extraPackages32 = with pkgs.driversi686Linux; [ - # 32-bit VA-API support for older games - libva-vdpau-driver - libvdpau-va-gl - ]; - }; - - # RADV (Mesa Vulkan driver) is enabled by default and is the best choice for gaming - # No need for AMD_VULKAN_ICD environment variable anymore - - # ═══════════════════════════════════════════════════════════════ - # CORECTRL - # ═══════════════════════════════════════════════════════════════ - # Fan curves, overclocking, and GPU monitoring - programs.corectrl.enable = true; - - # AMD GPU overdrive/overclocking support - hardware.amdgpu.overdrive.enable = true; - - # Add user to corectrl group for full access without password - users.users.${username}.extraGroups = [ "corectrl" ]; - - # NOTE: Kernel params (amdgpu.ppfeaturemask) are in configuration.nix - - # ═══════════════════════════════════════════════════════════════ - # GPU PACKAGES - # ═══════════════════════════════════════════════════════════════ - environment.systemPackages = with pkgs; [ - # ─── Monitoring ─── - radeontop # AMD GPU monitoring (like nvidia-smi) - nvtopPackages.amd # Modern GPU monitor with AMD support - - # ─── Vulkan Tools ─── - vulkan-tools # vulkaninfo, etc. - vulkan-loader - - # ─── Video Acceleration ─── - libva-utils # vainfo - verify VA-API - vdpauinfo # Verify VDPAU - ]; -} diff --git a/modules/hardware/audio.nix b/modules/hardware/audio.nix new file mode 100644 index 0000000..35ae59a --- /dev/null +++ b/modules/hardware/audio.nix @@ -0,0 +1,70 @@ +# modules/hardware/audio.nix +# PipeWire audio, Bluetooth, and media controls +{ + config, + pkgs, + lib, + ... +}: + +{ + services.pulseaudio.enable = false; + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + + wireplumber.extraConfig = { + "10-bluez" = { + "monitor.bluez.properties" = { + "bluez5.enable-sbc-xq" = true; + "bluez5.enable-msbc" = true; + "bluez5.enable-hw-volume" = true; + "bluez5.roles" = [ + "a2dp_sink" + "a2dp_source" + "bap_sink" + "bap_source" + "hsp_hs" + "hsp_ag" + "hfp_hf" + "hfp_ag" + ]; + "bluez5.codecs" = [ + "ldac" + "aac" + "aptx_hd" + "aptx" + "sbc_xq" + "sbc" + ]; + }; + }; + }; + }; + + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + Experimental = false; + KernelExperimental = false; + }; + Policy = { + AutoEnable = true; + }; + }; + }; + + environment.systemPackages = with pkgs; [ + pwvucontrol + pavucontrol + playerctl + ]; +} diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix new file mode 100644 index 0000000..ac041f6 --- /dev/null +++ b/modules/hardware/default.nix @@ -0,0 +1,9 @@ +# modules/hardware/default.nix +{ + imports = [ + ./storage.nix + ./audio.nix + ./gpu-amd.nix + ./power.nix + ]; +} diff --git a/modules/hardware/gpu-amd.nix b/modules/hardware/gpu-amd.nix new file mode 100644 index 0000000..585c28a --- /dev/null +++ b/modules/hardware/gpu-amd.nix @@ -0,0 +1,38 @@ +# modules/hardware/gpu-amd.nix +# AMD GPU drivers, Vulkan, and video acceleration +{ + config, + pkgs, + lib, + ... +}: + +{ + hardware.graphics = { + enable = true; + enable32Bit = true; + + extraPackages = with pkgs; [ + libva-vdpau-driver + libvdpau-va-gl + rocmPackages.clr.icd + ]; + + extraPackages32 = with pkgs.driversi686Linux; [ + libva-vdpau-driver + libvdpau-va-gl + ]; + }; + + programs.corectrl.enable = true; + hardware.amdgpu.overdrive.enable = true; + + environment.systemPackages = with pkgs; [ + radeontop + nvtopPackages.amd + vulkan-tools + vulkan-loader + libva-utils + vdpauinfo + ]; +} diff --git a/modules/hardware/power.nix b/modules/hardware/power.nix new file mode 100644 index 0000000..4a747e6 --- /dev/null +++ b/modules/hardware/power.nix @@ -0,0 +1,17 @@ +# modules/hardware/power.nix +# Power management and CPU governor +{ + config, + pkgs, + lib, + ... +}: + +{ + services.power-profiles-daemon.enable = true; + powerManagement.cpuFreqGovernor = "schedutil"; + + environment.systemPackages = with pkgs; [ + power-profiles-daemon + ]; +} diff --git a/modules/hardware/storage.nix b/modules/hardware/storage.nix new file mode 100644 index 0000000..9a865ff --- /dev/null +++ b/modules/hardware/storage.nix @@ -0,0 +1,52 @@ +# modules/hardware/storage.nix +# Filesystems, SSD maintenance, and swap +{ + config, + pkgs, + lib, + username, + ... +}: + +{ + fileSystems."/mnt/Intenso-SSD" = { + device = "/dev/disk/by-uuid/51c56376-8384-4762-a8e9-8151fe91173b"; + fsType = "ext4"; + options = [ + "defaults" + "nofail" + "x-gvfs-show" + ]; + }; + + fileSystems."/mnt/Samsung-SSD" = { + device = "/dev/disk/by-uuid/343ea612-9305-4fb6-9d4c-7a7ca8b0e72c"; + fsType = "ext4"; + options = [ + "defaults" + "nofail" + "x-gvfs-show" + ]; + }; + + fileSystems."/mnt/Extern-SSD" = { + device = "/dev/disk/by-uuid/4e233c88-e91b-480c-b795-6fffc1fbdc69"; + fsType = "ext4"; + options = [ + "defaults" + "nofail" + "x-gvfs-show" + ]; + }; + + services.fstrim = { + enable = true; + interval = "weekly"; + }; + + zramSwap = { + enable = true; + algorithm = "zstd"; + memoryPercent = 100; + }; +} diff --git a/modules/navidrome.nix b/modules/navidrome.nix deleted file mode 100644 index ebf0879..0000000 --- a/modules/navidrome.nix +++ /dev/null @@ -1,61 +0,0 @@ -# modules/navidrome.nix -# Self-hosted music streaming server -{ - config, - pkgs, - lib, - username, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # NAVIDROME MUSIC SERVER - # ═══════════════════════════════════════════════════════════════ - services.navidrome = { - enable = true; - - settings = { - # Music library location - MusicFolder = "/home/${username}/Music"; - - # Server settings - # Bind to localhost only - access via Tailscale if needed remotely - Address = "127.0.0.1"; - Port = 4533; - - # UI settings - UIWelcomeMessage = "Welcome to Navidrome!"; - - # Enable transcoding (requires ffmpeg) - EnableTranscodingConfig = true; - - # Scan settings - ScanSchedule = "@every 1h"; # Rescan library every hour - - # Last.fm scrobbling (configure in UI after setup) - LastFM.Enabled = true; - - # Enable sharing features - EnableSharing = true; - - # Enable covers from external sources - CoverArtPriority = "cover.*, folder.*, front.*, embedded, external"; - - # Session timeout (24 hours) - SessionTimeout = "24h"; - - # Enable Prometheus metrics (optional) - # Prometheus.Enabled = true; - }; - }; - - # Firewall not needed - Navidrome binds to localhost only - # Uncomment if you need network access: - # networking.firewall.allowedTCPPorts = [ 4533 ]; - - # Ensure music directory exists and has correct permissions - systemd.tmpfiles.rules = [ - "d /home/${username}/Music 0755 ${username} users -" - ]; -} diff --git a/modules/power.nix b/modules/power.nix deleted file mode 100644 index 69465e7..0000000 --- a/modules/power.nix +++ /dev/null @@ -1,32 +0,0 @@ -# modules/power.nix -# Power management for desktop: CPU governor control, power profiles -{ - config, - pkgs, - lib, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # POWER PROFILES DAEMON - # ═══════════════════════════════════════════════════════════════ - # Provides power-saver, balanced, and performance profiles - # Can be switched via CLI or desktop integration - services.power-profiles-daemon.enable = true; - - # ═══════════════════════════════════════════════════════════════ - # CPU FREQUENCY SCALING - # ═══════════════════════════════════════════════════════════════ - # Use schedutil for modern AMD CPUs (responds to load dynamically) - powerManagement.cpuFreqGovernor = "schedutil"; - - # ═══════════════════════════════════════════════════════════════ - # PACKAGES - # ═══════════════════════════════════════════════════════════════ - environment.systemPackages = with pkgs; [ - power-profiles-daemon # Already enabled as service, CLI tool for control - ]; - - # NOTE: Kernel params (amd_pstate) are in configuration.nix -} diff --git a/modules/services.nix b/modules/services.nix deleted file mode 100644 index 424890c..0000000 --- a/modules/services.nix +++ /dev/null @@ -1,86 +0,0 @@ -# modules/services.nix -# System services: SSD maintenance, swap, mDNS, profile sync -{ - config, - pkgs, - lib, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # SSD MAINTENANCE - # ═══════════════════════════════════════════════════════════════ - # Weekly TRIM for SSDs (improves longevity and performance) - services.fstrim = { - enable = true; - interval = "weekly"; - }; - - # ═══════════════════════════════════════════════════════════════ - # ZRAM SWAP - # ═══════════════════════════════════════════════════════════════ - # Compressed swap in RAM - better than no swap, faster than disk - zramSwap = { - enable = true; - algorithm = "zstd"; # Best compression ratio - memoryPercent = 100; # Use up to 50% of RAM for compressed swap - }; - - # ═══════════════════════════════════════════════════════════════ - # MDNS / AVAHI - # ═══════════════════════════════════════════════════════════════ - # mDNS for local network discovery (.local domains) - services.avahi = { - enable = true; - nssmdns4 = true; # Enable .local resolution - openFirewall = true; # Allow mDNS through firewall - - publish = { - enable = true; - addresses = true; - workstation = true; - }; - }; - - # ═══════════════════════════════════════════════════════════════ - # PROFILE SYNC DAEMON - # ═══════════════════════════════════════════════════════════════ - # Sync browser profiles to RAM for faster performance - # Works with Firefox/Zen Browser profiles - services.psd = { - enable = true; - }; - - # User needs to configure ~/.config/psd/psd.conf after first run - # Default will auto-detect Firefox profiles - - # ═══════════════════════════════════════════════════════════════ - # ADDITIONAL SYSTEM OPTIMIZATIONS - # ═══════════════════════════════════════════════════════════════ - - # Enable firmware updates - services.fwupd.enable = true; - - # Thermald for Intel CPUs (AMD uses different thermal management) - # Uncomment if on Intel: - # services.thermald.enable = true; - - # Early OOM killer - prevents system freeze on memory exhaustion - services.earlyoom = { - enable = true; - freeMemThreshold = 5; # Start killing at 5% free memory - freeSwapThreshold = 10; # Also consider swap - enableNotifications = true; - }; - - # ═══════════════════════════════════════════════════════════════ - # LOCATE DATABASE - # ═══════════════════════════════════════════════════════════════ - # Fast file search with plocate - services.locate = { - enable = true; - package = pkgs.plocate; - interval = "daily"; - }; -} diff --git a/modules/services/avahi.nix b/modules/services/avahi.nix new file mode 100644 index 0000000..a2ab69b --- /dev/null +++ b/modules/services/avahi.nix @@ -0,0 +1,22 @@ +# modules/services/avahi.nix +# mDNS for local network discovery +{ + config, + pkgs, + lib, + ... +}: + +{ + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + + publish = { + enable = true; + addresses = true; + workstation = true; + }; + }; +} diff --git a/modules/services/default.nix b/modules/services/default.nix new file mode 100644 index 0000000..9b348e6 --- /dev/null +++ b/modules/services/default.nix @@ -0,0 +1,9 @@ +# modules/services/default.nix +{ + imports = [ + ./avahi.nix + ./printing.nix + ./maintenance.nix + ./navidrome.nix + ]; +} diff --git a/modules/services/maintenance.nix b/modules/services/maintenance.nix new file mode 100644 index 0000000..20df173 --- /dev/null +++ b/modules/services/maintenance.nix @@ -0,0 +1,26 @@ +# modules/services/maintenance.nix +# System maintenance and optimization services +{ + config, + pkgs, + lib, + ... +}: + +{ + services.psd.enable = true; + services.fwupd.enable = true; + + services.earlyoom = { + enable = true; + freeMemThreshold = 5; + freeSwapThreshold = 10; + enableNotifications = true; + }; + + services.locate = { + enable = true; + package = pkgs.plocate; + interval = "daily"; + }; +} diff --git a/modules/services/navidrome.nix b/modules/services/navidrome.nix new file mode 100644 index 0000000..bff08c3 --- /dev/null +++ b/modules/services/navidrome.nix @@ -0,0 +1,32 @@ +# modules/services/navidrome.nix +# Self-hosted music streaming server +{ + config, + pkgs, + lib, + username, + ... +}: + +{ + services.navidrome = { + enable = true; + + settings = { + MusicFolder = "/home/${username}/Music"; + Address = "127.0.0.1"; + Port = 4533; + UIWelcomeMessage = "Welcome to Navidrome!"; + EnableTranscodingConfig = true; + ScanSchedule = "@every 1h"; + LastFM.Enabled = true; + EnableSharing = true; + CoverArtPriority = "cover.*, folder.*, front.*, embedded, external"; + SessionTimeout = "24h"; + }; + }; + + systemd.tmpfiles.rules = [ + "d /home/${username}/Music 0755 ${username} users -" + ]; +} diff --git a/modules/services/printing.nix b/modules/services/printing.nix new file mode 100644 index 0000000..06f7563 --- /dev/null +++ b/modules/services/printing.nix @@ -0,0 +1,12 @@ +# modules/services/printing.nix +# CUPS printing service +{ + config, + pkgs, + lib, + ... +}: + +{ + services.printing.enable = true; +} diff --git a/modules/shell.nix b/modules/shell.nix deleted file mode 100644 index 216cd85..0000000 --- a/modules/shell.nix +++ /dev/null @@ -1,133 +0,0 @@ -# modules/shell.nix -# Fish shell configuration with plugins and aliases -{ - config, - pkgs, - lib, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # FISH SHELL - # ═══════════════════════════════════════════════════════════════ - programs.fish = { - enable = true; - - # Interactive shell init (equivalent to config.fish) - interactiveShellInit = '' - # Disable greeting - set -g fish_greeting - - # Ghostty shell integration - if set -q GHOSTTY_RESOURCES_DIR - source "$GHOSTTY_RESOURCES_DIR/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish" - end - - # Pure prompt configuration - set -g pure_show_system_time false - set -g pure_enable_single_line_prompt true - - # Key bindings (vi mode optional) - # fish_vi_key_bindings - - # Better directory navigation - set -g fish_prompt_pwd_dir_length 3 - - # Clear screen and show system info on new shell - clear && fastfetch - ''; - - # ═══════════════════════════════════════════════════════════════ - # ALIASES - # ═══════════════════════════════════════════════════════════════ - shellAliases = { - # ─── Modern Replacements ─── - ll = "eza -la --icons --git"; - ls = "eza --icons"; - la = "eza -la --icons"; - lt = "eza --tree --icons --level=2"; - cat = "bat"; - find = "fd"; - grep = "rg"; - df = "duf"; - du = "dust"; - sed = "sd"; - - # ─── Docker ─── - dc = "docker compose"; - dps = "docker ps"; - dpa = "docker ps -a"; - dl = "docker logs -f"; - dex = "docker exec -it"; - - # ─── Git ─── - gs = "git status"; - gd = "git diff"; - gds = "git diff --staged"; - gl = "git log --oneline -20"; - glo = "git log --oneline --graph --all"; - ga = "git add"; - gc = "git commit"; - gp = "git push"; - gpu = "git pull"; - gco = "git checkout"; - gb = "git branch"; - gst = "git stash"; - - # ─── NixOS ─── - rebuild = "sudo nixos-rebuild switch --flake ."; - rebuild-boot = "sudo nixos-rebuild boot --flake ."; - rebuild-test = "sudo nixos-rebuild test --flake ."; - update = "nix flake update"; - search = "nix search nixpkgs"; - gc-nix = "sudo nix-collect-garbage -d"; - - # User profile (GUI apps, fast-updating tools) - update-apps = "nix profile upgrade '.*'"; - list-apps = "nix profile list"; - - # ─── System ─── - ports = "ss -tulanp"; - myip = "curl -s ifconfig.me"; - ".." = "cd .."; - "..." = "cd ../.."; - "...." = "cd ../../.."; - - # ─── Safety ─── - rm = "rm -i"; - mv = "mv -i"; - cp = "cp -i"; - }; - - # ═══════════════════════════════════════════════════════════════ - # ABBREVIATIONS - # ═══════════════════════════════════════════════════════════════ - # Expand on space, more flexible than aliases - shellAbbrs = { - g = "git"; - d = "docker"; - n = "nix"; - v = "nvim"; - c = "code"; - z = "zeditor"; - }; - }; - - # ═══════════════════════════════════════════════════════════════ - # PLUGINS & PACKAGES - # ═══════════════════════════════════════════════════════════════ - # Fish plugins (managed by NixOS) - environment.systemPackages = with pkgs; [ - # Fish plugins - fishPlugins.pure # Pure prompt (minimal & fast) - fishPlugins.autopair # Auto-close brackets, quotes - fishPlugins.fzf-fish # Fzf integration for fish - fishPlugins.done # Notification when long command finishes - fishPlugins.grc # Colorize command output - - # Required by plugins/aliases - grc # Required by fishPlugins.grc - dust # Better du - ]; -} diff --git a/modules/theming.nix b/modules/theming.nix deleted file mode 100644 index 7f0560e..0000000 --- a/modules/theming.nix +++ /dev/null @@ -1,84 +0,0 @@ -# modules/theming.nix -# Visual theming: fonts, GTK/Qt themes, cursors, icons -{ - config, - pkgs, - lib, - ... -}: - -{ - # ═══════════════════════════════════════════════════════════════ - # FONTS - # ═══════════════════════════════════════════════════════════════ - fonts = { - packages = with pkgs; [ - # Your existing fonts - jetbrains-mono - nerd-fonts.jetbrains-mono - - # Additional fonts for full coverage - inter # Modern UI font - noto-fonts # Wide Unicode coverage - noto-fonts-cjk-sans # Chinese, Japanese, Korean - noto-fonts-color-emoji # Color emoji - - # Optional nice fonts - source-sans # Adobe Source Sans - source-serif # Adobe Source Serif - source-code-pro # Adobe Source Code - fira-code # Alternative coding font with ligatures - ]; - - fontconfig = { - enable = true; - - # Default fonts - defaultFonts = { - sansSerif = [ - "Inter" - "Noto Sans" - ]; - serif = [ "Noto Serif" ]; - monospace = [ - "JetBrainsMono Nerd Font" - "JetBrains Mono" - ]; - emoji = [ "Noto Color Emoji" ]; - }; - - # Font rendering settings - hinting = { - enable = true; - style = "slight"; - }; - antialias = true; - subpixel.rgba = "rgb"; - }; - }; - - # ═══════════════════════════════════════════════════════════════ - # GTK THEME - # ═══════════════════════════════════════════════════════════════ - environment.systemPackages = with pkgs; [ - # GTK themes - adw-gtk3 # GTK3 theme matching libadwaita - adwaita-icon-theme # GNOME icons (needed for many apps) - - # Icon theme - papirus-icon-theme # Modern, flat icons - - # Qt theming - libsForQt5.qt5ct # Qt5 configuration tool - kdePackages.qt6ct # Qt6 configuration tool - - # Theme tools - dconf-editor # Edit GNOME/GTK settings - nwg-look # GTK settings editor for Wayland - ]; - - # ═══════════════════════════════════════════════════════════════ - # CURSOR & ICON PATHS - # ═══════════════════════════════════════════════════════════════ - environment.pathsToLink = [ "/share/icons" ]; -}