-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
230 lines (229 loc) · 6.3 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
{
description = "My configuration as a flake";
inputs = {
stable.url = "github:NixOS/nixpkgs/nixos-24.11";
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
hardware.url = "github:NixOS/nixos-hardware";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "stable";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "stable";
};
emacs-overlay = {
url = "github:nix-community/emacs-overlay";
inputs.nixpkgs.follows = "stable";
};
emacs-mirror = {
url = "github:emacs-mirror/emacs";
flake = false;
};
utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
stable,
unstable,
hardware,
home-manager,
rust-overlay,
emacs-overlay,
emacs-mirror,
utils,
} @ inputs: let
allPackagesOverlay =
stable.lib.composeManyExtensions
[
(final: prev: {
lib =
prev.lib
// {
jmpunkt = lib;
};
})
(import ./overlays/10-pkgs.nix)
(import ./overlays/emacs-overlay-glue.nix {inherit emacs-overlay emacs-mirror;})
];
lib = import ./lib.nix {
inherit self unstable stable;
minimumOverlays = [
rust-overlay.overlays.default
allPackagesOverlay
emacs-overlay.overlays.package
];
};
inherit
(lib)
mkUnstableOverlay
mkSystem
mkSystemCross
mkPkgs
packageSD
packageISO
packageSystem
packageVM
;
forAllSystems =
utils.lib.eachDefaultSystem
(system: {legacyPackages = mkPkgs system unstable [(mkUnstableOverlay system)];});
forx86Systems =
utils.lib.eachSystem
["x86_64-linux" "i686-linux"]
(system: {
apps = {
repl =
utils.lib.mkApp
{
drv =
unstable.legacyPackages.${system}.writeShellScriptBin
"repl"
''
confnix=$(mktemp)
echo "builtins.getFlake (toString $(git rev-parse --show-toplevel))" >$confnix
trap "rm $confnix" EXIT
nix repl $confnix
'';
};
};
packages = let
rpi2System =
mkSystemCross
{
host = system;
target = "armv7l-hf-multiplatform";
system = "armv7l-linux";
nixpkgs = unstable;
modules = [
./machines/rpi2b/configuration.nix
];
};
in {
ee = emacs-mirror;
keyboard = self.legacyPackages.${system}.callPackage ./qmk {};
sd-rpi2 = packageSD rpi2System;
rpi2 = packageSystem rpi2System;
iso-minimal = packageISO (
mkSystem
{
inherit system inputs;
nixpkgs = stable;
modules = [(import ./machines/iso-minimal/configuration.nix)];
}
);
iso = packageISO (
mkSystem
{
inherit system inputs;
nixpkgs = stable;
modules = [
(import ./machines/iso/configuration.nix)
self.nixosModules.home-unknown
({...}: {
home-manager.users.nixos = ./home/jonas/home.nix;
})
];
}
);
vm-alpha128 = packageVM (mkSystem
{
inherit system inputs;
nixpkgs = stable;
modules = [
self.nixosModules.alpha128
"${stable}/nixos/modules/virtualisation/qemu-vm.nix"
./configurations/qemu-vm.nix
];
});
vm-gamma64 = packageVM (mkSystem
{
inherit system inputs;
nixpkgs = stable;
modules = [
self.nixosModules.gamma64
"${stable}/nixos/modules/virtualisation/qemu-vm.nix"
./configurations/qemu-vm.nix
];
});
};
});
forx86_64Systems =
utils.lib.eachSystem
["x86_64-linux"]
(system: {
packages = {
alpha128 = packageSystem (
mkSystem
{
inherit system inputs;
nixpkgs = stable;
modules = [
self.nixosModules.alpha128
];
}
);
gamma64 = packageSystem (mkSystem
{
inherit system inputs;
nixpkgs = stable;
modules = [self.nixosModules.gamma64];
});
};
});
in
(
stable.lib.attrsets.recursiveUpdate
forAllSystems
(
stable.lib.attrsets.recursiveUpdate
forx86Systems
forx86_64Systems
)
)
// {
inherit lib;
overlays.default = allPackagesOverlay;
templates = import ./templates;
nixosModules = {
home-unknown = (
{config, ...}: {
imports = [
home-manager.nixosModules.home-manager
];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit inputs;
systemConfig = config;
};
}
);
home-jonas = (
{config, ...}: {
imports = [self.nixosModules.home-unknown];
home-manager.users.jonas = ./home/jonas/home.nix;
}
);
gamma64 = {config, ...}: {
imports = [
./machines/gamma64/configuration.nix
hardware.nixosModules.lenovo-thinkpad-e495
hardware.nixosModules.common-pc-laptop-ssd
self.nixosModules.home-jonas
];
};
alpha128 = {conifg, ...}: {
imports = [
./machines/alpha128/configuration.nix
hardware.nixosModules.common-pc
hardware.nixosModules.common-pc-ssd
hardware.nixosModules.common-cpu-amd
hardware.nixosModules.common-cpu-amd-pstate
hardware.nixosModules.common-gpu-amd
self.nixosModules.home-jonas
];
};
};
};
}