-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
247 lines (247 loc) · 10.4 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
{
inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/nixos-24.11";
nixpkgs-23_05.url = "nixpkgs/nixos-23.05";
unstable.url = "nixpkgs/nixos-unstable";
#"github:quentinmit/nixpkgs/xquartz";
home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
darwin.url = "github:LnL7/nix-darwin/master";
darwin.inputs.nixpkgs.follows = "nixpkgs";
nur-mweinelt.url = "github:mweinelt/nur-packages";
nur-mweinelt.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.inputs.flake-compat.follows = "flake-compat";
deploy-rs.inputs.utils.follows = "flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
cargo2nix.url = "github:cargo2nix/cargo2nix/release-0.11.0";
cargo2nix.inputs.flake-utils.follows = "flake-utils";
cargo2nix.inputs.flake-compat.follows = "flake-compat";
cargo2nix.inputs.nixpkgs.follows = "nixpkgs";
cargo2nix.inputs.rust-overlay.follows = "rust-overlay";
plasma-manager.url = "github:pjones/plasma-manager";
plasma-manager.inputs.nixpkgs.follows = "nixpkgs";
plasma-manager.inputs.home-manager.follows = "home-manager";
py-profinet.url = "github:quentinmit/py-profinet/asyncio";
py-profinet.inputs.nixpkgs.follows = "nixpkgs";
py-profinet.inputs.flake-utils.follows = "flake-utils";
Jovian-NixOS.url = "github:Jovian-Experiments/Jovian-NixOS";
Jovian-NixOS.inputs.nixpkgs.follows = "nixpkgs";
nixgl.url = "github:guibou/nixGL";
nixgl.inputs.nixpkgs.follows = "nixpkgs";
nixgl.inputs.flake-utils.follows = "flake-utils";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
authentik.url = "github:nix-community/authentik-nix";
authentik.inputs.nixpkgs.follows = "nixpkgs";
authentik.inputs.flake-utils.follows = "flake-utils";
authentik.inputs.flake-compat.follows = "flake-compat";
bluechips.url = "github:quentinmit/bluechips";
bluechips.inputs.nixpkgs.follows = "nixpkgs";
bluechips.inputs.flake-utils.follows = "flake-utils";
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
lanzaboote.inputs.flake-compat.follows = "flake-compat";
lanzaboote.inputs.flake-utils.follows = "flake-utils";
lanzaboote.inputs.pre-commit-hooks-nix.follows = "";
lanzaboote.inputs.rust-overlay.follows = "rust-overlay";
mosh-server-upnp.url = "github:arcnmx/mosh-server-upnp";
mosh-server-upnp.inputs.nixpkgs.follows = "nixpkgs";
gradle2nix.url = "github:tadfisher/gradle2nix/v2";
gradle2nix.inputs.nixpkgs.follows = "nixpkgs";
gradle2nix.inputs.flake-utils.follows = "flake-utils";
oom-hardware.url = "github:robertjakub/oom-hardware";
};
outputs = { self, darwin, nixpkgs, nixpkgs-23_05, unstable, sops-nix, flake-compat, flake-utils, home-manager, nixos-hardware, deploy-rs, cargo2nix, py-profinet, Jovian-NixOS, bluechips, mosh-server-upnp, gradle2nix, ... }@args:
let
overlay = final: prev: {
pkgsNativeGnu64 = import nixpkgs { system = "x86_64-linux"; };
unstable = import unstable {
system = final.system or final.stdenv.system;
inherit (final) config;
overlays = [
self.overlays.new
#self.overlays.stable
self.overlays.unstable
py-profinet.overlays.default
Jovian-NixOS.overlays.default
bluechips.overlays.default
];
};
inherit (gradle2nix.packages.${final.system or "x86_64-linux"}) gradle2nix;
};
overlays = [
overlay
self.overlays.new
self.overlays.stable
self.overlays.stable-darwin
self.overlays.mosh-server-upnp
cargo2nix.overlays.default
deploy-rs.overlay
];
# Overlays-module makes "pkgs.unstable" available in configuration.nix
overlayModule = { config, pkgs, ... }: {
nixpkgs.overlays = overlays;
};
specialArgs = args // {
channels = { inherit nixpkgs unstable; };
};
findModules = dir:
builtins.concatLists (builtins.attrValues (builtins.mapAttrs
(name: type:
if type == "regular" then [{
name = builtins.elemAt (builtins.match "(.*)\\.nix" name) 0;
value = dir + "/${name}";
}] else if (
builtins.readDir (dir + "/${name}"))
? "default.nix" then [{
inherit name;
value = dir + "/${name}";
}]
else
(map
(e: e // {name = "${name}/${e.name}";})
(findModules (dir + "/${name}"))
)
) (builtins.readDir dir)));
in (flake-utils.lib.eachDefaultSystem (system:
let inherit ((
import nixpkgs {
inherit system;
inherit overlays;
config.allowUnfree = true;
})) pkgs;
in {
legacyPackages = pkgs;
devShells.esphome = import ./workshop/esphome/shell.nix { pkgs = pkgs.unstable; };
})) // {
inherit overlayModule;
inherit self args;
overlays.new = import ./nix/pkgs/all-packages.nix;
overlays.stable = import ./nix/pkgs/overlays.nix;
overlays.stable-darwin = import ./nix/pkgs/darwin-overlays.nix;
overlays.mosh-server-upnp = final: prev: {
mosh-server-upnp = final.callPackage mosh-server-upnp.flakes.args.packages.mosh-server-upnp {};
};
overlays.default = nixpkgs.lib.composeManyExtensions overlays;
overlays.unstable = import ./nix/pkgs/unstable-overlays.nix;
nixosConfigurations = (nixpkgs.lib.genAttrs [
"workshop"
"bedroom-pi"
"droid"
"goddard"
"heartofgold"
"rascsi"
] (name: nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = (builtins.attrValues self.nixosModules) ++ [
overlayModule
./${name}/configuration.nix
];
})) // {
uconsole = unstable.lib.nixosSystem {
inherit specialArgs;
modules = [ #(builtins.attrValues self.nixosModules) ++ [
self.nixosModules.base
self.nixosModules.sshd-sops
self.nixosModules.telegraf
({
nixpkgs.overlays = [
overlay
self.overlays.new
self.overlays.stable
self.overlays.unstable
self.overlays.mosh-server-upnp
];
})
./uconsole/configuration.nix
];
};
};
darwinConfigurations.mac = darwin.lib.darwinSystem {
system = "x86_64-darwin";
inherit specialArgs;
modules = (builtins.attrValues self.darwinModules) ++ [
overlayModule
(final: prev: {
nixpkgs-23_05 = import nixpkgs-23_05 {
inherit (final) system config;
};
})
./mac/configuration.nix
];
};
homeConfigurations.deck = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = "x86_64-linux";
};
modules = (builtins.attrValues self.homeModules) ++ [
overlayModule
./steamdeck/deck.nix
];
extraSpecialArgs = specialArgs;
};
nixosModules = builtins.listToAttrs (findModules ./nix/modules);
darwinModules = builtins.listToAttrs (findModules ./nix/darwin);
homeModules = builtins.listToAttrs (findModules ./nix/home);
deploy.nodes.droid = {
sshUser = "root";
hostname = "droid.isz.wtf";
profiles.system.path = deploy-rs.lib.${self.nixosConfigurations.droid.pkgs.system}.activate.nixos self.nixosConfigurations.droid;
};
deploy.nodes.workshop = {
sshUser = "root";
hostname = "workshop.mgmt.isz.wtf";
profiles.system.path = deploy-rs.lib.${self.nixosConfigurations.workshop.pkgs.system}.activate.nixos self.nixosConfigurations.workshop;
};
deploy.nodes.bedroom-pi = {
sshUser = "root";
hostname = "bedroom-pi.mgmt.isz.wtf";
profiles.system.path = deploy-rs.lib.${self.nixosConfigurations.bedroom-pi.pkgs.system}.activate.nixos self.nixosConfigurations.bedroom-pi;
};
deploy.nodes.heartofgold = {
sshUser = "root";
hostname = "heartofgold.isz.wtf";
profiles.system.path = deploy-rs.lib.${self.nixosConfigurations.workshop.pkgs.system}.activate.nixos self.nixosConfigurations.heartofgold;
};
deploy.nodes.uconsole = {
sshUser = "root";
hostname = "uconsole.isz.wtf";
profiles.system.path = deploy-rs.lib.${self.nixosConfigurations.uconsole.pkgs.system}.activate.nixos self.nixosConfigurations.uconsole;
};
steamdeckSys = import ./steamdeck/sys.nix { inherit self nixpkgs specialArgs; };
steamdeckSysext = import ./nix/sysext.nix {
inherit self nixpkgs specialArgs;
system = "x86_64-linux";
modules = [
./steamdeck/configuration.nix
];
};
deploy.nodes.steamdeck = {
hostname = "steamdeck.isz.wtf";
# sshOpts doesn't work because of https://github.com/NixOS/nix/issues/8292
#sshOpts = [ "source" "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh;" ];
#profiles.sys = {
# sshUser = "root";
# path = deploy-rs.lib.x86_64-linux.activate.custom self.steamdeckSys "./bin/nix-sys";
#};
profiles.deck = {
sshUser = "deck";
path = deploy-rs.lib.${self.homeConfigurations.deck.pkgs.system}.activate.home-manager self.homeConfigurations.steamdeck-deck;
};
};
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
}