Skip to content

[feature] add nixos module and library function to generate deploy.nodes attributes from its config options #281

@ppenguin

Description

@ppenguin

I am in the process of transitioning from nixinate to deploy-rs, and found the "duplication" I have to do in the flake a bit awkward.

Background: I have no explicit hosts defined in my flake, but the nixosConfigurations are generated automatically by scanning the hosts/ directory in my flake, which contain all host's system configs in separate sub-directories.

Consequently, it would we nice if one could just do within hosts/somehost/configuration.nix something like

imports = [
   inputs.deploy-rs.nixosModule.default
];

deploy = {
   hostname = "somehost.fqdn.net"
   sshOpts = ...;
   profiles.system = {
      ...
   };
};

and in the flake

deploy.nodes = (deploy-rs.lib.getNodes self.nixosConfigurations) // { /* possibly further "manual" ones */}

where getNodes would just gather the attribute sets for deploy (if they exist) over all hosts in nixosConfigurations

nixinate seems to need _module.args = { nixinate = {}; };, not sure why, maybe because importing the module would lead to recursion? In that case the deploy attribute could be done similarly.

I saw something possibly related in #269 but haven't quite understood how that proposal might be related in terms of UX and functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions