-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
251 lines (249 loc) · 7.92 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
248
249
250
251
{
description = "blissful's /etc/nixos";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
# Rolling unstable nixpkgs, updated frequently. If setting manually, pick a
# commit built in Hydra: https://hydra.nixos.org/jobset/nixos/trunk-combined
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
# Whatever pin makes my server happy... https://hydra.nixos.org/jobset/nixos/release-24.05
nixpkgs-stable.url = "github:nixos/nixpkgs?rev=a7d87b7f9b63f97c43269fa902eb89851b379687";
# Most up to date nixpkgs, for specific bug fixes.
nixpkgs-latest.url = "github:nixos/nixpkgs/master";
# Flake sources.
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
presage-src = {
url = "github:azuline/presage";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-search-cli-src = {
url = "github:peterldowns/nix-search-cli";
inputs.nixpkgs.follows = "nixpkgs";
};
pgmigrate-src = {
url = "github:peterldowns/pgmigrate";
inputs.nixpkgs.follows = "nixpkgs";
};
rose-src = {
url = "github:azuline/rose/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# Non-flake sources.
nnn-src = {
url = "github:azuline/nnn";
flake = false;
};
discord = {
url = "https://dl.discordapp.net/apps/linux/0.0.33/discord-0.0.33.tar.gz";
flake = false;
};
nsxiv-src = {
url = "github:azuline/nsxiv";
flake = false;
};
zathura-pdf-mupdf-src = {
url = "github:azuline/zathura-pdf-mupdf";
flake = false;
};
fish-plugin-wd = {
url = "github:fischerling/plugin-wd";
flake = false;
};
fish-plugin-nix-env = {
url = "github:lilyball/nix-env.fish";
flake = false;
};
};
outputs =
{ self
, home-manager
, nixpkgs
, nixpkgs-stable
, nixpkgs-latest
, flake-utils
, nix-search-cli-src
, presage-src
, pgmigrate-src
, rose-src
# Non-Nix sources
, nnn-src
, discord
, nsxiv-src
, zathura-pdf-mupdf-src
, fish-plugin-wd
, fish-plugin-nix-env
}: (flake-utils.lib.eachDefaultSystem (system:
let
pkgs-stable = import nixpkgs-stable { inherit system; config.allowUnfree = true; };
pkgs-latest = import nixpkgs-latest { inherit system; config.allowUnfree = true; };
srcs = { inherit discord nnn-src nsxiv-src fish-plugin-wd fish-plugin-nix-env zathura-pdf-mupdf-src; };
pins = {
nix-search-cli = nix-search-cli-src.packages.${system}.nix-search;
rose = rose-src.packages.${system}.rose-py;
rose-cli = rose-src.packages.${system}.rose-cli;
presage = presage-src.defaultPackage.${system};
pgmigrate = pgmigrate-src.packages.${system}.pgmigrate;
figma-agent = pkgs-latest.figma-agent;
};
pkgs = import ./pkgs { inherit system nixpkgs srcs pins; };
makeHomeConfiguration =
{
# This enables per-host configurations, typically screen size differences.
host
# Location of Nix directory.
, nixDir
# Whether we are connected to an external monitor (laptop only). The monitor name.
, monitor ? null
# Username for home-manager configuration.
, username
# A function that takes post-parametrized bundles of packages and returns a subset.
, chooseBundles
# Custom per-host module code.
, custom ? { ... }: { }
}:
let
sys = { inherit host nixDir monitor; };
bundles = import ./home;
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit sys srcs; };
modules = chooseBundles bundles ++ [{
programs.home-manager.enable = true;
# Automatically set some environment variables that will ease usage
# of software installed with nix on non-NixOS linux (fixing local
# issues, settings XDG_DATA_DIRS, etc).
targets.genericLinux.enable = true;
# Workaround for flakes https://github.com/nix-community/home-manager/issues/2942.
nixpkgs.config.allowUnfreePredicate = (pkg: true);
home.username = "${username}";
home.homeDirectory = "/home/${username}";
home.stateVersion = "22.11";
}] ++ [ custom ];
};
in
{
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
python
ruff
mypy
python.pkgs.aiohttp
python.pkgs.pyperclip
python.pkgs.python-dotenv
];
};
};
packages = {
nixosConfigurations = {
splendor = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
pin = { transmission_4 = pkgs.transmission_4; };
};
modules = [ ./os/splendor/configuration.nix ];
};
haiqin = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ ./os/haiqin/configuration.nix ];
};
neptune = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ ./os/neptune/configuration.nix ];
};
frieren = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
pin = { presage = pkgs.presage; };
};
modules = [ ./os/frieren/configuration.nix ];
};
};
homeConfigurations = {
splendor = makeHomeConfiguration {
host = "splendor";
nixDir = "/etc/nixos";
username = "blissful";
chooseBundles = b: [
b.cliBundle
b.devBundle
b.guiBundle
b.personalMachineBundle
b.i3Bundle
];
custom = { pkgs, ... }: {
imports = [ ./home/cdrama-rss ];
home.packages = with pkgs; [
backup-scripts
exif-mtime-sync
win-switch
splendor-change-audio
];
};
};
haiqin = makeHomeConfiguration {
host = "haiqin";
nixDir = "/etc/nixos";
username = "blissful";
monitor = null;
chooseBundles = b: [
b.cliBundle
b.devBundle
b.guiBundle
b.personalMachineBundle
b.i3Bundle
];
custom = { pkgs, ... }: {
home.packages = with pkgs; [
(monitor-switch.override { monitor = "HDMI-1"; })
exif-mtime-sync
haiqin-change-audio
];
};
};
haiqin-monitor = makeHomeConfiguration {
host = "haiqin";
nixDir = "/etc/nixos";
username = "blissful";
monitor = "HDMI-1";
chooseBundles = b: [
b.cliBundle
b.devBundle
b.guiBundle
b.personalMachineBundle
b.i3Bundle
];
custom = { pkgs, ... }: {
home.packages = with pkgs; [
(monitor-switch.override { monitor = "HDMI-1"; })
exif-mtime-sync
haiqin-change-audio
];
};
};
neptune = makeHomeConfiguration {
host = "neptune";
nixDir = "/etc/nixos";
username = "blissful";
chooseBundles = b: [
b.cliBundle
b.guiBundle
b.personalMachineBundle
b.i3Bundle
];
};
frieren = makeHomeConfiguration {
host = "frieren";
nixDir = "/etc/nixos";
username = "blissful";
chooseBundles = b: [
b.cliBundle
];
};
};
};
}));
}