[Nix-dev] NixOps usage survey.

Tomas Hlavaty tom at logand.com
Mon Sep 5 22:11:11 CEST 2016


Hi Aloïs,

if you don't need any of the backends nixops offers except maybe "none",
it might be better to avoid the stateful nature of nixops and go with a
simple script based on nixos-rebuild, something like:

deploy1.sh:

HOST=$1
NIXPKGS=$2
nixos-rebuild switch \
  -I nixos-config=./$HOST/configuration.nix \
  -I nixpkgs=$NIXPKGS \
  --build-host localhost \
  --target-host root@$HOST

deploy.sh:

NIXPKGS=https://nixos.org/channels/nixos-16.03/nixexprs.tar.xz
sh deploy1.sh host1 $NIXPKGS
sh deploy1.sh host2 $NIXPKGS

You could have a private hydra for your software and configure it as a
binary cache for the nixos-rebuild above.

It is very simple, roughly equivalent to the "none" backend in nixops
and you avoid drawbacks of nixops described in the other emails.

You just need to get an initial NixOS installed on a new machine
somehow, and after that the script above will do the magic.

nixops helps with the part "get an initial NixOS installed on a new
machine somehow", but if that is not your concern, this approach might
be better.

Cheers,

Tomas


More information about the nix-dev mailing list