Document bare metal installation via Calamares

hosts/moonarch holds machine independent settings only; the disk layout
comes from Calamares, which also produces hardware-configuration.nix.
This commit is contained in:
2026-08-07 16:57:22 +02:00
parent d35c4a1408
commit 777a975f1b
4 changed files with 152 additions and 6 deletions
+15
View File
@@ -77,3 +77,18 @@
output.
- **How**: `virtio-vga-gl` with `gl=on`, and the VM is shut down when not in
use. The underlying amdgpu problem is a host issue, unrelated to Moonarch.
## 2026-08-07 Disk layout via Calamares, not disko
- **Who**: Dominik
- **Why**: Stage 3 targets bare metal, but no target machine exists yet —
neither the number of disks nor their device paths are known.
- **Tradeoffs**: `disko` would put partitioning and encryption under version
control, which pays off when reinstalling often or setting up several
machines alike. For a single machine it is extra work without return, and it
would require guessing device paths. Calamares already covers partitioning,
LUKS and hardware detection, and produces `hardware-configuration.nix` — the
one file that cannot be written in advance.
- **How**: `hosts/moonarch/` holds only machine independent settings.
Installation runs through Calamares, then the generated hardware file is
copied into the host directory. See README.md.
+49
View File
@@ -45,6 +45,55 @@ Activate:
sudo nixos-rebuild switch --flake .#moonarch-vm
```
## Installing on bare metal
The disk layout is not declared here. Calamares handles partitioning,
encryption and hardware detection, and produces the one file that cannot be
written in advance: `hardware-configuration.nix` with the machine's UUIDs,
LUKS devices and kernel modules.
1. Boot the NixOS ISO and run Calamares. Choose `dkressler` as the user name —
that is what `hosts/moonarch/default.nix` declares. Pick btrfs, snapper
expects it.
2. Reboot into the fresh system. It runs on the configuration Calamares
generated, without Moonarch.
3. Enable flakes and install git — neither is available yet:
```bash
sudo nano /etc/nixos/configuration.nix
# nix.settings.experimental-features = [ "nix-command" "flakes" ];
# environment.systemPackages = with pkgs; [ git ];
sudo nixos-rebuild switch
```
4. Clone this repo and take over the hardware file:
```bash
git clone https://gitea.moonarch.de/nevaforget/moonix.git
cp /etc/nixos/hardware-configuration.nix moonix/hosts/moonarch/
```
5. Add the import to `hosts/moonarch/default.nix`:
```nix
imports = [ ./hardware-configuration.nix ];
```
6. Switch and reboot:
```bash
sudo nixos-rebuild switch --flake ~/moonix#moonarch
```
If step 6 breaks the system, pick the previous generation in the boot menu —
the Calamares install stays available as generation 1.
Still missing afterwards: a `nixos-hardware` profile for the specific model
(firmware, power management, model quirks). It can be added at any time.
`nixosConfigurations.moonarch` therefore evaluates but is not installable on
its own: without `hardware-configuration.nix` it has no filesystems.
## Version bumps
The project repos are pinned to release tags. After tagging a new version:
+21 -6
View File
@@ -7,6 +7,7 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Project sources. These repos are not flakes themselves, they are
# consumed as plain source trees pinned to a release tag.
moonarch = {
@@ -87,12 +88,26 @@
};
};
nixosConfigurations.moonarch-vm = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/moonarch-vm
self.nixosModules.moonarch
];
nixosConfigurations = {
# QEMU test VM.
moonarch-vm = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/moonarch-vm
self.nixosModules.moonarch
];
};
# Bare metal. Machine independent settings only — no disk layout and
# no hardware profile, both depend on a target machine that is not
# decided yet. Not installable as is.
moonarch = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/moonarch
self.nixosModules.moonarch
];
};
};
devShells.${system}.default = pkgs.mkShell {
+67
View File
@@ -0,0 +1,67 @@
# ABOUTME: Host configuration for the bare metal machine.
# ABOUTME: Machine independent settings only — no disk layout, no hardware profile.
{ pkgs, ... }:
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_zen;
boot.kernelParams = [ "quiet" ];
networking.hostName = "moonarch";
networking.networkmanager.enable = true;
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "de_DE.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
console.keyMap = "de";
services.xserver.xkb.layout = "de";
users.users.dkressler = {
isNormalUser = true;
description = "Dominik Kressler";
extraGroups = [ "networkmanager" "wheel" "video" "input" "plugdev" "docker" ];
shell = pkgs.zsh;
};
# Snapshots of root and home. snap-pac has no counterpart here: NixOS keeps
# its own generations, so pre/post package snapshots are redundant.
services.snapper = {
configs = {
root = {
SUBVOLUME = "/";
ALLOW_USERS = [ "dkressler" ];
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
};
home = {
SUBVOLUME = "/home";
ALLOW_USERS = [ "dkressler" ];
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
};
};
snapshotInterval = "hourly";
cleanupInterval = "1d";
};
services.fstrim.enable = true;
services.fwupd.enable = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nixpkgs.config.allowUnfree = true;
system.stateVersion = "26.05";
}