Exploratory: Add bootstrap script hook #1505
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this PR is more of an exploratory PR, to see whether this idea is useful for the general public. Internally at our company we're using nixops to deploy to non-NixOS systemd distributions. One of the issues we used to have is that nixops makes certain assumptions about the target machine, namely that it has a working multi-user nix installation, and that it has a
keys
group defined for secrets. For a while we've handled this explicitly outside nixops, we basically made the machine look like NixOS for the purposes of nixops.However, with a small addition to nixops, we now tackle this issue much more elegantly. Namely, this PR adds a nullable config option
deployment.bootstrapScript
, which (if set) is run on the master SSH connection before any nix-specific actions are taken, but after the resource closure has been built. This allows us to do the nix installation and certain early setup (like mounting of /nix from a separate hard disk), independent of the /nix/store.The actual mechanism I added is a bit broken as it only handles None type targets, but the control flow of the resource configuration is a bit too tricky and I couldn't figure out how to do it for a general resource type.
Question is, is this a useful enough feature to be included upstream? If so, can I get any pointers to how to expose the option to a more generic resource type? Also, the changes are on top of the 1.7 tag (the PR is submitted against release-1.7, which seems to have diverged from the tag(??)), would this feature go into 2.0 only? I tried upgrading to 2.0 but got into a bunch of unrelated issues with deployment.
Thank you!