-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
213 lines (178 loc) · 5.82 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
{
description = "NixOS config flake";
outputs =
{
self,
nixpkgs,
home-manager,
nixos-hardware,
...
}@inputs:
let
inherit (self) outputs;
lib = nixpkgs.lib.extend (final: prev: (import ./lib final) // home-manager.lib);
systems = [
"x86_64-linux"
"aarch64-linux"
];
pkgsFor = lib.genAttrs systems (system: import nixpkgs { inherit system; });
forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system});
keys = import ./secrets/not-so-secrets.nix;
defaultSettings = {
# Define username here. Probably a better way to do this
username = "olai";
};
mkConfig =
{
name,
extraModules ? [ ],
globalSettings ? defaultSettings,
}:
lib.nixosSystem {
specialArgs = {
inherit
inputs
outputs
globalSettings
keys
lib
;
};
modules = [
./hosts/${name}/configuration.nix
{
# I don't want to pass name as a specialArg
settings.home-manager.path = ./hosts/${name}/home.nix;
}
] ++ extraModules;
};
in
{
packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs inputs; });
devShells = forEachSystem (pkgs: {
default = import ./shell.nix { inherit pkgs; };
});
nixosConfigurations = {
# Desktop but nix
nixdesktop = mkConfig { name = "desktop"; };
x220-nix = mkConfig {
name = "x220-nix";
extraModules = [ nixos-hardware.nixosModules.lenovo-thinkpad-t420 ];
};
oci-nix = mkConfig { name = "oci"; };
t420-nix = mkConfig {
name = "t420";
extraModules = [ nixos-hardware.nixosModules.lenovo-thinkpad-t420 ];
};
e14g5-nix = mkConfig {
name = "e14g5";
# extraModules = [nixos-hardware.nixosModules.common-cpu-amd nixos-hardware.nixosModules.common-gpu-amd];
extraModules = [ nixos-hardware.nixosModules.lenovo-thinkpad-e14-amd ];
};
vm-nix = mkConfig { name = "vm"; };
installer = mkConfig {
name = "installer";
globalSettings.username = "nixos";
};
};
homeConfigurations."${defaultSettings.username}" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages."x86_64-linux"; # Idk how to do but somehow make this also arm
extraSpecialArgs = {
inherit inputs outputs keys;
globalSettings = defaultSettings;
};
modules = [ ./home.nix ];
};
};
inputs = {
# === Important stuff ===
# NOTE: I'm trying to make sure as few as possible instances of nixpkgs are instantiated, to improve the time and space it takes. All the top-level nixpkgs inputs are set to follow either the stable or unstable input, but i have not done anything for inputs of the inputs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# This is only used by a few things
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
# i think this can be just nixpkgs with the same result
nixpkgs-lib.url = "github:nix-community/nixpkgs.lib";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
impermanence.url = "github:nix-community/impermanence";
# === Other utils ===
plover-flake = {
url = "github:LilleAila/plover-flake/linux-uinput-fixed";
inputs.nixpkgs.follows = "nixpkgs";
};
niri = {
url = "github:sodiboo/niri-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
# emacs-overlay = {
# url = "github:nix-community/emacs-overlay";
# inputs.nixpkgs.follows = "nixpkgs";
# inputs.nixpkgs-stable.follows = "nixpkgs-stable";
# };
spacemacs = {
url = "github:syl20bnr/spacemacs";
flake = false;
};
nix-colors = {
url = "github:misterio77/nix-colors";
inputs.nixpkgs-lib.follows = "nixpkgs-lib";
};
firefox-addons = {
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
};
wrapper-manager = {
url = "github:viperML/wrapper-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-index-database = {
url = "github:Mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
programsdb = {
url = "github:wamserma/flake-programs-sqlite";
inputs.nixpkgs.follows = "nixpkgs";
};
factorio-versions.url = "github:ocfox/factorio-versions";
woomer = {
url = "github:coffeeispower/woomer";
inputs.nixpkgs.follows = "nixpkgs";
};
focal = {
url = "github:iynaix/focal";
inputs.nixpkgs.follows = "nixpkgs";
};
# === My stuff ===
nix-cursors = {
url = "github:LilleAila/nix-cursors";
inputs.nixpkgs.follows = "nixpkgs";
};
wl-screenrec-daemon = {
url = "github:LilleAila/wl-screenrec-daemon";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim-config = {
url = "github:LilleAila/nvim-nix";
# inputs.nixpkgs.follows = "nixpkgs";
inputs.nix-colors.follows = "nix-colors";
};
emacs-config = {
url = "github:LilleAila/emacs-nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nix-colors.follows = "nix-colors";
};
ags-config = {
url = "github:LilleAila/ags-config";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nix-colors.follows = "nix-colors";
};
};
}