Imported from DenisSud/nixos-config (
AGENTS.md). Install upstream withnpx skills add DenisSud/nixos-config. Copyright stays with the author.
NixOS Configuration
My NixOS config, supporting two hosts:
pc— Desktop, AMD Ryzen + NVIDIA RTX 5070 (Blackwell). The "decked out" machine: Docker, Ollama+CUDA on LAN, Steam + gaming stack, Xray proxy.g14— ASUS ROG Zephyrus G14 laptop, AMD Cezanne iGPU + NVIDIA RTX 3050 Mobile (hybrid). The "lite" machine: no Docker, no Steam, no LibreOffice, no Ollama. Addsasusctl+supergfxdfor power/profile/dGPU-mode control.
Dotfiles are managed as separate git repos and symlinked into place (out-of-band from NixOS):
- dotfiles-shell — Fish + Starship + Ghostty
- dotfiles-nvim — Neovim config
- dotfiles-pi — Pi coding agent config
Repository Structure
nixos-config/
├── flake.nix # Flake entry point: nixpkgs + rip inputs (asusctl/supergfxd built-in)
├── flake.lock
├── AGENTS.md # This file
│
├── hosts/ # One entry file + one hardware file per machine
│ ├── pc.nix # PC host — composes common + PC-only modules
│ ├── pc-hardware.nix # generated by nixos-generate-config (do not edit)
│ ├── g14.nix # g14 host — composes common + ASUS module
│ └── g14-hardware.nix # generated by nixos-generate-config (do not edit)
│
└── modules/ # Functional split — one file per concern
├── boot.nix # systemd-boot + EFI (common)
├── nix.nix # flakes, nh, weekly gc (common)
├── network.nix # NetworkManager + firewall (common)
├── locale.nix # timezone + i18n (common)
├── graphics.nix # graphics, i2c, nvidia-ctk (common)
├── audio.nix # PipeWire + rtkit (common)
├── desktop.nix # GNOME + gdm (common)
├── fonts.nix # Inter + JetBrains Mono (common)
├── services.nix # openssh, flatpak, appimage,
│ # polkit, nix-index (common)
├── dev-tools.nix # LSPs, formatters, tree-sitter,
│ # gcc, pkg-config, nodejs (common)
├── shell-utils.nix # tmux, bat, fd, eza, gh, etc.
│ # + shell aliases + session
│ # vars (common)
├── user.nix # denis user + base user pkgs (common)
├── programs.nix # fish, direnv, gnupg, mtr (common)
│
├── virtualization.nix # Docker (PC only)
├── ollama.nix # ollama-cuda, LAN-exposed (PC only)
├── gaming.nix # Steam + ProtonUp-Qt + Lutris
│ # + Heroic + mangohud +
│ # gamescope + gamemode (PC only)
├── xray.nix # Xray systemd service (PC only)
│
└── asus.nix # asusctl + supergfxd (g14 only)
Pattern: Each host file in hosts/ is a thin composition layer — it imports
the common modules, the host-specific modules, and sets per-host values
(hostname, kernel, NVIDIA options, extra user packages). Modules themselves
are flat — they don't define custom options, they just declare config. To
add/remove a feature from a host, add/remove its module from the host's
imports list.
Machines
pc (Desktop)
- Hostname:
pc - GPU: NVIDIA RTX 5070 (Blackwell) with open kernel module
- Kernel:
linuxPackages_latest - systemd-boot
- Docker enabled
- Ollama (CUDA build) exposed to LAN on port
11434 - Steam + full gaming stack
- Xray proxy service (reads
/etc/xray/config.json) - LibreOffice + ddcutil-based monitor brightness GNOME extension
g14 (Laptop)
- Hostname:
g14 - GPU: AMD Cezanne (integrated) + NVIDIA RTX 3050 Mobile (hybrid)
- NVIDIA Prime offload mode (dGPU on demand via
nvidia-offloadorsupergfxctl) - Proprietary NVIDIA kernel modules (open modules don't play well with Prime hybrid yet)
- Full ASUS Linux stack (built into nixpkgs, no extra flake input):
services.asusd(profiles, fan curves, AniMe matrix, LED keyboard, ROG Control Center GUI) +services.supergfxd(dGPU mode switching)- Note:
supergfxctlis being phased out upstream — only keep it if you need vfio for VMs or have dGPU power-off issues. See https://asus-linux.org/guides/nixos
- Note:
- No Docker, Steam, LibreOffice, or Ollama — keeps rebuilds fast
- Default kernel (no
linuxPackages_latest)
Applying Configuration
Build (dry-run)
sudo nixos-rebuild dry-build --flake .#pc
# or
sudo nixos-rebuild dry-build --flake .#g14
Switch
sudo nixos-rebuild switch --flake .#pc
# or
sudo nixos-rebuild switch --flake .#g14
Using nh (Nix Helper)
# From any directory — nh reads the flake path from config (set in modules/nix.nix)
nh os switch
nh os boot
Update flake inputs
sudo nix flake update
Dotfiles Setup
After a fresh install, clone and link the dotfile repos:
# Clone repos
git clone git@github.com:DenisSud/dotfiles-shell.git ~/.dotfiles-shell
git clone git@github.com:DenisSud/dotfiles-nvim.git ~/.dotfiles-nvim
git clone git@github.com:DenisSud/dotfiles-pi.git ~/.dotfiles-pi
# Symlink everything
fish ~/.dotfiles-shell/fish/dotfiles.fish link
The dotfiles.fish script creates these symlinks:
| Source | Target |
|---|---|
~/.dotfiles-pi/settings.json |
~/.pi/agent/settings.json |
~/.dotfiles-pi/models.json |
~/.pi/agent/models.json |
~/.dotfiles-pi/themes |
~/.pi/agent/themes |
~/.dotfiles-pi/skills |
~/.pi/agent/skills |
~/.dotfiles-pi/extensions |
~/.pi/agent/extensions |
~/.dotfiles-nvim |
~/.config/nvim |
~/.dotfiles-shell/fish/config.fish |
~/.config/fish/config.fish |
~/.dotfiles-shell/starship.toml |
~/.config/starship.toml |
~/.dotfiles-shell/ghostty/config |
~/.config/ghostty/config |
Key Technologies
- NixOS with flakes and
nixos-unstable - ASUS Linux (built into nixpkgs via
services.asusd+services.supergfxd) for laptop power/profile/dGPU control - Fish shell (with Starship prompt)
- Ghostty terminal
- Neovim with Lua configuration
- GNOME desktop environment
- PipeWire for audio
- NVIDIA graphics with container toolkit
- Docker virtualization (PC only)
- Ollama local LLM server, CUDA-enabled (PC only)
- Steam + ProtonUp-Qt + Lutris + Heroic gaming (PC only)
- Xray proxy service (PC only)
Important Paths
- Hardware configs:
hosts/*-hardware.nix(generated bynixos-generate-config— do not edit) - Host entry files:
hosts/*.nix - Functional modules:
modules/*.nix
Secrets
User-specific secrets (API keys, tokens) are stored in ~/.env and sourced by Fish shell. This file is NOT tracked in git.
# ~/.env example:
set -gx OPENAI_API_KEY "sk-..."
Xray's /etc/xray/config.json is also deployed out-of-band (not managed by NixOS).
Development Tools Installed
- Editors: Neovim
- Terminal Tools: tmux, zellij, starship, eza, bat, fzf, fd, rip, btop-cuda
- Git Tools: git, git-lfs, gh
- LSP Servers: vtsls, vscode-langservers-extracted, emmet-language-server, gopls, rust-analyzer, lua-language-server, basedpyright, nil
- Formatters: nixfmt, stylua, prettierd, gofumpt, gotools, rustfmt, isort, black
- System Tools: fastfetch, onefetch, gh, pi-coding-agent
- Nix Helpers: nh, nix-index (replaces command-not-found)
Common Tasks
Add a new system package
Edit modules/shell-utils.nix (for shell tools) or the relevant functional module → environment.systemPackages.
Add a new user package
Edit modules/user.nix → users.users.denis.packages (for packages on both hosts), or hosts/{pc,g14}.nix for host-specific user packages.
Add a new feature module
- Create
modules/<feature>.nixwith{ ... }: { ... }config - Import it from
hosts/pc.nixand/orhosts/g14.nixas appropriate
Add a new host
- Run
sudo nixos-generate-config --flake .#hostnameand save the hardware config tohosts/<hostname>-hardware.nix - Create
hosts/<hostname>.nix— copyhosts/pc.nixorhosts/g14.nixas a template, adjust imports + per-host values - Add the new host to
flake.nix→nixosConfigurations
Rebuild after hardware changes
sudo nixos-generate-config --flake .#pc --show-hardware-config > hosts/pc-hardware.nix
Time Zone & Locale
- Time Zone:
Europe/Moscow - Default Locale:
en_US.UTF-8 - Additional locales: Russian (ru_RU.UTF-8) for address/currency/etc.
Notes
- Both hosts import the same set of common modules — host files only differ in which extra modules they pull in and per-host values (hostname, NVIDIA options, kernel, extra user packages).
- The firewall is on with explicit allowed ports (SSH on 22; Ollama on 11434 is auto-opened by
services.ollama.openFirewall). - Pi agent uses declarative config only; runtime state (sessions, auth) is per-device.
nhruns weekly garbage collection automatically.- Dotfiles are managed as independent git repos, not through NixOS (this is intentional — see "Dotfiles Setup" above).