fix(colmena): deploy the systems nixosConfigurations evaluates

Colmena deployments now ship the same toplevel as nixosConfigurations: nodes gain the nixpkgs
registry, nixPath and dated version, and akane no longer gets the x86_64 dsh.

Assisted-by: DeepSeek Harness 0.2.1-rc.2 (claude-opus-5-5)
This commit is contained in:
Ryan Yin authored and ryan4yin | 二花 committed 2026-10-21 20:59:07 +08:00
1 parent 9a3cf189cd
commit 3b3992468b
8 files changed
+65 -67

No files matched your search

-9
View File
@@ -20,15 +20,6 @@ let
map (it: it.nixosConfigurations or { }) dataWithoutPaths
);
packages = lib.attrsets.mergeAttrsList (map (it: it.packages or { }) dataWithoutPaths);
# colmena contains some meta info, which need to be merged carefully.
colmenaMeta = {
nodeNixpkgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeNixpkgs or { }) dataWithoutPaths
);
nodeSpecialArgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeSpecialArgs or { }) dataWithoutPaths
);
};
colmena = lib.attrsets.mergeAttrsList (map (it: it.colmena or { }) dataWithoutPaths);
};
in
@@ -0,0 +1,7 @@
{
lib,
outputs,
}:
lib.genAttrs [ "akane" ] (
name: outputs.nixosConfigurations.${name}.config.system.build.toplevel.drvPath
)
@@ -0,0 +1,6 @@
{
lib,
inputs,
}:
# Colmena must deploy the system that nixosConfigurations evaluates and builds.
lib.genAttrs [ "akane" ] (name: inputs.self.colmenaHive.toplevel.${name}.drvPath)
+35 -24
View File
@@ -91,32 +91,45 @@ let
darwinSystemValues = builtins.attrValues darwinSystems;
allSystemValues = nixosSystemValues ++ darwinSystemValues;
nixosConfigurations = lib.attrsets.mergeAttrsList (
map (it: it.nixosConfigurations or { }) nixosSystemValues
);
# Per-node deployment settings from `mylib.colmenaSystem`, keyed by host name.
colmenaDeployments = lib.attrsets.mergeAttrsList (map (it: it.colmena or { }) nixosSystemValues);
# Raw Colmena hive (nodes + meta), evaluated below into the exposed
# `colmenaHive` output. The nix-community Colmena rewrite only reads
# `colmenaHive`, so the raw hive is not an output of its own.
#
# Each node is rebuilt from its `nixosConfigurations` entry: the same modules
# (including the one `nixpkgs.lib.nixosSystem` appends), specialArgs and
# system. Colmena applies `nodeNixpkgs`' overlays and config on top of the
# node's own, so it gets a package set with none: not the node's `pkgs`, and
# not `legacyPackages`, which carries the flake's own overlays.
rawColmenaHive = {
meta =
(
let
system = "x86_64-linux";
in
{
# colmena's default nixpkgs & specialArgs
nixpkgs = import nixpkgs { inherit system; };
specialArgs = genSpecialArgs system;
}
)
// {
# per-node nixpkgs & specialArgs
nodeNixpkgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeNixpkgs or { }) nixosSystemValues
);
nodeSpecialArgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeSpecialArgs or { }) nixosSystemValues
);
};
meta = {
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
nodeNixpkgs = builtins.mapAttrs (
name: _: import nixpkgs { inherit (nixosConfigurations.${name}.pkgs.stdenv.hostPlatform) system; }
) colmenaDeployments;
nodeSpecialArgs = builtins.mapAttrs (
name: _: nixosConfigurations.${name}._module.specialArgs
) colmenaDeployments;
};
}
// lib.attrsets.mergeAttrsList (map (it: it.colmena or { }) nixosSystemValues);
// builtins.mapAttrs (name: deployment: {
imports = [
deployment
# Colmena evaluates with nixpkgs' plain lib, which lacks the version the
# flake's lib reports; without this the toplevel differs (`26.11pre-git`).
{
system.nixos.versionSuffix = lib.trivial.versionSuffix;
system.nixos.revision = lib.trivial.revisionWithDefault null;
}
]
++ nixosConfigurations.${name}._module.args.modules;
}) colmenaDeployments;
# Helper function to generate a set of attributes for each system
forAllSystems = func: (nixpkgs.lib.genAttrs allSystemNames func);
@@ -133,9 +146,7 @@ in
};
# NixOS Hosts
nixosConfigurations = lib.attrsets.mergeAttrsList (
map (it: it.nixosConfigurations or { }) nixosSystemValues
);
inherit nixosConfigurations;
# Colmena - remote deployment via SSH. The nix-community evaluator reads the
# evaluated `colmenaHive` output built from the raw hive in the `let` block.
-9
View File
@@ -20,15 +20,6 @@ let
map (it: it.nixosConfigurations or { }) dataWithoutPaths
);
packages = lib.attrsets.mergeAttrsList (map (it: it.packages or { }) dataWithoutPaths);
# colmena contains some meta info, which need to be merged carefully.
colmenaMeta = {
nodeNixpkgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeNixpkgs or { }) dataWithoutPaths
);
nodeSpecialArgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeSpecialArgs or { }) dataWithoutPaths
);
};
colmena = lib.attrsets.mergeAttrsList (map (it: it.colmena or { }) dataWithoutPaths);
};
in
@@ -0,0 +1,7 @@
{
lib,
outputs,
}:
lib.genAttrs [ "kana" ] (
name: outputs.nixosConfigurations.${name}.config.system.build.toplevel.drvPath
)
@@ -0,0 +1,6 @@
{
lib,
inputs,
}:
# Colmena must deploy the system that nixosConfigurations evaluates and builds.
lib.genAttrs [ "kana" ] (name: inputs.self.colmenaHive.toplevel.${name}.drvPath)