[Nix-dev] How do you manage bare-metal local servers with nixops

zimbatm zimbatm at zimbatm.com
Mon Dec 14 22:33:57 CET 2015


Hi rohit,

Personally I just have a folder per machine with the /etc/nixos folder and
a little script that runs rsync + `nixos-rebuild --switch` on the target
machine.

Over time I will probably switch to using nixops as well but for a start
it's working super well for me. Especially since it doesn't have any nix
dependency on the source machine. It takes just a couple of seconds to
deploy which is way better than anything I had in the past (ansible,
puppet, capistrano, ...).
On Thu, 10 Dec 2015 20:45 Christoph Hrdinka <c.nix-dev at hrdinka.at> wrote:

> Hi Rohit!
>
> You can use nixops to deploy to any server running ssh. All you have to
> do is install a basic NixOS system with opensshd enabled on your target
> server. Then tell nixops the hostname/ip address of the new server
> via `deployment.targetHost`.
>
> Nixops will evaluate any nix expression you give it. If you supply
> multiple files these will be merged. Your nix expression must yield an
> attribute set of the following form:
>
> {
>   someMachineName =
>     { config, lib, pkgs, ... }:
>     {
>       deployment.targetHost = "hostname or ip";
>       # your usual nixos configuration file
>       # ...
>     }
>
>   anotherMachine =
>     {....}
> }
>
> Every machine described in there will be deployed according to your
> configuation. Since it is a normal nix expression you can use any way
> to produce it. You can have basic templates that will be merged and
> overwritten by more specific ones, write everything in one file, spread
> it over hundret files or write a configuration syntax from which nix
> will derive all actual server configs.
>
> For what exactly do you need PXE? Is it for the initial NixOS install
> or do you want to use it because it worked for you till now with other
> systems?
> If you want it because of less configuration work it may be the wrong
> tool for a NixOS setup. Nixops is much better suited for this job than
> any PXE setup could ever be. It is made for simple deployment of
> hundrets of machines.
>
> You might also want to have a look at disnix/disnixos.
>
> Regards,
> Christoph Hrdinka.
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20151214/47f8a22d/attachment.html 


More information about the nix-dev mailing list