-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
flake.nix
91 lines (89 loc) · 2.75 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
{
description = "raspberry-pi nixos configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
u-boot-src = {
flake = false;
url = "https://ftp.denx.de/pub/u-boot/u-boot-2024.07.tar.bz2";
};
rpi-linux-6_6_54-src = {
flake = false;
url = "github:raspberrypi/linux/rpi-6.6.y";
};
rpi-linux-6_10_12-src = {
flake = false;
url = "github:raspberrypi/linux/rpi-6.10.y";
};
rpi-firmware-src = {
flake = false;
url = "github:raspberrypi/firmware/1.20241001";
};
rpi-firmware-nonfree-src = {
flake = false;
url = "github:RPi-Distro/firmware-nonfree/bookworm";
};
rpi-bluez-firmware-src = {
flake = false;
url = "github:RPi-Distro/bluez-firmware/bookworm";
};
rpicam-apps-src = {
flake = false;
url = "github:raspberrypi/rpicam-apps/v1.5.2";
};
libcamera-src = {
flake = false;
url = "github:raspberrypi/libcamera/69a894c4adad524d3063dd027f5c4774485cf9db"; # v0.3.1+rpt20240906
};
libpisp-src = {
flake = false;
url = "github:raspberrypi/libpisp/v1.0.7";
};
};
outputs = srcs@{ self, ... }:
let
pinned = import srcs.nixpkgs {
system = "aarch64-linux";
overlays = with self.overlays; [ core libcamera ];
};
in
{
overlays = {
core = import ./overlays (builtins.removeAttrs srcs [ "self" ]);
libcamera = import ./overlays/libcamera.nix (builtins.removeAttrs srcs [ "self" ]);
};
nixosModules = {
raspberry-pi = import ./rpi {
inherit pinned;
core-overlay = self.overlays.core;
libcamera-overlay = self.overlays.libcamera;
};
sd-image = import ./sd-image;
};
nixosConfigurations = {
rpi-example = srcs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [ self.nixosModules.raspberry-pi self.nixosModules.sd-image ./example ];
};
};
checks.aarch64-linux = self.packages.aarch64-linux;
packages.aarch64-linux = with pinned.lib;
let
kernels =
foldlAttrs f { } pinned.rpi-kernels;
f = acc: kernel-version: board-attr-set:
foldlAttrs
(acc: board-version: drv: acc // {
"linux-${kernel-version}-${board-version}" = drv;
})
acc
board-attr-set;
in
{
example-sd-image = self.nixosConfigurations.rpi-example.config.system.build.sdImage;
firmware = pinned.raspberrypifw;
libcamera = pinned.libcamera;
wireless-firmware = pinned.raspberrypiWirelessFirmware;
uboot-rpi-arm64 = pinned.uboot-rpi-arm64;
} // kernels;
};
}