nixos-config/lib.nix
2020-07-19 13:31:21 +02:00

25 lines
650 B
Nix

{
findImport = name:
let
localpath = ./.. + "/${name}";
importpath = ./imports + "/${name}";
in
if builtins.pathExists localpath then
localpath
else if builtins.pathExists importpath then
(import importpath)
else (abort "couldn't find import ${name}");
mkSystem = { nixpkgs, system ? "x86_64-linux", rev ? "git", extraModules ? [ ], ... }:
let
machine = import "${nixpkgs}/nixos/lib/eval-config.nix" {
inherit system;
modules = [
({ ... }: {
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
})
] ++ extraModules;
};
in
machine;
}