refactor: make nanuqsaurus module-based; keep btrfs install profile

This commit is contained in:
randogoth 2026-02-04 20:53:05 +02:00
parent e640b43b2f
commit bb138278f1
13 changed files with 218 additions and 173 deletions

64
docs/adopt.md Normal file
View file

@ -0,0 +1,64 @@
# 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-25.11";
nanuqsaurus.url = "git+https://codeberg.org/randogoth/nanuqsaurus.git";
nanuqsaurus.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{ self, nixpkgs, nanuqsaurus, ... }:
{
nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./hardware-configuration.nix
nanuqsaurus.nixosModules.nanuqsaurus
# Your local overrides/customizations:
({ ... }: {
# Optional: change the default admin username ("admin")
nanuqsaurus.admin.username = "admin";
networking.hostName = "my-host";
system.stateVersion = "25.11";
})
];
};
};
}
```
## 2) Switch to it
```bash
sudo nixos-rebuild switch --flake /etc/nixos#my-host
```
## 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#my-host`
- Keep all your machine-specific changes in the wrapper flake (additional modules, packages, services, etc.).

View file

@ -13,20 +13,28 @@ Pick a stable disk path (prefer /dev/disk/by-id/*) and run:
--disk main /dev/disk/by-id/<your-disk> \
--mount-point /mnt
Adopt an existing NixOS install (no repartition)
-----------------------------------------------
Create a small local wrapper flake that imports this repo as a module and keeps
your machines `hardware-configuration.nix` for mounts/boot.
See: docs/adopt.md (on the custom ISO: `/etc/nixos/docs/adopt.md`)
ISO shortcut
------------
If you are using the custom ISO from this repo, it embeds the flake at /etc/nixos.
You can run the wrapper script (defaults: DISK=/dev/vda, TARGET_HOST=nanuqsaurus):
You can run the wrapper script (defaults: DISK=/dev/vda, TARGET_HOST=nanuqsaurus-btrfs):
sudo /etc/nixos/scripts/install-btrfs.sh
Optionally set DISK, TARGET_HOST, and FLAKE:
sudo DISK=/dev/disk/by-id/<your-disk> TARGET_HOST=nanuqsaurus \
FLAKE="github:<owner>/<repo>" \
sudo DISK=/dev/disk/by-id/<your-disk> TARGET_HOST=nanuqsaurus-btrfs \
FLAKE="git+https://codeberg.org/<owner>/<repo>.git" \
/etc/nixos/scripts/install-btrfs.sh