-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] add nixos module and library function to generate deploy.nodes
attributes from its config options
#281
Comments
Hi, this can be done very well using flake.parts, see my config for example: https://gitea.pherzog.xyz/phil/dotfiles/src/branch/main/modules/flake/deploy.nix I'd argue this is out of scope for deploy-rs |
Thanks for the input, I took a quick look. It appears to me that this is just a function that maps some existing nixos configuration options into a function that generates the node deployment expression... I'm doing something a bit similar now. It helps to reduce boiler plate, but it still cannot avoid having node-specific logic outside of the node's system config. My main point was that deploy-rs deploy options (the ones that cannot be deduced from existing nixos config options) need to be defined in the flake currently, because a nixos-config has no suitable "data attributes" to put them in, even though it's more natural to keep such deploy options with the system config and not separately. I.e. a simple nixos module that declares these options would suffice. I'd argue it is scope of deploy-rs, because it improves UX almost trivially and is specific top deploy-rs. |
Personally, I am not a fan of embedding deployment specific data into the nixos configuration for a few reasons but I can see your case. If you want to draft a simple nixos module we could see how well that integrates with the current deploy-rs. |
Sure 👌 , I'll "put it on the list", hope to get around to it soon... |
I store all hosts in a separate attrset and generate both nixosConfigurations and deploy.nodes from it via mapAttrs
|
I am in the process of transitioning from
nixinate
todeploy-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 thehosts/
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 likeand in the flake
where
getNodes
would just gather the attribute sets fordeploy
(if they exist) over all hosts innixosConfigurations
nixinate
seems to need_module.args = { nixinate = {}; };
, not sure why, maybe because importing the module would lead to recursion? In that case thedeploy
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.
The text was updated successfully, but these errors were encountered: