[Nix-dev] Best Practices on Modularizing Configuration.nix?
Jookia
166291 at gmail.com
Mon Feb 27 21:40:52 CET 2017
On Mon, Feb 27, 2017 at 09:15:27AM -0500, Mark Gardner wrote:
> So far, this seems like a good approach. Except that each machine has its
> own configuration.nix that I would like to keep in the git repository too
> but of course I can't have different top level files with the same name. To
> solve this, I could moved the current configuration.nix inside of cfg (as
> cfg/mylaptop.cfg.nix perhaps) or merge with the existing cfg/mylaptop.nix
> then making configuration.nix a symlink to it. That way the only thing to
> do by hand is create the symlink to select a particular configuration. Is
> this reasonable? Is there a better way to do it?
>
> How do you modularize your configuration and put it into a repo such that
> you can easily create a configuration for a new machine (and put it in the
> repo too) without a lot of hand work?
>
> Mark
> --
> Mark Gardner
> --
I have a configuration for each host, but then I set my nix path like so:
NIX_PATH=nixpkgs=/home/jookia.data/nixos/nixpkgs.git:nixos-config=/home/jookia.data/nixos/configuration.git/novena.nix
nixos-config points to my host-specific configuration. Then in that host
configuration I set the path something like this:
nix.nixPath = [
"nixos-config=/home/jookia.data/nixos/configuration.git/novena.nix"
];
More information about the nix-dev
mailing list