Merge pull request 'Dendritic flake-parts layout, Stylix theming, agenix secrets, Claude Code tooling, nix-ld' (#1) from claude/busy-faraday-pr5ce1 into main

Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
Aleksey Selihov committed 2026-10-13 06:20:03 +00:00
commit 80ec3dfdd3
112 files changed
+3059 -1918

No files matched your search

Executable → Regular
+7 -4
View File
@@ -24,10 +24,13 @@ multi-agent workflow. The main session is the orchestrator; you work for it.
## Repository context
This is a NixOS flake (flakes, home-manager, agenix, disko, lanzaboote,
Hyprland via its own overlay, Noctalia shell). Custom options live under the
`my.*` namespace (`modules/nixos`, `modules/home`). See the root `CLAUDE.md`
and `README.md` before designing.
This is a NixOS flake in the dendritic layout (flake-parts + import-tree):
every `.nix` file under `modules/` is a flake-parts module, features are
aspects `flake.modules.nixos.<name>` / `flake.modules.homeManager.<name>`,
shared data lives in `config.meta` (`modules/users/`), hosts in
`modules/hosts/<name>/`, theming in `modules/theme/stylix.nix`. Stack:
home-manager, agenix, disko, lanzaboote, Hyprland via its own overlay,
Noctalia, Stylix. See the root `CLAUDE.md` and `README.md` before designing.
## Attempt tracking and escalation
Executable → Regular
View File
File mode changed.
+1 -1
View File
@@ -2,7 +2,7 @@
name: mao-implementer
description: Sonnet implementation agent. Use to implement a designed, scoped task, run the relevant checks, and self-review the diff. Escalates to mao-designer (Opus) after 3 failed attempts.
model: sonnet
effort: max
effort: xhigh
---
You are **mao-implementer**, the implementation agent in this repository's
View File
File mode changed.
View File
File mode changed.
Executable → Regular
View File
File mode changed.
Executable → Regular
+3
View File
@@ -9,3 +9,6 @@ result-*
# Images
*.qcow2
*.iso
# Serena writes per-project state into every repository it activates
.serena/
Executable → Regular
+39 -16
View File
@@ -2,23 +2,46 @@
## Repository overview
NixOS flake for the `desktop` host (user `faumaray`): flakes, home-manager,
agenix (secrets + SSH keys), disko (NVMe system disk + SATA SSD data disk),
lanzaboote (Secure Boot), Hyprland (from its flake, applied through its own
overlay), Noctalia shell, WezTerm, Neovim, Steam + Proton, full AMD
CPU/GPU support.
NixOS flake for the `desktop` host (user `faumaray`) in the dendritic layout:
every `.nix` file under `modules/` is a flake-parts module, imported by
import-tree. Features ("aspects") are `flake.modules.nixos.<name>` and
`flake.modules.homeManager.<name>`; a host imports the aspects it wants.
Stack: flake-parts, home-manager (NixOS module), agenix, disko, lanzaboote
(Secure Boot), Hyprland (own flake and overlay) + Noctalia, Stylix theming,
WezTerm, Neovim, Steam + Proton, proxy-suite, Docker and a Gitea runner,
Claude Code with MCP servers, full AMD support.
- `flake.nix`: inputs and outputs (`nixosConfigurations`, `apps`, `packages.iso`, `devShells`, `formatter`).
- `lib/`: helpers (`mkHost`).
- `overlays/`: custom overlays plus the upstream Hyprland overlay.
- `modules/nixos/`: NixOS modules, with custom options under `my.*`.
- `modules/home/`: home-manager modules, with custom options under `my.home.*`.
- `hosts/<name>/`: per-host config, `disko.nix`, `hardware-configuration.nix`.
- `secrets/`: `secrets.nix` (recipients) and encrypted `*.age` files. Never commit plaintext or `keys/`.
- `apps/`: install, key and secret helper scripts exposed as `nix run .#<app>`.
The canonical remote is Gitea (https://git.faumaray.com/faumaray/NixOsConfig);
GitHub is a secondary remote. Pull requests and issues are handled through the
Gitea MCP tools.
Conventions: format with `nix fmt` (nixfmt). New behaviour goes behind a
`my.*` option with an `enable` flag. Keep host files declarative and small.
- `flake.nix`: inputs and `nixConfig`; `outputs` is flake-parts over import-tree
of `modules/`.
- `modules/flake/`: glue: systems, `meta` (shared data), host construction
(`configurations.nixos`), overlays, packages, apps, dev shell, formatter, checks.
- `modules/users/`: `meta.owner`, the user identity every aspect reads.
- `modules/core/`: the `core` aspect every host imports (nix, nixpkgs, boot,
locale, networking, users, home-manager, facts for install-system; agenix
joins it from `modules/security/secrets.nix`).
- `modules/<area>/`: aspects (`boot`, `hardware`, `security`, `network`, `dev`,
`desktop`, `theme`, `cli`, `ai`, `gaming`); one file can define the NixOS and
the home-manager half of a feature.
- `modules/hosts/<name>/`: a host: aspect lists and host-only values
(`modules/hosts/desktop/host.nix`, plus `hardware.nix` and `disks.nix`).
- `modules/installer/`: the installer ISO.
- `hosts/<name>/`: files install-system writes (`hardware-configuration.nix`,
`disk-ids.json`); not modules.
- `pkgs/`: install, key and secret helpers (`nix run .#<app>`; the apps are
declared in `modules/flake/apps.nix`).
- `secrets/`: `secrets.nix` (recipients) and encrypted `*.age` files, all
optional (login password, SSH keys, `secrets/gitea-runner-token.age`,
`secrets/tg-ws-proxy-secret.age`). Never commit plaintext or `keys/`.
Conventions: format with `nix fmt` (nixfmt). New behaviour is a new aspect,
not an `enable` option: importing an aspect enables it. Shared values come from
`config.meta`, bound in a `let` before any NixOS/home-manager module;
home-manager halves read the system through `osConfig`. Theming goes through
`modules/theme/stylix.nix`. Keep host files small.
Checks: `nix flake check --no-build` and
`nix eval .#nixosConfigurations.desktop.config.system.build.toplevel.drvPath`.
@@ -34,7 +57,7 @@ re-delegate it or act as orchestrators.
|---|---|---|
| main session | `fable` / `max` (see `.claude/settings.json`) | Orchestrator |
| `mao-designer` | opus / max | Designs, acceptance criteria, escalations |
| `mao-implementer` | sonnet / max | Implements, tests, self-reviews |
| `mao-implementer` | sonnet / xhigh | Implements, tests, self-reviews |
| `mao-sonnet-reviewer` | sonnet / max | Independent implementation review |
| `mao-opus-reviewer` | opus / max | Final independent review |
| `mao-helper` | haiku | Searches, summaries, routine git |
Executable → Regular
+393 -45
View File
@@ -3,13 +3,27 @@
Declarative NixOS for one AMD desktop (`desktop`, user `faumaray`), installable
from a USB stick with a single command.
The canonical remote is Gitea: <https://git.faumaray.com/faumaray/NixOsConfig>
(`origin`). GitHub (<https://github.com/Faumaray/NixOsConfig>, remote `github`)
is a secondary remote.
## Features
- **Flake** with home-manager, agenix, disko, lanzaboote and nixos-hardware.
- **Flake** in the dendritic layout (flake-parts + import-tree) with
home-manager, agenix, disko, lanzaboote, nixos-hardware and Stylix.
- **Hyprland** (from its own flake, current git) under UWSM with the
**Noctalia v5** shell, WezTerm, Neovim, zsh + starship.
**Noctalia v5** shell, WezTerm, Neovim, zsh + starship and Dolphin. SDDM logs
the user straight into the session (autologin).
- **Stylix theming**: Catppuccin Mocha, Monaspace and Inter fonts, Bibata cursor
and Papirus icons for GTK, Qt, the TTY, Hyprland, Noctalia, WezTerm and the
command-line tools, all from one file.
- **Gaming**: Steam with Proton-GE, gamescope, gamemode, MangoHud.
- **Full AMD**: AMD CPU, Radeon GPU (Mesa, LACT, optional ROCm).
- **Network**: proxy-suite (zapret, Telegram WebSocket proxy), AmneziaVPN,
NetworkManager with the OpenVPN plugin.
- **Dev**: Docker (rootless and rootful), a Gitea Actions runner, **nix-ld**
and AppImage support for binaries built for other distros, and **Claude
Code** with codebase-memory-mcp, Serena, REA and caveman.
- **Disks via disko, btrfs, no encryption**:
- NVMe: ESP (`/boot`, 2G) + btrfs `nixos` with `@root @home @nix @log @swap`
(16G swapfile).
@@ -24,45 +38,165 @@ from a USB stick with a single command.
## Layout
```
flake.nix inputs and outputs
lib/ mkHost, mkInstaller
overlays/ hyprland (upstream), noctalia, additions (./pkgs), modifications
flake.nix inputs and nixConfig; outputs = flake-parts over import-tree of modules/
flake.lock pinned inputs (committed)
modules/ every .nix file below is a flake-parts module (import-tree)
flake/ glue: systems, meta (shared data), hosts -> nixosConfigurations,
overlays, packages, apps, dev shell, formatter, checks
users/ meta.owner: the user's identity (faumaray.nix)
core/ the `core` aspect every host imports: nix, boot, locale, networking,
users, home-manager, facts for install-system
boot/ secure-boot (lanzaboote) or systemd-boot
hardware/ amd (CPU, GPU, LACT), rocm (optional, not imported by desktop)
security/ secrets (agenix), ssh (server and client)
network/ vpn (AmneziaVPN), proxy-suite (zapret, Telegram proxy)
dev/ docker, gitea-runner, nix-ld (foreign binaries, AppImage)
desktop/ hyprland (+ its Lua files), noctalia, audio, fonts, wezterm, xdg, apps
theme/ stylix: scheme, fonts, cursor, icons, target list
cli/ shell, git, neovim
gaming/ steam
ai/ claude-code
installer/ the installer ISO
hosts/desktop/ host.nix (aspects + host-only values), hardware.nix, disks.nix
hosts/desktop/ written by install-system: hardware-configuration.nix, disk-ids.json (not modules)
pkgs/ install-system, create-keys, set-password, secret-from-file, switch-system
apps/ the same tools as `nix run .#<app>`
modules/nixos/ NixOS modules, options under my.*
modules/home/ home-manager modules, options under my.home.*
modules/installer/ the installer ISO
hosts/desktop/ default.nix (the host), disks.nix, disk-ids.json, hardware-configuration.nix, home.nix
secrets/ secrets.nix (recipients) and the encrypted *.age files
keys/ PRIVATE keys, gitignored, lives only on your USB stick
.claude/, CLAUDE.md project settings and instructions for Claude Code sessions
```
### How it is organised
### How it is organised (dendritic)
- `lib.mkHost` builds a host from `hosts/<name>` plus every module in
`modules/nixos`. A module does nothing until its `my.*` option is switched on,
so the host file stays short and declarative.
- Overlays are composed in `overlays/default.nix`. `overlays/additions.nix`
adds everything in `pkgs/`; `overlays/modifications.nix` changes existing
packages. Put your own tweaks there.
- `my.*` options (NixOS): `my.user`, `my.locale`, `my.boot.secureBoot.enable`,
`my.hardware.amd`, `my.disks`, `my.desktop.hyprland.enable`,
`my.gaming.enable`, `my.secrets`. Home-manager side: `my.home.<module>.enable`,
switched on in `hosts/desktop/home.nix`.
- To add a machine: copy `hosts/desktop`, register it in `flake.nix`
(`myLib.mkHost { hostname = "..."; }`).
- **Every `.nix` file under `modules/` is a flake-parts module.** `flake.nix`
only declares inputs; its `outputs` is
`flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules)`.
import-tree imports every file below `modules/` (paths containing `/_` are
skipped), so there are no import lists: `git add` a new file and it is part of
the flake.
- **An aspect is one feature**, published as `flake.modules.nixos.<name>` (a
NixOS module) and/or `flake.modules.homeManager.<name>` (a home-manager
module). One file can define both halves, e.g. `modules/security/ssh.nix`
(server and client). Importing an aspect turns the feature on: there are no
`enable` options. Alternatives are separate aspects (`secure-boot` or
`systemd-boot`). `core` is the always-on basics, merged from
`modules/core/*.nix` and the agenix import in `modules/security/secrets.nix`.
- **A host picks aspects.** `modules/hosts/desktop/host.nix` sets
`configurations.nixos.desktop.module`: the list of NixOS aspects, the owner's
home-manager aspects and the values that belong to this machine only (time
zone, locale, keyboard layouts, firewall, `stateVersion`s). `hardware.nix` and
`disks.nix` add to the same module. `modules/flake/nixos.nix` turns every
`configurations.nixos.<name>` into `nixosConfigurations.<name>` and
`checks.<system>.nixos-<name>`.
- **A combined aspect attaches its home-manager half to the owner** from its
NixOS half (`home-manager.users.<owner>.imports`), so the host imports it
once. Home-manager-only aspects (`shell`, `git`, `neovim`, `wezterm`, `xdg`,
`apps`, `claude-code`) are listed in the host's `home-manager.users.<owner>`
block.
- **Shared data** is two typed top-level flake-parts options (schema in
`modules/flake/meta.nix`, not a flake output): `meta.owner` (name, full name,
e-mail, uid, SSH keys; the values are in `modules/users/faumaray.nix`) and
`meta.secretsDir` (default `./secrets`). A file reads them from the
flake-parts `config`, bound in a `let` *before* any NixOS or home-manager
module (inside `{ config, ... }:` of those, `config` is the NixOS or
home-manager configuration), so both halves get the values by closure.
- **Host values are plain NixOS options** (`time.timeZone`,
`services.xserver.xkb`, ...), set in `host.nix`. A home-manager half reads
them, and everything else on the system side (`osConfig.age.secrets`, ...),
through `osConfig`, home-manager's handle on the NixOS configuration.
- The only custom option left is the read-only `config.my` in
`modules/core/install-facts.nix`, a compatibility view of the real
configuration that `install-system` evaluates; aspects never read it.
> No `flake.lock` is committed yet. The first build (or `install-system`)
> locks all inputs with `nix flake lock`; commit the resulting `flake.lock` so
> installs and the ISO are reproducible.
Rules of thumb:
- A third-party module is imported by exactly one aspect (agenix and
home-manager: `core`; lanzaboote: `secure-boot`; Stylix: `theme`; disko: the
host's `disks.nix`). Importing it twice declares its options twice.
- A dynamic attribute such as `users.users.${owner.name}` may appear only once
per attribute set: put everything for the owner into one block.
- A secret is declared (`age.secrets.<name>`) only when
`meta.secretsDir + "/<name>.age"` exists, with a `warnings` entry otherwise.
Never put a secret value into a `.nix` file.
#### Add an aspect
1. Create `modules/<area>/<name>.nix` with a header comment (what it does; for a
combined aspect, what each half does).
2. Define `flake.modules.nixos.<name>` and/or `flake.modules.homeManager.<name>`.
A combined aspect adds its home-manager half from the NixOS half:
```nix
{ config, ... }:
let
# flake-parts' config: read shared values here, before the `config` argument
# of a NixOS or home-manager module shadows the name.
inherit (config.meta) owner;
hmFoo = config.flake.modules.homeManager.foo;
in
{
flake.modules.nixos.foo =
{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.hello ];
home-manager.users.${owner.name}.imports = [ hmFoo ];
};
flake.modules.homeManager.foo =
{ osConfig, ... }:
{
programs.git.settings.user.email = owner.email;
home.sessionVariables.KB_LAYOUT = osConfig.services.xserver.xkb.layout;
};
}
```
3. If Stylix supports the program, add `stylix.targets.<program>.enable = true;`
to `modules/theme/stylix.nix` (its home-manager half for user programs).
4. Add the name to the NixOS list (or the home-manager list) in
`modules/hosts/<host>/host.nix`.
5. `git add` the new file (flakes only see tracked files), run `nix fmt` and
`nix flake check --no-build`.
#### Add a host
1. Create `hosts/<new>/` with `disk-ids.json`
(`{"system": "/dev/disk/by-id/nvme-CHANGE-ME", "data": "/dev/disk/by-id/ata-CHANGE-ME"}`)
and a placeholder `hardware-configuration.nix` (`hosts/desktop/`'s is a
template). `install-system` rewrites both and needs the directory to exist.
2. Copy `modules/hosts/desktop/` to `modules/hosts/<new>/`. In each file replace
`configurations.nixos.desktop` with `configurations.nixos.<new>` and the
`hosts/desktop/` paths; adjust the aspect lists, time zone and keyboard
layouts, firewall, disks and the `stateVersion`s.
3. `git add` everything, then `nix run .#install -- --host <new>` on the target.
If a second host needs the same disk layout, lift `disks.nix` into a shared
aspect at that point.
### Flake outputs
| Output | Contents |
|---|---|
| `nixosConfigurations` | `desktop`, `installer` |
| `packages.x86_64-linux` | `create-keys`, `install-system`, `iso`, `secret-from-file`, `set-password`, `switch-system` |
| `apps.x86_64-linux` | `create-keys`, `install`, `secret-from-file`, `set-password`, `switch` |
| `checks.x86_64-linux` | `create-keys`, `formatting`, `install-system`, `nixos-desktop`, `secret-from-file`, `set-password`, `switch-system` |
| `devShells.x86_64-linux` | `default` (`nix develop`: agenix, disko, age, ssh-to-age, sbctl, git, nixfmt, nixd, shellcheck) |
| `formatter.x86_64-linux` | `nix fmt` (nixfmt; skips the generated `hosts/*/hardware-configuration.nix`) |
| `overlays` | `hyprland`, `noctalia`, `additions`, `modifications`, and `default`, which composes the four |
| `modules` | `nixos.<aspect>`, `homeManager.<aspect>` |
`checks.x86_64-linux.nixos-desktop` is the host's toplevel: with `--no-build`,
`nix flake check` evaluates the whole host down to its derivation, without it
the host is built. `formatting` is the nixfmt check; the five tools are checks
too (their shellcheck runs when they are built).
## First-time setup (on your current machine)
Everything here is **optional**. Without it the system still installs; the
login password then is `changeme` (with a warning) and there is no SSH key.
login password then is `changeme` (with a warning), there is no SSH key, the
Gitea runner is not configured and the Telegram proxy is off (a warning each).
```sh
git clone <this repo> nixos-config && cd nixos-config
git clone https://git.faumaray.com/faumaray/NixOsConfig nixos-config && cd nixos-config
# 1. Host SSH key (the agenix identity) and Secure Boot keys -> keys/desktop/
nix run .#create-keys
@@ -91,6 +225,46 @@ Copy the whole directory, **including `keys/`**, to the USB stick (and back
The installer copies them to `/etc/ssh` and `/var/lib/sbctl`; if they are
missing it generates new ones and saves them back to the stick.
### Secrets
| File in `secrets/` | Content | Consumer |
|---|---|---|
| `faumaray-password.age` | hashed login password (`mkpasswd -m yescrypt`; `set-password`) | the user account (`modules/core/users.nix`) |
| `ssh-id_ed25519.age`, `ssh-id_ed25519_work.age` | private SSH keys (+ optional plain `.pub` files) | linked to `~/.ssh/<key>` (`modules/security/ssh.nix`) |
| `gitea-runner-token.age` | one line `TOKEN=<registration token>` | Gitea runner `performance`, `tokenFile` (`modules/dev/gitea-runner.nix`) |
| `tg-ws-proxy-secret.age` | the hex secret (32 hex digits, generated below) | Telegram proxy, `secretFile` (`modules/network/proxy-suite.nix`) |
The last two are new: the runner token and the Telegram secret used to be
plaintext in the Nix files. Create them the same way as the others (the
recipients are already listed in `secrets/secrets.nix`; `secret-from-file` runs
`git add` for you):
```sh
# Gitea runner: a fresh registration token from the Gitea runners page.
# The editor opens; type one line: TOKEN=<registration token>
(cd secrets && agenix -e gitea-runner-token.age -i ~/.ssh/id_ed25519)
# or without an editor (the token lands in your shell history):
printf 'TOKEN=%s\n' '<registration token>' \
| nix run .#secret-from-file -- gitea-runner-token.age - -i ~/.ssh/id_ed25519
# Telegram proxy: a new secret; note it, the Telegram clients need it in the proxy link
s=$(od -An -N16 -tx1 /dev/urandom | tr -d ' \n') && [ "${#s}" -eq 32 ] && echo "$s" \
&& printf '%s\n' "$s" | nix run .#secret-from-file -- tg-ws-proxy-secret.age - -i ~/.ssh/id_ed25519
unset s
git add secrets/gitea-runner-token.age secrets/tg-ws-proxy-secret.age # agenix -e does not
```
(`-` reads the plaintext from stdin, so no plaintext file is left behind; add
`--force` to replace an existing file. Show a stored secret again with
`age -d -i ~/.ssh/id_ed25519 secrets/tg-ws-proxy-secret.age`.)
**Rotate the old values.** They are in the git history, so treat them as leaked:
create a new runner registration token in Gitea and a new MTProto secret, and
update the Telegram clients with the new proxy link. Until the two files exist a
switch removes the runner instance and turns the Telegram proxy off, each with
an evaluation warning.
## Install from USB
Needs a UEFI PC and network. **The NixOS installer image is not Secure Boot
@@ -163,7 +337,8 @@ Useful options: `--host`, `--flake DIR`, `--keys-dir DIR`, `--select-disks`,
## After the installation
Reboot, remove the stick, log in (greetd/tuigreet: pick **Hyprland**).
Reboot, remove the stick. SDDM logs `faumaray` in automatically and starts
Hyprland (UWSM session); the login password is for `sudo` and the TTYs.
**Secure Boot** (lanzaboote). The keys exist but the firmware does not trust them yet:
@@ -188,22 +363,148 @@ Reboot, remove the stick, log in (greetd/tuigreet: pick **Hyprland**).
Proton-GE appears under the compatibility tool list.
**Noctalia** starts with the session (a systemd user service). `Super+Space`
launcher, `Super+S` control center, `Super+,` settings. Changes made in the
settings window are stored by Noctalia and override `modules/home/noctalia.nix`;
move what you want to keep into that file.
launcher, `Super+S` control center, `Super+,` settings. Its colours come from
Stylix (see Theming). Changes made in the settings window are stored by
Noctalia and override `modules/desktop/noctalia.nix`; move what you want to keep
into that file.
Commit the files the installer generated:
`hosts/desktop/disk-ids.json`, `hosts/desktop/hardware-configuration.nix`, `flake.lock`.
`hosts/desktop/disk-ids.json` and `hosts/desktop/hardware-configuration.nix`
(and `flake.lock` if it changed).
## Theming (Stylix)
One palette for the whole desktop, applied by [Stylix](https://github.com/nix-community/stylix).
Everything is set in `modules/theme/stylix.nix`: the NixOS half holds the scheme,
fonts, cursor, icons and the system-wide targets, the home-manager half the
per-program targets.
| Setting | Value |
|---|---|
| Scheme | Catppuccin Mocha (16 colours inline, so evaluation needs no import-from-derivation), polarity dark |
| Fonts | monospace Monaspace Radon, sans Inter, serif Noto Serif, emoji Noto Color Emoji; WezTerm and Noctalia keep Monaspace Krypton through a per-target override |
| Cursor | Bibata-Modern-Classic, 24 |
| Icons | Papirus-Dark (Papirus-Light for a light scheme) |
| Wallpaper | none: Noctalia draws it |
Targets are opt-in (`stylix.autoEnable = false`), so Stylix touches only what is
listed:
- NixOS: `console` (TTY palette), `fontconfig`, `font-packages`, `gtk`.
- home-manager: `gtk`, `qt` (qt5ct/qt6ct + Kvantum), `hyprland`, `noctalia`,
`wezterm`, `bat`, `btop`, `fzf`, `starship`, `mpv`, `zathura`.
- Everything else is off, `neovim` and `firefox` on purpose (see below).
How to change it:
- **Turn a target off**: set `stylix.targets.<name>.enable = false;` (or delete
the line) in the matching half of `modules/theme/stylix.nix`. This is also the
way back for one program if you dislike the new look.
- **Change the scheme**: edit the `base16Scheme` colours, or point it at a
packaged scheme, `"${pkgs.base16-schemes}/share/themes/<name>.yaml"` (that is
import-from-derivation: evaluation then builds it). For a light scheme also
set `stylix.polarity`, and change `gtk.colorScheme` and the dconf
`color-scheme` (both fixed to dark in the home-manager half).
- **Noctalia follows the palette**: Stylix's `noctalia` target writes a custom
palette `stylix` (`~/.config/noctalia/palettes/stylix.json`) and selects it.
Its opacity part is off, so Noctalia keeps its own panel opacities, and the
shell font stays Monaspace Krypton. Settings changed in Noctalia's own window
still override the file.
- **Hyprland**: Stylix sets the border, group, shadow and background colours
after `settings.lua` is loaded, so the colour literals in that file no longer
take effect; disable the `hyprland` target to use your own.
- **Neovim keeps catppuccin on purpose.** `modules/cli/neovim/init.lua` sets its
own colorscheme and lualine theme; Stylix's neovim target would append
mini.base16 after it and clear the highlight groups they created. The palette
is Catppuccin Mocha either way, so the look matches.
- Firefox is not themed: Stylix needs a profile declared in home-manager, which
would hide your existing one.
Visible changes compared with the configuration before Stylix:
- The TTY uses the Catppuccin palette.
- GTK apps use `adw-gtk3` with Stylix CSS and Inter 12 (was `adw-gtk3-dark`);
the default serif font is Noto Serif (was DejaVu Serif).
- Qt apps (Dolphin, Telegram, TeamSpeak) use Kvantum with the palette (was
adwaita-dark).
- Hyprland borders, groups and shadows use the palette (blue/surface; they were
the Hyprland default cyan/grey).
- Noctalia uses the `stylix` palette and WezTerm the generated `stylix` scheme;
bat, btop, fzf, starship, mpv and zathura follow the palette.
## Claude Code tools
`modules/ai/claude-code.nix` is a home-manager-only aspect (`claude-code`, listed
in `host.nix`). It installs, for the owner (user scope):
| What | Details |
|---|---|
| `claude` | Claude Code from nixpkgs (unfree, allowed in `core`) |
| MCP `codememory` | codebase-memory-mcp (DeusData), a code knowledge graph; the CLI is on PATH, indexes live in `~/.cache/codebase-memory-mcp`. To use another server, replace this one `mcpServers` entry |
| MCP `serena` | Serena, semantic code retrieval and editing; the `serena` flake input pinned to a release tag, started per project (`--project-from-cwd`; the dashboard is started but not opened in a browser, and listens only on 127.0.0.1) |
| MCP `rea` | REA (Reverse Engineer Anything), `npx --yes rea-agents@<pinned version> mcp`; wrapper `rea` on PATH, plus REA's skill `reverse-engineer-anything` from the same npm release |
| plugin `caveman` | skills, commands, agents and hooks (JuliusBrussee/caveman at a pinned tag); its default mode is off, `/caveman` turns it on per session |
Where it lands in the home:
- `~/.claude/settings.json`: merged on every switch and still writable
(`mutableSettings`); the aspect only sets `env.MCP_TIMEOUT`. It sets no model,
effort, permissions or hooks, so a repository's own `.claude/settings.json`
applies as before.
- `~/.claude/skills/claude-code-home-manager` (home-manager's generated plugin
that carries the three MCP servers; their tools are named
`mcp__plugin_hm_<server>__<tool>`), `~/.claude/skills/caveman` and
`~/.claude/skills/reverse-engineer-anything`.
- `~/.config/caveman/config.json` = `{"defaultMode": "off"}`, written once if
missing (caveman may change it later).
- On PATH: `codebase-memory-mcp`, `serena`, `rea` and `node` (caveman's hooks need
it). `~/.claude.json` (Claude Code's own state) is not touched.
What is not hermetic or worth knowing:
- **REA runs from npm**: the first start downloads the pinned version and its
dependencies into `~/.npm` (needs network; the dependency tree is not pinned).
Standalone executables shipped by npm packages rely on the `nix-ld` aspect;
`.node` add-ons loaded by the Nix-built `node` do not. REA's skill and
caveman are fetched with fixed hashes.
- **Serena writes `.serena/` into every project it activates** (it is in this
repository's `.gitignore`). It is built locally from its lock file, not
downloaded from a binary cache, so the first switch takes longer.
- Plugins run code: caveman's hooks run `node` scripts in every session.
- The first switch moves existing files at these paths to `*.hm-backup` (not
`settings.json`, which is merged). `home-manager.overwriteBackup = true`
(`modules/core/home-manager.nix`) lets later switches replace an older
`*.hm-backup` instead of stopping.
Bump a pin:
- Serena: change the tag of the `serena` input in `flake.nix`, then
`nix flake update serena`. Serena v1.7.0's own flake uses the deprecated
`stdenv.isLinux` / `stdenv.isDarwin` (the two warnings seen at every
evaluation); a future nixpkgs update may remove them and require bumping the
`serena` input.
- REA: change `reaVersion` in `modules/ai/claude-code.nix`, then
`nix store prefetch-file --unpack --hash-type sha256 https://registry.npmjs.org/rea-agents/-/rea-agents-<version>.tgz`
and put the printed hash into `hash`.
- caveman: change `tag`, then `nix flake prefetch github:JuliusBrussee/caveman/<tag>`
and put its hash into `hash`.
## Day-2
```sh
switch-system # nh os switch (or: switch-system boot | test)
nix flake update # new inputs, then switch-system
nix fmt # nixfmt
nix flake check --no-build
nh os switch # rebuild + activate (flake: ~/nixos-config); also nh os boot | nh os test
nix run .#switch # the same through the repo helper switch-system (-- boot | test)
nix flake update # new inputs, then switch (one input: nix flake update stylix)
nix fmt # nixfmt over the whole tree
nix flake check --no-build # evaluates every check, including the whole desktop host
nix build .#checks.x86_64-linux.nixos-desktop # builds the whole system without activating it
```
`nix flake check --no-build` builds nothing, so a failure that only shows at
build time (for example Noctalia validating its generated `config.toml`) appears
in the `nixos-desktop` build or in the switch itself. After `nix flake update`
build first.
Roll back: pick an older generation in the boot menu, or
`sudo nixos-rebuild switch --rollback`.
@@ -216,30 +517,77 @@ sudo btrfs subvolume create /mnt/data/@projects
sudo umount /mnt/data
```
then add `Projects = { };` to `homeFolders` in `hosts/desktop/disks.nix`
(subvolume name defaults to `@projects`) and run `switch-system`.
then add `Projects = { };` to `homeFolders` in `modules/hosts/desktop/disks.nix`
(subvolume name defaults to `@projects`) and switch.
**Change a secret**: `cd secrets && agenix -e faumaray-password.age -i ~/.ssh/id_ed25519`
(or run `set-password` / `secret-from-file` again with `--force`), `git add`, switch.
### Foreign binaries (nix-ld, AppImage)
The `nix-ld` aspect (`modules/dev/nix-ld.nix`) runs programs built for other
Linux distributions. nix-ld gives plain ELF binaries a dynamic linker and a broad
library set (`NIX_LD`, `NIX_LD_LIBRARY_PATH`); `.AppImage` files run directly
through `appimage-run` (binfmt). When a binary stops with `error while loading
shared libraries: libfoo.so.N`, add the package that ships it to
`programs.nix-ld.libraries` in that file and switch. AppImages do not use
nix-ld: give them extra libraries through `programs.appimage.package`.
### Verify in a fresh session
From the repository root of a fresh clone or shell (new files must be
`git add`ed first), these confirm that the configuration evaluates:
```sh
nix flake check --no-build # ends with: all checks passed!
nix eval --raw .#nixosConfigurations.desktop.config.system.build.toplevel.drvPath
nix eval --raw .#packages.x86_64-linux.iso.drvPath
nix build .#checks.x86_64-linux.formatting # nixfmt check, same formatter as `nix fmt`
nix flake show # the outputs listed under "Flake outputs"
```
The two `nix eval` lines print a `/nix/store/...-nixos-system-desktop-26.11...drv`
and the ISO's `.drv`. The only warnings to expect are `stdenv.isLinux is
deprecated` and `stdenv.isDarwin is deprecated` (Serena's pinned uv2nix and
another input), `unknown flake output 'modules'` (the flake-parts `modules`
output), and, until `secrets/gitea-runner-token.age` and
`secrets/tg-ws-proxy-secret.age` exist, one warning each for the runner and the
Telegram proxy.
## Troubleshooting
- **The PC does not boot after enabling Secure Boot.** Disable Secure Boot in
the firmware and boot. To go back to plain systemd-boot set
`my.boot.secureBoot.enable = false;` in `hosts/desktop/default.nix` and run
`switch-system boot`. `sbctl enroll-keys` refusing to run means the firmware
is not in Setup Mode.
the firmware and boot. To go back to plain systemd-boot replace `secure-boot`
with `systemd-boot` in the `imports` list of `modules/hosts/desktop/host.nix`
and run `nh os boot` (or `nix run .#switch -- boot`); the installer's closing
hint gives the same instruction.
`sbctl enroll-keys` refusing to run means the firmware is not in Setup Mode.
- **Secrets do not decrypt** (no password, no `~/.ssh/id_ed25519`). The host key
in `secrets/secrets.nix` must match `/etc/ssh/ssh_host_ed25519_key.pub` on the
machine. Test: `sudo age -d -i /etc/ssh/ssh_host_ed25519_key secrets/<name>.age`.
Fix `secrets.nix`, re-encrypt (`agenix -r -i <your key>`), `git add`, switch.
Meanwhile log in with `changeme` (when no password secret is defined) and
run `passwd`.
- **The Gitea runner or the Telegram proxy is gone after a switch.** The two
service secrets do not exist yet; see "Secrets" under First-time setup. The
evaluation warning names the missing file.
- **The SSD is missing or fails.** Its mounts use `nofail` and a 10 s timeout, so
the system still boots from the NVMe. Files written to `~/Games` meanwhile land
on the NVMe and are hidden once the SSD is mounted again.
- **A new file is "not found" by Nix.** Flakes only see git-tracked files: `git add` it.
- **The installer stopped halfway.** Run it again with `--disko-mode mount` (and
the same `--flake`); partitions and the already installed host key are reused.
- **Slow first build / compiling Hyprland or Noctalia.** The binary caches in
`flake.nix` (`nixConfig`) must be accepted; use `--accept-flake-config`.
- **Slow first build / compiling Hyprland, Noctalia or Serena.** The binary caches in
`flake.nix` (`nixConfig`) must be accepted; use `--accept-flake-config`. Serena
is always built locally.
- **A switch stops at an existing `*.hm-backup` file.** Home-manager moves files
it now manages (GTK/Qt/Kvantum configs, `~/.claude/skills/*`) to `*.hm-backup`.
`home-manager.overwriteBackup = true` (`modules/core/home-manager.nix`)
replaces an older backup, so this should only happen if that setting was
removed: look at the backup, then delete it. Files such as
`~/.config/gtk-3.0/gtk.css` or `~/.config/qt6ct/qt6ct.conf` can be rewritten
by Noctalia's GTK template or the qt*ct tools; the next switch backs the
rewritten file up again.
- **WezTerm starts with default colours or fonts after an update.** WezTerm drops
its whole config silently when a value does not parse (Stylix writes the
palette). `WEZTERM_LOG=debug wezterm show-keys` must log `Reloaded configuration`.
-16
View File
@@ -1,16 +0,0 @@
# `nix run .#<app>`: install and key/secret helpers (see ../pkgs).
{ pkgs, ... }:
let
app = pkg: description: {
type = "app";
program = pkgs.lib.getExe pkg;
meta.description = description;
};
in
{
install = app pkgs.install-system "Install this flake onto this machine from the NixOS installer (wipes the configured disks)";
create-keys = app pkgs.create-keys "Create the SSH host key and Secure Boot keys in keys/<host>/";
set-password = app pkgs.set-password "Encrypt the login password into secrets/<user>-password.age";
secret-from-file = app pkgs.secret-from-file "Encrypt an existing file (e.g. an SSH key) as secrets/<name>.age";
switch = app pkgs.switch-system "Rebuild and switch this machine from the flake";
}
Generated Executable → Regular
+432 -1
View File
@@ -53,6 +53,74 @@
"type": "github"
}
},
"base16": {
"inputs": {
"fromYaml": "fromYaml"
},
"locked": {
"lastModified": 1755819240,
"narHash": "sha256-qcMhnL7aGAuFuutH4rq9fvAhCpJWVHLcHVZLtPctPlo=",
"owner": "SenchoPens",
"repo": "base16.nix",
"rev": "75ed5e5e3fce37df22e49125181fa37899c3ccd6",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "base16.nix",
"type": "github"
}
},
"base16-fish": {
"flake": false,
"locked": {
"lastModified": 1765809053,
"narHash": "sha256-XCUQLoLfBJ8saWms2HCIj4NEN+xNsWBlU1NrEPcQG4s=",
"owner": "tomyun",
"repo": "base16-fish",
"rev": "86cbea4dca62e08fb7fd83a70e96472f92574782",
"type": "github"
},
"original": {
"owner": "tomyun",
"repo": "base16-fish",
"rev": "86cbea4dca62e08fb7fd83a70e96472f92574782",
"type": "github"
}
},
"base16-helix": {
"flake": false,
"locked": {
"lastModified": 1776754714,
"narHash": "sha256-E3OAK27smtATTmX45uoTSRsVD+Y+ZiVVfgM/tjpbtYg=",
"owner": "tinted-theming",
"repo": "base16-helix",
"rev": "4d508123037e7851ad36ebf7d9c48b0e9e1eb581",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-helix",
"type": "github"
}
},
"base16-vim": {
"flake": false,
"locked": {
"lastModified": 1732806396,
"narHash": "sha256-e0bpPySdJf0F68Ndanwm+KWHgQiZ0s7liLhvJSWDNsA=",
"owner": "tinted-theming",
"repo": "base16-vim",
"rev": "577fe8125d74ff456cf942c733a85d769afe58b7",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-vim",
"rev": "577fe8125d74ff456cf942c733a85d769afe58b7",
"type": "github"
}
},
"crane": {
"locked": {
"lastModified": 1789760033,
@@ -109,6 +177,22 @@
"type": "github"
}
},
"firefox-gnome-theme": {
"flake": false,
"locked": {
"lastModified": 1783570805,
"narHash": "sha256-ptl5aRlCv9/uRSv2u8Hq8UFVFeZ6Q/bT049bpqNgc3w=",
"owner": "rafaelmardojai",
"repo": "firefox-gnome-theme",
"rev": "5602ed62d638142c1ab31dccd01dfbfb28841225",
"type": "github"
},
"original": {
"owner": "rafaelmardojai",
"repo": "firefox-gnome-theme",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@@ -141,6 +225,79 @@
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1790898470,
"narHash": "sha256-zTwuwezD0w3hpga6a6P8emidzAZFyWqlNeRBlpWOOl8=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "024633cd702b10285db5cb19b40ad48d2399ba60",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"fromYaml": {
"flake": false,
"locked": {
"lastModified": 1731966426,
"narHash": "sha256-lq95WydhbUTWig/JpqiB7oViTcHFP8Lv41IGtayokA8=",
"owner": "SenchoPens",
"repo": "fromYaml",
"rev": "106af9e2f715e2d828df706c386a685698f3223b",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "fromYaml",
"type": "github"
}
},
"gnome-shell": {
"flake": false,
"locked": {
"host": "gitlab.gnome.org",
"lastModified": 1776175984,
"narHash": "sha256-RJFlFW8GiMei6oqUGrMkGEvVqOH8U7Q8abc1yK4VKD8=",
"owner": "GNOME",
"repo": "gnome-shell",
"rev": "e0fdc4c13250e9a9b8ea9594c83925274f4a5dca",
"type": "gitlab"
},
"original": {
"host": "gitlab.gnome.org",
"owner": "GNOME",
"ref": "50.1",
"repo": "gnome-shell",
"type": "gitlab"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -511,6 +668,21 @@
"type": "github"
}
},
"import-tree": {
"locked": {
"lastModified": 1788467110,
"narHash": "sha256-ljEMTXP/rH0tOvDzc9gzwww6KcHRPRnEHzd9lK48V7s=",
"owner": "vic",
"repo": "import-tree",
"rev": "eb1b52eaecc57f7c136d07ae8a93e724dfecac46",
"type": "github"
},
"original": {
"owner": "vic",
"repo": "import-tree",
"type": "github"
}
},
"lanzaboote": {
"inputs": {
"crane": "crane",
@@ -629,6 +801,31 @@
"type": "github"
}
},
"nur": {
"inputs": {
"flake-parts": [
"stylix",
"flake-parts"
],
"nixpkgs": [
"stylix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1785549842,
"narHash": "sha256-DCwBZmGsySF7oKGTRgEv2HvpxVXkHT+38VhTM76k0B4=",
"owner": "nix-community",
"repo": "NUR",
"rev": "a9f987b57594e845e3e5cdd423b9a70846d70308",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"pre-commit": {
"inputs": {
"flake-compat": "flake-compat_2",
@@ -697,17 +894,71 @@
"type": "github"
}
},
"pyproject-build-systems": {
"inputs": {
"nixpkgs": [
"serena",
"nixpkgs"
],
"pyproject-nix": [
"serena",
"pyproject-nix"
],
"uv2nix": [
"serena",
"uv2nix"
]
},
"locked": {
"lastModified": 1755484659,
"narHash": "sha256-2FfbqsaHVQd12XFFUAinIMAuGO3853LONmva1gT3vKw=",
"owner": "pyproject-nix",
"repo": "build-system-pkgs",
"rev": "9778e87c2361810ff15e287ca5895c9da4a0e900",
"type": "github"
},
"original": {
"owner": "pyproject-nix",
"repo": "build-system-pkgs",
"type": "github"
}
},
"pyproject-nix": {
"inputs": {
"nixpkgs": [
"serena",
"nixpkgs"
]
},
"locked": {
"lastModified": 1755886095,
"narHash": "sha256-oMQ1YERKqiac28LB1cKjl4d0gjvK98SbGejFMfK0WGE=",
"owner": "pyproject-nix",
"repo": "pyproject.nix",
"rev": "7ea903d50c20d4d3ea45ccaad7ee0d21996780c9",
"type": "github"
},
"original": {
"owner": "pyproject-nix",
"repo": "pyproject.nix",
"type": "github"
}
},
"root": {
"inputs": {
"agenix": "agenix",
"disko": "disko",
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"hyprland": "hyprland",
"import-tree": "import-tree",
"lanzaboote": "lanzaboote",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2",
"noctalia": "noctalia",
"proxy-suite": "proxy-suite"
"proxy-suite": "proxy-suite",
"serena": "serena",
"stylix": "stylix"
}
},
"rust-overlay": {
@@ -731,6 +982,66 @@
"type": "github"
}
},
"serena": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"pyproject-build-systems": "pyproject-build-systems",
"pyproject-nix": "pyproject-nix",
"uv2nix": "uv2nix"
},
"locked": {
"lastModified": 1786299277,
"narHash": "sha256-IrsD4pnu/47M/O9b8H9c7K8WENGv3FihlqzCB6szBXg=",
"owner": "oraios",
"repo": "serena",
"rev": "949a27ef1e5fda1a6e7b561e777bcece345c6ffd",
"type": "github"
},
"original": {
"owner": "oraios",
"ref": "v1.7.0",
"repo": "serena",
"type": "github"
}
},
"stylix": {
"inputs": {
"base16": "base16",
"base16-fish": "base16-fish",
"base16-helix": "base16-helix",
"base16-vim": "base16-vim",
"firefox-gnome-theme": "firefox-gnome-theme",
"flake-parts": [
"flake-parts"
],
"gnome-shell": "gnome-shell",
"nixpkgs": [
"nixpkgs"
],
"nur": "nur",
"systems": "systems_3",
"tinted-kitty": "tinted-kitty",
"tinted-schemes": "tinted-schemes",
"tinted-tmux": "tinted-tmux",
"tinted-zed": "tinted-zed"
},
"locked": {
"lastModified": 1791574276,
"narHash": "sha256-UMnLnZ3JlA7UTBNNNx1rNsXYoPP/cirXLCKGiQ/yDx8=",
"owner": "nix-community",
"repo": "stylix",
"rev": "2856c4c6a845b9bec98828ef197abe176e4806bb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "stylix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
@@ -746,6 +1057,126 @@
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1774449309,
"narHash": "sha256-brhZ8DmuGtzkCYHJg4HEd602amKm89Y9ytsFZ5uWD1w=",
"owner": "nix-systems",
"repo": "default",
"rev": "c29398b59d2048c4ab79345812849c9bd15e9150",
"type": "github"
},
"original": {
"owner": "nix-systems",
"ref": "future-26.11",
"repo": "default",
"type": "github"
}
},
"tinted-kitty": {
"flake": false,
"locked": {
"lastModified": 1735730497,
"narHash": "sha256-4KtB+FiUzIeK/4aHCKce3V9HwRvYaxX+F1edUrfgzb8=",
"owner": "tinted-theming",
"repo": "tinted-kitty",
"rev": "de6f888497f2c6b2279361bfc790f164bfd0f3fa",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "tinted-kitty",
"type": "github"
}
},
"tinted-schemes": {
"flake": false,
"locked": {
"lastModified": 1785153830,
"narHash": "sha256-fNdfCTeCXU3tZG3TMincd+u68qBHQgCr2Ljr/M1mWP0=",
"owner": "tinted-theming",
"repo": "schemes",
"rev": "9bd28ed313560db3c5b605c63bc4e309e78e3fc8",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "schemes",
"type": "github"
}
},
"tinted-tmux": {
"flake": false,
"locked": {
"lastModified": 1785031658,
"narHash": "sha256-mZp9O2LjzdMzlqQF3l3fjqsuPBzXy+1qTfBEUGjTlpk=",
"owner": "tinted-theming",
"repo": "tinted-tmux",
"rev": "5d2c67f61ea7af36f16865ab6d541cdba41dc257",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "tinted-tmux",
"type": "github"
}
},
"tinted-zed": {
"flake": false,
"locked": {
"lastModified": 1785030526,
"narHash": "sha256-klZf8UviewRkxuu74Bhbq6tqy7oxebQC7UVRWbbtQxU=",
"owner": "tinted-theming",
"repo": "base16-zed",
"rev": "16f5a8adf4a6b1310d0a61ab172de963e8f76a02",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-zed",
"type": "github"
}
},
"uv2nix": {
"inputs": {
"nixpkgs": [
"serena",
"nixpkgs"
],
"pyproject-nix": [
"serena",
"pyproject-nix"
]
},
"locked": {
"lastModified": 1755887980,
"narHash": "sha256-MD1IhwuoDXQSYcQ/JfEpMxrk6pPl+aHPXSqZLOXLHks=",
"owner": "pyproject-nix",
"repo": "uv2nix",
"rev": "76778b5f457e416688324d19d8f02ec5e22cbe0c",
"type": "github"
},
"original": {
"owner": "pyproject-nix",
"repo": "uv2nix",
"type": "github"
}
},
"xdph": {
"inputs": {
"aquamarine": [
Executable → Regular
+23 -70
View File
@@ -1,12 +1,11 @@
{
description = "faumaray's NixOS configuration: Hyprland + Noctalia, agenix, disko, lanzaboote";
description = "faumaray's NixOS configuration: Hyprland + Noctalia, Stylix, agenix, disko, lanzaboote";
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
"https://noctalia.cachix.org"
];
allowUnfree = true;
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4="
@@ -17,6 +16,14 @@
# Hyprland git and Noctalia v5 both track nixos-unstable.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Dendritic glue: every .nix file under ./modules is a flake-parts module,
# imported by import-tree (paths containing `/_` are skipped).
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
import-tree.url = "github:vic/import-tree";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
@@ -41,9 +48,10 @@
url = "github:FUFSoB/proxy-suite-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware";
# Hyprland is consumed through its own overlay (see overlays/default.nix),
# Hyprland is consumed through its own overlay (modules/flake/overlays.nix),
# built against our nixpkgs so mesa/libdrm always match the system.
hyprland = {
url = "github:hyprwm/Hyprland";
@@ -52,76 +60,21 @@
# No `follows` on purpose: keeps the noctalia.cachix.org binary cache usable.
noctalia.url = "github:noctalia-dev/noctalia";
# Theming (modules/theme/stylix.nix). Stylix has no home-manager input.
stylix = {
url = "github:nix-community/stylix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-parts.follows = "flake-parts";
};
outputs =
{ self, nixpkgs, ... }@inputs:
let
inherit (nixpkgs) lib;
systems = [ "x86_64-linux" ];
forAllSystems = lib.genAttrs systems;
myLib = import ./lib { inherit inputs self lib; };
pkgsFor =
system:
import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config.allowUnfree = true;
# Serena MCP server for Claude Code (modules/ai/claude-code.nix); not in
# nixpkgs. Pinned to a release tag: bump the tag to update.
serena = {
url = "github:oraios/serena/v1.7.0";
inputs.nixpkgs.follows = "nixpkgs";
};
in
{
lib = myLib;
overlays = import ./overlays { inherit inputs; };
nixosModules.default = ./modules/nixos;
homeModules.default = ./modules/home;
nixosConfigurations = {
desktop = myLib.mkHost {
hostname = "desktop";
system = "x86_64-linux";
};
# Bootable installer ISO with this flake baked in: `nix build .#iso`.
installer = myLib.mkInstaller { system = "x86_64-linux"; };
};
packages = forAllSystems (system: {
iso = self.nixosConfigurations.installer.config.system.build.isoImage;
});
apps = forAllSystems (
system:
import ./apps {
pkgs = pkgsFor system;
inherit inputs self;
}
);
devShells = forAllSystems (
system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.mkShell {
name = "nixos-config";
packages = [
inputs.agenix.packages.${system}.default
inputs.disko.packages.${system}.disko
pkgs.age
pkgs.ssh-to-age
pkgs.sbctl
pkgs.git
pkgs.nixfmt
pkgs.nixd
pkgs.shellcheck
];
};
}
);
formatter = forAllSystems (system: (pkgsFor system).nixfmt-tree);
};
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);
}
-45
View File
@@ -1,45 +0,0 @@
# desktop: AMD CPU + AMD GPU workstation/gaming PC.
# System on the NVMe, part of /home on the SATA SSD (see disko.nix / my.disks).
{ inputs, ... }:
{
imports = [
./hardware-configuration.nix
./disks.nix
inputs.nixos-hardware.nixosModules.common-cpu-amd
inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate
inputs.nixos-hardware.nixosModules.common-gpu-amd
inputs.nixos-hardware.nixosModules.common-pc-ssd
];
my = {
user = {
name = "faumaray";
fullName = "faumaray";
email = "faumaray@gmail.com";
};
locale = {
timeZone = "Europe/Moscow";
defaultLocale = "en_US.UTF-8";
keyboardLayouts = [
"us"
"ru"
];
keyboardOptions = [ "grp:alt_shift_toggle" ];
};
boot.secureBoot.enable = true;
hardware.amd.enable = true;
desktop.hyprland.enable = true;
gaming.enable = true;
secrets.enable = true;
};
home-manager.users.faumaray = ./home.nix;
# Set once at install time; do not change on upgrades.
system.stateVersion = "26.05";
}
Executable → Regular
View File
File mode changed.
-33
View File
@@ -1,33 +0,0 @@
# Disk layout of `desktop`; the generic logic lives in modules/nixos/hardware/disks.nix.
# The device paths come from disk-ids.json, which `nix run .#install` rewrites
# after you pick the disks (list them with `ls -l /dev/disk/by-id`).
{ lib, ... }:
let
ids = lib.importJSON ./disk-ids.json;
in
{
my.disks = {
enable = true;
system.device = ids.system;
data = {
enable = true;
device = ids.data;
# Each entry becomes a btrfs subvolume on the data disk, mounted at
# ~/<Name>. To add a folder later, add `Name = { };` here, create the
# subvolume (`btrfs subvolume create /mnt/data/@name`, with the data
# disk's top level mounted), then rebuild. Storage is a free-form folder
# to organise yourself; Steam's library goes in ~/Games/SteamLibrary.
homeFolders = {
Games = { };
Downloads = { };
Documents = { };
Music = { };
Pictures = { };
Videos = { };
Storage = { };
};
};
};
}
View File
File mode changed.
-28
View File
@@ -1,28 +0,0 @@
# home-manager config for the desktop's user (wired up in ./default.nix).
# The modules live in modules/home; this file only turns them on.
{ osConfig, ... }:
let
name = osConfig.my.user.name;
in
{
home = {
username = name;
homeDirectory = "/home/${name}";
# Set once at install time; do not change on upgrades.
stateVersion = "26.05";
};
my.home = {
hyprland.enable = true;
noctalia.enable = true;
wezterm.enable = true;
neovim.enable = true;
shell.enable = true;
git.enable = true;
ssh.enable = true;
xdg.enable = true;
theming.enable = true;
apps.enable = true;
};
}
-69
View File
@@ -1,69 +0,0 @@
{
inputs,
self,
lib,
}:
let
specialArgs = { inherit inputs self; };
in
{
# Build a full NixOS host from hosts/<hostname>.
mkHost =
{
hostname,
system ? "x86_64-linux",
extraModules ? [ ],
}:
lib.nixosSystem {
inherit specialArgs;
modules = [
{
nixpkgs.hostPlatform = system;
nixpkgs.overlays = [ self.overlays.default ];
nixpkgs.config.allowUnfree = true;
networking.hostName = hostname;
}
inputs.home-manager.nixosModules.home-manager
inputs.agenix.nixosModules.default
inputs.disko.nixosModules.disko
inputs.lanzaboote.nixosModules.lanzaboote
inputs.noctalia.nixosModules.default
inputs.proxy-suite.nixosModules.default
self.nixosModules.default
../hosts/${hostname}
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "hm-backup";
extraSpecialArgs = specialArgs;
sharedModules = [
inputs.noctalia.homeModules.default
self.homeModules.default
];
};
}
]
++ extraModules;
};
# Live installer ISO that carries this flake and the install tooling.
mkInstaller =
{
system ? "x86_64-linux",
}:
lib.nixosSystem {
inherit specialArgs;
modules = [
"${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
{
nixpkgs.hostPlatform = system;
nixpkgs.overlays = [ self.overlays.default ];
}
../modules/installer
];
};
}
+107
View File
@@ -0,0 +1,107 @@
# Claude Code (pkgs.claude-code, unfree) for the owner, through home-manager's
# programs.claude-code, with:
# codememory MCP server: codebase-memory-mcp (DeusData), code knowledge graph (nixpkgs)
# serena MCP server: semantic code retrieval and editing (inputs.serena)
# rea MCP server and skill: Reverse Engineer Anything (npm rea-agents)
# caveman plugin: skills, commands, agents and hooks (JuliusBrussee/caveman)
# Everything is user scope (~/.claude). A repository's own .claude/settings.json
# still applies on top of it; nothing here sets a model, effort, permissions or
# hooks. MCP servers land in home-manager's generated plugin, so their tools
# are named mcp__plugin_hm_<server>__<tool>.
{ inputs, ... }:
{
flake.modules.homeManager.claude-code =
{
lib,
pkgs,
...
}:
let
serena = inputs.serena.packages.${pkgs.stdenv.hostPlatform.system}.serena;
# REA has no Nix package: the MCP server runs from npm through npx
# (pinned version, fetched on first start: not hermetic). Its skill comes
# from the same npm release. Knobs: reaVersion and the hash below.
reaVersion = "6.4.0";
reaPackage = pkgs.fetchzip {
url = "https://registry.npmjs.org/rea-agents/-/rea-agents-${reaVersion}.tgz";
hash = "sha256-aJTYn9CZchdwJLBMn9no4C2EGBO6XemsH3J0GU1DqWM=";
};
# `rea` on PATH and as the MCP command; npx needs node for the package's
# own `#!/usr/bin/env node` scripts.
rea = pkgs.writeShellApplication {
name = "rea";
runtimeInputs = [ pkgs.nodejs ];
text = ''exec npx --yes "rea-agents@${reaVersion}" "$@"'';
};
# Knobs: tag and hash.
caveman = pkgs.fetchFromGitHub {
owner = "JuliusBrussee";
repo = "caveman";
tag = "v3.2.0";
hash = "sha256-GfC8e+EGL7kotZQfZ9kD7ZEWJfhmXujHOHpMxeU3bEo=";
};
in
{
programs.claude-code = {
enable = true;
# Claude Code also writes ~/.claude/settings.json itself; merge the
# declared keys into a writable file on every switch instead of
# replacing it with a read-only link.
mutableSettings = true;
# Serena (Python) can take longer than the default MCP start timeout.
settings.env.MCP_TIMEOUT = "60000";
mcpServers = {
# To use another code-memory server, replace this one entry.
codememory = {
command = lib.getExe pkgs.codebase-memory-mcp;
args = [ ];
};
serena = {
command = lib.getExe serena;
args = [
"start-mcp-server"
"--context"
"claude-code"
"--project-from-cwd"
"--open-web-dashboard"
"false"
];
};
rea = {
command = lib.getExe rea;
args = [ "mcp" ];
};
};
skills.reverse-engineer-anything = "${reaPackage}/skills/reverse-engineer-anything";
# Loaded as a personal plugin (Claude Code >= 2.1.157).
plugins.caveman = caveman;
};
# The CLIs themselves; caveman's hooks need `node` on PATH (they exit
# silently without it).
home.packages = [
pkgs.codebase-memory-mcp
serena
rea
pkgs.nodejs
];
# caveman switches every new session into its terse style unless its
# default mode says otherwise. Start with it off (turn it on per session
# with /caveman), so agents in repositories like this one keep their
# normal reports. Written once; caveman may change it later.
home.activation.cavemanDefaultMode = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -e "$HOME/.config/caveman/config.json" ]; then
run mkdir -p "$HOME/.config/caveman"
run sh -c 'echo "{\"defaultMode\": \"off\"}" > "$HOME/.config/caveman/config.json"'
fi
'';
};
}
+23
View File
@@ -0,0 +1,23 @@
# Secure Boot through lanzaboote. Keys live in /var/lib/sbctl (create them with
# `sbctl create-keys` before the first boot). A host that does not want Secure
# Boot imports the `systemd-boot` aspect instead; import only one of the two.
{ inputs, ... }:
{
flake.modules.nixos.secure-boot =
{ lib, pkgs, ... }:
{
imports = [ inputs.lanzaboote.nixosModules.lanzaboote ];
boot = {
lanzaboote = {
enable = true;
pkiBundle = "/var/lib/sbctl";
configurationLimit = 10;
};
# lanzaboote installs the boot entries itself.
loader.systemd-boot.enable = lib.mkForce false;
};
environment.systemPackages = [ pkgs.sbctl ];
};
}
+11
View File
@@ -0,0 +1,11 @@
# Plain systemd-boot, the alternative to the `secure-boot` aspect (lanzaboote):
# a host imports one of the two.
{
flake.modules.nixos.systemd-boot = {
boot.loader.systemd-boot = {
enable = true;
configurationLimit = 10;
editor = false;
};
};
}
+7 -15
View File
@@ -1,27 +1,19 @@
# Git identity and defaults. The name and email come from my.user so the
# identity is defined once, in the host file.
{
config,
lib,
pkgs,
osConfig,
...
}:
# Git identity and defaults. The identity is the owner's (meta.owner), defined
# once in modules/users/faumaray.nix.
{ config, ... }:
let
cfg = config.my.home.git;
inherit (config.meta) owner;
in
{
options.my.home.git.enable = lib.mkEnableOption "Git and GitHub CLI configuration";
config = lib.mkIf cfg.enable {
flake.modules.homeManager.git = {
programs = {
git = {
enable = true;
settings = {
user = {
name = osConfig.my.user.fullName;
inherit (osConfig.my.user) email;
name = owner.fullName;
inherit (owner) email;
};
init.defaultBranch = "main";
pull.rebase = true;
+46
View File
@@ -0,0 +1,46 @@
# Neovim with LSP, completion, fuzzy finding and format-on-save.
# The editor config is in init.lua next to this file. It sets the catppuccin
# colorscheme itself, so Stylix's neovim target stays off (modules/theme/stylix.nix).
{
flake.modules.homeManager.neovim =
{ pkgs, ... }:
{
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
nvim-treesitter.withAllGrammars
nvim-lspconfig
blink-cmp
telescope-nvim
telescope-fzf-native-nvim
plenary-nvim
lualine-nvim
gitsigns-nvim
which-key-nvim
oil-nvim
conform-nvim
catppuccin-nvim
nvim-web-devicons
mini-nvim
];
# Language servers, formatters and search tools, visible to nvim only.
extraPackages = with pkgs; [
nixd
nixfmt
lua-language-server
stylua
bash-language-server
shfmt
ripgrep
fd
];
initLua = builtins.readFile ./init.lua;
};
};
}
View File
File renamed without changes.
+76
View File
@@ -0,0 +1,76 @@
# Interactive shell: zsh with starship prompt, fzf, zoxide, eza, bat, direnv.
# Home-manager only (hm.shell); the owner's login shell is set in core/users.nix.
{
flake.modules.homeManager.shell =
{ pkgs, ... }:
{
programs = {
zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
autocd = true;
history = {
size = 50000;
save = 50000;
# Share between open terminals, skip duplicates and space-prefixed lines.
share = true;
ignoreDups = true;
ignoreSpace = true;
extended = true;
};
shellAliases = {
cat = "bat";
".." = "cd ..";
g = "git";
# nh builds, diffs and activates the flake in one step.
rebuild = "nh os switch";
rebuild-boot = "nh os boot";
rebuild-test = "nh os test";
};
};
starship = {
enable = true;
settings = {
add_newline = false;
# Short marker inside `nix shell` / `nix develop`.
nix_shell.format = "[$symbol$state]($style) ";
};
};
fzf = {
enable = true;
defaultCommand = "fd --type f --hidden --exclude .git";
fileWidget.command = "fd --type f --hidden --exclude .git";
changeDirWidget.command = "fd --type d --hidden --exclude .git";
};
# `z dir` jumps to frecent directories, `zi` picks with fzf.
zoxide.enable = true;
# ls, ll, la, lt and lla aliases come from the zsh integration.
eza = {
enable = true;
icons = "auto";
git = true;
};
bat.enable = true;
direnv = {
enable = true;
nix-direnv.enable = true;
};
btop.enable = true;
fastfetch.enable = true;
};
# fd backs the fzf commands above.
home.packages = [ pkgs.fd ];
};
}
+14
View File
@@ -0,0 +1,14 @@
# Boot basics every host shares: EFI variable access, systemd in the initrd and
# the latest kernel. The boot loader itself is an aspect of its own: the host
# imports `secure-boot` (lanzaboote) or `systemd-boot`.
{
flake.modules.nixos.core =
{ lib, pkgs, ... }:
{
boot = {
loader.efi.canTouchEfiVariables = true;
initrd.systemd.enable = true;
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
};
};
}
+19
View File
@@ -0,0 +1,19 @@
# home-manager as a NixOS module. Aspects add their home-manager half to the
# owner (`home-manager.users.<owner>.imports`), so every home-manager module
# also receives `osConfig` (the NixOS configuration) and `inputs`.
{ inputs, ... }:
{
flake.modules.nixos.core = {
imports = [ inputs.home-manager.nixosModules.home-manager ];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "hm-backup";
# gtk.css and qt6ct.conf may be rewritten by Noctalia's GTK template or qt*ct;
# without this a later switch fails ("would be clobbered") on the old .hm-backup.
overwriteBackup = true;
extraSpecialArgs = { inherit inputs; };
};
};
}
+30
View File
@@ -0,0 +1,30 @@
# Read-only facts for pkgs/install-system/install-system.sh, which evaluates
# `nixosConfigurations.<host>.config.my` and reads user.name, user.uid,
# boot.secureBoot.enable and secrets.enable. Everything here is derived from
# the real configuration; no aspect may read `config.my`.
{ config, lib, ... }:
let
inherit (config.meta) owner;
in
{
flake.modules.nixos.core =
{ config, ... }:
{
options.my = lib.mkOption {
type = lib.types.raw;
readOnly = true;
internal = true;
description = "Facts for install-system (derived; do not set, do not read in aspects).";
};
config.my = {
user = {
inherit (owner) name;
inherit (config.users.users.${owner.name}) uid;
};
# Only the secure-boot aspect imports lanzaboote.
boot.secureBoot.enable = config.boot.lanzaboote.enable or false;
secrets.enable = config.age.secrets != { };
};
};
}
+13
View File
@@ -0,0 +1,13 @@
# The parts of the locale setup that do not depend on the machine. The host
# sets the time zone, the default locale and the XKB layouts
# (modules/hosts/<name>/host.nix); the console follows those layouts, and so
# does Hyprland (modules/desktop/hyprland, through osConfig).
{
flake.modules.nixos.core = {
# Russian stays available for apps and games even with an English UI.
i18n.extraLocales = [ "ru_RU.UTF-8/UTF-8" ];
# TTY and initrd keymap follow the XKB layout set by the host.
console.useXkbConfig = true;
};
}
+13
View File
@@ -0,0 +1,13 @@
# NetworkManager with the OpenVPN plugin. The owner joins the `networkmanager`
# group in users.nix. Whether a firewall runs is the host's decision
# (modules/hosts/<name>/host.nix).
{
flake.modules.nixos.core =
{ pkgs, ... }:
{
networking.networkmanager = {
enable = true;
plugins = [ pkgs.networkmanager-openvpn ];
};
};
}
+51
View File
@@ -0,0 +1,51 @@
# Nix daemon settings, binary caches, garbage collection and flake registry.
{ config, inputs, ... }:
let
inherit (config.meta) owner;
in
{
flake.modules.nixos.core = {
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
# root is already trusted by default; this adds the admin group.
trusted-users = [ "@wheel" ];
warn-dirty = false;
# Same caches as flake.nixConfig, so the system keeps using them after
# install without the "untrusted flake settings" prompt.
extra-substituters = [
"https://nix-community.cachix.org"
"https://noctalia.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4="
];
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
# `nix shell nixpkgs#foo` and <nixpkgs> use the exact nixpkgs of this flake
# instead of fetching a different revision.
channel.enable = false;
registry.nixpkgs.flake = inputs.nixpkgs;
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
};
programs = {
# Nicer `nixos-rebuild` front-end that knows where the flake lives.
nh = {
enable = true;
flake = "/home/${owner.name}/nixos-config";
};
};
};
}
+15
View File
@@ -0,0 +1,15 @@
# Every host uses this flake's overlay and allows unfree packages (Steam,
# TeamSpeak, Claude Code). home-manager shares this package set
# (useGlobalPkgs, modules/core/home-manager.nix).
{ config, ... }:
let
overlay = config.flake.overlays.default;
in
{
flake.modules.nixos.core = {
nixpkgs = {
overlays = [ overlay ];
config.allowUnfree = true;
};
};
}
+56
View File
@@ -0,0 +1,56 @@
# The owner's account (meta.owner, modules/users/faumaray.nix): the only
# interactive user. The `docker` and `gamemode` groups are added by the docker
# and gaming aspects.
{ config, ... }:
let
inherit (config.meta) owner;
passwordSecret = "${owner.name}-password";
in
{
flake.modules.nixos.core =
{
config,
lib,
pkgs,
...
}:
let
hasPasswordSecret = config.age.secrets ? ${passwordSecret};
in
{
users.mutableUsers = true;
users.users.${owner.name} = {
isNormalUser = true;
inherit (owner) uid;
description = owner.fullName;
extraGroups = [
"wheel"
"networkmanager"
"video"
"audio"
"input"
"render"
];
shell = pkgs.zsh;
openssh.authorizedKeys.keys = owner.sshAuthorizedKeys;
# Real password comes from agenix; otherwise a throwaway one so the first
# boot can never lock the user out.
hashedPasswordFile = lib.mkIf hasPasswordSecret config.age.secrets.${passwordSecret}.path;
initialPassword = lib.mkIf (!hasPasswordSecret) "changeme";
};
# Required by `shell = pkgs.zsh` (puts zsh into /etc/shells).
programs.zsh.enable = true;
security.sudo.wheelNeedsPassword = true;
warnings = lib.optional (!hasPasswordSecret) ''
User "${owner.name}" has the temporary password "changeme". Run `passwd` after
the first login, or add secrets/${passwordSecret}.age (hashed with
`mkpasswd -m yescrypt`, encrypted with agenix) and `git add` it.
'';
};
}
+26
View File
@@ -0,0 +1,26 @@
# Everyday desktop applications (home-manager). Firefox, mpv, imv and zathura
# are configured programs; mpv and zathura are also themed by Stylix
# (theme/stylix.nix). Firefox is not: Stylix would need a declared profile.
{
flake.modules.homeManager.apps =
{ pkgs, ... }:
{
programs = {
firefox.enable = true;
mpv.enable = true;
imv.enable = true;
zathura.enable = true;
};
home.packages = with pkgs; [
vesktop # Discord client with working screen sharing on Wayland
telegram-desktop
file-roller
teamspeak6-client
loupe # image viewer
zenity
procps
networkmanager-openvpn
];
};
}
+1 -2
View File
@@ -1,7 +1,6 @@
# PipeWire as the single audio server (ALSA, PulseAudio and JACK clients).
{ config, lib, ... }:
{
config = lib.mkIf config.my.desktop.hyprland.enable {
flake.modules.nixos.audio = {
services = {
pipewire = {
enable = true;
+15
View File
@@ -0,0 +1,15 @@
# Coverage fonts: scripts and symbols that the theme fonts do not have. The
# theme fonts themselves (Monaspace, Inter, Noto Serif, Noto Color Emoji) and
# the fontconfig default families come from Stylix (theme/stylix.nix, targets
# `font-packages` and `fontconfig`).
{
flake.modules.nixos.fonts =
{ pkgs, ... }:
{
fonts.packages = with pkgs; [
noto-fonts-cjk-sans
nerd-fonts.jetbrains-mono
nerd-fonts.symbols-only
];
};
}
View File
File renamed without changes.
+135
View File
@@ -0,0 +1,135 @@
# Hyprland desktop, both halves of one feature:
# NixOS UWSM-managed compositor, SDDM with autologin of the owner,
# portals, keyring and the small services a desktop needs.
# home-manager the user configuration. Hyprland reads Lua: the real config
# is in the .lua files next to this file; Nix only passes in the
# values that come from elsewhere (`require("nixvars")`).
# The NixOS half adds the home-manager half to the owner, so a host imports
# `nixos.hyprland` once. Noctalia, audio and fonts are separate aspects.
{ config, ... }:
let
inherit (config.meta) owner;
hmHyprland = config.flake.modules.homeManager.hyprland;
in
{
flake.modules.nixos.hyprland =
{ pkgs, ... }:
{
home-manager.users.${owner.name}.imports = [ hmHyprland ];
# package/portalPackage stay default: the overlay swaps in the flake builds.
programs.hyprland = {
enable = true;
withUWSM = true;
xwayland.enable = true;
};
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
settings.Autologin = {
Session = "hyprland.desktop";
User = owner.name;
};
};
xdg.portal.extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-hyprland
];
security.polkit.enable = true;
services.gnome.gnome-keyring.enable = true;
programs.dconf.enable = true;
# Electron/Chromium apps use native Wayland.
environment.sessionVariables.NIXOS_OZONE_WL = "1";
# Removable drives and trash/mounts in the file manager.
services.udisks2.enable = true;
services.gvfs.enable = true;
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
environment.systemPackages = with pkgs; [
wl-clipboard
cliphist
grim
slurp
brightnessctl
playerctl
pavucontrol
kdePackages.dolphin
kdePackages.dolphin-plugins
hyprpicker
];
};
flake.modules.homeManager.hyprland =
{
config,
lib,
pkgs,
osConfig,
...
}:
let
cursor = config.home.pointerCursor;
# Exposed to the Lua files as `require("nixvars")`. Keyboard layouts come
# from the NixOS configuration (services.xserver.xkb, set by the host),
# the cursor from home-manager (set by Stylix, theme/stylix.nix).
nixVars = {
kbLayout = osConfig.services.xserver.xkb.layout;
kbOptions = osConfig.services.xserver.xkb.options;
terminal = "wezterm";
fileManager = "dolphin";
cursorSize = if cursor.enable then cursor.size else 24;
cursorTheme = if cursor.enable then cursor.name else "";
};
in
{
wayland.windowManager.hyprland = {
enable = true;
configType = "lua";
# The NixOS half (programs.hyprland) installs the compositor and the
# portal, built from the flake overlay. Installing them again here would
# put a second copy in the user profile.
package = null;
portalPackage = null;
# UWSM owns the session and graphical-session.target; HM's own
# hyprland-session.target and dbus import would only duplicate that.
systemd.enable = false;
xwayland.enable = true;
# Loaded in name order; `nixvars` is a helper module, not loaded on its
# own. Stylix's colours are rendered after these files (hl.config in
# hyprland.lua), so they override the colours in settings.lua.
extraLuaFiles = {
nixvars = {
content = "return ${lib.generators.toLua { } nixVars}\n";
autoLoad = false;
};
"10-settings" = ./settings.lua;
"20-binds" = ./binds.lua;
"30-rules" = ./rules.lua;
};
};
# Tools the binds call (screenshots, file manager).
home.packages = with pkgs; [
grim
slurp
wl-clipboard
kdePackages.dolphin
kdePackages.dolphin-plugins
];
};
}
View File
File renamed without changes.
File renamed without changes.
+67
View File
@@ -0,0 +1,67 @@
# Noctalia v5 shell (bar, launcher, notifications, lock screen, wallpaper),
# both halves of one feature:
# NixOS the package and the services its panels talk to
# (NetworkManager, Bluetooth, UPower, power profiles). The user
# service is started by home-manager, so
# `programs.noctalia.systemd` stays off here.
# home-manager the user service and the shell settings.
# The NixOS half adds the home-manager half to the owner, so a host imports
# `nixos.noctalia` once.
#
# The modules come from the noctalia flake. home-manager ships its own
# `programs.noctalia` too (modules/programs/noctalia), and nixpkgs has one for
# NixOS; the flake's modules list those in `disabledModules`, so importing them
# here replaces the others and nothing is declared twice. They are imported
# only in this file (a module value imported twice declares its options twice).
#
# Colours: Stylix's `noctalia` target (theme/stylix.nix) writes the custom
# palette `stylix` and `theme.*`; the shell font comes from the same target
# (overridden to Monaspace Krypton there). So no `theme` and no `font_family`
# here. Settings are validated at build time by `noctalia config validate`, so
# only keys from the upstream schema may appear. Anything changed in the
# settings window at runtime is stored separately and overrides the file.
{ config, inputs, ... }:
let
inherit (config.meta) owner;
hmNoctalia = config.flake.modules.homeManager.noctalia;
in
{
flake.modules.nixos.noctalia =
{ pkgs, ... }:
{
imports = [ inputs.noctalia.nixosModules.default ];
home-manager.users.${owner.name}.imports = [ hmNoctalia ];
programs.noctalia = {
enable = true;
package = pkgs.noctalia;
# NetworkManager, Bluetooth, UPower and power-profiles-daemon, which the
# shell's panels talk to.
recommendedServices.enable = true;
};
};
flake.modules.homeManager.noctalia = {
imports = [ inputs.noctalia.homeModules.default ];
programs.noctalia = {
enable = true;
# A user service instead of hl.exec_cmd, so it restarts on failure and
# follows graphical-session.target (managed by UWSM).
systemd.enable = true;
settings.shell = {
telemetry_enabled = false;
# No other polkit agent is started in the session.
polkit_agent = true;
# Apps started from the launcher get their own systemd scope, so
# restarting the shell service does not kill them.
launch_apps_as_systemd_services = true;
};
};
};
}
+50
View File
@@ -0,0 +1,50 @@
# WezTerm terminal (SUPER+Return in Hyprland). Colours and the font come from
# Stylix (theme/stylix.nix: scheme "stylix", Monaspace Krypton + Noto Color
# Emoji, size 12); this file holds the rest of the configuration.
{
flake.modules.homeManager.wezterm =
{ lib, ... }:
let
action = lib.generators.mkLuaInline;
in
{
programs.wezterm = {
enable = true;
settings = {
# Wayland-native, no client-side titlebar (Hyprland draws the borders).
enable_wayland = true;
window_decorations = "NONE";
window_padding = {
left = 8;
right = 8;
top = 8;
bottom = 8;
};
# A tab bar only when there is more than one tab.
hide_tab_bar_if_only_one_tab = true;
use_fancy_tab_bar = false;
scrollback_lines = 20000;
audible_bell = "Disabled";
check_for_updates = false;
# Hyprland owns SUPER and ALT+Tab, so splits live on CTRL+SHIFT.
# phys: keys are layout independent and work with the ru layout.
keys = [
{
key = "phys:D";
mods = "CTRL|SHIFT";
action = action "wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' }";
}
{
key = "phys:E";
mods = "CTRL|SHIFT";
action = action "wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' }";
}
];
};
};
};
}
+4 -13
View File
@@ -1,16 +1,9 @@
# XDG base dirs, the user folders and default applications.
# Documents, Downloads, Music, Pictures and Videos are separate subvolumes on
# the data SSD mounted into $HOME (my.disks); Desktop, Templates and Public
# are plain directories on the system disk. Home-manager's default folder
# names already match, so only the unwanted ones are changed.
{
config,
lib,
...
}:
# the data SSD mounted into $HOME (modules/hosts/desktop/disks.nix); Desktop,
# Templates and Public are plain directories on the system disk. Home-manager's
# default folder names already match, so only the unwanted ones are changed.
let
cfg = config.my.home.xdg;
firefox = "firefox.desktop";
fileManager = "Dolphin.desktop";
imageViewer = "org.gnome.Loupe.desktop";
@@ -19,9 +12,7 @@ let
archiveManager = "org.gnome.FileRoller.desktop";
in
{
options.my.home.xdg.enable = lib.mkEnableOption "XDG directories and default applications";
config = lib.mkIf cfg.enable {
flake.modules.homeManager.xdg = {
xdg = {
enable = true;
+21
View File
@@ -0,0 +1,21 @@
# Docker: the rootful daemon (the Gitea Actions runner in dev/gitea-runner.nix
# runs its jobs on it) next to rootless Docker for the owner, on the btrfs
# storage driver. The owner joins the `docker` group.
{ config, ... }:
let
inherit (config.meta) owner;
in
{
flake.modules.nixos.docker = {
virtualisation.docker = {
enable = true;
rootless = {
enable = true;
setSocketVariable = true;
};
storageDriver = "btrfs";
};
users.users.${owner.name}.extraGroups = [ "docker" ];
};
}
+67
View File
@@ -0,0 +1,67 @@
# Gitea Actions runner "performance" for git.faumaray.com, running jobs in
# rootful Docker (dev/docker.nix). The registration token is an agenix secret:
# secrets/gitea-runner-token.age one line `TOKEN=<registration token>`
# (nix run .#secret-from-file -- gitea-runner-token.age <file>)
# Without that file the runner is not configured and a warning says so.
{ config, lib, ... }:
let
tokenSecret = config.meta.secretsDir + "/gitea-runner-token.age";
hasToken = builtins.pathExists tokenSecret;
in
{
flake.modules.nixos.gitea-runner =
{ config, ... }:
{
age.secrets = lib.optionalAttrs hasToken {
gitea-runner-token = {
file = tokenSecret;
mode = "0400";
};
};
# An instance without token or tokenFile fails the upstream assertion, so
# the instance only exists when the secret does.
services.gitea-actions-runner.instances = lib.optionalAttrs hasToken {
performance = {
enable = true;
url = "https://git.faumaray.com";
name = "Perfrormance Runner";
tokenFile = config.age.secrets.gitea-runner-token.path;
labels = [
"ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
"voelin-release:docker://docker.gitea.com/runner-images:ubuntu-latest"
"ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04"
"ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
"echoion-release-serial:docker://git.faumaray.ru/void/echoion-release-builder:gcc-16.1.0"
];
settings = {
runner = {
capacity = 5;
timeout = "3h";
fetch_timeout = "5s";
fetch_interval = "1s";
};
cache = {
enabled = true;
host = "192.168.255.242"; # or "localhost" if not using isolated docker containers
port = 8088;
dir = "/var/lib/gitea-runner/cache";
};
container = {
# Ensure the job container passes standard bridge mode
network_mode = "bridge";
# Provide the job containers an alias to reach the host system
options = "--add-host=host.docker.internal:host-gateway";
};
};
};
};
warnings = lib.optional (!hasToken) ''
The Gitea Actions runner "performance" is not configured: secrets/gitea-runner-token.age
is missing. Put `TOKEN=<new registration token>` in a file, then
`nix run .#secret-from-file -- gitea-runner-token.age <file>` and `git add` it.
'';
};
}
+119
View File
@@ -0,0 +1,119 @@
# Foreign binaries: programs built for ordinary Linux distributions (prebuilt
# tools, language servers, npm/pip native modules, game launchers, AppImages)
# expect /lib64/ld-linux-x86-64.so.2 and libraries in /usr/lib, neither of
# which exists on NixOS. Two mechanisms cover that:
#
# - nix-ld puts a stub dynamic linker at the standard path. The stub reads
# NIX_LD (the real linker) and NIX_LD_LIBRARY_PATH (the library directory
# built from `programs.nix-ld.libraries`), both exported to every session,
# and starts the program with them. A plain ELF binary then just runs. If it
# stops with "error while loading shared libraries: libfoo.so.N", find the
# nixpkgs package that ships that library (search.nixos.org), add it to the
# list below and switch.
# - AppImages bundle most of their libraries and want FUSE. appimage-run runs
# them in an FHS environment of its own, and the binfmt registration makes
# `./Some.AppImage` work directly. nix-ld is not involved there; to give
# every AppImage an extra library set
# `programs.appimage.package = pkgs.appimage-run.override { extraPkgs = pkgs: [ ... ]; };`.
#
# The module's own defaults (zlib, zstd, stdenv.cc.cc, curl, openssl, attr,
# libssh, bzip2, libxml2, acl, libsodium, util-linux, xz, systemd) stay; the
# list is merged with them. The ones repeated below are the base every
# foreign binary needs, kept explicit so they survive a change of the defaults.
# No whole desktop stacks (Qt, Electron) here: an app that needs one ships it
# or gets a package of its own.
{
flake.modules.nixos.nix-ld =
{ pkgs, ... }:
{
programs.nix-ld = {
enable = true;
libraries = with pkgs; [
# C/C++ runtime (libstdc++, libgcc_s), compression, crypto, text.
stdenv.cc.cc.lib
zlib
zstd
bzip2
xz
openssl
curl
expat
icu
libxml2
libxslt
sqlite
libffi
ncurses
libxcrypt-legacy # libcrypt.so.1, which older binaries still link
libunwind
libsecret
libusb1
util-linux # libuuid, libmount, libblkid
systemd # libudev, libsystemd
# Graphics: OpenGL, EGL, Vulkan, hardware video, Wayland.
libGL
libGLU
mesa
libgbm
libdrm
vulkan-loader
libva
libvdpau
wayland
libxkbcommon
# Audio.
alsa-lib
libpulseaudio
pipewire
SDL2
# Fonts and images.
fontconfig
freetype
harfbuzz
libpng
libjpeg
# GTK and the pieces Electron/Chromium-style apps dlopen.
glib
gtk3
gdk-pixbuf
pango
cairo
at-spi2-core # also ships libatk and libatk-bridge
cups
dbus
nspr
nss
libnotify
libappindicator
libayatana-appindicator
# X11 client libraries (XWayland keeps X11-only binaries working).
libx11
libxcomposite
libxcursor
libxdamage
libxext
libxfixes
libxi
libxrandr
libxrender
libxscrnsaver
libxtst
libxcb
libxxf86vm
libxshmfence
];
};
# `appimage-run` plus the binfmt hooks for AppImage type 1 and 2; the
# module also enables FUSE.
programs.appimage = {
enable = true;
binfmt = true;
};
};
}
+20
View File
@@ -0,0 +1,20 @@
# `nix run .#<app>`: install and key/secret helpers (../../pkgs).
{
perSystem =
{ lib, pkgs, ... }:
let
app = pkg: description: {
program = lib.getExe pkg;
meta.description = description;
};
in
{
apps = {
install = app pkgs.install-system "Install this flake onto this machine from the NixOS installer (wipes the configured disks)";
create-keys = app pkgs.create-keys "Create the SSH host key and Secure Boot keys in keys/<host>/";
set-password = app pkgs.set-password "Encrypt the login password into secrets/<user>-password.age";
secret-from-file = app pkgs.secret-from-file "Encrypt an existing file (e.g. an SSH key) as secrets/<name>.age";
switch = app pkgs.switch-system "Rebuild and switch this machine from the flake";
};
};
}
+34
View File
@@ -0,0 +1,34 @@
# Development: `nix develop`, `nix fmt` and the formatting check. Both skip
# hardware-configuration.nix, which nixos-generate-config (install-system) writes.
{ self, ... }:
{
perSystem =
{ inputs', pkgs, ... }:
{
devShells.default = pkgs.mkShell {
name = "nixos-config";
packages = [
inputs'.agenix.packages.default
inputs'.disko.packages.disko
pkgs.age
pkgs.ssh-to-age
pkgs.sbctl
pkgs.git
pkgs.nixfmt
pkgs.nixd
pkgs.shellcheck
];
};
formatter = pkgs.nixfmt-tree.override {
settings.formatter.nixfmt.excludes = [ "hosts/*/hardware-configuration.nix" ];
};
checks.formatting = pkgs.runCommandLocal "nixfmt-check" { nativeBuildInputs = [ pkgs.nixfmt ]; } ''
cd ${self}
find . -name '*.nix' ! -path './hosts/*/hardware-configuration.nix' -print0 \
| xargs -0 nixfmt --check
touch $out
'';
};
}
+70
View File
@@ -0,0 +1,70 @@
# Shared data for every aspect: who owns this flake and where the secrets are.
# Top-level flake-parts options, not a flake output. Read them in any module
# through the flake-parts `config`, bound in a `let` before any lower-level
# module so the NixOS/home-manager `config` cannot shadow it:
#
# { config, ... }:
# let
# inherit (config.meta) owner;
# in
# {
# flake.modules.nixos.foo = { pkgs, ... }: { users.users.${owner.name}.shell = pkgs.zsh; };
# flake.modules.homeManager.foo = { programs.git.settings.user.email = owner.email; };
# }
{ lib, ... }:
let
inherit (lib) mkOption types;
in
{
options.meta = {
owner = mkOption {
description = "The single interactive user of every host in this flake.";
type = types.submodule {
options = {
name = mkOption {
type = types.str;
description = "Login name.";
};
fullName = mkOption {
type = types.str;
description = "Display name (GECOS), also the git author name.";
};
email = mkOption {
type = types.str;
description = "E-mail address, used for git.";
};
uid = mkOption {
type = types.int;
default = 1000;
description = "Numeric user id.";
};
sshAuthorizedKeys = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Public keys allowed to log in over SSH.";
};
sshKeys = mkOption {
type = types.listOf types.str;
default = [ "id_ed25519" ];
description = ''
Private SSH key names. Each one is installed as ~/.ssh/<name> when
secrets/ssh-<name>.age exists (and ~/.ssh/<name>.pub when
secrets/ssh-<name>.pub exists).
'';
};
};
};
};
secretsDir = mkOption {
type = types.path;
default = ../../secrets;
defaultText = lib.literalExpression "./secrets";
description = ''
Directory with the agenix *.age files. A secret is declared only when its
file exists, so a fresh clone still evaluates. Flakes only see files that
git tracks: `git add` new secrets before building.
'';
};
};
}
+54
View File
@@ -0,0 +1,54 @@
# Host construction. Every `configurations.nixos.<name>.module` (merged from all
# files that set it, see modules/hosts/<name>/) becomes
# `nixosConfigurations.<name>`, and its toplevel becomes
# `checks.<system>.nixos-<name>`, so `nix flake check --no-build` evaluates
# every host completely (plain `nix flake check` builds them).
{
config,
inputs,
lib,
...
}:
let
hosts = config.configurations.nixos;
inherit (config.flake) nixosConfigurations;
in
{
options.configurations.nixos = lib.mkOption {
description = "NixOS hosts, one deferred module per host.";
default = { };
type = lib.types.lazyAttrsOf (
lib.types.submodule {
options.module = lib.mkOption {
type = lib.types.deferredModule;
description = "The host's NixOS module: aspects to import plus host-only values.";
};
}
);
};
config = {
flake.nixosConfigurations = lib.mapAttrs (
name: host:
inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
host.module
{ networking.hostName = lib.mkDefault name; }
];
}
) hosts;
perSystem =
{ system, ... }:
let
hostsOnSystem = lib.filterAttrs (
name: _: nixosConfigurations.${name}.pkgs.stdenv.hostPlatform.system == system
) hosts;
toplevel = name: nixosConfigurations.${name}.config.system.build.toplevel;
in
{
checks = lib.mapAttrs' (name: _: lib.nameValuePair "nixos-${name}" (toplevel name)) hostsOnSystem;
};
};
}
+44
View File
@@ -0,0 +1,44 @@
# Overlays exposed as `overlays.<name>`; `default` composes all of them and is
# applied to every host (modules/core/nixpkgs.nix), to the installer and to the
# per-system package set (modules/flake/packages.nix).
{ inputs, lib, ... }:
{
flake.overlays = rec {
# Hyprland's own upstream overlays, built from the pinned `hyprland` flake
# input against our nixpkgs. Upstream `default` omits the hyprwm libraries
# (aquamarine, hyprutils, hyprland-guiutils, ...); `hyprland-packages`
# carries them plus Hyprland, `hyprland-extras` adds the matching portal.
hyprland = lib.composeManyExtensions [
inputs.hyprland.overlays.hyprland-packages
inputs.hyprland.overlays.hyprland-extras
];
# Noctalia from its flake. That flake does not follow our nixpkgs, so the
# store path matches noctalia.cachix.org and is downloaded, not compiled.
noctalia = final: _prev: {
noctalia = inputs.noctalia.packages.${final.stdenv.hostPlatform.system}.default;
};
# This repository's own packages (../../pkgs): install and key helpers.
additions =
final: _prev:
import ../../pkgs {
pkgs = final;
inherit inputs;
};
# Changes to existing nixpkgs packages. They apply system-wide and to
# home-manager (useGlobalPkgs = true).
modifications = _final: prev: {
# btop with AMD GPU monitoring (ROCm SMI) for the Radeon card.
btop = prev.btop.override { rocmSupport = true; };
};
default = lib.composeManyExtensions [
hyprland
noctalia
additions
modifications
];
};
}
+32
View File
@@ -0,0 +1,32 @@
# The per-system package set (our overlay, unfree allowed) and the repository's
# own tools as flake packages. They are checks too, so plain `nix flake check`
# builds them (writeShellApplication runs shellcheck).
{ config, inputs, ... }:
let
overlay = config.flake.overlays.default;
in
{
perSystem =
{ system, pkgs, ... }:
let
tools = {
inherit (pkgs)
install-system
create-keys
set-password
secret-from-file
switch-system
;
};
in
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ overlay ];
config.allowUnfree = true;
};
packages = tools;
checks = tools;
};
}
+9
View File
@@ -0,0 +1,9 @@
# flake-parts glue: the module classes this flake publishes (flake.modules.nixos.*
# and flake.modules.homeManager.*, exported as the `modules` output) and the
# systems the per-system outputs are built for.
{ inputs, ... }:
{
imports = [ inputs.flake-parts.flakeModules.modules ];
systems = [ "x86_64-linux" ];
}
+56
View File
@@ -0,0 +1,56 @@
# Steam + Proton, gamescope, gamemode and MangoHud. The owner joins the
# `gamemode` group (created by programs.gamemode) so gamemoderun may renice and
# tune the GPU.
{ config, ... }:
let
inherit (config.meta) owner;
in
{
flake.modules.nixos.gaming =
{ pkgs, ... }:
{
programs = {
steam = {
enable = true;
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
dedicatedServer.openFirewall = false;
gamescopeSession.enable = true;
extraCompatPackages = [ pkgs.proton-ge-bin ];
protontricks.enable = true;
# Steam Input on Wayland (controllers acting as keyboard/mouse).
extest.enable = true;
};
gamescope = {
enable = false;
# Lets gamescope raise its own priority.
capSysNice = true;
};
gamemode = {
enable = true;
settings = {
general.renice = 10;
gpu = {
apply_gpu_optimisations = "accept-responsibility";
gpu_device = 0;
amd_performance_level = "high";
};
};
};
};
hardware.steam-hardware.enable = true;
environment.systemPackages = with pkgs; [
mangohud
protonplus
];
# Some Proton games exhaust the default map count and crash.
boot.kernel.sysctl."vm.max_map_count" = 2147483642;
users.users.${owner.name}.extraGroups = [ "gamemode" ];
};
}
+39
View File
@@ -0,0 +1,39 @@
# AMD CPU + Radeon GPU. The nixos-hardware profiles (common-cpu-amd, -pstate,
# -gpu-amd, -pc-ssd) are imported by the host (modules/hosts/<name>/hardware.nix);
# defaults that overlap use mkDefault. The ROCm/HIP compute stack is a separate
# aspect (hardware/rocm.nix).
{
flake.modules.nixos.amd =
{ lib, pkgs, ... }:
{
hardware = {
graphics = {
enable = true;
# Steam/Proton and Wine need the 32-bit Mesa drivers.
enable32Bit = true;
};
amdgpu = {
initrd.enable = lib.mkDefault true;
opencl.enable = true;
# LACT needs the overdrive bit in amdgpu.ppfeaturemask to tune clocks.
overdrive.enable = true;
};
cpu.amd.updateMicrocode = lib.mkDefault true;
};
boot.kernelModules = [ "kvm-amd" ];
# LACT: GPU monitoring, fan curves and overclocking.
services.lact.enable = true;
environment.systemPackages = with pkgs; [
vulkan-tools
mesa-demos
radeontop
nvtopPackages.amd
lm_sensors
];
};
}
+16
View File
@@ -0,0 +1,16 @@
# ROCm/HIP compute stack for AMD GPUs: rocminfo, rocm-smi and the /opt/rocm/hip
# link many HIP applications look for. Off by default: a host opts in by
# importing this aspect next to `amd` (the desktop host does not).
{
flake.modules.nixos.rocm =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs.rocmPackages; [
rocminfo
rocm-smi
];
# Many HIP applications look for the runtime in /opt/rocm/hip.
systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ];
};
}
-33
View File
@@ -1,33 +0,0 @@
# Everyday desktop applications.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.home.apps;
in
{
options.my.home.apps.enable = lib.mkEnableOption "desktop applications";
config = lib.mkIf cfg.enable {
programs = {
firefox.enable = true;
mpv.enable = true;
imv.enable = true;
zathura.enable = true;
};
home.packages = with pkgs; [
vesktop # Discord client with working screen sharing on Wayland
telegram-desktop
file-roller
teamspeak6-client
loupe # image viewer
zenity
procps
networkmanager-openvpn
];
};
}
-17
View File
@@ -1,17 +0,0 @@
# Home-manager modules, all behind `my.home.<name>.enable` (default false).
# Loaded for every user through home-manager.sharedModules (see lib/default.nix);
# hosts/<name>/home.nix turns the wanted ones on.
{
imports = [
./hyprland
./noctalia.nix
./wezterm.nix
./neovim
./shell.nix
./git.nix
./ssh.nix
./xdg.nix
./theming.nix
./apps.nix
];
}
-65
View File
@@ -1,65 +0,0 @@
# Hyprland user configuration. Hyprland 0.56 reads Lua, so the real config lives
# in the plain .lua files next to this module; Nix only passes in the few
# values that come from the system config (keyboard layouts, cursor, apps).
{
config,
lib,
pkgs,
osConfig,
...
}:
let
cfg = config.my.home.hyprland;
cursor = config.home.pointerCursor;
# Exposed to the Lua files as `require("nixvars")`.
nixVars = {
kbLayout = lib.concatStringsSep "," osConfig.my.locale.keyboardLayouts;
kbOptions = lib.concatStringsSep "," osConfig.my.locale.keyboardOptions;
terminal = "wezterm";
fileManager = "dolphin";
cursorSize = if cursor.enable then cursor.size else 24;
cursorTheme = if cursor.enable then cursor.name else "";
};
in
{
options.my.home.hyprland.enable = lib.mkEnableOption "Hyprland user configuration (Lua)";
config = lib.mkIf cfg.enable {
wayland.windowManager.hyprland = {
enable = true;
configType = "lua";
# The NixOS module (programs.hyprland) installs the compositor and the
# portal, built from the flake overlay. Installing them again here would
# put a second copy in the user profile.
package = null;
portalPackage = null;
# UWSM owns the session and graphical-session.target; HM's own
# hyprland-session.target and dbus import would only duplicate that.
systemd.enable = false;
xwayland.enable = true;
# Loaded in name order; `nixvars` is a helper module, not loaded on its own.
extraLuaFiles = {
nixvars = {
content = "return ${lib.generators.toLua { } nixVars}\n";
autoLoad = false;
};
"10-settings" = ./settings.lua;
"20-binds" = ./binds.lua;
"30-rules" = ./rules.lua;
};
};
# Tools the binds call (screenshots, file manager).
home.packages = with pkgs; [
grim
slurp
wl-clipboard
kdePackages.dolphin
kdePackages.dolphin-plugins
];
};
}
-54
View File
@@ -1,54 +0,0 @@
# Neovim with LSP, completion, fuzzy finding and format-on-save.
# The editor config is in init.lua next to this file.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.home.neovim;
in
{
options.my.home.neovim.enable = lib.mkEnableOption "Neovim editor";
config = lib.mkIf cfg.enable {
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
nvim-treesitter.withAllGrammars
nvim-lspconfig
blink-cmp
telescope-nvim
telescope-fzf-native-nvim
plenary-nvim
lualine-nvim
gitsigns-nvim
which-key-nvim
oil-nvim
conform-nvim
catppuccin-nvim
nvim-web-devicons
mini-nvim
];
# Language servers, formatters and search tools, visible to nvim only.
extraPackages = with pkgs; [
nixd
nixfmt
lua-language-server
stylua
bash-language-server
shfmt
ripgrep
fd
];
initLua = builtins.readFile ./init.lua;
};
};
}
-47
View File
@@ -1,47 +0,0 @@
# Noctalia v5 shell (bar, launcher, notifications, lock screen, wallpaper).
# The module itself comes from the noctalia flake (home-manager sharedModules).
# Settings are validated at build time by `noctalia config validate`, so only
# keys from the upstream schema may appear here. Anything changed in the
# settings window at runtime is stored separately and overrides this file.
{
config,
lib,
...
}:
let
cfg = config.my.home.noctalia;
in
{
options.my.home.noctalia.enable = lib.mkEnableOption "Noctalia shell";
config = lib.mkIf cfg.enable {
programs.noctalia = {
enable = true;
# A user service instead of hl.exec_cmd, so it restarts on failure and
# follows graphical-session.target (managed by UWSM).
systemd.enable = true;
settings = {
theme = {
mode = "dark";
source = "builtin";
builtin = "Catppuccin";
};
shell = {
# Installed system-wide (modules/nixos/desktop/fonts.nix).
font_family = "Monaspace Krypton";
telemetry_enabled = false;
# No other polkit agent is started in the session.
polkit_agent = true;
# Apps started from the launcher get their own systemd scope, so
# restarting the shell service does not kill them.
launch_apps_as_systemd_services = true;
};
};
};
};
}
-84
View File
@@ -1,84 +0,0 @@
# Interactive shell: zsh with starship prompt, fzf, zoxide, eza, bat, direnv.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.home.shell;
in
{
options.my.home.shell.enable = lib.mkEnableOption "zsh shell environment and CLI tools";
config = lib.mkIf cfg.enable {
programs = {
zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
autocd = true;
history = {
size = 50000;
save = 50000;
# Share between open terminals, skip duplicates and space-prefixed lines.
share = true;
ignoreDups = true;
ignoreSpace = true;
extended = true;
};
shellAliases = {
cat = "bat";
".." = "cd ..";
g = "git";
# nh builds, diffs and activates the flake in one step.
rebuild = "nh os switch";
rebuild-boot = "nh os boot";
rebuild-test = "nh os test";
};
};
starship = {
enable = true;
settings = {
add_newline = false;
# Short marker inside `nix shell` / `nix develop`.
nix_shell.format = "[$symbol$state]($style) ";
};
};
fzf = {
enable = true;
defaultCommand = "fd --type f --hidden --exclude .git";
fileWidget.command = "fd --type f --hidden --exclude .git";
changeDirWidget.command = "fd --type d --hidden --exclude .git";
};
# `z dir` jumps to frecent directories, `zi` picks with fzf.
zoxide.enable = true;
# ls, ll, la, lt and lla aliases come from the zsh integration.
eza = {
enable = true;
icons = "auto";
git = true;
};
bat.enable = true;
direnv = {
enable = true;
nix-direnv.enable = true;
};
btop.enable = true;
fastfetch.enable = true;
};
# fd backs the fzf commands above.
home.packages = [ pkgs.fd ];
};
}
-81
View File
@@ -1,81 +0,0 @@
# SSH client, agent and the user's keys.
# Private keys are agenix secrets (decrypted at boot into /run/agenix); this
# module only links them into ~/.ssh so ssh finds them at the usual path.
{
config,
lib,
osConfig,
...
}:
let
cfg = config.my.home.ssh;
secrets = osConfig.my.secrets;
# Keys that actually have an encrypted secret in the repo. Without a secret
# nothing is linked, so a fresh install still boots and ssh falls back to
# whatever key the user generates by hand.
keys = lib.filter (k: osConfig.age.secrets ? "ssh-${k}") secrets.userSshKeys;
pubFile = k: secrets.dir + "/ssh-${k}.pub";
# The decrypted file lives outside the store, so link it by absolute path.
keyFiles = lib.listToAttrs (
map (
k:
lib.nameValuePair ".ssh/${k}" {
source = config.lib.file.mkOutOfStoreSymlink osConfig.age.secrets."ssh-${k}".path;
}
) keys
);
# Public keys are not secret, so they are plain files from the repo.
pubFiles = lib.listToAttrs (
map (k: lib.nameValuePair ".ssh/${k}.pub" { source = pubFile k; }) (
lib.filter (k: builtins.pathExists (pubFile k)) keys
)
);
in
{
options.my.home.ssh.enable = lib.mkEnableOption "SSH client, agent and agenix-provided keys";
config = lib.mkIf cfg.enable {
programs.ssh = {
enable = true;
# Spell the defaults out below instead of relying on the deprecated ones.
enableDefaultConfig = false;
settings = {
"*" = {
# Load a key into the agent on first use, so the passphrase (if any)
# is typed once per login.
AddKeysToAgent = "yes";
ServerAliveInterval = 60;
ServerAliveCountMax = 3;
HashKnownHosts = false;
UserKnownHostsFile = "~/.ssh/known_hosts";
};
"github.com" = {
User = "git";
IdentityFile = "~/.ssh/id_ed25519";
# Offer only this key, not everything in the agent.
IdentitiesOnly = true;
};
"git.protei.ru" = {
User = "git";
IdentityFile = "~/.ssh/id_ed25519_work";
IdentitiesOnly = true;
};
};
};
# A plain user service rather than gnome-keyring's agent: no keyring to
# unlock, and it sets SSH_AUTH_SOCK for shells, systemd and D-Bus. The
# system must not start another agent (programs.ssh.startAgent).
services.ssh-agent.enable = true;
home.file = keyFiles // pubFiles;
};
}
-51
View File
@@ -1,51 +0,0 @@
# Dark GTK and Qt look, icons and cursor. Noctalia themes the shell itself;
# this keeps the apps consistent with it.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.home.theming;
in
{
options.my.home.theming.enable = lib.mkEnableOption "GTK/Qt theme, icons and cursor";
config = lib.mkIf cfg.enable {
gtk = {
enable = true;
colorScheme = "dark";
theme = {
name = "adw-gtk3-dark";
package = pkgs.adw-gtk3;
};
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
};
# gtk.enable above lets GTK apps pick the cursor up from here.
home.pointerCursor = {
enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 24;
gtk.enable = true;
};
# Qt apps follow the GTK settings, with the Adwaita dark widget style.
qt = {
enable = true;
platformTheme.name = "gtk3";
style.name = "adwaita-dark";
};
# libadwaita and GTK 4 apps read the preference from dconf. The system
# needs programs.dconf.enable for this to be applied.
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
};
}
-50
View File
@@ -1,50 +0,0 @@
# WezTerm terminal (SUPER+Return in Hyprland). The fonts it asks for
# (JetBrainsMono Nerd Font, Noto Color Emoji) come from modules/nixos/desktop/fonts.nix.
{
config,
lib,
...
}:
let
cfg = config.my.home.wezterm;
in
{
options.my.home.wezterm.enable = lib.mkEnableOption "WezTerm terminal";
config = lib.mkIf cfg.enable {
programs.wezterm = {
enable = true;
extraConfig = ''
local act = wezterm.action
local config = wezterm.config_builder()
config.color_scheme = 'Catppuccin Mocha'
config.font = wezterm.font_with_fallback { 'Monaspace Krypton', 'Noto Color Emoji' }
config.font_size = 12.0
-- Wayland-native, no client-side titlebar (Hyprland draws the borders).
config.enable_wayland = true
config.window_decorations = 'NONE'
config.window_padding = { left = 8, right = 8, top = 8, bottom = 8 }
-- A tab bar only when there is more than one tab.
config.hide_tab_bar_if_only_one_tab = true
config.use_fancy_tab_bar = false
config.scrollback_lines = 20000
config.audible_bell = 'Disabled'
config.check_for_updates = false
-- Hyprland owns SUPER and ALT+Tab, so splits live on CTRL+SHIFT.
-- phys: keys are layout independent and work with the ru layout.
config.keys = {
{ key = 'phys:D', mods = 'CTRL|SHIFT', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' } },
{ key = 'phys:E', mods = 'CTRL|SHIFT', action = act.SplitVertical { domain = 'CurrentPaneDomain' } },
}
return config
'';
};
};
}
+165
View File
@@ -0,0 +1,165 @@
# desktop: disk layout (disko), btrfs, no encryption.
# system disk (NVMe): ESP + btrfs "nixos" with @root @home @nix @log @swap
# data disk (SATA): btrfs "data", one subvolume per home folder, each
# mounted inside the owner's home (~/Games, ~/Music, ...)
# The device paths come from hosts/desktop/disk-ids.json, which
# `nix run .#install` rewrites after you pick the disks
# (list them with `ls -l /dev/disk/by-id`).
{
config,
inputs,
lib,
...
}:
let
inherit (config.meta) owner;
ids = lib.importJSON ../../../hosts/desktop/disk-ids.json;
home = "/home/${owner.name}";
# Each entry becomes a btrfs subvolume on the data disk, mounted at
# ~/<Name>. To add a folder later, add `Name = { };` here, create the
# subvolume (`btrfs subvolume create /mnt/data/@name`, with the data disk's
# top level mounted), then rebuild. Storage is a free-form folder to organise
# yourself; Steam's library goes in ~/Games/SteamLibrary.
homeFolders = {
Games = { };
Downloads = { };
Documents = { };
Music = { };
Pictures = { };
Videos = { };
Storage = { };
};
subvolumeOf = name: folder: folder.subvolume or ("@" + lib.toLower name);
# Compression keeps the NVMe small-write friendly; noatime avoids metadata writes.
btrfsOptions = [
"compress=zstd:1"
"noatime"
];
dataMountOptions = btrfsOptions ++ [
# The machine still boots (to the system disk) if the SSD is missing.
"nofail"
"x-systemd.device-timeout=10s"
];
placeholders = lib.filter (lib.hasInfix "CHANGE-ME") [
ids.system
ids.data
];
in
{
configurations.nixos.desktop.module = {
imports = [ inputs.disko.nixosModules.disko ];
disko.devices.disk = {
system = {
type = "disk";
device = ids.system;
content = {
type = "gpt";
partitions = {
ESP = {
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
# Only root may read the ESP (random seed, lanzaboote images).
mountOptions = [ "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [
"-f"
"-L"
"nixos"
];
subvolumes = {
"@root" = {
mountpoint = "/";
mountOptions = btrfsOptions;
};
"@home" = {
mountpoint = "/home";
mountOptions = btrfsOptions;
};
"@nix" = {
mountpoint = "/nix";
mountOptions = btrfsOptions;
};
"@log" = {
mountpoint = "/var/log";
mountOptions = btrfsOptions;
};
# No compression on the swapfile's subvolume.
"@swap" = {
mountpoint = "/swap";
mountOptions = [ "noatime" ];
swap.swapfile.size = "16G";
};
};
};
};
};
};
};
data = {
type = "disk";
device = ids.data;
content = {
type = "gpt";
partitions.data = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [
"-f"
"-L"
"data"
];
subvolumes = lib.mapAttrs' (
name: folder:
lib.nameValuePair (subvolumeOf name folder) {
mountpoint = "${home}/${name}";
mountOptions = dataMountOptions;
}
) homeFolders;
};
};
};
};
};
# Logs must be mounted before journald starts in stage 2.
fileSystems."/var/log".neededForBoot = true;
services.btrfs.autoScrub = {
enable = true;
interval = "monthly";
fileSystems = [
"/"
"${home}/${lib.head (lib.attrNames homeFolders)}"
];
};
# Subvolume roots are created root-owned; hand them to the owner. The home
# directory itself is listed first so the mount points have a parent.
systemd.tmpfiles.rules = [
"d ${home} 0700 ${owner.name} users -"
]
++ lib.mapAttrsToList (name: _: "d ${home}/${name} 0755 ${owner.name} users -") homeFolders;
warnings = lib.optional (placeholders != [ ]) ''
hosts/desktop/disk-ids.json still has placeholder device paths (${lib.concatStringsSep ", " placeholders}).
Run `nix run .#install`, or edit hosts/desktop/disk-ids.json, before installing.
'';
};
}
+14
View File
@@ -0,0 +1,14 @@
# desktop: the generated hardware scan (rewritten by install-system) and the
# nixos-hardware profiles for an AMD CPU and GPU on an SSD.
{ inputs, ... }:
{
configurations.nixos.desktop.module = {
imports = [
../../../hosts/desktop/hardware-configuration.nix
inputs.nixos-hardware.nixosModules.common-cpu-amd
inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate
inputs.nixos-hardware.nixosModules.common-gpu-amd
inputs.nixos-hardware.nixosModules.common-pc-ssd
];
};
}
+70
View File
@@ -0,0 +1,70 @@
# desktop: AMD CPU + AMD GPU workstation/gaming PC. Which aspects it runs, plus
# the few values that belong to this machine only. Hardware: hardware.nix,
# disks: disks.nix. install-system writes hosts/desktop/disk-ids.json and
# hosts/desktop/hardware-configuration.nix at the repository root.
{ config, ... }:
let
inherit (config.meta) owner;
nixos = config.flake.modules.nixos;
hm = config.flake.modules.homeManager;
in
{
configurations.nixos.desktop.module = {
# Aspects with a home-manager half (hyprland, noctalia, ssh, theme) add it
# to the owner themselves.
imports = with nixos; [
core
secure-boot
amd
ssh
secrets
hyprland
noctalia
audio
fonts
theme
gaming
vpn
proxy-suite
docker
gitea-runner
nix-ld
];
# The owner's own programs (home-manager only). A dynamic attribute such
# as `${owner.name}` may appear only once per attribute set, so everything
# for the owner's home-manager configuration sits in this one block.
home-manager.users.${owner.name} = {
imports = with hm; [
shell
git
neovim
wezterm
xdg
apps
claude-code
];
# Set once at install time; do not change on upgrades.
home.stateVersion = "26.05";
};
nixpkgs.hostPlatform = "x86_64-linux";
time.timeZone = "Europe/Moscow";
i18n.defaultLocale = "en_US.UTF-8";
# XKB layouts in switching order. The console follows them
# (core/locale.nix) and so does Hyprland (desktop/hyprland, via osConfig).
services.xserver.xkb = {
layout = "us,ru";
options = "grp:alt_shift_toggle";
};
# No packet filter on this machine.
networking.firewall.enable = false;
# Set once at install time; do not change on upgrades.
system.stateVersion = "26.05";
};
}
-80
View File
@@ -1,80 +0,0 @@
# Installer ISO (`nix build .#iso`): the minimal NixOS installer plus this
# flake and the install tooling. Wired up in lib/default.nix (mkInstaller).
{
lib,
pkgs,
inputs,
self,
...
}:
let
inherit (pkgs.stdenv.hostPlatform) system;
# Every flake input including nested ones, so the sources are on the ISO and
# a locked flake installs without re-downloading them.
allInputs = builtins.genericClosure {
startSet = map (i: {
key = toString i.outPath;
inherit i;
}) (lib.attrValues inputs);
operator =
x:
map (i: {
key = toString i.outPath;
inherit i;
}) (lib.attrValues (x.i.inputs or { }));
};
in
{
nix.settings = {
experimental-features = [
"nix-command"
"flakes"
];
# The flake's nixConfig lists binary caches (Noctalia, nix-community).
accept-flake-config = true;
};
# nmtui / nmcli instead of wpa_supplicant.
networking.networkmanager = {
enable = true;
plugins = with pkgs; [
networkmanager-openvpn
];
};
networking.wireless.enable = lib.mkForce false;
environment.systemPackages = [
pkgs.install-system
pkgs.create-keys
pkgs.set-password
pkgs.secret-from-file
pkgs.git
pkgs.jq
pkgs.age
pkgs.sbctl
pkgs.btrfs-progs
pkgs.neovim
inputs.disko.packages.${system}.disko
inputs.agenix.packages.${system}.default
];
# The flake itself, read-only. install-system copies it before changing it.
environment.etc."nixos-config".source = self;
system.extraDependencies = map (x: x.i.outPath) allInputs;
users.motd = ''
NixOS installer for the "desktop" flake
1. Network: nmtui (Ethernet works out of the box)
2. Install: sudo install-system
(flake: /etc/nixos-config, or --flake DIR for a copy on a stick;
--keys-dir DIR for keys/ on a mounted stick)
3. Keys: create-keys, set-password, secret-from-file (see the README)
install-system asks which disks to use and erases them only after you type the host name.
'';
}
+108
View File
@@ -0,0 +1,108 @@
# Installer ISO (`nix build .#iso`): the minimal NixOS installer plus this
# flake and the install tooling. The installer is not a host: it imports no
# other aspect and has no home-manager.
{
config,
inputs,
lib,
...
}:
let
overlay = config.flake.overlays.default;
in
{
flake.modules.nixos.installer =
{ pkgs, ... }:
let
inherit (pkgs.stdenv.hostPlatform) system;
# Every flake input including nested ones, so the sources are on the ISO and
# a locked flake installs without re-downloading them.
allInputs = builtins.genericClosure {
startSet = map (i: {
key = toString i.outPath;
inherit i;
}) (lib.attrValues inputs);
operator =
x:
map (i: {
key = toString i.outPath;
inherit i;
}) (lib.attrValues (x.i.inputs or { }));
};
in
{
nix.settings = {
experimental-features = [
"nix-command"
"flakes"
];
# The flake's nixConfig lists binary caches (Noctalia, nix-community).
accept-flake-config = true;
};
# nmtui / nmcli instead of wpa_supplicant.
networking.networkmanager = {
enable = true;
plugins = with pkgs; [
networkmanager-openvpn
];
};
networking.wireless.enable = lib.mkForce false;
environment.systemPackages = [
pkgs.install-system
pkgs.create-keys
pkgs.set-password
pkgs.secret-from-file
pkgs.git
pkgs.jq
pkgs.age
pkgs.sbctl
pkgs.btrfs-progs
pkgs.neovim
inputs.disko.packages.${system}.disko
inputs.agenix.packages.${system}.default
];
# The flake itself, read-only. install-system copies it before changing it.
environment.etc."nixos-config".source = inputs.self;
system.extraDependencies = map (x: x.i.outPath) allInputs;
users.motd = ''
NixOS installer for the "desktop" flake
1. Network: nmtui (Ethernet works out of the box)
2. Install: sudo install-system
(flake: /etc/nixos-config, or --flake DIR for a copy on a stick;
--keys-dir DIR for keys/ on a mounted stick)
3. Keys: create-keys, set-password, secret-from-file (see the README)
install-system asks which disks to use and erases them only after you type the host name.
'';
};
flake.nixosConfigurations.installer = inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
"${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
{
nixpkgs.hostPlatform = "x86_64-linux";
nixpkgs.overlays = [ overlay ];
}
config.flake.modules.nixos.installer
];
};
perSystem =
{ system, ... }:
{
# The ISO is built for x86_64-linux only.
packages = lib.optionalAttrs (system == "x86_64-linux") {
iso = config.flake.nixosConfigurations.installer.config.system.build.isoImage;
};
};
}
+66
View File
@@ -0,0 +1,66 @@
# proxy-suite (github:FUFSoB/proxy-suite-flake): zapret DPI bypass, the
# Telegram WebSocket proxy and the GUI. The MTProto secret is an agenix secret:
# secrets/tg-ws-proxy-secret.age the secret (32 hex digits)
# (nix run .#secret-from-file -- tg-ws-proxy-secret.age <file>)
# proxy-suite reads it through systemd LoadCredential, so root ownership is
# enough. Without the file the Telegram proxy stays off and a warning says so.
{
config,
inputs,
lib,
...
}:
let
tgSecret = config.meta.secretsDir + "/tg-ws-proxy-secret.age";
hasTgSecret = builtins.pathExists tgSecret;
in
{
flake.modules.nixos.proxy-suite =
{ config, ... }:
{
imports = [ inputs.proxy-suite.nixosModules.default ];
age.secrets = lib.optionalAttrs hasTgSecret {
tg-ws-proxy-secret = {
file = tgSecret;
mode = "0400";
};
};
services.proxy-suite = {
enable = true;
proxy = {
enable = false;
};
# perAppRouting = {
# enable = true;
# createDefaultProfiles = true;
# proxychains.enable = true;
# tun.enable = true;
# tproxy.enable = true;
# zapret.enable = true;
# };
zapret = {
enable = true;
zapret-discord-youtube.configName = "general(ALT)";
};
tgWsProxy = {
enable = hasTgSecret;
secretFile = if hasTgSecret then config.age.secrets.tg-ws-proxy-secret.path else null;
bypassTransparentProxy = true;
};
gui.enable = true;
};
warnings = lib.optional (!hasTgSecret) ''
The Telegram WebSocket proxy (services.proxy-suite.tgWsProxy) is off:
secrets/tg-ws-proxy-secret.age is missing. Create it with the command in
secrets/README.md (32 random hex digits) and `git add` it.
'';
};
}
+9
View File
@@ -0,0 +1,9 @@
# VPN clients: AmneziaVPN and the NetworkManager tray applet. The OpenVPN plugin
# for NetworkManager comes with NetworkManager itself (core/networking.nix), so
# imported connections work with or without this aspect.
{
flake.modules.nixos.vpn = {
programs.nm-applet.enable = true;
programs.amnezia-vpn.enable = true;
};
}
-49
View File
@@ -1,49 +0,0 @@
# Bootloader: lanzaboote (Secure Boot) or plain systemd-boot, plus kernel.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.boot;
in
{
options.my.boot.secureBoot.enable = lib.mkEnableOption ''
Secure Boot through lanzaboote. Keys live in /var/lib/sbctl (create them
with `sbctl create-keys` before the first boot). When disabled the system
uses plain systemd-boot
'';
config = lib.mkMerge [
{
boot = {
loader.efi.canTouchEfiVariables = true;
initrd.systemd.enable = true;
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
};
}
(lib.mkIf cfg.secureBoot.enable {
boot = {
lanzaboote = {
enable = true;
pkiBundle = "/var/lib/sbctl";
configurationLimit = 10;
};
# lanzaboote installs the boot entries itself.
loader.systemd-boot.enable = lib.mkForce false;
};
environment.systemPackages = [ pkgs.sbctl ];
})
(lib.mkIf (!cfg.secureBoot.enable) {
boot.loader.systemd-boot = {
enable = true;
configurationLimit = 10;
editor = false;
};
})
];
}
-57
View File
@@ -1,57 +0,0 @@
# Time zone, locale and keyboard layout (also used by the console and by the
# home-manager Hyprland module through osConfig).
{ config, lib, ... }:
let
cfg = config.my.locale;
inherit (lib) mkOption types;
in
{
options.my.locale = {
timeZone = mkOption {
type = types.str;
example = "Europe/Moscow";
description = "IANA time zone name.";
};
defaultLocale = mkOption {
type = types.str;
default = "en_US.UTF-8";
description = "Default system locale (LANG).";
};
keyboardLayouts = mkOption {
type = types.listOf types.str;
default = [ "us" ];
example = [
"us"
"ru"
];
description = "XKB layouts, in switching order.";
};
keyboardOptions = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "grp:alt_shift_toggle" ];
description = "XKB options such as the layout toggle shortcut.";
};
};
config = {
time.timeZone = cfg.timeZone;
i18n = {
inherit (cfg) defaultLocale;
# Russian stays available for apps and games even with an English UI.
extraLocales = [ "ru_RU.UTF-8/UTF-8" ];
};
services.xserver.xkb = {
layout = lib.concatStringsSep "," cfg.keyboardLayouts;
options = lib.concatStringsSep "," cfg.keyboardOptions;
};
# TTY and initrd keymap follow the XKB layout above.
console.useXkbConfig = true;
};
}
-93
View File
@@ -1,93 +0,0 @@
# NetworkManager with the default (closed) firewall. The user joins the
# `networkmanager` group in users.nix.
{
config,
lib,
pkgs,
...
}:
{
networking = {
networkmanager = {
enable = true;
plugins = with pkgs; [
networkmanager-openvpn
];
};
firewall.enable = false;
};
programs.nm-applet.enable = true;
programs.amnezia-vpn.enable = true;
services.proxy-suite = {
enable = true;
proxy = {
enable = false;
};
# perAppRouting = {
# enable = true;
# createDefaultProfiles = true;
# proxychains.enable = true;
# tun.enable = true;
# tproxy.enable = true;
# zapret.enable = true;
# };
zapret = {
enable = true;
zapret-discord-youtube.configName = "general(ALT)";
};
tgWsProxy = {
enable = true;
secret = "637854682629bfdca35fe9c58e797915";
bypassTransparentProxy = true;
};
gui.enable = true;
};
virtualisation.docker.enable = true;
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
virtualisation.docker.storageDriver = "btrfs";
services.gitea-actions-runner.instances."performance" = {
enable = true;
url = "https://git.faumaray.com";
name = "Perfrormance Runner";
token = "DJrTt1RLMROrXxVBDF1XVvo7wiKhHVxmofBBjl4S";
labels = [
"ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
"voelin-release:docker://docker.gitea.com/runner-images:ubuntu-latest"
"ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04"
"ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
"echoion-release-serial:docker://git.faumaray.ru/void/echoion-release-builder:gcc-16.1.0"
];
settings = {
runner = {
capacity = 5;
timeout = "3h";
fetch_timeout = "5s";
fetch_interval = "1s";
};
cache = {
enabled = true;
host = "192.168.255.242"; # or "localhost" if not using isolated docker containers
port = 8088;
dir = "/var/lib/gitea-runner/cache";
};
container = {
# Ensure the job container passes standard bridge mode
network_mode = "bridge";
# Provide the job containers an alias to reach the host system
options = "--add-host=host.docker.internal:host-gateway";
};
};
};
}
-53
View File
@@ -1,53 +0,0 @@
# Nix daemon settings, binary caches, garbage collection and flake registry.
{
config,
inputs,
...
}:
{
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
# root is already trusted by default; this adds the admin group.
trusted-users = [ "@wheel" ];
warn-dirty = false;
# Same caches as flake.nixConfig, so the system keeps using them after
# install without the "untrusted flake settings" prompt.
extra-substituters = [
"https://nix-community.cachix.org"
"https://noctalia.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4="
];
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
# `nix shell nixpkgs#foo` and <nixpkgs> use the exact nixpkgs of this flake
# instead of fetching a different revision.
channel.enable = false;
registry.nixpkgs.flake = inputs.nixpkgs;
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
};
programs = {
# Nicer `nixos-rebuild` front-end that knows where the flake lives.
nh = {
enable = true;
flake = "/home/${config.my.user.name}/nixos-config";
};
# Lets prebuilt binaries (editors' language servers, game launchers) run.
nix-ld.enable = true;
};
}
-90
View File
@@ -1,90 +0,0 @@
# The primary (only) interactive user.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.user;
inherit (lib) mkOption types;
passwordSecret = "${cfg.name}-password";
hasPasswordSecret = config.age.secrets ? ${passwordSecret};
in
{
options.my.user = {
name = mkOption {
type = types.str;
example = "faumaray";
description = "Login name of the primary user.";
};
fullName = mkOption {
type = types.str;
description = "Display name (GECOS), also used for git.";
};
email = mkOption {
type = types.str;
description = "E-mail address, used for git.";
};
uid = mkOption {
type = types.int;
default = 1000;
description = "Numeric user id.";
};
extraGroups = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Groups in addition to the ones every desktop user gets.";
};
sshAuthorizedKeys = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Public keys allowed to log in over SSH.";
};
};
config = {
users.mutableUsers = true;
users.users.${cfg.name} = {
isNormalUser = true;
inherit (cfg) uid;
description = cfg.fullName;
extraGroups = [
"wheel"
"networkmanager"
"video"
"audio"
"input"
"render"
"docker"
]
++ lib.optional config.my.gaming.enable "gamemode"
++ cfg.extraGroups;
shell = pkgs.zsh;
openssh.authorizedKeys.keys = cfg.sshAuthorizedKeys;
# Real password comes from agenix; otherwise a throwaway one so the first
# boot can never lock the user out.
hashedPasswordFile = lib.mkIf hasPasswordSecret config.age.secrets.${passwordSecret}.path;
initialPassword = lib.mkIf (!hasPasswordSecret) "changeme";
};
# Required by `shell = pkgs.zsh` (puts zsh into /etc/shells).
programs.zsh.enable = true;
security.sudo.wheelNeedsPassword = true;
warnings = lib.optional (!hasPasswordSecret) ''
User "${cfg.name}" has the temporary password "changeme". Run `passwd` after
the first login, or add secrets/${passwordSecret}.age (hashed with
`mkpasswd -m yescrypt`, encrypted with agenix) and `git add` it.
'';
};
}
-24
View File
@@ -1,24 +0,0 @@
# Every NixOS module of this flake (exported as `nixosModules.default`).
# Each file declares its own `my.*` options and is inert until enabled.
{
imports = [
./core/nix.nix
./core/boot.nix
./core/locale.nix
./core/users.nix
./core/networking.nix
./hardware/amd.nix
./hardware/disks.nix
./security/secrets.nix
./security/ssh.nix
./desktop/hyprland.nix
./desktop/noctalia.nix
./desktop/audio.nix
./desktop/fonts.nix
./gaming/steam.nix
];
}
-28
View File
@@ -1,28 +0,0 @@
# System fonts and the default families fontconfig falls back to.
{
config,
lib,
pkgs,
...
}:
{
config = lib.mkIf config.my.desktop.hyprland.enable {
fonts = {
packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-color-emoji
inter
nerd-fonts.jetbrains-mono
nerd-fonts.symbols-only
monaspace
];
fontconfig.defaultFonts = {
monospace = [ "Monaspace Radon" ];
sansSerif = [ "Inter" ];
emoji = [ "Noto Color Emoji" ];
};
};
};
}
-88
View File
@@ -1,88 +0,0 @@
# Hyprland session: UWSM-managed compositor, greetd login, portals, keyring and
# the small system services a desktop needs. Noctalia, audio and fonts are
# separate files gated on the same option.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.desktop.hyprland;
in
{
options.my.desktop.hyprland.enable = lib.mkEnableOption "the Hyprland desktop session";
config = lib.mkIf cfg.enable {
# package/portalPackage stay default: the overlay swaps in the flake builds.
programs.hyprland = {
enable = true;
withUWSM = true;
xwayland.enable = true;
};
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
settings = {
Autologin = {
Session = "hyprland.desktop";
User = "faumaray";
};
};
};
services.greetd = {
enable = false;
# Keeps boot messages from drawing over the greeter.
useTextGreeter = true;
settings.default_session = {
command = lib.concatStringsSep " " [
(lib.getExe pkgs.tuigreet)
"--time"
"--remember"
"--remember-user-session"
"--asterisks"
"--sessions ${config.services.displayManager.sessionData.desktops}/share/wayland-sessions"
];
user = "greeter";
};
};
xdg.portal.extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-hyprland
];
security.polkit.enable = true;
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true;
programs.dconf.enable = true;
# Electron/Chromium apps use native Wayland.
environment.sessionVariables.NIXOS_OZONE_WL = "1";
# Removable drives and trash/mounts in the file manager.
services.udisks2.enable = true;
services.gvfs.enable = true;
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
environment.systemPackages = with pkgs; [
wl-clipboard
cliphist
grim
slurp
brightnessctl
playerctl
pavucontrol
kdePackages.dolphin
kdePackages.dolphin-plugins
hyprpicker
];
};
}
-19
View File
@@ -1,19 +0,0 @@
# Noctalia shell, system side. The user service is started by home-manager
# (modules/home), so `programs.noctalia.systemd` stays off here.
{
config,
lib,
pkgs,
...
}:
{
config = lib.mkIf config.my.desktop.hyprland.enable {
programs.noctalia = {
enable = true;
package = pkgs.noctalia;
# NetworkManager, Bluetooth, UPower and power-profiles-daemon, which the
# shell's panels talk to.
recommendedServices.enable = true;
};
};
}
-57
View File
@@ -1,57 +0,0 @@
# Steam + Proton, gamescope, gamemode and MangoHud.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.gaming;
in
{
options.my.gaming.enable = lib.mkEnableOption "the gaming stack (Steam, Proton-GE, gamescope, gamemode)";
config = lib.mkIf cfg.enable {
programs = {
steam = {
enable = true;
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
dedicatedServer.openFirewall = false;
gamescopeSession.enable = true;
extraCompatPackages = [ pkgs.proton-ge-bin ];
protontricks.enable = true;
# Steam Input on Wayland (controllers acting as keyboard/mouse).
extest.enable = true;
};
gamescope = {
enable = false;
# Lets gamescope raise its own priority.
capSysNice = true;
};
gamemode = {
enable = true;
settings = {
general.renice = 10;
gpu = {
apply_gpu_optimisations = "accept-responsibility";
gpu_device = 0;
amd_performance_level = "high";
};
};
};
};
hardware.steam-hardware.enable = true;
environment.systemPackages = with pkgs; [
mangohud
protonplus
];
# Some Proton games exhaust the default map count and crash.
boot.kernel.sysctl."vm.max_map_count" = 2147483642;
};
}
-71
View File
@@ -1,71 +0,0 @@
# AMD CPU + Radeon GPU. nixos-hardware (common-cpu-amd, -pstate, -gpu-amd,
# -pc-ssd) is imported by the host; defaults that overlap use mkDefault.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.hardware.amd;
in
{
options.my.hardware.amd = {
enable = lib.mkEnableOption "AMD CPU and Radeon GPU support";
rocm.enable = lib.mkEnableOption "ROCm/HIP compute stack (rocminfo, rocm-smi, /opt/rocm/hip)";
lact.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "LACT daemon for GPU monitoring, fan curves and overclocking.";
};
};
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
hardware = {
graphics = {
enable = true;
# Steam/Proton and Wine need the 32-bit Mesa drivers.
enable32Bit = true;
};
amdgpu = {
initrd.enable = lib.mkDefault true;
opencl.enable = true;
};
cpu.amd.updateMicrocode = lib.mkDefault true;
};
boot.kernelModules = [ "kvm-amd" ];
environment.systemPackages = with pkgs; [
vulkan-tools
mesa-demos
radeontop
nvtopPackages.amd
lm_sensors
];
}
(lib.mkIf cfg.lact.enable {
services.lact.enable = true;
# LACT needs the overdrive bit in amdgpu.ppfeaturemask to tune clocks.
hardware.amdgpu.overdrive.enable = true;
})
(lib.mkIf cfg.rocm.enable {
environment.systemPackages = with pkgs.rocmPackages; [
rocminfo
rocm-smi
];
# Many HIP applications look for the runtime in /opt/rocm/hip.
systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ];
})
]
);
}
-216
View File
@@ -1,216 +0,0 @@
# Declarative disk layout, generated into `disko.devices` from `my.disks`.
#
# system disk (NVMe): ESP + btrfs "nixos" with @root @home @nix @log @swap
# data disk (SATA): btrfs "data", one subvolume per home folder, each
# mounted inside the user's home (~/Games, ~/Music, ...)
#
# `disko-install` / the install script partitions the disks from this; on a
# running system the same data produces the matching `fileSystems` entries.
{
config,
lib,
...
}:
let
cfg = config.my.disks;
inherit (lib) mkOption types;
user = config.my.user.name;
home = "/home/${user}";
folders = cfg.data.homeFolders;
hasFolders = cfg.data.enable && folders != { };
# Compression keeps the NVMe small-write friendly; noatime avoids metadata writes.
btrfsOptions = [
"compress=zstd:1"
"noatime"
];
placeholderDevices = lib.filter (d: lib.hasInfix "CHANGE-ME" d) (
[ cfg.system.device ] ++ lib.optional cfg.data.enable cfg.data.device
);
in
{
options.my.disks = {
enable = lib.mkEnableOption "the disko-managed disk layout";
system = {
device = mkOption {
type = types.str;
example = "/dev/disk/by-id/nvme-Samsung_SSD_990_PRO_1TB_S6XXXXXXXXXXXX";
description = "Whole disk for the ESP and the btrfs root. Use a stable /dev/disk/by-id path.";
};
espSize = mkOption {
type = types.str;
default = "2G";
description = "Size of the EFI system partition (mounted on /boot).";
};
swapSize = mkOption {
type = types.str;
default = "16G";
description = "Size of the swapfile in the @swap subvolume.";
};
};
data = {
enable = lib.mkEnableOption "the second (data) disk";
device = mkOption {
type = types.str;
example = "/dev/disk/by-id/ata-Samsung_SSD_870_EVO_2TB_S6XXXXXXXXXXXX";
description = "Whole disk holding the home folder subvolumes.";
};
mountOptions = mkOption {
type = types.listOf types.str;
default = [
"compress=zstd:1"
"noatime"
# The machine still boots (to the system disk) if the SSD is missing.
"nofail"
"x-systemd.device-timeout=10s"
];
description = "Mount options of every data subvolume.";
};
homeFolders = mkOption {
type = types.attrsOf (
types.submodule (
{ name, ... }:
{
options.subvolume = mkOption {
type = types.str;
default = "@" + lib.toLower name;
defaultText = lib.literalExpression ''"@" + lib.toLower name'';
description = "Btrfs subvolume backing this folder.";
};
}
)
);
default = { };
example = lib.literalExpression ''{ Games = { }; Music.subvolume = "@tunes"; }'';
description = ''
Folders of the home directory that live on the data disk. The attribute
name is the folder name and is mounted at /home/<user>/<name>.
'';
};
};
};
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
disko.devices.disk.system = {
type = "disk";
inherit (cfg.system) device;
content = {
type = "gpt";
partitions = {
ESP = {
size = cfg.system.espSize;
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
# Only root may read the ESP (random seed, lanzaboote images).
mountOptions = [ "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [
"-f"
"-L"
"nixos"
];
subvolumes = {
"@root" = {
mountpoint = "/";
mountOptions = btrfsOptions;
};
"@home" = {
mountpoint = "/home";
mountOptions = btrfsOptions;
};
"@nix" = {
mountpoint = "/nix";
mountOptions = btrfsOptions;
};
"@log" = {
mountpoint = "/var/log";
mountOptions = btrfsOptions;
};
# No compression on the swapfile's subvolume.
"@swap" = {
mountpoint = "/swap";
mountOptions = [ "noatime" ];
swap.swapfile.size = cfg.system.swapSize;
};
};
};
};
};
};
};
# Logs must be mounted before journald starts in stage 2.
fileSystems."/var/log".neededForBoot = true;
services.btrfs.autoScrub = {
enable = true;
interval = "monthly";
fileSystems = [
"/"
]
++ lib.optional hasFolders "${home}/${lib.head (lib.attrNames folders)}";
};
warnings = lib.optional (placeholderDevices != [ ]) ''
my.disks still has placeholder device paths (${lib.concatStringsSep ", " placeholderDevices}).
Run `nix run .#install`, or edit hosts/desktop/disk-ids.json, before installing.
'';
}
(lib.mkIf cfg.data.enable {
disko.devices.disk.data = {
type = "disk";
inherit (cfg.data) device;
content = {
type = "gpt";
partitions.data = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [
"-f"
"-L"
"data"
];
subvolumes = lib.mapAttrs' (
name: folder:
lib.nameValuePair folder.subvolume {
mountpoint = "${home}/${name}";
inherit (cfg.data) mountOptions;
}
) folders;
};
};
};
};
# Subvolume roots are created root-owned; hand them to the user. The
# home directory itself is listed first so the mount points have a parent.
systemd.tmpfiles.rules = [
"d ${home} 0700 ${user} users -"
]
++ lib.mapAttrsToList (name: _: "d ${home}/${name} 0755 ${user} users -") folders;
})
]
);
}
-75
View File
@@ -1,75 +0,0 @@
# agenix secrets. Every secret file is optional: a secret is only declared when
# its .age file exists in `my.secrets.dir`, so a fresh clone still evaluates.
#
# <user>-password.age hashed login password (mkpasswd -m yescrypt)
# ssh-<key>.age private SSH key, installed for the user (home-manager
# links it to ~/.ssh/<key>)
{
config,
inputs,
lib,
pkgs,
...
}:
let
cfg = config.my.secrets;
user = config.my.user.name;
secretFile = name: cfg.dir + "/${name}.age";
exists = name: builtins.pathExists (secretFile name);
passwordSecrets = lib.optionalAttrs (exists "${user}-password") {
"${user}-password" = {
file = secretFile "${user}-password";
mode = "0400";
};
};
sshSecrets = lib.listToAttrs (
map (
key:
lib.nameValuePair "ssh-${key}" {
file = secretFile "ssh-${key}";
owner = user;
mode = "0400";
}
) (lib.filter (key: exists "ssh-${key}") cfg.userSshKeys)
);
in
{
options.my.secrets = {
enable = lib.mkEnableOption "agenix secrets from the repository's secrets/ directory";
dir = lib.mkOption {
type = lib.types.path;
default = ../../../secrets;
defaultText = lib.literalExpression "../../../secrets";
description = ''
Directory holding the *.age files. In a flake only files tracked by git
are visible, so `git add` new secrets before building.
'';
};
userSshKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
"id_ed25519"
"id_ed25519_work"
];
description = "SSH key names; each maps to secrets/ssh-<name>.age if present.";
};
};
config = lib.mkIf cfg.enable {
# The host key is generated on the install USB (`create-keys`) and copied
# to the target, so secrets can be decrypted on the very first boot.
age.identityPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
age.secrets = passwordSecrets // sshSecrets;
environment.systemPackages = [
inputs.agenix.packages.${pkgs.stdenv.hostPlatform.system}.default
pkgs.age
];
};
}
-21
View File
@@ -1,21 +0,0 @@
# Key-only OpenSSH server. The host key is also the agenix identity.
{
services.openssh = {
enable = true;
openFirewall = true;
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = "no";
};
hostKeys = [
{
type = "ed25519";
path = "/etc/ssh/ssh_host_ed25519_key";
}
];
};
# The keyring (NixOS) and home-manager provide the agent.
programs.ssh.startAgent = false;
}
+59
View File
@@ -0,0 +1,59 @@
# agenix. The module itself is part of `core`, so `config.age.secrets` always
# exists (users.nix, install-facts.nix and the home-manager ssh aspect read
# it). The `secrets` aspect decrypts the owner's secrets with the host key.
#
# Every secret is optional: it is declared only when its .age file exists in
# meta.secretsDir, so a fresh clone still evaluates.
# <owner>-password.age hashed login password (mkpasswd -m yescrypt)
# ssh-<key>.age private SSH key of the owner (meta.owner.sshKeys);
# home-manager links it to ~/.ssh/<key> (security/ssh.nix)
# Service secrets are declared next to their service (dev/gitea-runner.nix,
# network/proxy-suite.nix) with the same pattern.
{
config,
inputs,
lib,
...
}:
let
inherit (config.meta) owner secretsDir;
secretFile = name: secretsDir + "/${name}.age";
exists = name: builtins.pathExists (secretFile name);
passwordSecrets = lib.optionalAttrs (exists "${owner.name}-password") {
"${owner.name}-password" = {
file = secretFile "${owner.name}-password";
mode = "0400";
};
};
sshSecrets = lib.listToAttrs (
map (
key:
lib.nameValuePair "ssh-${key}" {
file = secretFile "ssh-${key}";
owner = owner.name;
mode = "0400";
}
) (lib.filter (key: exists "ssh-${key}") owner.sshKeys)
);
in
{
flake.modules.nixos.core.imports = [ inputs.agenix.nixosModules.default ];
flake.modules.nixos.secrets =
{ pkgs, ... }:
{
# The host key is generated on the install USB (`create-keys`) and copied
# to the target, so secrets can be decrypted on the very first boot.
age.identityPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
age.secrets = passwordSecrets // sshSecrets;
environment.systemPackages = [
inputs.agenix.packages.${pkgs.stdenv.hostPlatform.system}.default
pkgs.age
];
};
}
+105
View File
@@ -0,0 +1,105 @@
# SSH, both halves:
# NixOS key-only OpenSSH server; its host key is also the agenix identity.
# home-manager the owner's client config, agent and keys. Private keys are
# agenix secrets decrypted into /run/agenix (security/secrets.nix);
# this only links them into ~/.ssh, reading what the NixOS side
# declared through `osConfig.age.secrets`.
{ config, ... }:
let
inherit (config.meta) owner secretsDir;
hmSsh = config.flake.modules.homeManager.ssh;
in
{
flake.modules.nixos.ssh = {
home-manager.users.${owner.name}.imports = [ hmSsh ];
services.openssh = {
enable = true;
openFirewall = true;
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = "no";
};
hostKeys = [
{
type = "ed25519";
path = "/etc/ssh/ssh_host_ed25519_key";
}
];
};
# home-manager's ssh-agent service provides the agent.
programs.ssh.startAgent = false;
};
flake.modules.homeManager.ssh =
{
config,
lib,
osConfig,
...
}:
let
# Keys that have a secret on this host. Without one nothing is linked, so
# a fresh install still works and ssh uses whatever key the user makes.
keys = lib.filter (k: osConfig.age.secrets ? "ssh-${k}") owner.sshKeys;
pubFile = k: secretsDir + "/ssh-${k}.pub";
# The decrypted file lives outside the store, so link it by absolute path.
keyFiles = lib.listToAttrs (
map (
k:
lib.nameValuePair ".ssh/${k}" {
source = config.lib.file.mkOutOfStoreSymlink osConfig.age.secrets."ssh-${k}".path;
}
) keys
);
# Public keys are not secret, so they are plain files from the repo.
pubFiles = lib.listToAttrs (
map (k: lib.nameValuePair ".ssh/${k}.pub" { source = pubFile k; }) (
lib.filter (k: builtins.pathExists (pubFile k)) keys
)
);
in
{
programs.ssh = {
enable = true;
# Spell the defaults out below instead of relying on the deprecated ones.
enableDefaultConfig = false;
settings = {
"*" = {
# Load a key into the agent on first use, so the passphrase (if any)
# is typed once per login.
AddKeysToAgent = "yes";
ServerAliveInterval = 60;
ServerAliveCountMax = 3;
HashKnownHosts = false;
UserKnownHostsFile = "~/.ssh/known_hosts";
};
"github.com" = {
User = "git";
IdentityFile = "~/.ssh/id_ed25519";
# Offer only this key, not everything in the agent.
IdentitiesOnly = true;
};
"git.protei.ru" = {
User = "git";
IdentityFile = "~/.ssh/id_ed25519_work";
IdentitiesOnly = true;
};
};
};
# A plain user service rather than gnome-keyring's agent: no keyring to
# unlock, and it sets SSH_AUTH_SOCK for shells, systemd and D-Bus.
services.ssh-agent.enable = true;
home.file = keyFiles // pubFiles;
};
}
+140
View File
@@ -0,0 +1,140 @@
# Theme: one palette, fonts, cursor and icons for the whole desktop, applied by
# Stylix (github:nix-community/stylix).
# NixOS Stylix itself (its home-manager module is added to every
# home-manager user and inherits these settings), the TTY
# palette and the default font families.
# home-manager which programs Stylix themes.
# Targets are opt-in (`autoEnable = false`): Stylix touches only what is listed
# here. A new program that Stylix supports gets its `stylix.targets.<name>`
# line in this file.
{ config, inputs, ... }:
let
inherit (config.meta) owner;
hmTheme = config.flake.modules.homeManager.theme;
in
{
flake.modules.nixos.theme =
{ pkgs, ... }:
{
imports = [ inputs.stylix.nixosModules.stylix ];
home-manager.users.${owner.name}.imports = [ hmTheme ];
stylix = {
enable = true;
# With autoEnable Stylix would also write GNOME, KDE, X resources, gedit,
# gdu, Blender, ... configs and rebuild gtksourceview through an overlay.
autoEnable = false;
polarity = "dark";
# Catppuccin Mocha, from tinted-theming/schemes base16/catppuccin-mocha.yaml.
# Inline, so evaluation needs no import-from-derivation. Another scheme:
# base16Scheme = "${pkgs.base16-schemes}/share/themes/<name>.yaml";
base16Scheme = {
scheme = "Catppuccin Mocha";
author = "https://github.com/catppuccin/catppuccin";
slug = "catppuccin-mocha";
variant = "dark";
base00 = "1e1e2e"; # base
base01 = "181825"; # mantle
base02 = "313244"; # surface0
base03 = "45475a"; # surface1
base04 = "585b70"; # surface2
base05 = "cdd6f4"; # text
base06 = "f5e0dc"; # rosewater
base07 = "b4befe"; # lavender
base08 = "f38ba8"; # red
base09 = "fab387"; # peach
base0A = "f9e2af"; # yellow
base0B = "a6e3a1"; # green
base0C = "94e2d5"; # teal
base0D = "89b4fa"; # blue
base0E = "cba6f7"; # mauve
base0F = "f2cdcd"; # flamingo
};
# No wallpaper: Noctalia draws it, so every Stylix wallpaper part stays off.
image = null;
fonts = {
monospace = {
package = pkgs.monaspace;
name = "Monaspace Radon";
};
sansSerif = {
package = pkgs.inter;
name = "Inter";
};
serif = {
package = pkgs.noto-fonts;
name = "Noto Serif";
};
emoji = {
package = pkgs.noto-fonts-color-emoji;
name = "Noto Color Emoji";
};
};
cursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 24;
};
icons = {
enable = true;
package = pkgs.papirus-icon-theme;
dark = "Papirus-Dark";
light = "Papirus-Light";
};
targets = {
# TTY palette (vt.default_{red,grn,blu} kernel parameters).
console.enable = true;
# fontconfig default families from `fonts` above, and their packages.
fontconfig.enable = true;
font-packages.enable = true;
# programs.dconf, which home-manager's GTK settings need.
gtk.enable = true;
};
};
};
flake.modules.homeManager.theme = {
stylix.targets = {
gtk = {
enable = true;
# No Flatpak here: do not write ~/.themes or Flatpak overrides.
flatpakSupport.enable = false;
};
qt.enable = true;
hyprland.enable = true;
noctalia = {
enable = true;
# Keep Noctalia's own panel opacities and the shell font chosen for it.
opacity.enable = false;
fonts.override.sansSerif.name = "Monaspace Krypton";
};
wezterm = {
enable = true;
fonts.override.monospace.name = "Monaspace Krypton";
};
bat.enable = true;
btop.enable = true;
fzf.enable = true;
starship.enable = true;
mpv.enable = true;
zathura.enable = true;
# Not enabled:
# - neovim: cli/neovim/init.lua still sets the catppuccin colorscheme;
# Stylix's mini.base16 would run after it and stack a second one.
# - firefox: needs a declared profile (programs.firefox.profiles);
# declaring one would replace the existing Firefox profile.
};
# libadwaita/GTK 4 apps read the preference from dconf.
gtk.colorScheme = "dark";
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
};
}
+13
View File
@@ -0,0 +1,13 @@
# faumaray, the owner of this flake. Identity data only; the aspects read it
# through `config.meta.owner` (schema: modules/flake/meta.nix).
{
meta.owner = {
name = "faumaray";
fullName = "faumaray";
email = "faumaray@gmail.com";
sshKeys = [
"id_ed25519"
"id_ed25519_work"
];
};
}
-7
View File
@@ -1,7 +0,0 @@
# Adds this repository's own packages (./pkgs) to pkgs.
{ inputs }:
final: _prev:
import ../pkgs {
pkgs = final;
inherit inputs;
}
-32
View File
@@ -1,32 +0,0 @@
# Overlays exposed as `self.overlays.<name>`; `default` composes all of them
# and is applied to every host (see lib/default.nix).
{ inputs }:
let
inherit (inputs.nixpkgs) lib;
in
rec {
# Hyprland's own upstream overlays, built from the pinned `hyprland` flake
# input against our nixpkgs. Upstream `default` omits the hyprwm libraries
# (aquamarine, hyprutils, hyprland-guiutils, ...); `hyprland-packages`
# carries them plus Hyprland, `hyprland-extras` adds the matching portal.
hyprland = lib.composeManyExtensions [
inputs.hyprland.overlays.hyprland-packages
inputs.hyprland.overlays.hyprland-extras
];
# Noctalia from its flake, as published on noctalia.cachix.org.
noctalia = import ./noctalia.nix { inherit inputs; };
# Our own packages from ./pkgs (install tooling and helpers).
additions = import ./additions.nix { inherit inputs; };
# Tweaks to existing nixpkgs packages.
modifications = import ./modifications.nix { inherit inputs; };
default = lib.composeManyExtensions [
hyprland
noctalia
additions
modifications
];
}
-8
View File
@@ -1,8 +0,0 @@
# Changes to existing nixpkgs packages. Add `name = prev.name.override { ... }`
# or `.overrideAttrs` entries here; they apply system-wide and to home-manager
# (useGlobalPkgs = true).
{ inputs }:
_final: prev: {
# btop with AMD GPU monitoring (ROCm SMI) for the Radeon card.
btop = prev.btop.override { rocmSupport = true; };
}
-7
View File
@@ -1,7 +0,0 @@
# Use the Noctalia build from its own flake. That flake does not follow our
# nixpkgs, so the store path matches noctalia.cachix.org and is downloaded
# instead of compiled.
{ inputs }:
final: _prev: {
noctalia = inputs.noctalia.packages.${final.stdenv.hostPlatform.system}.default;
}
Executable → Regular
View File
File mode changed.
Executable → Regular
View File
File mode changed.
Executable → Regular
+1 -1
View File
@@ -1,4 +1,4 @@
# Our own packages: install and key helpers. Imported by overlays/additions.nix,
# Our own packages: install and key helpers. Imported by modules/flake/overlays.nix,
# so they show up as pkgs.<name> on every host and on the installer ISO.
{ pkgs, inputs }:
let
Executable → Regular
View File
File mode changed.
+2 -2
View File
@@ -566,7 +566,7 @@ install_host_key() {
verify_secrets() {
if [ "$SECRETS_ENABLE" != true ]; then
info "my.secrets.enable is off: skipping the secrets check"
info "no secrets/*.age files are declared (config.my.secrets.enable = false): skipping the secrets check"
return
fi
local sdir="$FLAKE/secrets" hostkey="$MNT/etc/ssh/ssh_host_ed25519_key"
@@ -742,7 +742,7 @@ EOF
- sudo sbctl enroll-keys --microsoft
- Reboot, enable Secure Boot in the firmware, then check:
bootctl status | grep -i 'secure boot'
Cannot boot at all? Set my.boot.secureBoot.enable = false in hosts/$HOST/default.nix.
Cannot boot at all? In modules/hosts/$HOST/host.nix swap the secure-boot aspect for systemd-boot.
EOF
fi
cat <<EOF
View File
File mode changed.
Loaded 100 of 112 files, more files were not shown because too many files have changed in this diff. Show more