nix-community / nixos-anywhere

install nixos everywhere via ssh [maintainer=@numtide]
https://nix-community.github.io/nixos-anywhere/
MIT License
1.53k stars 106 forks source link

colmena integration documentation #362

Closed neunenak closed 1 month ago

neunenak commented 1 month ago

The quickstart documentation mentions that the flake created by nixos-anywhere can be referenced by colmena for doing further deployments. However, there is no documentation on exactly how to import the configuration specified by the nixos-anywhere flake into an existing colmena flake. I've tried:

outputs.<machine-name> = { config, pkgs, ...}: {
   deployment.targetHost = "host.address";
   imports = [ inputs.nixos-anywhere-flake.nixosConfigurations.<machine-name> ];
}

which gives the error:

Could not load a value as a module, because it is of type "configuration"

I'm not sure exactly how to solve this problem, and in any case it would be good if the exact syntax needed to use nixos-anywhere with colmena was documented.

sedlund commented 1 month ago

The quickstart documentation mentions that the flake created by nixos-anywhere can be referenced by colmena for doing further deployments.

Can you please reference the exact section.

nixos-anywhere does not create a flake.

it would be good if the exact syntax needed to use nixos-anywhere with colmena was documented.

colmena is a separate project. How it should be configured for use is documented there.

neunenak commented 1 month ago

The quickstart documentation mentions that the flake created by nixos-anywhere can be referenced by colmena for doing further deployments.

Can you please reference the exact section.

In https://github.com/nix-community/nixos-anywhere/blob/main/docs/quickstart.md :

The new server's configurations are defined in the flake. nixos-anywhere does not create etc/nixos/configuration.nix, since it expects the server to be administered remotely. Any future changes to the configuration should be made to the flake, and you would reference this flake when doing the nixos-rebuild command or a deployment tool of your choice i.e. colmena, nixinate.

nixos-anywhere does not create a flake.

I'm confused now, because the quickstart documentation above that I've been following definitely instructs users to make a flake that has the initial system configuration in it.

it would be good if the exact syntax needed to use nixos-anywhere with colmena was documented.

colmena is a separate project. How it should be configured for use is documented there.

The nixos-anywhere documentation I linked above mentions colmena; without it I wouldn't have expected that I could use nixos-anywhere with colmena at all. Anyway, if whoever wrote it expected that the two projects were compatible, I'd like to know what they had in mind about exactly how they were compatible.

sedlund commented 1 month ago

instructs users to make a flake that has the initial system configuration in it.

Yes, you created a flake to configure your system. The example flake given is a generic NixOS Flake with disko included to do partitioning. There is nothing specific to nixos-anywhere in it.

For example if you booted the regular NixOS install ISO and copied over that example flake, you could run nixos-install --flake .# (if it was in your current directory) and it would install the system without nixos-anywhere. Or it could be in a github and be referenced as nixos-install --flake github:yourGitHubUser/yourRepo

Once the system has been installed with nixos-anywhere you will not have to use it again unless you want to reload.

As far as nixos-anywhere is concerned, it is done with that system. It is only a bootstrapping tool to get NixOS onto a target system in a convenient way. From here on, how you apply future configuration to the system is up to you. Examples were given.

You can choose any of these - or others:

I appreciate your feedback, I will try to update the documentation to make this clearer.