From 630647784256953ccee573571f19139460868e7c Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Sun, 1 Nov 2026 06:47:51 -0600 Subject: [PATCH] fix(clan): migrate clan machine path off removed clanModules (#159) clan-core at the locked rev (8b9fd720) exports no clanModules output, so evaluating nixosConfigurations.user failed with "attribute clanModules missing" at modules/disko.nix:12. - modules/disko.nix: standalone static disko config per the upstream disk-id migration guide; disk name keeps the machine generated diskId (cross-checked against vars/per-machine/user/disk-id/diskId/value). Device stays in machines/user/configuration.nix. - modules/shared.nix: drop the dead sshd/root-password/user-password/state-version imports and the clan.user-password option. sshd and password generation are now clanServices inventory instances; state-version is enabled by clanCore defaults. Also move programs.gvfs -> services.gvfs (option renamed upstream; it blocked evaluation of the same file). - lib/default.nix (make-clan): inventory.instances for sshd (CA certificates disabled - the old module only generated host keys and this repo has no shared openssh-ca vars), users instances for root and user passwords, and the zerotier network. - machines/user/configuration.nix: remove clan.core.networking.zerotier.controller.enable (direct option removed upstream); the machine is controller+peer of the zerotier inventory instance instead. - vars/shared/zerotier-network-zerotier/network-id/value: seed the public network-id var with the machines existing network id from machines/user/facts/zerotier-network-id (value-preserving; the zerotier identity var is generated at deploy time by clan vars generate). --- lib/default.nix | 42 ++++++++++++++++++- machines/user/configuration.nix | 6 +-- modules/disko.nix | 21 ++++------ modules/shared.nix | 25 ++++++----- .../network-id/value | 1 + 5 files changed, 65 insertions(+), 30 deletions(-) create mode 100644 vars/shared/zerotier-network-zerotier/network-id/value diff --git a/lib/default.nix b/lib/default.nix index 03894c29fb..4f8198e1f4 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -478,6 +478,41 @@ let user = { }; # sara = { }; }; + # clanServices replacements for the clanModules.* imports that + # modules/shared.nix used to carry (clanModules was removed + # upstream; see #159). state-version is not listed here: + # clanCore enables it by default. + inventory.instances = { + # Runs the OpenSSH server with persistent host keys. + # Root's authorized keys stay in machines/user/configuration.nix. + sshd = { + roles.server.tags.all = { }; + # The old sshd module only generated host keys; CA-signed host + # certificates are a new-service extra that would require + # shared openssh-ca vars this repo does not have. + roles.server.settings.certificate.enable = false; + }; + # Generates the root password (was clanModules.root-password). + user-root = { + module.name = "users"; + roles.default.tags.all = { }; + roles.default.settings.user = "root"; + }; + # Zerotier network (was clan.core.networking.zerotier.controller + # in machines/user/configuration.nix; the direct option was + # removed upstream). This machine is the controller and a peer. + zerotier = { + module.name = "zerotier"; + roles.controller.machines.user = { }; + roles.peer.machines.user = { }; + }; + # Generates the "user" password (was clanModules.user-password). + user-user = { + module.name = "users"; + roles.default.tags.all = { }; + roles.default.settings.user = "user"; + }; + }; }; in { @@ -608,7 +643,12 @@ let in { packages = { - inherit mcpx idMailDeploy pkarrDeploy developingTodayBackupDeploy; + inherit + mcpx + idMailDeploy + pkarrDeploy + developingTodayBackupDeploy + ; mcpx-docs = mcpxDocs; }; checks = { diff --git a/machines/user/configuration.nix b/machines/user/configuration.nix index 13e1e7be60..3d342bffe7 100644 --- a/machines/user/configuration.nix +++ b/machines/user/configuration.nix @@ -35,7 +35,7 @@ '' ]; - # Zerotier needs one controller to accept new nodes. Once accepted - # the controller can be offline and routing still works. - clan.core.networking.zerotier.controller.enable = true; + # Zerotier is configured through the clan inventory (zerotier instance + # in lib/default.nix): this machine is the network controller. Once a + # node is accepted the controller can be offline and routing still works. } diff --git a/modules/disko.nix b/modules/disko.nix index 711d62cf84..afee266cb2 100644 --- a/modules/disko.nix +++ b/modules/disko.nix @@ -1,16 +1,11 @@ -{ - lib, - clan-core, - config, - ... -}: +{ lib, ... }: -let - suffix = config.clan.core.vars.generators.disk-id.files.diskId.value; -in { - imports = [ clan-core.clanModules.disk-id ]; - + # Migrated off the removed clan-core disk-id module per the upstream + # clan-core disk-id migration guide: this file is now a standalone static + # disko configuration. The disk name suffix is the machine's generated + # diskId, cross-checked against vars/per-machine/user/disk-id/diskId/value + # (`clan vars list user`) — do not change it after installation. # 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; @@ -18,8 +13,8 @@ in disko.devices = { disk = { "main" = { - # suffix is to prevent disk name collisions - name = "main-" + suffix; + # static diskId suffix prevents disk name collisions + name = "main-822c2b3a90814675aa45e433aa1fe59a"; type = "disk"; # Set the following in flake.nix for each maschine: # device = ; diff --git a/modules/shared.nix b/modules/shared.nix index 57e757b8c0..e7b32296ee 100644 --- a/modules/shared.nix +++ b/modules/shared.nix @@ -1,20 +1,19 @@ -{ config, clan-core, ... }: +{ config, ... }: { - imports = [ - # Enables the OpenSSH server for remote access - clan-core.clanModules.sshd - # Set a root password - clan-core.clanModules.root-password - clan-core.clanModules.user-password - clan-core.clanModules.state-version - ]; + # The services this file used to import from clan-core + # (sshd, root-password, user-password, state-version) were removed + # upstream. At the locked clan-core rev they are clanServices enabled + # as inventory instances in lib/default.nix (make-clan): sshd runs the + # OpenSSH server, and the users service generates the root and "user" + # passwords. state-version needs no replacement: clanCore enables + # clan.core.settings.state-version by default. See #159. # Locale service discovery and mDNS services.avahi.enable = true; - # generate a random password for our user below - # can be read using `clan secrets get -user-password` command - clan.user-password.user = "user"; + # A generated password for the user below is provided by the users + # clanService instance in lib/default.nix; read it with + # `clan vars get user user-password-user/user-password`. users.users.user = { isNormalUser = true; extraGroups = [ @@ -31,5 +30,5 @@ # Enable Android/ADB and MTP support # programs.adb.enable = true; services.udisks2.enable = true; - programs.gvfs.enable = true; + services.gvfs.enable = true; } diff --git a/vars/shared/zerotier-network-zerotier/network-id/value b/vars/shared/zerotier-network-zerotier/network-id/value new file mode 100644 index 0000000000..859995a50e --- /dev/null +++ b/vars/shared/zerotier-network-zerotier/network-id/value @@ -0,0 +1 @@ +c5e451b2d6c22070 \ No newline at end of file