-
Notifications
You must be signed in to change notification settings - Fork 0
/
images.nix
103 lines (85 loc) · 2.29 KB
/
images.nix
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{ pkgs, lib, ... }:
with lib;
rec {
pinned = import ./pinned.nix { inherit lib pkgs; };
nixosBuild = {modules ? []}:
(import (pinned.nixpkgsVpsFree.path + "/nixos/lib/eval-config.nix") {
system = "x86_64-linux";
modules = [
(pinned.nixpkgsVpsFree.path + "/nixos/modules/installer/netboot/netboot-minimal.nix")
] ++ modules;
}).config.system.build;
nixosNetboot = {modules ? []}:
let
build = nixosBuild { inherit modules; };
in {
toplevel = build.toplevel;
dir = pkgs.symlinkJoin {
name = "nixos_netboot";
paths = with build; [ netbootRamdisk kernel netbootIpxeScript ];
};
};
node = {modules ? []}:
let
build = pinned.vpsadminosBuild { inherit modules; };
in {
toplevel = build.toplevel;
kernelParams = build.kernelParams;
dir = pkgs.symlinkJoin {
name = "vpsadminos_netboot";
paths = with build; [ dist ];
};
};
vpsadminosISO =
let
build = pinned.vpsadminosBuild {
modules = [{
imports = [
"${pinned.vpsadminosSrc}/os/configs/iso.nix"
];
system.secretsDir = null;
}];
};
in build.isoImage;
inMenu = name: netbootitem: netbootitem // { menu = name; };
# stock NixOS
nixos = nixosNetboot { };
nixosZfs = nixosNetboot {
modules = [ {
boot.supportedFilesystems = [ "zfs" ];
} ];
};
nixosZfsSSH = nixosNetboot {
modules = [ {
imports = [ ./env.nix ];
boot.supportedFilesystems = [ "zfs" ];
# enable ssh
systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
} ];
};
# stock vpsAdminOS
vpsadminos = node { };
# node configurations
devnode1 = node {
modules = [ {
imports = [
./nodes/devnode1.nix
];
} ];
};
macMap = {
devnode1 = [
"00:25:90:c9:d4:d6"
];
};
# netboot.mappings is in form { "MAC1" = "nodeX"; "MAC2" = "nodeX"; }
mappings = lib.listToAttrs (lib.flatten (lib.mapAttrsToList (x: y: map (mac: lib.nameValuePair mac x) y) macMap));
nixosItems = {
#nixos = inMenu "NixOS" nixos;
#nixoszfs = inMenu "NixOS ZFS" nixosZfs;
#nixoszfsssh = inMenu "NixOS ZFS SSH" nixosZfsSSH;
};
vpsadminosItems = {
inherit devnode1;
};
}