Repository navigation
How to expose host-dependent top-level outputs in den?
#181
|
Hi everyone, I am currently migrating my Nix configuration from a custom I encounter a scenario where I need to expose top-level flake outputs that depend on specific attributes of the defined hosts. Specifically, I use The logic looks roughly like this (with {inputs, self, ...}: {
flake.deploy.nodes.${host.name} = {
hostname = host.name;
profiles.system.path = inputs.deploy-rs.lib.${host.system}.activate.nixos self.nixosConfigurations.${host.name};
};
}What is the idiomatic way to achieve this in |
Replies: 1 comment
|
Hey @HPCesia, all those attributes you need in your code snippet I see your flake output looks like it can already be a function of nodeDeploy = name: host: {
hostname = host.hostName;
profiles.system.path = inputs.deploy-rs.lib.${host.system}.activate.nixos self.nixosConfigurations.${name};
};
flake.deploy.nodes = mapAttrs nodeDeploy den.hosts.x86_64-linux;that's the easiest way I might believe. |
Hey @HPCesia, all those attributes you need in your code snippet
host.{system,name}exist on thehostschema (you can also add new free-form attributes to them in case you need it, or useden.base.hostto add module typed options to all hosts schema).I see your flake output looks like it can already be a function of
host,that's the easiest way I might believe.