-
Notifications
You must be signed in to change notification settings - Fork 15
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 wishlist and general orientation of this tool #2
Comments
In #nixus, @ashkitten was wondering about bootstrapping a system (logs). A possibility I thought of:
|
In #nixos-chat @andir was talking about wanting to have machines configs depend on IP's yet to be provisioned, and related things (logs). After thinking about this, I came up with the following idea that generalizes this concept well:
This could look like this: { pkgs, ... }: {
phases.provision = {}: {
executable = pkgs.writeScript "provision" ''
ip=$(curl https://my.provider/provision)
echo "{ \"ip\" : $ip }"
'';
# If this file exists, its value will be used as the phase output
# If it doesn't exist, the output is written there on phase call
persistTo = ./provision.json;
};
# The deploy phase depends on the provision phases output, which will be
# passed to this function
phases.deploy = { provision }: {
executable = pkgs.writeScript "deploy" ''
nix-copy-closure --to ${provision.ip} ${<system-closure>}
ssh ${provision.ip} ${<system-closure>}/bin/switch-to-configuration switch
'';
};
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: