-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
157 lines (142 loc) · 4.29 KB
/
flake.nix
File metadata and controls
157 lines (142 loc) · 4.29 KB
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
{
description = "Flake workspace / repo to stage and track Nixpkgs/NixOS's ability to be compiled completely with LLVM";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
systems.url = "github:nix-systems/default-linux";
flake-parts.url = "github:hercules-ci/flake-parts";
nixos-hardware.url = "github:NixOS/nixos-hardware";
};
nixConfig = {
extra-substituters = [ "https://cache.garnix.io" ];
extra-trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];
};
outputs =
{
self,
nixpkgs,
systems,
flake-parts,
nixos-hardware,
...
}@inputs:
let
inherit (nixpkgs) lib;
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import systems;
flake = {
hydraJobs =
lib.recursiveUpdate
self.packages
{
aarch64-linux = {
rpi4 = self.nixosConfigurations.rpi4.config.system.build.sdImage;
};
};
overlays.default = import ./pkgs/default.nix lib;
nixosConfigurations =
lib.filterAttrs (_: v: v != null) (
lib.genAttrs (import systems) (
system:
let
pkgs = inputs.self.legacyPackages.${system};
in
if pkgs.hostPlatform.isLinux then
inputs.nixpkgs.lib.nixosSystem {
inherit system pkgs;
modules = [
"${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix"
./nixos/default.nix
{
virtualisation = {
qemu.guestAgent.enable = false;
host.pkgs = pkgs.pkgsBuildBuild;
};
}
];
}
else
null
)
)
// {
rpi4 = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
pkgs = inputs.self.legacyPackages.aarch64-linux;
modules = [
inputs.nixos-hardware.nixosModules.raspberry-pi-4
./nixos/default.nix
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
(
{ pkgs, lib, ... }:
{
hardware = {
raspberry-pi."4" = {
apply-overlays-dtmerge.enable = true;
pwm0.enable = true;
fkms-3d.enable = true;
};
deviceTree.enable = true;
enableAllHardware = lib.mkForce false;
};
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
services.openssh.enable = true;
boot = {
supportedFilesystems = lib.mkForce [
"btrfs"
"f2fs"
"ntfs"
"vfat"
"xfs"
];
kernelParams = [ "console=serial0,115200" "cma=256M" ];
};
}
)
];
};
};
};
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{
_module.args.pkgs =
(import inputs.nixpkgs {
inherit system;
overlays = [
inputs.self.overlays.default
];
config = { };
}).pkgsLLVM;
legacyPackages = pkgs;
packages =
{
inherit (pkgs)
mesa
bash
stdenv
nix
jemalloc
firefox
;
}
// lib.optionalAttrs pkgs.hostPlatform.isLinux {
inherit (pkgs)
linux
systemd
;
nixos-vm = self.nixosConfigurations.${system}.config.system.build.toplevel;
};
};
};
}