+1
.gitattributes
+1
.gitattributes
···
1
+
secrets/* filter=git-crypt diff=git-crypt
+1
-115
README.md
+1
-115
README.md
···
1
-
[](https://app.bors.tech/repositories/32678)
2
-
[][mit]
3
-
[](https://nixos.org)
4
-
5
-
> #### ⚠ Advisory ⚠
6
-
> DevOS requires the [flakes][flakes] feature available via an _experimental_
7
-
> branch of [nix][nix]. Until nix 3.0 is released, this project
8
-
> should be considered unstable, though quite usable as flakes have been
9
-
> maturing _well_ [for a while](https://github.com/divnix/devos/tree/17713c22d07c54525c728c62060a0428b76dee3b).
10
-
11
-
# Introduction
12
-
DevOS grants a simple template to use, deploy and manage [NixOS][nixos] systems
13
-
for personal and productive use. A sane repository structure is provided,
14
-
integrating several popular projects like [home-manager][home-manager],
15
-
[devshell][devshell], and [more](./doc/integrations).
16
-
17
-
Striving for ___nix first™___ solutions with unobstrusive implementations,
18
-
a [flake centric][flake-doc] approach is taken for useful conveniences such as
19
-
[automatic source updates](./pkgs#automatic-source-updates).
20
-
21
-
Skip the indeterminate nature of other systems, _and_ the perceived
22
-
tedium of bootstrapping Nix. It's easier than you think!
23
-
24
-
### Status: Beta
25
-
Although this project has already matured quite a bit, especially through
26
-
recent outfactoring of [`digga`][digga], a fair amount of api polishing is still
27
-
expected. There are unstable versions (0._x_._x_) to help users keep track
28
-
of changes and progress.
29
-
30
-
## Getting Started
31
-
Check out the [guide](https://devos.divnix.com/start) to get up and running.
32
-
Also, have a look at [_flake.nix_][toc]. If anything is not immediately
33
-
discoverable from there through [`digga`][digga] library's [`mkFlake`][mk-flake],
34
-
please file a bug report.
35
-
36
-
## In the Wild
37
-
The author maintains his own branch, so you can take inspiration, direction, or
38
-
make critical comments about the [code][please]. 😜
39
-
40
-
## Motivation
41
-
NixOS provides an amazing abstraction to manage our environment, but that new
42
-
power can sometimes bring feelings of overwhelm and confusion. Having a turing
43
-
complete system can easily lead to unlimited complexity if we do it wrong.
44
-
Instead, we should have a community consensus on how to manage a NixOS system
45
-
and its satellite projects, from which best practices can evolve.
46
-
47
-
___The future is declarative! 🎉___
48
-
49
-
## Community Profiles
50
-
There are two branches from which to choose: [core][core] and
51
-
[community][community]. The community branch builds on core and includes
52
-
several ready-made profiles for discretionary use.
53
-
54
-
Every package and NixOS profile declared in community is uploaded to
55
-
[cachix](./integrations/cachix.md), so everything provided is available
56
-
without building anything. This is especially useful for the packages that are
57
-
[overridden](./concepts/overrides.md) from master, as without the cache,
58
-
rebuilds are quite frequent.
59
-
60
-
## Shoulders
61
-
This work does not reinvent the wheel. It stands on the [shoulders of the
62
-
following giants][giants]:
63
-
64
-
### :onion: — like the layers of an onion
65
-
- [`divnix/digga`][digga]
66
-
- [`gytis-ivaskevicius/flake-utils-plus`][fup]
67
-
- [`numtide/flake-utils`][fu]
68
-
69
-
### :family: — like family
70
-
- [`numtide/devshell`][devshell]
71
-
- [`serokell/deploy-rs`][deploy]
72
-
- [`NixOS/nixpkgs`][nixpkgs]
73
-
74
-
:heart:
75
-
76
-
## Inspiration & Art
77
-
- [hlissner/dotfiles][dotfiles]
78
-
- [nix-user-chroot](https://github.com/nix-community/nix-user-chroot)
79
-
- [Nickel](https://github.com/tweag/nickel)
80
-
- [Awesome Nix](https://github.com/nix-community/awesome-nix)
81
-
- [devshell](https://github.com/numtide/devshell)
82
-
83
-
## Divnix
84
-
The divnix org is an open space that spontaniously formed out of "the Nix".
85
-
It is really just a place where otherwise unrelated people a) get
86
-
together and b) stuff done.
87
-
88
-
It's a place to stop "geeking out in isolation" (or within company boundaries),
89
-
experiment and learn together and iterate quickly on best practices. That's what it is.
90
-
91
-
It might eventually become a non-profit if that's not too complicated or if those
92
-
goals are sufficiently upstreamed into "the Nix", dissolved.
93
-
94
-
# License
95
-
DevOS is licensed under the [MIT License][mit].
96
-
97
-
[mk-flake]: https://github.com/divnix/digga/tree/master/src/mkFlake
98
-
[nixpkgs]: https://github.com/NixOS/nixpkgs
99
-
[deploy]: https://github.com/serokell/deploy-rs
100
-
[toc]: https://github.com/divnix/devos/blob/core/flake.nix
101
-
[giants]: https://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants
102
-
[digga]: https://github.com/divnix/digga
103
-
[fup]: https://github.com/gytis-ivaskevicius/flake-utils-plus
104
-
[fu]: https://github.com/numtide/flake-utils
105
-
[devshell]: https://github.com/numtide/devshell
106
-
[nix]: https://nixos.org/manual/nix/stable
107
-
[mit]: https://mit-license.org
108
-
[nixos]: https://nixos.org/manual/nixos/stable
109
-
[home-manager]: https://nix-community.github.io/home-manager
110
-
[flakes]: https://nixos.wiki/wiki/Flakes
111
-
[flake-doc]: https://github.com/NixOS/nix/blob/master/src/nix/flake.md
112
-
[core]: https://github.com/divnix/devos
113
-
[community]: https://github.com/divnix/devos/tree/community
114
-
[dotfiles]: https://github.com/hlissner/dotfiles
115
-
[please]: https://github.com/nrdxp/devos/tree/nrd
1
+
Based on <https://github.com/nrdxp/nixflk>, with my own configs. Changes directory structure a bit.
-404
flake.lock
-404
flake.lock
···
1
-
{
2
-
"nodes": {
3
-
"ci-agent": {
4
-
"inputs": {
5
-
"flake-compat": "flake-compat",
6
-
"nix-darwin": [
7
-
"darwin"
8
-
],
9
-
"nixos-20_09": [
10
-
"nixos"
11
-
],
12
-
"nixos-unstable": [
13
-
"latest"
14
-
],
15
-
"pre-commit-hooks-nix": "pre-commit-hooks-nix"
16
-
},
17
-
"locked": {
18
-
"lastModified": 1619088868,
19
-
"narHash": "sha256-l9db+HpNIkY41MonGE8z4pbkjBa5BdzJTG5AxV7V7Lw=",
20
-
"owner": "hercules-ci",
21
-
"repo": "hercules-ci-agent",
22
-
"rev": "08f953a263518a3af0ca28cd887020ff3465bdf5",
23
-
"type": "github"
24
-
},
25
-
"original": {
26
-
"owner": "hercules-ci",
27
-
"repo": "hercules-ci-agent",
28
-
"type": "github"
29
-
}
30
-
},
31
-
"darwin": {
32
-
"inputs": {
33
-
"nixpkgs": [
34
-
"latest"
35
-
]
36
-
},
37
-
"locked": {
38
-
"lastModified": 1613595894,
39
-
"narHash": "sha256-MOk/7rCAUB5Lf4GL+HimvyAAZXYEw8gWsq5nW4PPQQA=",
40
-
"owner": "LnL7",
41
-
"repo": "nix-darwin",
42
-
"rev": "5c3146b75d5d478f0693d0ea6c83f1da8382ff56",
43
-
"type": "github"
44
-
},
45
-
"original": {
46
-
"owner": "LnL7",
47
-
"repo": "nix-darwin",
48
-
"type": "github"
49
-
}
50
-
},
51
-
"deploy": {
52
-
"inputs": {
53
-
"flake-compat": "flake-compat_2",
54
-
"naersk": "naersk",
55
-
"nixpkgs": "nixpkgs",
56
-
"utils": "utils"
57
-
},
58
-
"locked": {
59
-
"lastModified": 1616406726,
60
-
"narHash": "sha256-n9zmgxR03QNrvs9/fHewqE0j3SjL7Y+cglBCFu3U3rg=",
61
-
"owner": "serokell",
62
-
"repo": "deploy-rs",
63
-
"rev": "9e405fbc5ab5bacbd271fd78c6b6b6877c4d9f8d",
64
-
"type": "github"
65
-
},
66
-
"original": {
67
-
"owner": "serokell",
68
-
"repo": "deploy-rs",
69
-
"type": "github"
70
-
}
71
-
},
72
-
"devshell": {
73
-
"locked": {
74
-
"lastModified": 1618523768,
75
-
"narHash": "sha256-Gev9da35pHUey3kGz/zrJFc/9ICs++vPCho7qB1mqd8=",
76
-
"owner": "numtide",
77
-
"repo": "devshell",
78
-
"rev": "709fe4d04a9101c9d224ad83f73416dce71baf21",
79
-
"type": "github"
80
-
},
81
-
"original": {
82
-
"owner": "numtide",
83
-
"repo": "devshell",
84
-
"type": "github"
85
-
}
86
-
},
87
-
"digga": {
88
-
"inputs": {
89
-
"deploy": "deploy",
90
-
"devshell": "devshell",
91
-
"nixlib": "nixlib",
92
-
"nixpkgs": "nixpkgs_2",
93
-
"utils": "utils_2"
94
-
},
95
-
"locked": {
96
-
"lastModified": 1621354376,
97
-
"narHash": "sha256-b597Jj8B1Nq4NX/Gl/+bYGKqJxpSfUtr1Nmp9m1DND8=",
98
-
"owner": "divnix",
99
-
"repo": "digga",
100
-
"rev": "5ef9b8cabbc10c9b4fe5534107224c7241c63b3d",
101
-
"type": "github"
102
-
},
103
-
"original": {
104
-
"owner": "divnix",
105
-
"repo": "digga",
106
-
"type": "github"
107
-
}
108
-
},
109
-
"flake-compat": {
110
-
"flake": false,
111
-
"locked": {
112
-
"lastModified": 1606424373,
113
-
"narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=",
114
-
"owner": "edolstra",
115
-
"repo": "flake-compat",
116
-
"rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf",
117
-
"type": "github"
118
-
},
119
-
"original": {
120
-
"owner": "edolstra",
121
-
"repo": "flake-compat",
122
-
"type": "github"
123
-
}
124
-
},
125
-
"flake-compat_2": {
126
-
"flake": false,
127
-
"locked": {
128
-
"lastModified": 1606424373,
129
-
"narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=",
130
-
"owner": "edolstra",
131
-
"repo": "flake-compat",
132
-
"rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf",
133
-
"type": "github"
134
-
},
135
-
"original": {
136
-
"owner": "edolstra",
137
-
"repo": "flake-compat",
138
-
"type": "github"
139
-
}
140
-
},
141
-
"flake-utils": {
142
-
"locked": {
143
-
"lastModified": 1620759905,
144
-
"narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=",
145
-
"owner": "numtide",
146
-
"repo": "flake-utils",
147
-
"rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8",
148
-
"type": "github"
149
-
},
150
-
"original": {
151
-
"owner": "numtide",
152
-
"repo": "flake-utils",
153
-
"type": "github"
154
-
}
155
-
},
156
-
"home": {
157
-
"inputs": {
158
-
"nixpkgs": [
159
-
"nixos"
160
-
]
161
-
},
162
-
"locked": {
163
-
"lastModified": 1616724076,
164
-
"narHash": "sha256-SwbPXLjN2sLy4NL/GhodiJrdkIVZwGGTGiCN3JxH1cU=",
165
-
"owner": "nix-community",
166
-
"repo": "home-manager",
167
-
"rev": "fedfd430f96695997b3eaf8d7e82ca79406afa23",
168
-
"type": "github"
169
-
},
170
-
"original": {
171
-
"owner": "nix-community",
172
-
"repo": "home-manager",
173
-
"type": "github"
174
-
}
175
-
},
176
-
"latest": {
177
-
"locked": {
178
-
"lastModified": 1619400530,
179
-
"narHash": "sha256-7ZO7B+b9i1wFbHw62EFT+iwuBBpXeA/fcHlR63Z4J0w=",
180
-
"owner": "NixOS",
181
-
"repo": "nixpkgs",
182
-
"rev": "e8dc8adab655eb27957859c62bef11484b53f639",
183
-
"type": "github"
184
-
},
185
-
"original": {
186
-
"id": "nixpkgs",
187
-
"type": "indirect"
188
-
}
189
-
},
190
-
"naersk": {
191
-
"inputs": {
192
-
"nixpkgs": [
193
-
"latest"
194
-
]
195
-
},
196
-
"locked": {
197
-
"lastModified": 1610392286,
198
-
"narHash": "sha256-3wFl5y+4YZO4SgRYK8WE7JIS3p0sxbgrGaQ6RMw+d98=",
199
-
"owner": "nmattia",
200
-
"repo": "naersk",
201
-
"rev": "d7bfbad3304fd768c0f93a4c3b50976275e6d4be",
202
-
"type": "github"
203
-
},
204
-
"original": {
205
-
"owner": "nmattia",
206
-
"ref": "master",
207
-
"repo": "naersk",
208
-
"type": "github"
209
-
}
210
-
},
211
-
"naersk_2": {
212
-
"inputs": {
213
-
"nixpkgs": [
214
-
"latest"
215
-
]
216
-
},
217
-
"locked": {
218
-
"lastModified": 1614785451,
219
-
"narHash": "sha256-TPw8kQvr2UNCuvndtY+EjyXp6Q5GEW2l9UafXXh1XmI=",
220
-
"owner": "nmattia",
221
-
"repo": "naersk",
222
-
"rev": "e0fe990b478a66178a58c69cf53daec0478ca6f9",
223
-
"type": "github"
224
-
},
225
-
"original": {
226
-
"owner": "nmattia",
227
-
"repo": "naersk",
228
-
"type": "github"
229
-
}
230
-
},
231
-
"nixlib": {
232
-
"locked": {
233
-
"lastModified": 1620519687,
234
-
"narHash": "sha256-+6Dd72b2CASuXm2W7KRxZIE7AOy/dj4mU28vaF+zxcs=",
235
-
"owner": "divnix",
236
-
"repo": "nixpkgs.lib",
237
-
"rev": "c7b6169809c5f74dd0c34f3d69e9d12ba4d448de",
238
-
"type": "github"
239
-
},
240
-
"original": {
241
-
"owner": "divnix",
242
-
"repo": "nixpkgs.lib",
243
-
"type": "github"
244
-
}
245
-
},
246
-
"nixos": {
247
-
"locked": {
248
-
"lastModified": 1615797423,
249
-
"narHash": "sha256-5NGDZXPQzuoxf/42NiyC9YwwhwzfMfIRrz3aT0XHzSc=",
250
-
"owner": "NixOS",
251
-
"repo": "nixpkgs",
252
-
"rev": "266dc8c3d052f549826ba246d06787a219533b8f",
253
-
"type": "github"
254
-
},
255
-
"original": {
256
-
"id": "nixpkgs",
257
-
"ref": "nixos-unstable",
258
-
"type": "indirect"
259
-
}
260
-
},
261
-
"nixos-hardware": {
262
-
"locked": {
263
-
"lastModified": 1615652054,
264
-
"narHash": "sha256-jqXKU8Ovpi7MmPRqGf2FB3QOPcZtGwO2MFc0AYiOPjg=",
265
-
"owner": "nixos",
266
-
"repo": "nixos-hardware",
267
-
"rev": "31f61b90ddb9257b94888ee17ccf96236e180c76",
268
-
"type": "github"
269
-
},
270
-
"original": {
271
-
"owner": "nixos",
272
-
"repo": "nixos-hardware",
273
-
"type": "github"
274
-
}
275
-
},
276
-
"nixpkgs": {
277
-
"locked": {
278
-
"lastModified": 1610942247,
279
-
"narHash": "sha256-PKo1ATAlC6BmfYSRmX0TVmNoFbrec+A5OKcabGEu2yU=",
280
-
"owner": "NixOS",
281
-
"repo": "nixpkgs",
282
-
"rev": "7d71001b796340b219d1bfa8552c81995017544a",
283
-
"type": "github"
284
-
},
285
-
"original": {
286
-
"owner": "NixOS",
287
-
"ref": "nixpkgs-unstable",
288
-
"repo": "nixpkgs",
289
-
"type": "github"
290
-
}
291
-
},
292
-
"nixpkgs_2": {
293
-
"locked": {
294
-
"lastModified": 1620962350,
295
-
"narHash": "sha256-9ASW4d4/Z8HmRvuJI8rxbEOTbXTBpQ8y+CmFYBwtXzE=",
296
-
"owner": "nixos",
297
-
"repo": "nixpkgs",
298
-
"rev": "5d4a430472cafada97888cc80672fab255231f57",
299
-
"type": "github"
300
-
},
301
-
"original": {
302
-
"owner": "nixos",
303
-
"repo": "nixpkgs",
304
-
"type": "github"
305
-
}
306
-
},
307
-
"nur": {
308
-
"locked": {
309
-
"lastModified": 1615921934,
310
-
"narHash": "sha256-nURGM869KKA1+c1SHHsXKYcPXhHIuxWBjNXjJ90OzRQ=",
311
-
"owner": "nix-community",
312
-
"repo": "NUR",
313
-
"rev": "faf862e8cf009edfa38ecc61188f7a6ace293552",
314
-
"type": "github"
315
-
},
316
-
"original": {
317
-
"id": "nur",
318
-
"type": "indirect"
319
-
}
320
-
},
321
-
"pkgs": {
322
-
"inputs": {
323
-
"nixpkgs": [
324
-
"nixos"
325
-
]
326
-
},
327
-
"locked": {
328
-
"narHash": "sha256-Zs7dc0dNNa0Z3//+Gckxj7SKrMqVovY0xZZ1z8xWnEg=",
329
-
"path": "./pkgs",
330
-
"type": "path"
331
-
},
332
-
"original": {
333
-
"path": "./pkgs",
334
-
"type": "path"
335
-
}
336
-
},
337
-
"pre-commit-hooks-nix": {
338
-
"flake": false,
339
-
"locked": {
340
-
"lastModified": 1617783930,
341
-
"narHash": "sha256-SigoU2LWM1fMggqfM9H8XEIvjOjBVQ/wj/zrn02J28c=",
342
-
"owner": "cachix",
343
-
"repo": "pre-commit-hooks.nix",
344
-
"rev": "2d169bb1b23f3b71a894a66ea81f45c788943248",
345
-
"type": "github"
346
-
},
347
-
"original": {
348
-
"owner": "cachix",
349
-
"repo": "pre-commit-hooks.nix",
350
-
"type": "github"
351
-
}
352
-
},
353
-
"root": {
354
-
"inputs": {
355
-
"ci-agent": "ci-agent",
356
-
"darwin": "darwin",
357
-
"digga": "digga",
358
-
"home": "home",
359
-
"latest": "latest",
360
-
"naersk": "naersk_2",
361
-
"nixos": "nixos",
362
-
"nixos-hardware": "nixos-hardware",
363
-
"nur": "nur",
364
-
"pkgs": "pkgs"
365
-
}
366
-
},
367
-
"utils": {
368
-
"locked": {
369
-
"lastModified": 1610051610,
370
-
"narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=",
371
-
"owner": "numtide",
372
-
"repo": "flake-utils",
373
-
"rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc",
374
-
"type": "github"
375
-
},
376
-
"original": {
377
-
"owner": "numtide",
378
-
"repo": "flake-utils",
379
-
"type": "github"
380
-
}
381
-
},
382
-
"utils_2": {
383
-
"inputs": {
384
-
"flake-utils": "flake-utils"
385
-
},
386
-
"locked": {
387
-
"lastModified": 1620801141,
388
-
"narHash": "sha256-XPJ+/nP/s218E11R+4LJyvkrQXvdT3D6TzNjfWVYZnI=",
389
-
"owner": "gytis-ivaskevicius",
390
-
"repo": "flake-utils-plus",
391
-
"rev": "1a742047f3f7c97b22768ba7738ac5a01052099e",
392
-
"type": "github"
393
-
},
394
-
"original": {
395
-
"owner": "gytis-ivaskevicius",
396
-
"ref": "staging",
397
-
"repo": "flake-utils-plus",
398
-
"type": "github"
399
-
}
400
-
}
401
-
},
402
-
"root": "root",
403
-
"version": 7
404
-
}
+44
hosts/default.nix
+44
hosts/default.nix
···
1
+
inputs@{ home, impermanence, mynex, nixpkgs, self, pkgs, system, ... }:
2
+
let
3
+
utils = import ../lib/utils.nix { inherit lib pkgs; };
4
+
5
+
inherit (nixpkgs) lib;
6
+
inherit (utils) recImport;
7
+
8
+
config = hostName:
9
+
lib.nixosSystem {
10
+
inherit system;
11
+
12
+
specialArgs = {
13
+
usr = { inherit utils; };
14
+
util = utils;
15
+
nixosPersistence = "${impermanence}/nixos.nix";
16
+
};
17
+
18
+
modules = let
19
+
inherit (home.nixosModules) home-manager;
20
+
inherit (mynex.nixosModules) security networking;
21
+
22
+
core = ../profiles/core.nix;
23
+
24
+
global = {
25
+
networking.hostName = hostName;
26
+
nix.nixPath = [
27
+
"nixpkgs=${nixpkgs}"
28
+
"nixos-config=/etc/nixos/configuration.nix"
29
+
"nixpkgs-overlays=/etc/nixos/overlays"
30
+
];
31
+
32
+
nixpkgs = { inherit pkgs; };
33
+
nixpkgs.overlays = [ mynex.overlay ];
34
+
};
35
+
36
+
local = import "${toString ./.}/${hostName}.nix";
37
+
in [ core global local home-manager security networking ];
38
+
};
39
+
40
+
hosts = recImport {
41
+
dir = ./.;
42
+
_import = config;
43
+
};
44
+
in hosts
+169
hosts/lungmen.nix
+169
hosts/lungmen.nix
···
1
+
{ config, lib, pkgs, modulesPath, nixosPersistence, ... }:
2
+
let
3
+
btrfsPartPath = "/dev/disk/by-uuid/9a2ac687-7937-4ffa-9b59-8b5c13026466";
4
+
btrfsOptions = [ "compress-force=zstd" "noatime" ];
5
+
6
+
btrfsDiff = pkgs.writeScriptBin "btrfs-diff" ''
7
+
#!${pkgs.bash}/bin/bash
8
+
set -euo pipefail
9
+
10
+
sudo mkdir -p /mnt
11
+
sudo mount -o subvol=/ ${btrfsPartPath} /mnt
12
+
13
+
OLD_TRANSID=$(sudo btrfs subvolume find-new /mnt/root-blank 9999999)
14
+
15
+
sudo btrfs subvolume find-new "/mnt/root" "$OLD_TRANSID" |
16
+
sed '$d' |
17
+
cut -f17- -d' ' |
18
+
sort |
19
+
uniq |
20
+
while read path; do
21
+
path="/$path"
22
+
if [ -L "$path" ]; then
23
+
: # The path is a symbolic link, so is probably handled by NixOS already
24
+
elif [ -d "$path" ]; then
25
+
: # The path is a directory, ignore
26
+
else
27
+
echo "$path"
28
+
fi
29
+
done
30
+
31
+
sudo umount /mnt
32
+
'';
33
+
in {
34
+
imports = [
35
+
../users/patriot
36
+
../users/root
37
+
../profiles/network
38
+
../profiles/develop
39
+
(modulesPath + "/installer/scan/not-detected.nix")
40
+
nixosPersistence
41
+
];
42
+
43
+
boot = {
44
+
loader = {
45
+
efi.canTouchEfiVariables = true;
46
+
systemd-boot.enable = true;
47
+
};
48
+
kernelPackages = pkgs.linuxPackages_latest;
49
+
supportedFilesystems = [ "btrfs" ];
50
+
initrd = {
51
+
availableKernelModules =
52
+
[ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
53
+
kernelModules = [ "amdgpu" ];
54
+
};
55
+
kernelModules = [ "kvm-amd" ];
56
+
extraModulePackages = [ ];
57
+
initrd.postDeviceCommands = pkgs.lib.mkBefore ''
58
+
mkdir -p /mnt
59
+
mount -o subvol=/ ${btrfsPartPath} /mnt
60
+
btrfs subvolume list -o /mnt/root |
61
+
cut -f9 -d' ' |
62
+
while read subvolume; do
63
+
echo "deleting /$subvolume subvolume..."
64
+
btrfs subvolume delete "/mnt/$subvolume"
65
+
done &&
66
+
echo "deleting /root subvolume..." &&
67
+
btrfs subvolume delete /mnt/root
68
+
echo "restoring blank /root subvolume"
69
+
btrfs subvolume snapshot /mnt/root-blank /mnt/root
70
+
umount /mnt
71
+
'';
72
+
};
73
+
74
+
fileSystems."/" = {
75
+
device = btrfsPartPath;
76
+
fsType = "btrfs";
77
+
options = [ "subvol=root" ] ++ btrfsOptions;
78
+
};
79
+
80
+
fileSystems."/home" = {
81
+
device = btrfsPartPath;
82
+
fsType = "btrfs";
83
+
options = [ "subvol=home" ] ++ btrfsOptions;
84
+
};
85
+
86
+
fileSystems."/nix" = {
87
+
device = btrfsPartPath;
88
+
fsType = "btrfs";
89
+
options = [ "subvol=nix" ] ++ btrfsOptions;
90
+
};
91
+
92
+
fileSystems."/persist" = {
93
+
device = btrfsPartPath;
94
+
fsType = "btrfs";
95
+
options = [ "subvol=persist" ] ++ btrfsOptions;
96
+
neededForBoot = true;
97
+
};
98
+
99
+
fileSystems."/var/log" = {
100
+
device = btrfsPartPath;
101
+
fsType = "btrfs";
102
+
options = [ "subvol=log" ] ++ btrfsOptions;
103
+
neededForBoot = true;
104
+
};
105
+
106
+
fileSystems."/boot" = {
107
+
device = "/dev/disk/by-uuid/5784-BBB1";
108
+
fsType = "vfat";
109
+
};
110
+
111
+
swapDevices = [ ];
112
+
zramSwap = {
113
+
enable = true;
114
+
algorithm = "zstd";
115
+
};
116
+
117
+
nix.maxJobs = lib.mkDefault 4;
118
+
119
+
security = {
120
+
mitigations.disable = true;
121
+
allowSimultaneousMultithreading = false;
122
+
# Deleting root subvolume makes sudo show lecture every boot
123
+
sudo.extraConfig = ''
124
+
Defaults lecture = never
125
+
'';
126
+
};
127
+
128
+
sound.enable = true;
129
+
hardware = {
130
+
opengl = {
131
+
driSupport = true;
132
+
driSupport32Bit = true;
133
+
enable = true;
134
+
extraPackages = with pkgs; [
135
+
amdvlk
136
+
libvdpau-va-gl
137
+
vaapiVdpau
138
+
libva
139
+
vulkan-loader
140
+
];
141
+
extraPackages32 = with pkgs.pkgsi686Linux;
142
+
[ libvdpau-va-gl vaapiVdpau libva vulkan-loader ]
143
+
++ [ pkgs.driversi686Linux.amdvlk ];
144
+
};
145
+
pulseaudio = {
146
+
enable = true;
147
+
support32Bit = true;
148
+
};
149
+
};
150
+
# virtualisation.docker.enable = true;
151
+
152
+
environment = {
153
+
systemPackages = [ btrfsDiff ];
154
+
persistence."/persist" = {
155
+
directories = [ "/etc/nixos" "/var/lib/docker/" ];
156
+
files = [ "/etc/machine-id" ];
157
+
};
158
+
};
159
+
networking.interfaces.enp6s0.useDHCP = true;
160
+
161
+
services.xserver = {
162
+
enable = true;
163
+
# displayManager.gdm.enable = true;
164
+
# desktopManager.gnome3.enable = true;
165
+
videoDrivers = [ "amdgpu" ];
166
+
};
167
+
168
+
system.stateVersion = "20.09";
169
+
}
+12
hosts/niximg.nix
+12
hosts/niximg.nix
···
1
+
{ modulesPath, ... }: {
2
+
imports = [
3
+
# passwd is nixos by default
4
+
../users/nixos
5
+
../users/root
6
+
"${modulesPath}/installer/cd-dvd/iso-image.nix"
7
+
];
8
+
9
+
isoImage.makeEfiBootable = true;
10
+
isoImage.makeUsbBootable = true;
11
+
networking.networkmanager.enable = true;
12
+
}
+24
lib/utils.nix
+24
lib/utils.nix
···
1
+
{ lib, pkgs, ... }:
2
+
let
3
+
inherit (builtins) attrNames isAttrs isInt readDir toJSON;
4
+
5
+
inherit (lib) filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix;
6
+
in rec {
7
+
# mapFilterAttrs ::
8
+
# (name -> value -> bool )
9
+
# (name -> value -> { name = any; value = any; })
10
+
# attrs
11
+
mapFilterAttrs = seive: f: attrs: filterAttrs seive (mapAttrs' f attrs);
12
+
13
+
recImport = { dir, _import ? base: import "${dir}/${base}.nix" }:
14
+
mapFilterAttrs (_: v: v != null) (n: v:
15
+
if n != "default.nix" && hasSuffix ".nix" n && v == "regular"
16
+
17
+
then
18
+
let name = removeSuffix ".nix" n; in nameValuePair (name) (_import name)
19
+
20
+
else
21
+
nameValuePair ("") (null)) (readDir dir);
22
+
23
+
pkgBin = name: "${pkgs."${name}"}/bin/${name}";
24
+
}
+6
local/locale.nix
+6
local/locale.nix
+3
overlays/hikari.nix
+3
overlays/hikari.nix
+100
profiles/core.nix
+100
profiles/core.nix
···
1
+
{ config, lib, pkgs, util, ... }:
2
+
let
3
+
inherit (util) pkgBin;
4
+
inherit (lib) fileContents mkIf;
5
+
6
+
in {
7
+
imports = [ ../local/locale.nix ];
8
+
9
+
boot = {
10
+
tmpOnTmpfs = true;
11
+
loader.systemd-boot.configurationLimit = 10;
12
+
};
13
+
14
+
console.font = "7x14";
15
+
16
+
environment = let
17
+
coreBin = v: "${pkgs.coreutils}/bin/${v}";
18
+
nixBin = "${config.nix.package}/bin/nix";
19
+
in {
20
+
systemPackages = with pkgs; [
21
+
bat
22
+
exa
23
+
ripgrep
24
+
curl
25
+
git
26
+
gotop
27
+
gptfdisk
28
+
iputils
29
+
lm_sensors
30
+
mkpasswd
31
+
];
32
+
33
+
shellAliases = let ifSudo = string: mkIf config.security.sudo.enable string;
34
+
in {
35
+
g = pkgBin "git";
36
+
37
+
grep = "${pkgs.ripgrep}/bin/rg";
38
+
cat = "${pkgBin "bat"} -pp --theme=base16";
39
+
c = "${pkgBin "bat"} -pp --theme=base16";
40
+
41
+
df = "${coreBin "df"} -h";
42
+
free = "${pkgs.procps}/bin/free -h";
43
+
44
+
ls = pkgBin "exa";
45
+
l = "${pkgBin "exa"} -lhg --git";
46
+
la = "${pkgBin "exa"} -lhg --git -a";
47
+
t = "${pkgBin "exa"} -lhg --git -T";
48
+
ta = "${pkgBin "exa"} -lhg --git -a -T";
49
+
50
+
n = nixBin;
51
+
nf = "${nixBin} flake";
52
+
nfc = "${nixBin} flake check";
53
+
nfu = "${nixBin} flake update";
54
+
nfua = "${nixBin} flake update --recreate-lock-file";
55
+
nfs = "${nixBin} flake show";
56
+
np = "${nixBin} profile";
57
+
npl = "${nixBin} profile info";
58
+
npi = "${nixBin} profile install";
59
+
npr = "${nixBin} profile remove";
60
+
nsh = "${nixBin} shell";
61
+
ndev = "${nixBin} develop";
62
+
63
+
nosce = "cd /etc/nixos";
64
+
nosr = ifSudo "sudo nixos-rebuild --fast";
65
+
nosrs = ifSudo "sudo nixos-rebuild switch";
66
+
nosrb = ifSudo "sudo nixos-rebuild boot";
67
+
nosrt = ifSudo "sudo nixos-rebuild test";
68
+
ncg = ifSudo "sudo nix-collect-garbage";
69
+
ncgdo = ifSudo "sudo nix-collect-garbage --delete-old";
70
+
71
+
top = pkgBin "gotop";
72
+
73
+
myip =
74
+
"${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1";
75
+
};
76
+
};
77
+
78
+
nix = {
79
+
package = pkgs.nixFlakes;
80
+
autoOptimiseStore = true;
81
+
optimise.automatic = true;
82
+
allowedUsers = [ "@wheel" ];
83
+
trustedUsers = [ "root" "@wheel" ];
84
+
extraOptions = ''
85
+
experimental-features = nix-command flakes ca-references
86
+
'';
87
+
};
88
+
89
+
# security = {
90
+
# hideProcessInformation = true;
91
+
# protectKernelImage = true;
92
+
# };
93
+
94
+
programs.command-not-found.enable = false;
95
+
96
+
home-manager.useGlobalPkgs = true;
97
+
home-manager.useUserPackages = true;
98
+
99
+
users.mutableUsers = false;
100
+
}
+7
profiles/develop/default.nix
+7
profiles/develop/default.nix
+6
profiles/develop/editor/default.nix
+6
profiles/develop/editor/default.nix
+10
profiles/develop/editor/kakoune.nix
+10
profiles/develop/editor/kakoune.nix
+7
profiles/develop/godot.nix
+7
profiles/develop/godot.nix
+10
profiles/network/default.nix
+10
profiles/network/default.nix
+1
profiles/network/dns/default.nix
+1
profiles/network/dns/default.nix
···
1
+
{ imports = [ ./nextdns.nix ]; }
+6
profiles/network/dns/nextdns.nix
+6
profiles/network/dns/nextdns.nix
+6
profiles/network/dns/stubby/default.nix
+6
profiles/network/dns/stubby/default.nix
+16
profiles/network/dns/stubby/nextdns.nix
+16
profiles/network/dns/stubby/nextdns.nix
···
1
+
{
2
+
services.stubby = {
3
+
roundRobinUpstreams = false;
4
+
upstreamServers = let nextDnsId = "75e43d";
5
+
in ''
6
+
- address_data: 45.90.28.0
7
+
tls_auth_name: "${nextDnsId}.dns1.nextdns.io"
8
+
- address_data: 2a07:a8c0::0
9
+
tls_auth_name: "${nextDnsId}.dns1.nextdns.io"
10
+
- address_data: 45.90.30.0
11
+
tls_auth_name: "${nextDnsId}.dns2.nextdns.io"
12
+
- address_data: 2a07:a8c1::0
13
+
tls_auth_name: "${nextDnsId}.dns2.nextdns.io"
14
+
'';
15
+
};
16
+
}
+7
profiles/network/iwd.nix
+7
profiles/network/iwd.nix
+5
profiles/network/networkmanager.nix
+5
profiles/network/networkmanager.nix
+8
profiles/network/ssh.nix
+8
profiles/network/ssh.nix
+8
profiles/network/wpa_supplicant.nix
+8
profiles/network/wpa_supplicant.nix
+32
users/patriot/default.nix
+32
users/patriot/default.nix
···
1
+
{ config, pkgs, ... }: {
2
+
imports = [ ./home.nix ];
3
+
4
+
users.users.patriot = {
5
+
isNormalUser = true;
6
+
createHome = true;
7
+
home = "/home/patriot";
8
+
extraGroups = [ "wheel" "adbusers" "dialout" "docker" ];
9
+
shell = pkgs.zsh;
10
+
hashedPassword =
11
+
"$6$spzqhAyJfhHy$iHgLBlhjGn1l8PnbjJdWTn1GPvcjMqYNKUzdCe/7IrX6sHNgETSr/Nfpdmq9FCXLhrAfwHOd/q/8SvfeIeNX4/";
12
+
};
13
+
14
+
xdg.portal = {
15
+
enable = true;
16
+
gtkUsePortal = true;
17
+
extraPortals = with pkgs; [
18
+
xdg-desktop-portal
19
+
xdg-desktop-portal-gtk
20
+
xdg-desktop-portal-wlr
21
+
];
22
+
};
23
+
24
+
programs = {
25
+
adb.enable = true;
26
+
steam.enable = true;
27
+
java = {
28
+
enable = true;
29
+
package = pkgs.jre8;
30
+
};
31
+
};
32
+
}
+732
users/patriot/home.nix
+732
users/patriot/home.nix
···
1
+
{ config, lib, pkgs, util, ... }:
2
+
let
3
+
inherit (lib) mapAttrs' nameValuePair;
4
+
inherit (builtins) readDir;
5
+
inherit (util) pkgBin;
6
+
7
+
nixosConfig = config;
8
+
9
+
name = "Yusuf Bera Ertan";
10
+
email = "y.bera003.06@protonmail.com";
11
+
12
+
font = "Iosevka";
13
+
fontSize = 10;
14
+
fontComb = "${font} ${toString fontSize}";
15
+
fontPackage = pkgs.iosevka;
16
+
17
+
wallpaper = pkgs.fetchurl {
18
+
url = "https://static.zerochan.net/Mayer.%28Arknights%29.full.2724381.jpg";
19
+
hash = "sha256-W/nr3Ukm1pNoMWfebYiQ3v3i9OSH98PVV3tqTwRVbSU=";
20
+
name = "wallpaper";
21
+
};
22
+
23
+
kideSrc = pkgs.fetchgit {
24
+
url = "https://gitlab.com/yusdacra/kide.git";
25
+
rev = "c4116d433add520d8e18382e0bfee9c49bf67fd0";
26
+
sha256 = "sha256-RTYl0rFR7Tv5UisQXL4Wucrlw3NZeTKIqrXTdx095y0=";
27
+
fetchSubmodules = true;
28
+
};
29
+
kideFiles =
30
+
mapAttrs' (n: _: nameValuePair "kak/${n}" { source = "${kideSrc}/${n}"; })
31
+
(readDir kideSrc);
32
+
kideDeps = with pkgs; [
33
+
fzf
34
+
bat
35
+
ripgrep
36
+
universal-ctags
37
+
kak-lsp
38
+
wl-clipboard
39
+
xclip
40
+
];
41
+
42
+
colorSchemeLight = {
43
+
primary = {
44
+
normal = {
45
+
background = "fbf3db";
46
+
foreground = "53676d";
47
+
};
48
+
bright = {
49
+
background = "d5cdb6";
50
+
foreground = "3a4d53";
51
+
};
52
+
};
53
+
normal = {
54
+
black = "ece3cc";
55
+
red = "d2212d";
56
+
green = "489100";
57
+
yellow = "ad8900";
58
+
blue = "0072d4";
59
+
magenta = "ca4898";
60
+
cyan = "009c8f";
61
+
white = "909995";
62
+
};
63
+
bright = {
64
+
black = "d5cdb6";
65
+
red = "cc1729";
66
+
green = "428b00";
67
+
yellow = "a78300";
68
+
blue = "006dce";
69
+
magenta = "c44392";
70
+
cyan = "00978a";
71
+
white = "3a4d53";
72
+
};
73
+
};
74
+
75
+
colorSchemeDark = {
76
+
primary = {
77
+
normal = {
78
+
background = "181818";
79
+
foreground = "b9b9b9";
80
+
};
81
+
bright = {
82
+
background = "3b3b3b";
83
+
foreground = "dedede";
84
+
};
85
+
};
86
+
normal = {
87
+
black = "252525";
88
+
red = "ed4a46";
89
+
green = "70b433";
90
+
yellow = "dbb32d";
91
+
blue = "368aeb";
92
+
magenta = "eb6eb7";
93
+
cyan = "3fc5b7";
94
+
white = "777777";
95
+
};
96
+
bright = {
97
+
black = "3b3b3b";
98
+
red = "ff5e56";
99
+
green = "83c746";
100
+
yellow = "efc541";
101
+
blue = "4f9cfe";
102
+
magenta = "ff81ca";
103
+
cyan = "56d8c9";
104
+
white = "dedede";
105
+
};
106
+
};
107
+
108
+
colorScheme =
109
+
if builtins.pathExists ./light then colorSchemeLight else colorSchemeDark;
110
+
111
+
bgColor = colorScheme.primary.normal.background;
112
+
fgColor = colorScheme.primary.bright.foreground;
113
+
acColor = colorScheme.normal.red;
114
+
acColor2 = colorScheme.normal.yellow;
115
+
116
+
alacrittyColors = {
117
+
primary = {
118
+
background = "0x${bgColor}";
119
+
foreground = "0x${fgColor}";
120
+
};
121
+
normal = lib.mapAttrs (_: v: "0x${v}") colorScheme.normal;
122
+
bright = lib.mapAttrs (_: v: "0x${v}") colorScheme.bright;
123
+
};
124
+
125
+
# sway attrs reused
126
+
focusedWorkspace = {
127
+
background = "#${bgColor}";
128
+
border = "#${acColor}";
129
+
text = "#${acColor}";
130
+
};
131
+
activeWorkspace = {
132
+
background = "#${bgColor}";
133
+
border = "#${colorScheme.primary.bright.background}";
134
+
text = "#${fgColor}";
135
+
};
136
+
inactiveWorkspace = {
137
+
background = "#${bgColor}";
138
+
border = "#${bgColor}";
139
+
text = "#${fgColor}";
140
+
};
141
+
urgentWorkspace = {
142
+
background = "#${bgColor}";
143
+
border = "#${acColor2}";
144
+
text = "#${acColor2}";
145
+
};
146
+
addIndSway = x: {
147
+
background = x.background;
148
+
border = x.border;
149
+
childBorder = x.border;
150
+
text = x.text;
151
+
indicator = "#111111"; # don't care
152
+
};
153
+
fonts = [ fontComb ];
154
+
in {
155
+
home-manager.users.patriot = { config, pkgs, ... }: {
156
+
imports = [ ../profiles/hikari.nix ];
157
+
158
+
fonts.fontconfig.enable = true;
159
+
home = {
160
+
homeDirectory = nixosConfig.users.users.patriot.home;
161
+
packages =
162
+
with pkgs;
163
+
[
164
+
discord
165
+
fontPackage
166
+
bitwarden
167
+
pfetch
168
+
neofetch
169
+
gnupg
170
+
imv
171
+
mpv
172
+
youtube-dl
173
+
ffmpeg
174
+
mupdf
175
+
steam-run
176
+
lutris
177
+
xdg_utils
178
+
# xdg-user-dirs
179
+
# gnome3.zenity
180
+
# x11 docker stuff
181
+
# x11docker
182
+
# weston
183
+
# xwayland
184
+
# xpra
185
+
# xdotool
186
+
# xorg.setxkbmap
187
+
# xorg.xkbcomp
188
+
# xorg.xauth
189
+
] ++ kideDeps;
190
+
file = {
191
+
"wallpaper.png".source = ${wallpaper};
192
+
};
193
+
};
194
+
195
+
wayland.windowManager = {
196
+
hikari = {
197
+
enable = true;
198
+
inherit font;
199
+
};
200
+
sway = {
201
+
enable = false;
202
+
extraSessionCommands = ''
203
+
export SDL_VIDEODRIVER=wayland
204
+
# needs qt5.qtwayland in systemPackages
205
+
export QT_QPA_PLATFORM=wayland
206
+
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
207
+
# Fix for some Java AWT applications (e.g. Android Studio),
208
+
# use this if they aren't displayed properly:
209
+
export _JAVA_AWT_WM_NONREPARENTING=1
210
+
'';
211
+
config = {
212
+
inherit fonts;
213
+
bars = [ ]; # no
214
+
colors = {
215
+
background = "#${bgColor}";
216
+
focused = addIndSway focusedWorkspace;
217
+
focusedInactive = addIndSway inactiveWorkspace;
218
+
unfocused = addIndSway activeWorkspace;
219
+
urgent = addIndSway urgentWorkspace;
220
+
};
221
+
gaps.smartBorders = "on";
222
+
menu = "${pkgBin "rofi"} -show drun | ${pkgs.sway}/bin/swaymsg --";
223
+
modifier = "Mod4";
224
+
terminal = pkgBin "alacritty";
225
+
keybindings = let
226
+
mod = config.wayland.windowManager.sway.config.modifier;
227
+
cat = pkgs.coreutils + "/bin/cat";
228
+
grim = pkgBin "grim";
229
+
slurp = pkgBin "slurp";
230
+
pactl = pkgs.pulseaudio + "/bin/pactl";
231
+
playerctl = pkgBin "playerctl";
232
+
wf-recorder = pkgBin "wf-recorder";
233
+
wl-copy = pkgs.wl-clipboard + "/bin/wl-copy";
234
+
wl-paste = pkgs.wl-clipboard + "/bin/wl-paste";
235
+
shotFile = homeDir + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')";
236
+
in lib.mkOptionDefault {
237
+
"${mod}+q" = "kill";
238
+
# Screenshot and copy it to clipboard
239
+
"Mod1+s" = ''
240
+
exec export SFILE="${shotFile}.png" && ${grim} "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png
241
+
'';
242
+
# Save selected area as a picture and copy it to clipboard
243
+
"Mod1+Shift+s" = ''
244
+
exec export SFILE="${shotFile}.png" && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png
245
+
'';
246
+
# Record screen
247
+
"Mod1+r" = ''exec ${wf-recorder} -f "${shotFile}.mp4"'';
248
+
# Record an area
249
+
"Mod1+Shift+r" =
250
+
''exec ${wf-recorder} -g "$(${slurp})" -f "${shotFile}.mp4"'';
251
+
# Stop recording
252
+
"Mod1+c" = "exec pkill -INT wf-recorder";
253
+
"XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume 0 +5%";
254
+
"XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume 0 -5%";
255
+
"XF86AudioMute" = "exec ${pactl} set-sink-mute 0 toggle";
256
+
"XF86AudioPlay" = "exec ${playerctl} play-pause";
257
+
"XF86AudioPrev" = "exec ${playerctl} previous";
258
+
"XF86AudioNext" = "exec ${playerctl} next";
259
+
"XF86AudioStop" = "exec ${playerctl} stop";
260
+
};
261
+
input = {
262
+
"*" = {
263
+
xkb_layout = nixosConfig.services.xserver.layout;
264
+
accel_profile = "flat";
265
+
};
266
+
};
267
+
output = { "*" = { bg = wallpaper + " fill"; }; };
268
+
};
269
+
};
270
+
};
271
+
272
+
programs = {
273
+
alacritty = {
274
+
enable = true;
275
+
settings = {
276
+
font = {
277
+
normal = { family = font; };
278
+
size = fontSize;
279
+
};
280
+
colors = alacrittyColors;
281
+
};
282
+
};
283
+
tmux = {
284
+
enable = true;
285
+
newSession = true;
286
+
secureSocket = true;
287
+
baseIndex = 1;
288
+
escapeTime = 0;
289
+
keyMode = "vi";
290
+
terminal = "tmux-256color";
291
+
shortcut = "a";
292
+
extraConfig = ''
293
+
set -ga terminal-overrides ',*256col*:Tc'
294
+
set -g status off
295
+
'';
296
+
};
297
+
qutebrowser = {
298
+
enable = true;
299
+
settings = {
300
+
content.javascript.enabled = false;
301
+
colors.webpage.darkmode.enabled = true;
302
+
tabs = {
303
+
tabs_are_windows = true;
304
+
show = "never";
305
+
};
306
+
statusbar.show = "in-mode";
307
+
};
308
+
extraConfig = let
309
+
domains = [
310
+
"github.com"
311
+
"gitlab.com"
312
+
"nixos.org"
313
+
"protonmail.com"
314
+
"bitwarden.com"
315
+
"duckduckgo.com"
316
+
"youtube.com"
317
+
"docker.com"
318
+
];
319
+
enableJsForDomain = d: ''
320
+
config.set('content.javascript.enabled', True, 'https://*.${d}')
321
+
'';
322
+
in lib.concatStrings (map enableJsForDomain domains);
323
+
};
324
+
git = {
325
+
enable = true;
326
+
aliases = {
327
+
a = "add";
328
+
b = "branch";
329
+
c = "commit";
330
+
d = "diff";
331
+
l = "log";
332
+
s = "status";
333
+
co = "checkout";
334
+
dc = "diff --cached";
335
+
qc = "commit -am";
336
+
pl = "pull";
337
+
ps = "push";
338
+
rb = "rebase";
339
+
rs = "restore";
340
+
rv = "revert";
341
+
ss = "stash";
342
+
rst = "reset";
343
+
rss = "restore --staged";
344
+
ssp = "stash pop";
345
+
ssl = "stash list";
346
+
ssd = "stash drop";
347
+
};
348
+
extraConfig = { pull.rebase = true; };
349
+
lfs.enable = true;
350
+
signing = {
351
+
key = "E1C119F91F4CAE53E8445CAFBB57FCE7E35984F6";
352
+
signByDefault = true;
353
+
};
354
+
userName = name;
355
+
userEmail = email;
356
+
};
357
+
ssh = {
358
+
enable = true;
359
+
compression = true;
360
+
hashKnownHosts = true;
361
+
userKnownHostsFile = "~/.local/share/ssh/known-hosts";
362
+
extraConfig = ''
363
+
Host hub.darcs.net
364
+
ControlMaster no
365
+
ForwardAgent no
366
+
ForwardX11 no
367
+
Ciphers +aes256-cbc
368
+
MACs +hmac-sha1
369
+
'';
370
+
};
371
+
zsh = {
372
+
enable = true;
373
+
autocd = true;
374
+
enableVteIntegration = true;
375
+
enableAutosuggestions = true;
376
+
enableCompletion = true;
377
+
plugins = let
378
+
fast-syntax-highlighting = {
379
+
name = "fast-syntax-highlighting";
380
+
src = "${pkgs.zsh-fast-syntax-highlighting}";
381
+
};
382
+
per-directory-history = {
383
+
name = "per-directory-history";
384
+
src = pkgs.fetchFromGitHub {
385
+
owner = "jimhester";
386
+
repo = "per-directory-history";
387
+
rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06";
388
+
hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q=";
389
+
};
390
+
};
391
+
in [ fast-syntax-highlighting per-directory-history ];
392
+
# xdg compliant
393
+
dotDir = ".config/zsh";
394
+
history.path = ".local/share/zsh/history";
395
+
loginExtra = ''
396
+
if [ "$(${pkgs.coreutils}/bin/tty)" = "/dev/tty1" ]; then
397
+
exec ${pkgBin "hikari"}
398
+
fi
399
+
'';
400
+
shellAliases = nixosConfig.environment.shellAliases // {
401
+
rember = ''
402
+
${pkgs.kakoune-unwrapped}/bin/kak -e "try %(gtd-jump-today)" "${homeDir}/rember/stuff$(date '+_%m_%Y').gtd"
403
+
'';
404
+
};
405
+
};
406
+
starship = {
407
+
enable = true;
408
+
settings = {
409
+
add_newline = false;
410
+
character.symbol = ">";
411
+
directory = {
412
+
truncation_length = 2;
413
+
truncate_to_repo = false;
414
+
};
415
+
};
416
+
};
417
+
direnv = {
418
+
enable = true;
419
+
enableNixDirenvIntegration = true;
420
+
};
421
+
fzf.enable = true;
422
+
rofi = let
423
+
bgc = "#${bgColor}";
424
+
fgc = "#${fgColor}";
425
+
acc = "#${acColor}";
426
+
in {
427
+
enable = true;
428
+
colors = {
429
+
window = {
430
+
background = bgc;
431
+
border = bgc;
432
+
separator = bgc;
433
+
};
434
+
rows = {
435
+
normal = {
436
+
background = bgc;
437
+
foreground = fgc;
438
+
backgroundAlt = bgc;
439
+
highlight = {
440
+
background = bgc;
441
+
foreground = acc;
442
+
};
443
+
};
444
+
};
445
+
};
446
+
font = fontComb;
447
+
separator = "none";
448
+
terminal = pkgBin "alacritty";
449
+
};
450
+
waybar = {
451
+
enable = true;
452
+
settings = [
453
+
{
454
+
layer = "top";
455
+
position = "top";
456
+
modules-left = [ ];
457
+
modules-center = [ ];
458
+
modules-right = [ "pulseaudio" "cpu" "memory" "temperature" "clock" "tray" ];
459
+
modules = {
460
+
"tray" = {
461
+
spacing = 8;
462
+
};
463
+
"cpu" = {
464
+
format = "/cpu {usage}/";
465
+
};
466
+
"memory" = {
467
+
format = "/mem {}/";
468
+
};
469
+
"temperature" = {
470
+
hwmon-path = "/sys/class/hwmon/hwmon2/temp2_input";
471
+
format = "/tmp {temperatureC}C/";
472
+
};
473
+
"pulseaudio" = {
474
+
format = "/vol {volume}/ {format_source}";
475
+
format-bluetooth = "/volb {volume}/ {format_source}";
476
+
format-bluetooth-muted = "/volb/ {format_source}";
477
+
format-muted = "/vol/ {format_source}";
478
+
format-source = "/mic {volume}/";
479
+
format-source-muted = "/mic/";
480
+
};
481
+
};
482
+
}
483
+
];
484
+
style = ''
485
+
* {
486
+
border: none;
487
+
border-radius: 0;
488
+
/* `otf-font-awesome` is required to be installed for icons */
489
+
font-family: ${font};
490
+
font-size: ${toString fontSize}px;
491
+
min-height: 0;
492
+
}
493
+
494
+
window#waybar {
495
+
background-color: #222222;
496
+
border-bottom: 0px solid rgba(100, 114, 125, 0.5);
497
+
color: #ffffff;
498
+
transition-property: background-color;
499
+
transition-duration: .5s;
500
+
}
501
+
502
+
#workspaces button {
503
+
padding: 0 5px;
504
+
background-color: transparent;
505
+
color: #ffffff;
506
+
border-bottom: 3px solid transparent;
507
+
}
508
+
509
+
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
510
+
#workspaces button:hover {
511
+
background: rgba(0, 0, 0, 0.2);
512
+
box-shadow: inherit;
513
+
border-bottom: 3px solid #ffffff;
514
+
}
515
+
516
+
#workspaces button.focused {
517
+
background-color: #64727D;
518
+
border-bottom: 3px solid #ffffff;
519
+
}
520
+
521
+
#workspaces button.urgent {
522
+
background-color: #eb4d4b;
523
+
}
524
+
525
+
#mode {
526
+
background-color: #64727D;
527
+
border-bottom: 3px solid #ffffff;
528
+
}
529
+
530
+
#clock,
531
+
#battery,
532
+
#cpu,
533
+
#memory,
534
+
#temperature,
535
+
#backlight,
536
+
#network,
537
+
#pulseaudio,
538
+
#custom-media,
539
+
#tray,
540
+
#mode,
541
+
#idle_inhibitor,
542
+
#mpd {
543
+
padding: 0 10px;
544
+
margin: 0 4px;
545
+
color: #ffffff;
546
+
}
547
+
548
+
#clock {
549
+
background-color: #64727D;
550
+
color: #000000;
551
+
}
552
+
553
+
label:focus {
554
+
background-color: #000000;
555
+
}
556
+
557
+
#cpu {
558
+
background-color: #2ecc71;
559
+
color: #000000;
560
+
}
561
+
562
+
#memory {
563
+
background-color: #9b59b6;
564
+
color: #000000;
565
+
}
566
+
567
+
#pulseaudio {
568
+
background-color: #f1c40f;
569
+
color: #000000;
570
+
}
571
+
572
+
#pulseaudio.muted {
573
+
background-color: #90b1b1;
574
+
color: #2a5c45;
575
+
}
576
+
577
+
#temperature {
578
+
background-color: #f0932b;
579
+
color: #000000;
580
+
}
581
+
582
+
#temperature.critical {
583
+
background-color: #eb4d4b;
584
+
color: #000000;
585
+
}
586
+
587
+
#tray {
588
+
background-color: #2980b9;
589
+
}
590
+
'';
591
+
};
592
+
};
593
+
594
+
services = {
595
+
gpg-agent = {
596
+
enable = true;
597
+
enableSshSupport = true;
598
+
sshKeys = [ "8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965" ];
599
+
defaultCacheTtl = 3600 * 6;
600
+
defaultCacheTtlSsh = 3600 * 6;
601
+
maxCacheTtl = 3600 * 24;
602
+
maxCacheTtlSsh = 3600 * 24;
603
+
grabKeyboardAndMouse = false;
604
+
pinentryFlavor = "gtk2";
605
+
};
606
+
};
607
+
608
+
xdg = {
609
+
enable = true;
610
+
configFile = {
611
+
"kak/user/kakrc".text = ''
612
+
source "%val{config}/user/color/colorscheme.kak"
613
+
'';
614
+
"kak/user/color/colorscheme.kak".text = ''
615
+
evaluate-commands %sh{
616
+
fg="rgb:${colorScheme.primary.normal.foreground}"
617
+
bg="rgb:${colorScheme.primary.normal.background}"
618
+
br_fg="rgb:${colorScheme.primary.bright.foreground}"
619
+
br_bg="rgb:${colorScheme.primary.bright.background}"
620
+
621
+
red="rgb:${colorScheme.normal.red}"
622
+
green="rgb:${colorScheme.normal.green}"
623
+
yellow="rgb:${colorScheme.normal.yellow}"
624
+
blue="rgb:${colorScheme.normal.blue}"
625
+
magenta="rgb:${colorScheme.normal.magenta}"
626
+
cyan="rgb:${colorScheme.normal.cyan}"
627
+
628
+
br_red="rgb:${colorScheme.bright.red}"
629
+
br_green="rgb:${colorScheme.bright.green}"
630
+
br_yellow="rgb:${colorScheme.bright.yellow}"
631
+
br_blue="rgb:${colorScheme.bright.blue}"
632
+
br_magenta="rgb:${colorScheme.bright.magenta}"
633
+
br_cyan="rgb:${colorScheme.bright.cyan}"
634
+
635
+
echo "
636
+
set-face global value $yellow+b
637
+
set-face global type $br_yellow
638
+
set-face global variable $magenta
639
+
set-face global module $blue
640
+
set-face global function $br_cyan
641
+
set-face global string $br_green
642
+
set-face global keyword $br_red+b
643
+
set-face global operator $br_cyan
644
+
set-face global attribute $yellow
645
+
set-face global comment $fg
646
+
set-face global meta $br_yellow
647
+
set-face global builtin $br_fg+b
648
+
649
+
set-face global title $blue+u
650
+
set-face global header $br_cyan+u
651
+
set-face global bold $br_fg+b
652
+
set-face global italic $br_fg+i
653
+
set-face global mono $br_green
654
+
set-face global block $yellow
655
+
set-face global link $blue
656
+
set-face global bullet $br_magenta
657
+
set-face global list $magenta
658
+
659
+
set-face global Default $br_fg,$bg
660
+
set-face global PrimarySelection $bg,$br_fg
661
+
set-face global SecondarySelection $br_fg,$br_bg+i
662
+
set-face global PrimaryCursor $bg,$red+b
663
+
set-face global SecondaryCursor $bg,$br_cyan+i
664
+
set-face global MatchingChar $bg,$blue
665
+
set-face global Search $br_fg,$green
666
+
set-face global CurrentWord $br_fg,$blue
667
+
668
+
set-face global MenuForeground $cyan,$br_bg+b
669
+
set-face global MenuBackground $br_fg,$bg
670
+
671
+
set-face global Information $br_yellow,$bg
672
+
set-face global Error $br_bg,$br_red
673
+
674
+
set-face global BufferPadding $bg,$bg
675
+
set-face global Whitespace $bg
676
+
set-face global StatusLine $br_fg,$bg
677
+
set-face global StatusLineInfo $yellow,$bg
678
+
679
+
set-face global LineNumbers default
680
+
set-face global LineNumberCursor default,default+r
681
+
"
682
+
}
683
+
'';
684
+
"kak-lsp/kak-lsp.toml".text = ''
685
+
snippet_support = true
686
+
verbosity = 2
687
+
688
+
[semantic_scopes]
689
+
variable = "variable"
690
+
entity_name_function = "function"
691
+
entity_name_type = "type"
692
+
variable_other_enummember = "variable"
693
+
entity_name_namespace = "module"
694
+
695
+
[semantic_tokens]
696
+
type = "type"
697
+
variable = "variable"
698
+
namespace = "module"
699
+
function = "function"
700
+
string = "string"
701
+
keyword = "keyword"
702
+
operator = "operator"
703
+
comment = "comment"
704
+
705
+
[semantic_modifiers]
706
+
documentation = "documentation"
707
+
readonly = "default+d"
708
+
709
+
[server]
710
+
timeout = 1800
711
+
712
+
[language.rust]
713
+
filetypes = ["rust"]
714
+
roots = ["Cargo.toml"]
715
+
command = "${pkgBin "rust-analyzer"}"
716
+
717
+
[language.nix]
718
+
filetypes = ["nix"]
719
+
roots = ["flake.nix", "shell.nix", ".git"]
720
+
command = "${pkgBin "rnix-lsp"}"
721
+
'';
722
+
"nix/nix.conf".text = nixosConfig.nix.extraOptions;
723
+
"nixpkgs/config.nix".text = ''
724
+
{
725
+
android_sdk.accept_license = true;
726
+
allowUnfree = true;
727
+
}
728
+
'';
729
+
} // kideFiles;
730
+
};
731
+
};
732
+
}
+207
users/profiles/hikari.nix
+207
users/profiles/hikari.nix
···
1
+
{ lib, config, pkgs, ... }:
2
+
with lib;
3
+
let
4
+
cfg = config.wayland.windowManager.hikari;
5
+
in {
6
+
options.wayland.windowManager.hikari = {
7
+
enable = mkEnableOption "hikari window manager";
8
+
font = mkOption {
9
+
type = types.str;
10
+
default = "Iosevka";
11
+
};
12
+
};
13
+
14
+
config = mkIf cfg.enable {
15
+
home.packages = with pkgs; [ hikari ];
16
+
17
+
xdg = {
18
+
enable = true;
19
+
configFile = {
20
+
"hikari/hikari.conf".text = ''
21
+
ui {
22
+
border = 1
23
+
gap = 0
24
+
step = 120
25
+
font = "${cfg.font} 10"
26
+
27
+
colorscheme {
28
+
background = 0x282C34
29
+
foreground = 0x000000
30
+
selected = 0xF5E094
31
+
grouped = 0xFDAF53
32
+
first = 0xB8E673
33
+
conflict = 0xED6B32
34
+
insert = 0xE3C3FA
35
+
active = 0xFFFFFF
36
+
inactive = 0x465457
37
+
}
38
+
}
39
+
40
+
outputs {
41
+
"*" {
42
+
background = "${config.home.homeDirectory}/wallpaper.png"
43
+
}
44
+
}
45
+
46
+
inputs {
47
+
keyboards {
48
+
"*" {
49
+
xkb = {
50
+
layout = "tr"
51
+
}
52
+
}
53
+
}
54
+
}
55
+
56
+
layouts {
57
+
# main stack
58
+
s = {
59
+
scale = {
60
+
min = 0.5
61
+
max = 0.75
62
+
}
63
+
left = single
64
+
right = stack
65
+
}
66
+
67
+
# main queue
68
+
q = {
69
+
scale = 0.75
70
+
top = single
71
+
bottom = queue
72
+
}
73
+
74
+
f = full
75
+
h = stack
76
+
v = queue
77
+
g = grid
78
+
}
79
+
80
+
actions {
81
+
terminal = "${pkgs.alacritty}/bin/alacritty"
82
+
run = "${pkgs.wofi}/bin/wofi --show drun"
83
+
}
84
+
85
+
bindings {
86
+
keyboard {
87
+
"L+0" = workspace-switch-to-sheet-0
88
+
"L+1" = workspace-switch-to-sheet-1
89
+
"L+2" = workspace-switch-to-sheet-2
90
+
"L+3" = workspace-switch-to-sheet-3
91
+
"L+4" = workspace-switch-to-sheet-4
92
+
"L+5" = workspace-switch-to-sheet-5
93
+
"L+6" = workspace-switch-to-sheet-6
94
+
"L+7" = workspace-switch-to-sheet-7
95
+
"L+8" = workspace-switch-to-sheet-8
96
+
"L+9" = workspace-switch-to-sheet-9
97
+
"L+numbersign" = workspace-switch-to-sheet-alternate
98
+
"L+Period" = workspace-switch-to-sheet-current
99
+
"L+j" = workspace-switch-to-sheet-next
100
+
"L+k" = workspace-switch-to-sheet-prev
101
+
"L+Comma" = workspace-switch-to-sheet-next-inhabited
102
+
"LS+Comma" = workspace-switch-to-sheet-prev-inhabited
103
+
"LSC+g" = workspace-show-group
104
+
"LSC+i" = workspace-show-invisible
105
+
"LSC+Period" = workspace-show-all
106
+
"LC+n" = workspace-cycle-next
107
+
"LC+p" = workspace-cycle-prev
108
+
109
+
"LC+i" = sheet-show-invisible
110
+
"LC+Period" = sheet-show-all
111
+
"LC+g" = sheet-show-group
112
+
113
+
"LA+r" = layout-reset
114
+
"LA+Return" = layout-restack-append
115
+
"LAS+Return" = layout-restack-prepend
116
+
"L+Home" = layout-cycle-view-first
117
+
"L+End" = layout-cycle-view-last
118
+
"L+n" = layout-cycle-view-next
119
+
"L+p" = layout-cycle-view-prev
120
+
"L+x" = layout-exchange-view-next
121
+
"LS+x" = layout-exchange-view-prev
122
+
"LA+x" = layout-exchange-view-main
123
+
124
+
"LS+0" = view-pin-to-sheet-0
125
+
"LS+1" = view-pin-to-sheet-1
126
+
"LS+2" = view-pin-to-sheet-2
127
+
"LS+3" = view-pin-to-sheet-3
128
+
"LS+4" = view-pin-to-sheet-4
129
+
"LS+5" = view-pin-to-sheet-5
130
+
"LS+6" = view-pin-to-sheet-6
131
+
"LS+7" = view-pin-to-sheet-7
132
+
"LS+8" = view-pin-to-sheet-8
133
+
"LS+9" = view-pin-to-sheet-9
134
+
"LS+numbersign" = view-pin-to-sheet-alternate
135
+
"LS+Period" = view-pin-to-sheet-current
136
+
"LS+j" = view-pin-to-sheet-next
137
+
"LS+k" = view-pin-to-sheet-prev
138
+
139
+
"L+q" = view-quit
140
+
"L+Tab" = view-cycle-next
141
+
"LS+Tab" = view-cycle-prev
142
+
143
+
"L+Up" = view-move-up
144
+
"L+Down" = view-move-down
145
+
"L+Left" = view-move-left
146
+
"L+Right" = view-move-right
147
+
"LA+Up" = view-decrease-size-up
148
+
"LAS+Up" = view-increase-size-up
149
+
"LA+Down" = view-increase-size-down
150
+
"LAS+Down" = view-decrease-size-down
151
+
"LA+Left" = view-decrease-size-left
152
+
"LAS+Left" = view-increase-size-left
153
+
"LA+Right" = view-increase-size-right
154
+
"LAS+Right" = view-decrease-size-right
155
+
"LS+Up" = view-snap-up
156
+
"LS+Down" = view-snap-down
157
+
"LS+Left" = view-snap-left
158
+
"LS+Right" = view-snap-right
159
+
"L+r" = view-reset-geometry
160
+
161
+
"L+minus" = view-toggle-maximize-vertical
162
+
"L+less" = view-toggle-maximize-horizontal
163
+
"L+f" = view-toggle-maximize-full
164
+
"L5+plus" = view-toggle-floating
165
+
"L+i" = view-toggle-invisible
166
+
"L5+p" = view-toggle-public
167
+
168
+
"L+l" = mode-enter-layout
169
+
"L+s" = mode-enter-sheet-assign
170
+
"L+g" = mode-enter-group-assign
171
+
"L+m" = mode-enter-mark-assign
172
+
"L+acute" = mode-enter-mark-select
173
+
"LS+acute" = mode-enter-mark-switch-select
174
+
"LCA+g" = mode-enter-input-grab
175
+
176
+
"LS+Backspace" = lock
177
+
"LCA+q" = quit
178
+
"LCA+r" = reload
179
+
180
+
"L+Return" = action-terminal
181
+
"L+d" = action-run
182
+
183
+
"A+F1" = vt-switch-to-1
184
+
"A+F2" = vt-switch-to-2
185
+
"A+F3" = vt-switch-to-3
186
+
"A+F4" = vt-switch-to-4
187
+
"A+F5" = vt-switch-to-5
188
+
"A+F6" = vt-switch-to-6
189
+
"A+F7" = vt-switch-to-7
190
+
"A+F8" = vt-switch-to-8
191
+
"A+F9" = vt-switch-to-9
192
+
}
193
+
194
+
mouse {
195
+
"L+left" = mode-enter-move
196
+
"L+right" = mode-enter-resize
197
+
}
198
+
}
199
+
'';
200
+
"hikari/autostart".source = pkgs.writeScriptBin "hikari-autostart" ''
201
+
#!${pkgs.stdenv.shell}
202
+
${pkgs.waybar} &
203
+
'';
204
+
};
205
+
};
206
+
};
207
+
}