101 lines
3.2 KiB
Markdown
101 lines
3.2 KiB
Markdown
# NixOS configuration
|
|
|
|
Flake-based NixOS + home-manager configuration for this desktop.
|
|
|
|
## Layout
|
|
|
|
```
|
|
flake.nix # entrypoint; pins nixpkgs + home-manager
|
|
hosts/
|
|
pc-mans/ # one directory per machine
|
|
default.nix # host-specific (hostname, stateVersion, host LUKS)
|
|
hardware-configuration.nix # generated, host-specific; do not edit by hand
|
|
modules/
|
|
system/ # NixOS modules (system-wide concerns)
|
|
default.nix # imports the rest
|
|
boot.nix
|
|
locale.nix
|
|
networking.nix
|
|
nix.nix # flakes, gc, registry, allowUnfree
|
|
hardware-amd.nix # AMD CPU microcode + amdgpu/Mesa/Vulkan
|
|
audio.nix # PipeWire
|
|
fonts.nix
|
|
sway.nix # programs.sway, SDDM, portals, polkit
|
|
users.nix
|
|
packages.nix # system-wide packages
|
|
home/ # home-manager modules (per-user concerns)
|
|
default.nix
|
|
sway.nix # keybinds, bar, idle, lock, notifications
|
|
shell.nix # bash, tmux, direnv, fzf, eza, bat
|
|
git.nix
|
|
packages.nix
|
|
home/
|
|
mans.nix # home-manager entry for user `mans`
|
|
```
|
|
|
|
## First-time switch
|
|
|
|
The current system still boots from `/etc/nixos/configuration.nix`. To switch
|
|
to this flake-managed config:
|
|
|
|
```sh
|
|
# Sanity-check the build first (does not activate):
|
|
sudo nixos-rebuild build --flake ~/nixos#pc-mans
|
|
|
|
# Activate for this boot only (reverts on reboot):
|
|
sudo nixos-rebuild test --flake ~/nixos#pc-mans
|
|
|
|
# Make it the default boot entry:
|
|
sudo nixos-rebuild switch --flake ~/nixos#pc-mans
|
|
```
|
|
|
|
Once the switch succeeds you can ignore `/etc/nixos/` entirely. (Removing it
|
|
is fine; the flake doesn't read from there.)
|
|
|
|
## Day-to-day
|
|
|
|
```sh
|
|
nrs # alias: rebuild switch
|
|
nrt # alias: rebuild test
|
|
nfu # alias: flake update
|
|
```
|
|
|
|
Or the long forms:
|
|
|
|
```sh
|
|
sudo nixos-rebuild switch --flake ~/nixos#pc-mans
|
|
nix flake update ~/nixos
|
|
```
|
|
|
|
## Updating inputs
|
|
|
|
```sh
|
|
nix flake update ~/nixos # bumps nixpkgs + home-manager
|
|
sudo nixos-rebuild switch --flake ~/nixos#pc-mans
|
|
```
|
|
|
|
To roll back if something breaks:
|
|
|
|
```sh
|
|
sudo nixos-rebuild switch --rollback
|
|
```
|
|
|
|
## Hardware notes
|
|
|
|
- **CPU**: AMD Ryzen 9 9950X3D (Zen 5). Microcode updates enabled via
|
|
`hardware.cpu.amd.updateMicrocode`.
|
|
- **GPU**: AMD Radeon RX 9070 (RDNA 4, Navi 48). Requires recent kernel + Mesa;
|
|
we use `boot.kernelPackages = pkgs.linuxPackages_latest` and Mesa from
|
|
nixos-25.11. Both RADV (Mesa) and AMDVLK are installed; RADV is the default.
|
|
- **iGPU**: Granite Ridge integrated graphics on the 9950X3D. Same `amdgpu`
|
|
driver, no extra config.
|
|
- **WiFi**: Qualcomm WCN785x (FastConnect 7800 / Wi-Fi 7). Firmware ships in
|
|
`linux-firmware` which is pulled in by `hardware.enableRedistributableFirmware`.
|
|
- **Ethernet**: Realtek RTL8126 (5GbE). Handled by the in-tree `r8169` driver.
|
|
|
|
## Adding a new host
|
|
|
|
1. `mkdir hosts/<name>` and copy `hosts/pc-mans/default.nix` as a starting point.
|
|
2. Drop `hardware-configuration.nix` from `nixos-generate-config` into it.
|
|
3. Add a `nixosConfigurations.<name>` entry to `flake.nix`.
|