nanuqsaurus/docs/adopt.md
randogoth d1321cf7ca docs: nixos-26.05 in adopt examples, document impermanence
Bump the wrapper-flake nixpkgs channel in the adopt/laptop examples to
nixos-26.05, and add the "Impermanence (optional)" section covering the
/persist subvolume, the required "nixos" fs label, and the default
persistence set.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-28 12:38:06 +03:00

104 lines
3.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Adopt Nanuqsaurus on an existing NixOS install (no repartitioning)
This repo intentionally does **not** ship a “one size fits all” `nixosConfiguration` for installed systems.
Disk layouts, filesystems, initrd modules, and bootloader details are machine-specific and live in your
local `hardware-configuration.nix`.
The recommended workflow is to create a **small local wrapper flake** that:
- keeps your machines `hardware-configuration.nix` as the source of truth for mounts/boot,
- imports `nanuqsaurus` as a feature/profile module from its URL,
- keeps your personal changes in your own repo (or `/etc/nixos`).
## 1) Create a wrapper flake in `/etc/nixos`
On the target machine:
1. Ensure you have a `hardware-configuration.nix` (generated by `nixos-generate-config`).
2. Create `/etc/nixos/flake.nix` like this (adjust `hostName` and `stateVersion`):
```nix
{
description = "Local wrapper for the nanuqsaurus profile";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
nanuqsaurus = {
url = "git+https://codeberg.org/randogoth/nanuqsaurus.git";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware = {
url = "github:NixOS/nixos-hardware";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ nixpkgs, nanuqsaurus, nixos-hardware, ... }: {
nixosConfigurations.nanuqsaurus = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
# Optional: only needed if your local modules require access to flake inputs.
specialArgs = { inherit inputs; };
modules = [
./hardware-configuration.nix
# Optional: pick the right hardware module for your machine.
# Find your model at https://github.com/NixOS/nixos-hardware or use one of these generic profiles:
#nixos-hardware.nixosModules.common-cpu-intel
#nixos-hardware.nixosModules.common-cpu-amd
#nixos-hardware.nixosModules.common-gpu-intel
#nixos-hardware.nixosModules.common-gpu-amd
#nixos-hardware.nixosModules.common-gpu-nvidia
nanuqsaurus.nixosModules.nanuqsaurus
# Optional: opt into Flox tooling + cache
# nanuqsaurus.nixosModules.flox
{
# Optional: change the default admin username ("admin")
nanuqsaurus.admin.username = "admin";
# Optional: enable impermanence (requires a /persist Btrfs subvolume and mounts in hardware-configuration.nix)
# nanuqsaurus.impermanence.enable = true;
networking.hostName = "nanuqsaurus";
system.stateVersion = "25.11";
}
];
};
};
}
```
## 2) Switch to it
```bash
sudo nixos-rebuild switch --flake /etc/nixos#nanuqsaurus
```
## Updating later
- If you keep `nanuqsaurus.url` pointing at the repo, you can update with:
- `nix flake update` (in `/etc/nixos`), then
- `sudo nixos-rebuild switch --flake /etc/nixos#nanuqsaurus`
- Keep all your machine-specific changes in the wrapper flake (additional modules, packages, services, etc.).
## Impermanence (optional)
If you enable `nanuqsaurus.impermanence.enable = true;` you must:
- Add a `/persist` mount (Btrfs subvolume) in `hardware-configuration.nix`.
- Migrate state you care about into `/persist` before the first reboot.
Notes:
- The rollback logic expects the root Btrfs volume label to be `nixos`.
- Create the subvolume with `btrfs subvolume create /mnt/persist` and mount it as `/persist`.
The default persistence set includes:
- `/etc/nixos`
- `/etc/ssh`
- `/etc/cups`
- `/var/lib/cups`
- `/var/lib/libvirt`
- `/var/lib/secureboot`
- `/var/lib/tailscale`
- `/var/lib/systemd`
- `/var/lib/nixos`
- `/etc/machine-id`