-
Notifications
You must be signed in to change notification settings - Fork 15
/
flake.nix
116 lines (116 loc) · 3.95 KB
/
flake.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
104
105
106
107
108
109
110
111
112
113
114
115
116
{
inputs = {
cachecache.url = "github:cleverca22/cachecache";
utils.url = "github:numtide/flake-utils";
rpi-nixos.url = "github:cleverca22/rpi-nixos?rev=7dea0d95cfb31060b360833d5f60e0f5ebb4b84a";
#rpi-nixos.url = "path:/home/clever/apps/rpi/rpi-nixos";
firmware = {
flake = false;
url = "path:/home/clever/apps/rpi/firmware2";
#url = "github:raspberrypi/firmware";
};
#nix.url = "path:/home/clever/apps/nix-master";
zfs-utils = {
url = "github:cleverca22/zfs-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { rpi-nixos, firmware, cachecache, self, utils, nixpkgs, zfs-utils }:
let
lib = (import nixpkgs { system = "x86_64-linux"; }).lib;
common-config = { pkgs, ... }:
{
imports = [
./auto-gc.nix
];
boot = {
loader = {
raspberryPi = {
firmwareConfig = ''
enable_uart=1
uart_2ndstage=1
'';
};
};
};
nixpkgs.overlays = [
(self: super: {
raspberrypifw = super.raspberrypifw.overrideAttrs (old: {
src = firmware;
});
})
];
#nix.package = nix.packages.aarch64-linux.nix;
networking.firewall.enable = false;
environment.systemPackages = with pkgs; [
screen libraspberrypi
ncdu
];
users.users.root.openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC34wZQFEOGkA5b0Z6maE3aKy/ix1MiK1D0Qmg4E9skAA57yKtWYzjA23r5OCF4Nhlj1CuYd6P1sEI/fMnxf+KkqqgW3ZoZ0+pQu4Bd8Ymi3OkkQX9kiq2coD3AFI6JytC6uBi6FaZQT5fG59DbXhxO5YpZlym8ps1obyCBX0hyKntD18RgHNaNM+jkQOhQ5OoxKsBEobxQOEdjIowl2QeEHb99n45sFr53NFqk3UCz0Y7ZMf1hSFQPuuEC/wExzBBJ1Wl7E1LlNA4p9O3qJUSadGZS4e5nSLqMnbQWv2icQS/7J8IwY0M8r1MsL8mdnlXHUofPlG1r4mtovQ2myzOx clever@nixos"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDM3J+b+IoVRaM3Mr8M0iHPNTdLvBCKDJyt3zuiYVi1PoEKHuEd+BT7CDhdWS0BrvWoXNfa6vFNnniXQHY4euZPoyVHhVphJ508p+TfBReHgJ41+UHU6TOjam7+bIek5LN+qTi8s/CXsTsn2e6wAhgwmKPLEt2NBGgDvwVlivBfmgpcob+hOwOaFHpOEv+W1jmsJYdnRsX9K4jWEx6EEj+qxUa53ubwCwjtJ0o+s59wT2b+4M3qakpu1UZgmmchn8RWmf9OYPRaSyO1TEaGdLnDrhBezwVXKDgulZ8VKbAowpPCMjuqzR28XyNJDVQJHudy9Ir7k0HKQwTUYsqgcV/h root@nas"
];
services = {
prometheus.exporters.node = {
enable = true;
enabledCollectors = [
#"systemd"
"tcpstat"
"conntrack"
"diskstats"
#"entropy"
"filefd"
"filesystem"
"loadavg"
"meminfo"
"netdev"
#"netstat"
"stat"
"time"
"ntp"
"timex"
"vmstat"
#"logind"
"interrupts"
"ksmd"
#"processes"
];
#disabledCollectors = [ "hwmon" ];
};
};
nix = {
min-free-collection = true;
};
};
arm64-config = {
imports = [ common-config ];
nix = {
extraOptions = ''
extra-platforms = armv6l-linux armv7l-linux
'';
};
};
netboot-1 = { pkgs, ... }: {
imports = [ arm64-config ];
rpi-netboot.lun = "iqn.2021-08.com.example:pi400.img";
networking.hostName = "netboot-1";
};
netboot-2 = { pkgs, ... }: {
imports = [ arm64-config ];
rpi-netboot.lun = "iqn.2021-08.com.example:netboot-2.img";
};
arm64_images = {
netboot-1 = rpi-nixos.packages.aarch64-linux.net_image_pi4.override { configuration = netboot-1; };
netboot-2 = rpi-nixos.packages.aarch64-linux.net_image_pi4.override { configuration = netboot-2; };
};
in
utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
{
packages.cachecache = cachecache.outputs.packages.${system}.cachecache;
hydraJobs.cachecache = cachecache.outputs.packages.${system}.cachecache;
} // lib.optionalAttrs (system == "aarch64-linux") {
packages = arm64_images;
hydraJobs = arm64_images;
}
);
}