blob: 235d4e53a52b2fc7e52be0195f24cffb1e2e0f31 (
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
80
81
82
83
84
85
86
|
let
lock = builtins.readFile ./flake.lock |> builtins.fromJSON;
defaultNixpkgs = builtins.fetchTarball {
inherit (lock.nodes.nixpkgs.locked) url;
sha256 = lock.nodes.nixpkgs.locked.narHash;
};
disko = builtins.fetchTarball {
url = "https://github.com/nix-community/disko/archibe/${lock.nodes.disko.locked.rev}tar.gz";
sha256 = lock.nodes.disko.locked.narHash;
};
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.desktop
nixosModules.network
nixosModules.sshd
nixosModules.users
("${disko}/module.nix")
];
};
in
builtins.mapAttrs buildNixOS entries
);
in
{
pkgs = newPkgs;
inherit (newPkgs) depotPackages;
inherit machines;
}
|