[Nix-dev] nixops data deployment

Moritz Ulrich moritz at tarn-vedra.de
Fri Nov 1 22:24:05 CET 2013


The correct way would be adding the data to the nix-store. This way
you'd get all the benefits of Nix(OS): Atomic upgrades, easy switching
between configurations, rollbacks, etc.

Nix (the language) supports some functions to accomplish this:

- builtins.readFile reads a file and returns the contents as string
- pkgs.writeText can be used to write a string to a file in the nix
  store and returns the path to the file.

You can use these (and some others) to read from a file (your whitelist) on your
deploying machine (where you run nixops) and create a nix-store entry
with the contents of the file and refer to it in other expressions (e.g.
your postfix config).

Tim Barbour writes:

> I understand that one advantage of nixops is being able to deploy a set of
> services atomically, possibly including data that is needed by the services.
>
> What is the recommended way to get nixops to deploy some data for a service at
> the same time it deploys the service ?
>
> I would like to be able to deploy some services (e.g. postfix) via nixops,
> including required data (e.g. whitelist data). Obviously I could use something
> else (like rsync) to deploy the data, but that would break the atomic
> deployment, since the service could start before the data was available.
>
> Tim
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev


-- 
Moritz Ulrich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20131101/8f3ce6e4/attachment-0001.bin 


More information about the nix-dev mailing list