[Nix-dev] Building separate nixos/nixpkgs in the same nix build

Rickard Nilsson rickard.nilsson at telia.com
Thu Jan 24 18:19:44 CET 2013


Hi,

How do one go about building two NixOS systems in one build, when the two  
systems have separate nixos and nixpkgs sources from each other?

I've digged around a bit in nixos/default.nix and  
nixos/lib/eval-config.nix, and it seems the <nixpkgs> path is used in  
several places, and can't really be substituted by a nix expression. And I  
can't change the current NIX_PATH from within a nix expression, can I?

What I'm looking for is something like this:

{
   nixos1 = fetchgit { ... };
   nixpkgs1 = fetchgit { ... };
   nixos2 = /etc/system2/nixos;
   nixpkgs2 = /etc/system2/nixpkgs;

   system1 = (import nixos1 {
     configuration = /etc/system1/configuration.nix;
     nixpkgs = nixpkgs1;
   }).system;

   system2 = (import nixos2 {
     configuration = /etc/system2/configuration.nix;
     nixpkgs = nixpkgs2;
   }).system;
}

I've looked at Charon, but it seems all configurations and machines must  
use the same nixos and nixpkgs there?


Best regards,
   Rickard Nilsson


More information about the nix-dev mailing list