# modules/hosts/laptop/configuration.nix — the laptop as a NixOS module # (self.nixosModules.laptop), assembled from the named modules it imports. # # PCSpecialist Valeon II 17 (TongFang GM7RGxM): Ryzen 9 6900HX, Radeon 680M at # 06:00.0, RTX 3070 Ti Laptop at 01:00.0, 2560x1440@240 panel. Hyprland under # uwsm, Caelestia Shell from home-manager (modules/home/), or Niri with # Noctalia Shell (modules/features/desktop/), greetd + ReGreet to log in. { self, ... }: { flake.nixosModules.laptop = { config, pkgs, lib, user, identity, ... }: { imports = with self.nixosModules; [ laptop-hardware laptop-fan-throttle-guard # dead-GPU-fan workaround (vault gpu-fan-fix/, imported unchanged) laptop-fan-extras # the one imperative step fanfix install did: the performance profile laptop-uniwill # the `uniwill` hwmon the guard reads: kernel 6.19 driver built for this kernel laptop-nvidia laptop-ssd laptop-virt # KVM/QEMU + libvirtd + virt-manager; VMs on /mnt/ssd (Kali domain) laptop-docker # rootless Docker (user service, DOCKER_HOST) for the `dock` CLI; no docker group laptop-nix-settings # nix daemon settings, caches, nh laptop-toolbox # envfs, ~/.local/bin on PATH, the touchpad udev rule laptop-sops # sops-nix: secrets/system/* (host key) → /run/secrets laptop-fan-cli # fan-ec: root side of the `fan` command (modules/home/fan.nix), passwordless for wheel workstation # Claude Code / desktop, Obsidian, git, gh, glab home-manager # the user's home, built with the system (modules/home/) desktop-options # daemon.desktop.* switches desktop-hyprland # Hyprland + Caelestia (NixOS side) desktop-niri # Niri + Noctalia: the wrapped package as the login session theme # shared boot and console colours, branded GRUB branded-login # greetd + ReGreet, matching the lock screen pentest # the offensive toolkit (modules/features/pentest/default.nix) steam # programs.steam ]; # The desktops. Both are installed and chosen at login; set one to false to # drop it (modules/features/desktop/options.nix). daemon.desktop = { hyprland.enable = true; niri.enable = true; }; # The offensive toolkit (modules/features/pentest/). Every switchable # category is listed here, so the whole toolkit is toggled from one place: # flip a `false` to `true` and `nh os switch`. # # 23 categories carry their own switch. The 12 not named below are on by # default: core, wordlists, python, recon, ad, web, pivot, crack, shells, # bloodhound, payloads, gui. The vpn/time/htb/update machinery has no # switch of its own — it follows `enable` below. See pentest-cheat. daemon.pentest = { enable = true; # Off by default: each adds a large closure, or needs hardware you may # not have plugged in. Nothing here is needed for CPTS. dfir.enable = false; # memory/disk/log forensics (volatility, sleuthkit) reversing.enable = false; # radare2, rizin, gdb+gef, pwntools wireless.enable = false; # wifi: aircrack, wifite, kismet, hostapd radio.enable = false; # SDR/bluetooth/RFID: hackrf, ubertooth, proxmark3 hardware.enable = false; # flashrom, openocd, sigrok, can-utils c2.enable = false; # havoc, villain database.enable = false; # mysql/mssql/redis/mongo clients cloud.enable = false; # aws, az, gcloud, kubectl, pacu osint.enable = true; # sherlock, maigret, shodan, theHarvester, recon-ng and metadata tools social.enable = false; # phishing: gophish, setoolkit — scoped work only mobile.enable = false; # apktool, jadx, frida, adb wine.enable = false; # wine + mono, to run $ysoserial/ysoserial.exe and other .NET Framework exes }; # GRUB (themed Rosé Pine Dawn by modules/features/theme.nix) on the EFI # partition at /boot; kernels are copied there since / is a separate btrfs. boot.loader.grub = { enable = true; efiSupport = true; device = "nodev"; configurationLimit = 20; }; boot.loader.efi.canTouchEfiVariables = true; # NordVPN's socket starts before its daemon. Create its parent with the # correct group first, so clients can reach it even during socket activation. services.nordvpn.enable = true; systemd.tmpfiles.rules = [ "d /run/nordvpn 0750 nordvpn nordvpn -" ]; systemd.services.nordvpnd = { requires = [ "nordvpnd.socket" ]; after = [ "nordvpnd.socket" ]; # The upstream module puts Requires in [Service]; it belongs in [Unit]. serviceConfig.Requires = lib.mkForce [ ]; }; networking.hostName = "nixos"; networking.networkmanager.enable = true; # LocalSend (modules/home/tools.nix) discovers peers and receives on 53317. networking.firewall.allowedTCPPorts = [ 53317 ]; networking.firewall.allowedUDPPorts = [ 53317 ]; time.timeZone = identity.timeZone; i18n.defaultLocale = "en_US.UTF-8"; services.xserver.xkb = { layout = "us"; options = "compose:caps,shift:both_capslock_cancel"; }; nixpkgs.config.allowUnfree = true; # nvidia, obsidian, claude-desktop users.users.${user} = { isNormalUser = true; description = identity.description; extraGroups = [ "networkmanager" "wheel" "nordvpn" ]; shell = pkgs.zsh; }; ##### Shell ################################################################## # zsh is the login shell. Its configuration is the dotfiles' ZDOTDIR tree # (modules/home/shell.nix): core.zsh runs a cached compinit and theme.zsh # starts starship, so the global compinit and the default prompt stay off. # /etc/zshrc still puts every profile's share/zsh/site-functions on fpath. programs.zsh = { enable = true; enableGlobalCompInit = false; promptInit = ""; }; # Binaries that are not built by Nix (uv-managed Pythons and their wheels, # anything mise or npm downloads) expect /lib64/ld-linux-x86-64.so.2. programs.nix-ld.enable = true; ##### Desktop ################################################################ # The compositors themselves are features (modules/features/desktop/): this # section is what every desktop shares — the greeter, portals, polkit, audio. # greetd retains authentication; branded-login supplies the graphical # ReGreet presentation and the existing Wayland session chooser. services.greetd.enable = true; security.pam.services.greetd.enableGnomeKeyring = true; # unlock the keyring at login (Claude desktop uses it) security.polkit.enable = true; # agent: hyprpolkitagent user service (modules/home/hyprland.nix) services.udisks2.enable = true; # udiskie services.power-profiles-daemon.enable = true; # the fan fix depends on it # Keep running with the lid closed, on battery, AC power, or a dock. services.logind.settings.Login = { HandleLidSwitch = "ignore"; HandleLidSwitchExternalPower = "ignore"; HandleLidSwitchDocked = "ignore"; }; services.gnome.gnome-keyring.enable = true; programs.dconf.enable = true; services.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; wireplumber.enable = true; }; programs.firefox.enable = true; services.printing.enable = true; # pinentry-switch (ported from the Mac toolbox): one pinentry-program, two # front ends. gpgx sets PINENTRY_USER_DATA=gpgx-tty for the verbs it cannot # drive by loopback (`key passwd`, `--use-agent`, `raw`); gpg forwards it to # the agent, which hands it to pinentry, so those prompts stay in the # terminal. Everything else (plain gpg, `git commit -S`, GUI apps) sets # nothing and gets the pinentry-gnome3 dialog, as before. programs.gnupg.agent = { enable = true; pinentryPackage = pkgs.writeShellApplication { name = "pinentry-switch"; text = '' case "''${PINENTRY_USER_DATA-}" in gpgx-tty|tty) exec ${pkgs.pinentry-tty}/bin/pinentry-tty "$@" ;; esac exec ${pkgs.pinentry-gnome3}/bin/pinentry-gnome3 "$@" ''; }; }; ##### Fonts ################################################################## # DMMono Nerd Font is not in nixpkgs; modules/home/tools.nix links it from # ~/NixDaemon/dotfiles/assets into ~/.local/share/fonts. fonts.packages = with pkgs; [ noto-fonts noto-fonts-color-emoji noto-fonts-cjk-sans rubik # Caelestia clock font material-symbols # Caelestia icons ]; fonts.fontconfig.defaultFonts = { monospace = [ "DMMono Nerd Font" "Noto Sans Mono" ]; sansSerif = [ "Noto Sans" ]; serif = [ "Noto Serif" ]; emoji = [ "Noto Color Emoji" ]; }; ##### Session environment #################################################### # uwsm imports these through the login shell. GPU-specific ones are in nvidia.nix. environment.sessionVariables = { ELECTRON_OZONE_PLATFORM_HINT = "auto"; GDK_BACKEND = "wayland,x11"; QT_QPA_PLATFORM = "wayland;xcb"; QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; }; environment.systemPackages = with pkgs; [ pciutils # lspci usbutils ]; system.stateVersion = "26.05"; } ; }