From 4800fec13c644633f8ea289cf7f30abe7e02ff76 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Fri, 11 Jul 2025 20:39:03 +0200 Subject: [PATCH] diskId: add migration docs and a big fat warning --- clanModules/disk-id/roles/default.nix | 12 ++-- docs/mkdocs.yml | 1 + docs/site/guides/migrations/disk-id.md | 98 ++++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 docs/site/guides/migrations/disk-id.md diff --git a/clanModules/disk-id/roles/default.nix b/clanModules/disk-id/roles/default.nix index 348eb5233..80bdea435 100644 --- a/clanModules/disk-id/roles/default.nix +++ b/clanModules/disk-id/roles/default.nix @@ -1,5 +1,4 @@ { - config, pkgs, ... }: @@ -9,9 +8,14 @@ config = { warnings = [ - "The clan.disk-id module is deprecated and will be removed on 2025-07-15. - Please migrate to user-maintained configuration or the new equivalent clan services - (https://docs.clan.lol/reference/clanServices)." + '' + The clan.disk-id module is deprecated and will be removed on 2025-07-15. + For migration see: https://docs.clan.lol/guides/migrations/disk-id/ + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !!! Please migrate. Otherwise you may not be able to boot your system after that date. !!! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + '' ]; clan.core.vars.generators.disk-id = { files.diskId.secret = false; diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index be80dea06..d4ddd0905 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -79,6 +79,7 @@ nav: - Migrate existing Flakes: guides/migrations/migration-guide.md - Migrate inventory Services: guides/migrations/migrate-inventory-services.md - Facts Vars Migration: guides/migrations/migration-facts-vars.md + - Disk id: guides/migrations/disk-id.md - macOS: guides/macos.md - Reference: - Overview: reference/index.md diff --git a/docs/site/guides/migrations/disk-id.md b/docs/site/guides/migrations/disk-id.md new file mode 100644 index 000000000..db936922b --- /dev/null +++ b/docs/site/guides/migrations/disk-id.md @@ -0,0 +1,98 @@ +# Migrate disko config from `clanModules.disk-id` + +If you previously bootstrapped a machine's disk using `clanModules.disk-id`, you should now migrate to a standalone, self-contained disko configuration. This ensures long-term stability and avoids reliance on dynamic values from Clan. + +If your `disko.nix` currently looks something like this: + +```nix title="disko.nix" +{ + lib, + clan-core, + config, + ... +}: + +let + suffix = config.clan.core.vars.generators.disk-id.files.diskId.value; +in +{ + imports = [ + clan-core.clanModules.disk-id + ]; + + # DO NOT EDIT THIS FILE AFTER INSTALLATION of a machine + # Otherwise your system might not boot because of missing partitions / filesystems + boot.loader.grub.efiSupport = lib.mkDefault true; + boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true; + disko.devices = { + disk = { + "main" = { + # suffix is to prevent disk name collisions + name = "main-" + suffix; + type = "disk"; + # Set the following in flake.nix for each maschine: + # device = ; + content = { + # edlied + }; + }; + }; + }; +} +``` + +## Step 1: Retrieve your `disk-id` + +Run the following command to retrieve the generated disk ID for your machine: + +```bash +clan vars list +``` + +Which should print the generated `disk-id/diskId` value in clear text +You should see output like: + +```terminal-session +disk-id/diskId: fcef30a749f8451d8f60c46e1ead726f +# ... +# elided +``` + +Copy this value — you'll need it in the next step. + +## ✍️ Step 2: Replace Dynamic Configuration with Static Values + +✅ Goal: Make your disko.nix file standalone. + +We are going to make three changes: + +- Remove `let in, imports, {lib,clan-core,config, ...}:` to isolate the file. +- Replace `suffix` with the actual disk-id +- Move `disko.devices.disk.main.device` from `flake.nix` or `configuration.nix` into this file. + +```{.nix title="disko.nix" hl_lines="7-9 11-14"} +{ + boot.loader.grub.efiSupport = lib.mkDefault true; + boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true; + disko.devices = { + disk = { + "main" = { + # ↓ Copy the disk-id into place + name = "main-fcef30a749f8451d8f60c46e1ead726f"; + type = "disk"; + + # Some earlier guides had this line in a flake.nix + # disko.devices.disk.main.device = "/dev/disk/by-id/__CHANGE_ME__"; + # ↓ Copy the '/dev/disk/by-id' into here instead + device = "/dev/disk/by-id/nvme-eui.e8238fa6bf530001001b448b4aec2929"; + + # edlied; + }; + }; + }; +} +``` + +These steps are only needed for existing configurations that depend on the `diskId` module. + +For newer machines clan offers simple *disk templates* via its [templates cli](../../reference/cli/templates.md)