From d1a83f009ad7ae5aff579fe2664c061b60f36dcf Mon Sep 17 00:00:00 2001 From: toinux <26522723+itzwam@users.noreply.github.com> Date: Tue, 28 Apr 2026 01:03:22 +0200 Subject: [PATCH] feat: targetImage - using nixpkgs images module toplevels for updating images post-deployment --- src/nix/hive/eval.nix | 2 +- src/nix/hive/options.nix | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nix/hive/eval.nix b/src/nix/hive/eval.nix index 91e4f4c..b000294 100644 --- a/src/nix/hive/eval.nix +++ b/src/nix/hive/eval.nix @@ -184,7 +184,7 @@ in rec { __schema = "v0.5"; nodes = listToAttrs (map (name: { inherit name; value = evalNode name (configsFor name); }) nodeNames); - toplevel = lib.mapAttrs (_: v: v.config.system.build.toplevel) nodes; + toplevel = lib.mapAttrs (name: node: let targetImage = deploymentConfig.${name}.targetImage; in if targetImage == null then node.config.system.build.toplevel else node.config.system.build.images.${targetImage}.passthru.config.system.build.toplevel) nodes; deploymentConfig = lib.mapAttrs (_: v: v.config.deployment) nodes; deploymentConfigSelected = names: lib.filterAttrs (name: _: elem name names) deploymentConfig; evalSelected = names: lib.filterAttrs (name: _: elem name names) toplevel; diff --git a/src/nix/hive/options.nix b/src/nix/hive/options.nix index 3f56642..02dd3b5 100644 --- a/src/nix/hive/options.nix +++ b/src/nix/hive/options.nix @@ -124,6 +124,13 @@ with builtins; rec { type = types.nullOr types.str; default = "root"; }; + targetImage = lib.mkOption { + description = '' + The image (from system.build.images.) to deploy on the target. + ''; + type = types.nullOr types.str; + default = null; + }; allowLocalDeployment = lib.mkOption { description = '' Allow the configuration to be applied locally on the host running