-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
224 lines (214 loc) · 7.07 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
{
description = "Hoverbear's Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-wsl = {
# url = "github:nix-community/NixOS-WSL";
url = "github:K900/NixOS-WSL/native-systemd";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixos-wsl, home-manager }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
in
{
overlays.default = final: prev: {
neovimConfigured = final.callPackage ./packages/neovimConfigured { };
fix-vscode = final.callPackage ./packages/fix-vscode { };
};
packages = forAllSystems
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config.allowUnfree = true;
};
in
{
inherit (pkgs) neovimConfigured fix-vscode;
# Excluded from overlay deliberately to avoid people accidently importing it.
unsafe-bootstrap = pkgs.callPackage ./packages/unsafe-bootstrap { };
});
devShells = forAllSystems
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in
{
default = pkgs.mkShell
{
inputsFrom = with pkgs; [ ];
buildInputs = with pkgs; [
nixpkgs-fmt
];
};
});
homeConfigurations = forAllSystems
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in
{
ana = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./users/ana/home.nix
];
};
}
);
nixosConfigurations =
let
# Shared config between both the liveimage and real system
aarch64Base = {
system = "aarch64-linux";
modules = with self.nixosModules; [
({ config = { nix.registry.nixpkgs.flake = nixpkgs; }; })
home-manager.nixosModules.home-manager
traits.overlay
traits.base
services.openssh
];
};
x86_64Base = {
system = "x86_64-linux";
modules = with self.nixosModules; [
({ config = { nix.registry.nixpkgs.flake = nixpkgs; }; })
home-manager.nixosModules.home-manager
traits.overlay
traits.base
services.openssh
];
};
in
with self.nixosModules; {
x86_64IsoImage = nixpkgs.lib.nixosSystem {
inherit (x86_64Base) system;
modules = x86_64Base.modules ++ [
platforms.iso
];
};
aarch64IsoImage = nixpkgs.lib.nixosSystem {
inherit (aarch64Base) system;
modules = aarch64Base.modules ++ [
platforms.iso
{
config = {
virtualisation.vmware.guest.enable = nixpkgs.lib.mkForce false;
services.xe-guest-utilities.enable = nixpkgs.lib.mkForce false;
};
}
];
};
honeycombIsoImage = nixpkgs.lib.nixosSystem {
inherit (aarch64Base) system;
modules = aarch64Base.modules ++ [
platforms.iso
traits.honeycomb_lx2k
{
config = {
virtualisation.vmware.guest.enable = nixpkgs.lib.mkForce false;
services.xe-guest-utilities.enable = nixpkgs.lib.mkForce false;
};
}
];
};
gizmo = nixpkgs.lib.nixosSystem {
inherit (aarch64Base) system;
modules = aarch64Base.modules ++ [
platforms.gizmo
traits.honeycomb_lx2k
traits.machine
traits.workstation
traits.gnome
traits.hardened
users.ana
];
};
architect = nixpkgs.lib.nixosSystem {
inherit (x86_64Base) system;
modules = x86_64Base.modules ++ [
platforms.architect
traits.machine
traits.workstation
traits.gnome
traits.hardened
traits.gaming
users.ana
services.postgres
];
};
nomad = nixpkgs.lib.nixosSystem {
inherit (x86_64Base) system;
modules = x86_64Base.modules ++ [
platforms.nomad
traits.machine
traits.workstation
traits.gnome
traits.hardened
users.ana
];
};
wsl = nixpkgs.lib.nixosSystem {
inherit (x86_64Base) system;
modules = x86_64Base.modules ++ [
nixos-wsl.nixosModules.wsl
platforms.wsl
users.ana
];
};
};
nixosModules = {
platforms.container = ./platforms/container.nix;
platforms.wsl = ./platforms/wsl.nix;
platforms.gizmo = ./platforms/gizmo.nix;
platforms.architect = ./platforms/architect.nix;
platforms.nomad = ./platforms/nomad.nix;
platforms.iso-minimal = "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix";
platforms.iso = "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix";
traits.overlay = { nixpkgs.overlays = [ self.overlays.default ]; };
traits.base = ./traits/base.nix;
traits.machine = ./traits/machine.nix;
traits.gaming = ./traits/gaming.nix;
traits.gnome = ./traits/gnome.nix;
traits.jetbrains = ./traits/jetbrains.nix;
traits.hardened = ./traits/hardened.nix;
traits.sourceBuild = ./traits/source-build.nix;
traits.honeycomb_lx2k = ./traits/honeycomb_lx2k.nix;
services.postgres = ./services/postgres.nix;
services.openssh = ./services/openssh.nix;
# This trait is unfriendly to being bundled with platform-iso
traits.workstation = ./traits/workstation.nix;
users.ana = ./users/ana;
};
checks = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in
{
format = pkgs.runCommand "check-format"
{
buildInputs = with pkgs; [ rustfmt cargo ];
} ''
${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check ${./.}
touch $out # it worked!
'';
});
};
}