-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
185 lines (167 loc) · 5.21 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
{
description = "the-argus nixos system configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs?ref=nixos-unstable";
nixpkgs-master.url = "github:nixos/nixpkgs?ref=master";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
# home manager use our nixpkgs and not its own
inputs.nixpkgs.follows = "nixpkgs";
};
banner.url = "github:the-argus/banner.nix";
audio-plugins.url = "github:the-argus/audio-plugins-nix";
rycee-expressions = {
url = "gitlab:rycee/nur-expressions";
flake = false;
};
bitwarden-rofi = {
url = "github:the-argus/bitwarden-rofi";
inputs.nixpkgs.follows = "nixpkgs";
};
chrome-extensions = {
url = "github:the-argus/chrome-extensions-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
spicetify-nix = {
url = "github:Gerg-L/spicetify-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
gtk-nix = {
url = "github:the-argus/gtk-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nobar = {
url = "github:the-argus/nobar";
inputs.nixpkgs.follows = "nixpkgs";
};
nvim-config = {
url = "github:the-argus/nvim-config";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
# non-nix imports (need fast updates):
arkenfox-userjs = {
url = "github:arkenfox/user.js";
flake = false;
};
};
outputs = {
self,
nixpkgs,
nixpkgs-unstable,
nixpkgs-master,
home-manager,
rycee-expressions,
# , nur
audio-plugins,
...
} @ inputs: let
myLib = import ./lib {inherit (nixpkgs) lib;};
defaultGlobalSettings = myLib.globalConfig.defaults;
finalizeSettings = myLib.globalConfig.mkFinalizer {
inherit nixpkgs nixpkgs-unstable;
};
stateVersion = "22.11";
hosts = {
laptop = import ./hosts/laptop {
inherit nixpkgs;
hostname = "evil";
};
pc = import ./hosts/pc {
inherit nixpkgs;
hostname = "mutant";
};
tui = import ./hosts/tui {
inherit nixpkgs;
};
};
in {
createNixosConfiguration = settings: let
fs = finalizeSettings settings;
in
nixpkgs.lib.nixosSystem {
inherit (fs) pkgs system;
specialArgs =
inputs
// fs.extraSpecialArgs
// {
inherit (fs) unstable localbuild useMusl remotebuild;
inherit (fs) useFlags plymouth;
inherit (fs) hostname username;
inherit stateVersion;
settings = fs;
};
modules = [
{
imports = [./system/configuration.nix ./modules] ++ fs.additionalNixosModules;
}
];
};
createHomeConfigurations = userFolder: settings: let
fs = finalizeSettings settings;
inherit
(import "${rycee-expressions}" {inherit (fs) pkgs;})
firefox-addons
;
in
home-manager.lib.homeManagerConfiguration rec {
inherit (fs) pkgs;
modules =
[
userFolder
audio-plugins.homeManagerModules.${fs.system}
./modules/color/themes.nix
./modules/home-manager
({...}: {
home = {
inherit (fs) username;
inherit stateVersion;
homeDirectory = "/home/${fs.username}";
};
})
]
++ fs.additionalModules;
extraSpecialArgs =
inputs
// {
inherit (fs) homeDirectory;
inherit firefox-addons;
mpkgs = audio-plugins.mpkgSets.${fs.system};
}
// fs.extraExtraSpecialArgs
// {
inherit (fs) unstable remotebuild localbuild;
inherit (fs) useFlags useMusl useClang;
inherit (fs) hostname username;
inherit stateVersion;
settings = fs;
};
};
inherit finalizeSettings;
nixosConfigurations = {
default = self.createNixosConfiguration defaultGlobalSettings;
laptop = self.createNixosConfiguration hosts.laptop;
${hosts.laptop.hostname} = self.nixosConfigurations.laptop;
pc = self.createNixosConfiguration hosts.pc;
${hosts.pc.hostname} = self.nixosConfigurations.pc;
};
homeConfigurations = {
default = self.createHomeConfigurations ./user/primary defaultGlobalSettings;
laptop = self.createHomeConfigurations ./user/primary hosts.laptop;
pc = self.createHomeConfigurations ./user/primary hosts.pc;
tui = self.createHomeConfigurations ./user/tui hosts.tui;
};
devShell.${defaultGlobalSettings.system} =
(finalizeSettings defaultGlobalSettings).pkgs.mkShell {};
packages.${defaultGlobalSettings.system} = {
# wacky setup to make sure typst is unstable
myPackages = let
fs = finalizeSettings defaultGlobalSettings;
called = fs.pkgs.callPackage ./packages {};
unstableCalled = fs.unstable.callPackage ./packages {};
in
called // {inherit (unstableCalled) typst;};
};
formatter.${defaultGlobalSettings.system} = (finalizeSettings defaultGlobalSettings).pkgs.alejandra;
};
}