Skip to content

Instantly share code, notes, and snippets.

@johanot
Created October 3, 2020 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanot/164ace22de35ccad8259edfcae26ec07 to your computer and use it in GitHub Desktop.
Save johanot/164ace22de35ccad8259edfcae26ec07 to your computer and use it in GitHub Desktop.
let
p = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-20.03.tar.gz";
common = { pkgs, config, ... }: {
fileSystems."/" = { device = "/dev/null"; fsType = "ext4"; };
boot.loader.grub.devices = ["/dev/null"];
environment.systemPackages = [pkgs.ngrok];
nixpkgs.pkgs = import p { # set pkgs globally, kind of the same way as "network.pkgs" does transiently
config.allowUnfree = true;
};
};
in
{
host1 = { lib, ... }: { # this host will refuse to eval, because ngrok
imports = [ common ];
nixpkgs.pkgs = lib.mkForce (import p { # overrides "common"
config.allowUnfree = false;
});
};
host2 = { ... }: {
imports = [ common ];
};
host3 = { ... }: {
imports = [ common ];
};
network = { # set morph dependencies, so that they don't leak in from environment
lib = import "${p}/lib";
evalConfig = "${p}/nixos/lib/eval-config.nix";
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment