blob: 04d25736cc06957c5db4156c2885850b7ee7b9a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
let
lock = builtins.readFile ./flake.lock |> builtins.fromJSON;
defaultNixpkgs = builtins.fetchGit {
url = "https://github.com/NixOS/nixpkgs";
shallow = true;
inherit (lock.nodes.nixpkgs.locked) rev;
inherit (lock.nodes.nixpkgs.original) ref;
};
in
{
pkgs ? import defaultNixpkgs { },
localSystem ? builtins.currentSystem,
crossSystem ? null,
...
}:
let
inherit (pkgs) lib;
inherit (lib)
packagesFromDirectoryRecursive
;
importDir = import lib/importDir.nix { inherit lib; };
overlay =
final: _:
let
depotPackages = packagesFromDirectoryRecursive {
callPackage = lib.callPackageWith (final // { inherit depotPackages; });
directory = ./packages;
};
in
{
inherit depotPackages;
depot = depotPackages;
};
newPkgs = import defaultNixpkgs {
config = {
allowUnfree = true;
allowUnfreeRedistributable = true;
};
overlays = [ overlay ];
};
nixosModules = importDir ./modules (builtins.mapAttrs (_: { path, ... }: path));
machines = importDir ./machines (
entries:
let
defaultModule = { config, ... }: {
nixpkgs.overlays = [ overlay ];
system.stateVersion = lib.mkDefault config.system.nixos.release;
};
buildNixOS =
hostName: entry:
import (pkgs.path + "/nixos/lib/eval-config.nix") {
modules = [
defaultModule
entry.path
nixosModules.xnet
nixosModules.disk
# nixosModules.network
nixosModules.sshd
];
};
in
builtins.mapAttrs buildNixOS entries
);
in
{
inherit (newPkgs) depotPackages;
inherit machines;
}
|