Skip to content
yorqatPublic

About

My current workstations configuration

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

YorPuter

A pretty cool system on wayland with some cool widgets.

my current wallpaper


What's in the box

  • niri scrollable-tiling wayland compositor, with eww widgets and stylix theming
  • sops-nix for secrets (age-encrypted, committed to the repo)
  • impermanence on btrfs subvolumes — / is wiped at every boot, only whitelisted paths persist
  • home-manager, niri-flake, nixvim/nvchad, lanzaboote (secure boot is wired up but off by default)

Repo tour

setup/default.nix           <- THE config. user, host, locale, toggles. start here
hardware-configuration.nix  <- disks/mounts (machine-specific, regenerate per install)
sys/                        <- system-level modules (boot, core, nvidia, wayland)
usrs/                       <- home-manager config (niri, eww, shell, apps)
secrets/                    <- sops-encrypted payloads, deployed at boot
devshell/                   <- `nix develop` gives you the `secrets` util

The config in the config

Almost everything personal lives in setup/default.nix:

  • userName / hostName — the host is built as nixosConfigurations.<hostName>, so changing hostName changes what you pass to --flake .#<hostName>
  • timeZone, defaultLocale, extraLocale
  • lite — start with lite = true on a fresh install. It gates everything that assumes this machine: the nvidia driver module and the plasma6 session. With lite = true you get niri + core apps on anything; flip it to false only on hardware that actually has those things (or flip individual includes.<name> flags for fine control)
  • symLinks — home dirs (Documents, Downloads, ...) are symlinked onto /dat via tmpfiles rules. Point these at wherever your data disk is, or make /dat a symlink itself

Note: changing userName won't move your stuff — it creates a fresh home directory.


Disk layout

This config expects btrfs subvolumes with an ephemeral root:

/dev/nvme0n1p5   -> /boot      (vfat, ESP)
/dev/nvme0n1p6   -> /          (btrfs subvol @,        wiped every boot)
                    /nix       (btrfs subvol @nix)
                    /persist   (btrfs subvol @persist, neededForBoot)
/dev/sda1        -> /dat       (btrfs, documents/media/code; home dirs symlink into it)

Everything outside /persist is blank at boot. The persistence module whitelists /home (all of it), /var/log, /var/lib/{bluetooth,nixos,NetworkManager,...}, /etc/machine-id, and the sops key.


Secrets

Managed by sops-nix: payloads are encrypted in secrets/ with age, committed to the repo, and deployed at boot with 0600 permissions. Every tracked payload deploys to ~/.config/secrets/<name> automatically — there is no allowlist. The personal bits (deploy-path pins, env-var names, root-owned payloads) live in setup.secrets in setup/default.nix.

The age key must exist in two places, identical:

  • ~/.config/sops/age/keys.txt — for editing secrets
  • /var/lib/sops-nix/key.txt — for decrypting at boot (backed up to /persist by impermanence)

Back this key up somewhere offline. Every secret in the repo is unrecoverable without it.

To use your own key instead of mine (you should):

$ nix shell nixpkgs#age
$ age-keygen -o ~/.config/sops/age/keys.txt
$ mkdir -p /var/lib/sops-nix && cp ~/.config/sops/age/keys.txt /var/lib/sops-nix/key.txt

Then put your public key in .sops.yaml and re-encrypt everything: sops updatekeys secrets/*.

Manage payloads from the devshell:

$ nix develop
$ secrets add <name> <file>   # stage, encrypt, git add; prints where it will deploy
$ secrets edit <name>         # decrypt, open $EDITOR, re-encrypt
$ secrets rename <old> <new>  # git mv, no re-encryption needed
$ secrets rm <name>           # remove a payload
$ secrets list                # encryption, git-tracking, deploy path, env var

Staging a payload is all it takes: secrets add <name> <file> + rebuild. To also export it as an env var, add "<name>" = "<VAR>" to setup.secrets.envNames — sops-nix renders ~/.config/secrets/env, which .bashrc sources. So an API token is:

$ secrets add openrouter-api-key ./token    # + one line in setup.secrets.envNames
$ sudo nixos-rebuild switch --flake .#qat   # $OPENROUTER_API_KEY now set in bash

secrets add <name> <file> → register it in userSecrets + envNames → rebuild.


Try it out!

Installing from a nixos live environment

Boot a NixOS ISO, then partition like this (tip: set the esp flag on the boot partition with gparted):

p1  vfat   1G+    /boot (ESP)
p2  btrfs  rest   / /nix /persist subvolumes
(+ optional data disk for /dat)

Create the subvolumes and mount everything:

# mkfs
mkfs.fat -F 32 /dev/<efi-part>
mkfs.btrfs -L nixos /dev/<root-part>

# create subvolumes
mount /dev/<root-part> /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@nix
btrfs subvolume create /mnt/@persist
umount /mnt

# mount the real layout
mount -o subvol=@,compress=zstd,noatime /dev/<root-part> /mnt
mount --mkdir -o subvol=@nix,compress=zstd,noatime /dev/<root-part> /mnt/nix
mount --mkdir -o subvol=@persist,compress=zstd,noatime /dev/<root-part> /mnt/persist
mount --mkdir /dev/<efi-part> /mnt/boot
mount --mkdir -o compress=zstd,noatime /dev/<data-part> /mnt/dat   # optional

Note: /persist must stay neededForBoot = true in hardware-configuration.nix — sops secrets and impermanence both need it mounted before the system activates. If you nixos-generate-config, re-add the subvol= options and neededForBoot afterwards.

Now make it yours:

  1. Edit setup/default.nix — at minimum userName, hostName, timeZone, the locales, and lite = true (leaves out nvidia/plasma6; flip it later if your hardware wants them)
  2. Update the device UUIDs in hardware-configuration.nix to match your disks (lsblk -f)
  3. Generate your own age key and re-encrypt the secrets (see above) — you can't decrypt mine
  4. Create your own password hash — the user password is a sops secret:
    $ mkpasswd -m sha-512 > /tmp/hash   # then from the devshell:
    $ secrets add yor-password-hash /tmp/hash
    Add "yor-password-hash" to setup.secrets.root (it deploys root-owned for user creation) and point hashedPasswordFile at it.

Clone and install:

$ git clone https://github.com/yorqat/nixo.git && cd nixo
$ nixos-install --root /mnt --flake .#<hostName>

Warning: flakes ignore untracked files. If you added anything new (secrets payloads included), git add it before installing/rebuilding, or sops silently deploys nothing.

Reboot, log in through sddm (niri session is in there alongside plasma6).

Note: make sure /home/<userName> is actually owned by your user (ls -ld /home/<userName>). With impermanence + users.mutableUsers = false nothing fixes it for you — NixOS only creates+chowns the home when it doesn't exist yet, and with mutable users off a root-owned home stays root-owned (e.g. if it was pre-created or copied over from a live environment). If needed, fix it once: sudo chown -R <userName>:users /home/<userName>

Rebuilding on changes

$ nixos-rebuild switch --flake .#<hostName> -v

Note: if you update hardware or change mount points, regenerate: $ nixos-generate-config --show-hardware-config > hardware-configuration.nix — then re-check the subvol= options and neededForBoot note above.

Gotchas learned the hard way:

  • sudo nixos-rebuild re-roots flake.lock. If evals then fail with "Permission denied": sudo chown $USER:users flake.lock
  • secrets payloads live under secrets/ as whole-file binary format — don't rename them by hand, use secrets rename
  • to sanity-check a change without switching: nix eval .#nixosConfigurations.<hostName>.config.system.build.toplevel.drvPath

About

My current workstations configuration

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages