[Nix-dev] Templates

Marc Weber marco-oweber at gmx.de
Wed Jun 26 21:37:59 CEST 2013


> riak
You're talking about the nosql database, right? 

Excerpts from Malcolm Matalka's message of Wed Jun 26 21:26:40 +0200 2013:
> It also is a supported file type in my Emacs 

nix has an emacs mode nix-mode.le, did you know that?

For nix you can get "syntax checking" by running 

  nix-instantiate --eval-only FILE

(vim-addon-nix has done this for ages)

So do you think that Emacs mode should be improved?
> this feature.  I think putting config files in Nix expressions is
> suboptimal.

You can write config.nix and then import that:

config.nix:
{
  hostname ="abc";
}

configuration.nix:
let my_config = import config.nix; in
{
  networking.hostname = my_config.hostname;
}

etc.

Can you paste a couple of lines of a nicer configuration you want to use
and comment them why you think a different style is much different than
nix maintainers should care about it?

You can also use "substitute in place" like configurations:\

== the file
allowed_users: @USERS@
==

then make nix substitute @USERS@ to generate the final config.
grep nixos for @ and you should find some examples (bash scripts).

That would be sufficient if you want to create a config file for a
database only (eventually).

Marc Weber


More information about the nix-dev mailing list