-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
170 lines (136 loc) · 5.35 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
{
description = "Flake for RaspberryPi support on NixOS";
nixConfig = {
extra-substituters = [
"https://nixos-raspberrypi.cachix.org"
];
extra-trusted-public-keys = [
"nixos-raspberrypi.cachix.org-1:4iMO9LXa8BqhU+Rpg6LQKiGa2lsNh/j2oiYLNOQ5sPI="
];
connect-timeout = 5;
};
inputs = {
# use fork to allow disabling modules introduced by mkRemovedOptionModule
# and similar functions
nixpkgs.url = "github:nvmd/nixpkgs/modules-with-keys";
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
argononed = {
# url = "git+file:../argononed?shallow=1";
# url = "git+https://gitlab.com/DarkElvenAngel/argononed.git";
url = "github:nvmd/argononed";
flake = false;
};
};
outputs = { self, nixpkgs, argononed, ... }@inputs: let
rpiSystems = [ "aarch64-linux" "armv7l-linux" "armv6l-linux" ];
allSystems = nixpkgs.lib.systems.flakeExposed;
forSystems = systems: f: nixpkgs.lib.genAttrs systems (system: f system);
mkRpiPkgs = nixpkgs: system: import nixpkgs {
inherit system; overlays = [
self.overlays.bootloader
self.overlays.pkgs
self.overlays.vendor-pkgs
self.overlays.vendor-firmware
self.overlays.vendor-kernel
self.overlays.kernel-and-firmware
];
};
mkLegacyPackagesFor = nixpkgs: forSystems rpiSystems (mkRpiPkgs nixpkgs);
in {
devShells = forSystems allSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
name = "nixos-raspberrypi";
nativeBuildInputs = with pkgs; [
nil # lsp language server for nix
nixpkgs-fmt
nix-output-monitor
bash-language-server
shellcheck
(pkgs.callPackage ./devshells/nix-build-to-cachix.nix {})
];
};
});
lib = import ./lib ({
inherit (nixpkgs) lib;
} // inputs);
nixosModules = {
bootloader = import ./modules/system/boot/loader/raspberrypi;
default = import ./modules/raspberrypi.nix;
sd-image = import ./modules/installer/sd-card/sd-image-raspberrypi.nix;
sd-image-installer = import ./modules/installer/sd-card/sd-image-raspberrypi-installer.nix;
pisugar-3 = import ./modules/pisugar-3.nix;
raspberry-pi-5 = {
base = import ./modules/raspberry-pi-5;
display-vc4 = import ./modules/display-vc4.nix;
display-rp1 = import ./modules/raspberry-pi-5/display-rp1.nix;
bluetooth = import ./modules/bluetooth.nix;
};
raspberry-pi-4 = {
base = import ./modules/raspberry-pi-4.nix;
display-vc4 = import ./modules/display-vc4.nix;
case-argonone = import ./modules/case-argononev2.nix { inherit argononed; };
bluetooth = import ./modules/bluetooth.nix;
};
raspberry-pi-02 = {
base = import ./modules/raspberry-pi-02.nix;
display-vc4 = import ./modules/display-vc4.nix;
bluetooth = import ./modules/bluetooth.nix;
};
};
overlays = {
bootloader = import ./overlays/bootloader.nix;
pkgs = import ./overlays/pkgs.nix;
vendor-pkgs = import ./overlays/vendor-pkgs.nix;
vendor-firmware = import ./overlays/vendor-firmware.nix;
vendor-kernel = import ./overlays/vendor-kernel.nix;
vendor-kernel-nixpkgs = import ./overlays/vendor-kernel-nixpkgs.nix;
kernel-and-firmware = import ./overlays/linux-and-firmware.nix;
};
# "RPi world": nixpkgs with all overlays applied "globally", i.e.
# all packages here depend on rpi's/optimized versions of the dependencies
# * used inside the modules, where a choice of "sane defaults" about the
# nixpkgs channel had to be made
# * binary cache is generated from this package set
legacyPackages = mkLegacyPackagesFor nixpkgs;
packages = forSystems rpiSystems (system: let
pkgs = self.legacyPackages.${system};
in {
ffmpeg_4 = pkgs.ffmpeg_4;
ffmpeg_5 = pkgs.ffmpeg_5;
ffmpeg_6 = pkgs.ffmpeg_6;
ffmpeg_6-headless = pkgs.ffmpeg_6-headless;
ffmpeg_7 = pkgs.ffmpeg_7;
kodi = pkgs.kodi;
kodi-gbm = pkgs.kodi-gbm;
kodi-wayland = pkgs.kodi-wayland;
libcamera = pkgs.libcamera;
libpisp = pkgs.libpisp;
libraspberrypi = pkgs.libraspberrypi;
raspberrypi-utils = pkgs.raspberrypi-utils;
raspberrypi-udev-rules = (pkgs.callPackage ./pkgs/raspberrypi/udev-rules.nix {});
rpicam-apps = pkgs.rpicam-apps;
SDL2 = pkgs.SDL2;
vlc = pkgs.vlc;
# see legacyPackages.<system>.linuxAndFirmware for other versions of
# the bundle
inherit (pkgs.linuxAndFirmware.latest)
linux_rpi5 linux_rpi4 linux_rpi02
linuxPackages_rpi5 linuxPackages_rpi4 linuxPackages_rpi02
raspberrypifw raspberrypiWirelessFirmware;
argononed = pkgs.callPackage "${inputs.argononed}/OS/nixos/pkg.nix" {};
pisugar3-kmod = let
targetKernel = pkgs.linux_rpi02;
in (pkgs.linuxPackagesFor targetKernel).callPackage ./pkgs/pisugar-kmod.nix {
pisugarVersion = "3";
};
pisugar2-kmod = let
targetKernel = pkgs.linux_rpi02;
in (pkgs.linuxPackagesFor targetKernel).callPackage ./pkgs/pisugar-kmod.nix {
pisugarVersion = "2";
};
pisugar-power-manager-rs = pkgs.callPackage ./pkgs/pisugar-power-manager-rs.nix {};
});
};
}