mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-06 17:50:15 +00:00
Compare commits
786 Commits
fea0396dce
...
pre-platfo
Author | SHA1 | Date | |
---|---|---|---|
6ee5ade2bc | |||
043cd8ce5c | |||
07a0d5185b | |||
a4b5e05f8f | |||
83f548e95f | |||
c66ca460c0 | |||
2b36140fbf | |||
66207830ba | |||
0f7c15bf36 | |||
d31a083ed6 | |||
148839b0ab | |||
7714635fa0 | |||
ca6c275cd8 | |||
54a897abb6 | |||
45eb33485d | |||
cbdf17f618 | |||
fdf231b46e | |||
e9d611fc03 | |||
f899a76f7f | |||
aa93604a6a | |||
6d8fb63d54 | |||
1cb5827438 | |||
fccee387b8 | |||
6f22a3031b | |||
185258ad8a | |||
b69a9a2de7 | |||
f16859893d | |||
b668c991c8 | |||
405b1ce60f | |||
e6f5649999 | |||
ef03bb112d | |||
da172aaa66 | |||
11625adbe8 | |||
b691895e05 | |||
66ef1fa38d | |||
30cc02c2a7 | |||
0d3e42be3f | |||
61ab3e1b3f | |||
bc604bc2ce | |||
39f80ea79a | |||
6ca944fe42 | |||
28ffa10a59 | |||
006554f545 | |||
1b04f9a883 | |||
00f23f4b9c | |||
9b948f45ee | |||
1f0ee6b27f | |||
3348bd0b39 | |||
780ff152c8 | |||
d61ac18707 | |||
bee5631fab | |||
78d34d9177 | |||
100eedc8cd | |||
ce298b9600 | |||
7128cd8d0d | |||
7007577176 | |||
ca1c7cc23f | |||
ae43d24f62 | |||
c6de176b0b | |||
a36df414c1 | |||
1022a3998f | |||
67727954ec | |||
cf8fc2ac56 | |||
4c38ae86a9 | |||
4b3bc8a216 | |||
e9a2ce6df3 | |||
875054aa2c | |||
4b9eea276b | |||
fc5ed5e892 | |||
1d01ddbbbc | |||
8cba026f10 | |||
a6e4b3130d | |||
33868c1add | |||
d806bd7f56 | |||
120b97f970 | |||
5f71437e57 | |||
e8e65ba4d1 | |||
c594a0b161 | |||
57c3719600 | |||
98c9c85e95 | |||
3ef36c4873 | |||
1d1d5014a0 | |||
1f64ed0bb8 | |||
2bfb8ea8b5 | |||
e91d6665fb | |||
7e3ab279af | |||
cdb9da9c50 | |||
46bbd2c967 | |||
51bee71faf | |||
a7adc18463 | |||
25a959f404 | |||
9f31d775c7 | |||
5306070bc5 | |||
b729eff679 | |||
4883532c65 | |||
982d3ce2d8 | |||
64311e6e1c | |||
83c9393837 | |||
e72d4eb548 | |||
b51df2f3a3 | |||
f47f397e1f | |||
48b1d41aff | |||
25c4e79ccc | |||
3b86a666fd | |||
264ad53f67 | |||
1cb5d3138c | |||
9c4438bed2 | |||
642d3c183f | |||
5798406977 | |||
81cb603bb7 | |||
1e7c69b3ea | |||
45deba10af | |||
d1721efc6c | |||
96caba63c4 | |||
01cd6151c1 | |||
e6644ab7b9 | |||
e43f6cf000 | |||
a9cdf6ac38 | |||
9fb7f68b07 | |||
845fc000b6 | |||
0b0556f057 | |||
771cac63a3 | |||
f7c5d3510f | |||
6866ca5fee | |||
883dc15b3d | |||
842f373101 | |||
65aa25b213 | |||
5b2fef7e01 | |||
2a812c1bdb | |||
16a372ce64 | |||
fb45ccdd5c | |||
74e6d740af | |||
2ad5411b90 | |||
3b494bed5b | |||
de4c8c32ef | |||
a7be0ed5cc | |||
e7f8d706b2 | |||
39fda67d6e | |||
4eb0327a1b | |||
029119ce93 | |||
b15fd34e30 | |||
a47bcf8949 | |||
6c024107ee | |||
4ca25aa194 | |||
20fcca6bda | |||
0bbbabd6e8 | |||
ff05b99fe1 | |||
abdf4b64be | |||
6d0d36165e | |||
b4470727e5 | |||
126baae735 | |||
892dfbbee4 | |||
0198469b83 | |||
c89ca7ea94 | |||
0a98b72784 | |||
c7de16b14c | |||
1d405e1828 | |||
97f99a149e | |||
bc794f89bc | |||
63b90102f2 | |||
c86188d734 | |||
f1cdd4ae98 | |||
332921edd3 | |||
cc69cbaa6c | |||
d165428a37 | |||
3e7955533e | |||
0b9886f93e | |||
2f39eb2ceb | |||
cf19085158 | |||
a387950c9a | |||
dec46bcc97 | |||
0d6230b3dc | |||
517ae65cf1 | |||
6f4ee32e8e | |||
2c2f366c47 | |||
e509943103 | |||
8937d214f1 | |||
af4161c4f4 | |||
0a225d6599 | |||
b78bbf2003 | |||
97cfaf0708 | |||
dceb0c5c65 | |||
a309e96754 | |||
83e95b306d | |||
6742103195 | |||
57ce387402 | |||
265144d957 | |||
f0b9bfc0a7 | |||
a4c9813341 | |||
b051885b52 | |||
985e69b4b8 | |||
8e9d556cfe | |||
99581ae1ea | |||
96d410e1b2 | |||
8e88d70a52 | |||
8b1032ebda | |||
e55ee05c5c | |||
0cdae3569e | |||
0f1cbe2e06 | |||
7a22e798fc | |||
196d2e53e0 | |||
204621a0ba | |||
ab050582c1 | |||
6cf4c4979d | |||
ad0bb2d804 | |||
5117b14388 | |||
e6bde77984 | |||
b546d5b43a | |||
5aa0a935ad | |||
4555797667 | |||
5edd1a50d3 | |||
a16e3ae3cb | |||
edff6fc768 | |||
45ec4e5a3f | |||
48fbb2e2d9 | |||
7ce9ed564e | |||
8074276643 | |||
6edc828ece | |||
4b22c774e2 | |||
b7e81e009c | |||
3d90674522 | |||
0582b4a147 | |||
c06cb27bcc | |||
de106298d6 | |||
b34997257c | |||
ddfaf0064c | |||
e561d5984b | |||
de766b6893 | |||
654009ba74 | |||
a7006af5ad | |||
452afd70c1 | |||
0c399fc269 | |||
e59c565e2f | |||
d0e613f093 | |||
14538d83f5 | |||
2d31f5726f | |||
f4ed3f0ec6 | |||
d07abccbce | |||
0feb11b017 | |||
da559f808a | |||
9ebdfa1071 | |||
5bd81813cb | |||
69b2332700 | |||
d4708cd5f6 | |||
962515c10e | |||
ee97213b9f | |||
97ccf1c170 | |||
37e66f32c5 | |||
572459ba88 | |||
b47ca4c785 | |||
8f0f7911b0 | |||
c0356cab62 | |||
b98ced2939 | |||
aea3359236 | |||
760a016842 | |||
f59c228803 | |||
951570c88c | |||
c066d27909 | |||
e43fc0f8db | |||
b23efc4d77 | |||
2258e68bc2 | |||
bb23e9fdbe | |||
358206f6fb | |||
402d168304 | |||
1865f6985e | |||
c338ff5579 | |||
bf58cf62d3 | |||
520f0587c8 | |||
81f2c6372e | |||
b4b2a7f511 | |||
bc2d0a347d | |||
07137fdd91 | |||
e8e0c97e59 | |||
83496bcad1 | |||
7d82e18c4d | |||
3c2a971fc4 | |||
742fba29f9 | |||
56da4afb5b | |||
2088d82252 | |||
566a654f5b | |||
1462214a8e | |||
efc7daf5fc | |||
fa582fcc34 | |||
c66cedf146 | |||
8dde578676 | |||
5e1534451d | |||
c4a1c7564c | |||
0de2c429f2 | |||
eb6b72a25c | |||
0618fc3962 | |||
1b7e4687e4 | |||
9f33371daf | |||
bbc529287d | |||
f757e4a894 | |||
5cb7b87e74 | |||
a853352a57 | |||
a15c05491e | |||
82f7da5858 | |||
5d34ed5a68 | |||
f73c52e2b7 | |||
fecd66465d | |||
9b0d363909 | |||
400d45df39 | |||
634805d36d | |||
db051a737e | |||
cbf0d2680c | |||
316439dc9a | |||
edaf95cc1c | |||
5f867fa2dd | |||
bdaf63da20 | |||
c12d54314e | |||
f50bbeba94 | |||
848c8aac5f | |||
488b5d61fd | |||
6b5892eb1d | |||
c3be92dcaf | |||
64bee30b17 | |||
568fdc7491 | |||
8585574100 | |||
6b37ba13c9 | |||
efac745bdd | |||
7e0a0bbbd2 | |||
16e228b7b0 | |||
277c400248 | |||
2b03dd5198 | |||
bdd922d318 | |||
6b2dfb4aa9 | |||
67ab65fa16 | |||
b06ebc7185 | |||
a30b189207 | |||
eb3c1f7a4c | |||
c697cd4e38 | |||
661ef8dcbf | |||
ec09db42e6 | |||
3403924105 | |||
3d234072f6 | |||
b39cda6b84 | |||
47be4291a3 | |||
67f7506636 | |||
bbdfeb645e | |||
7f60d88f30 | |||
8babcf342b | |||
a5ec39cd2a | |||
63434c8309 | |||
1a5fe54d06 | |||
b2cfdc1fdf | |||
3a4568bc69 | |||
203bb6a13a | |||
4bfd65acb3 | |||
d636de890c | |||
1e9401eef2 | |||
ea67467cbf | |||
fc6bdeb1ad | |||
2758637953 | |||
f747c80c2a | |||
013f67c0a8 | |||
fb145e5772 | |||
408b329684 | |||
ad70457600 | |||
f54f7b6e2e | |||
2700efa6e4 | |||
e44adf4568 | |||
471b258ff7 | |||
ac6329baf6 | |||
a61ac456a9 | |||
cf77adb366 | |||
2217568a59 | |||
05deb5b979 | |||
8621e2375d | |||
25975da0c1 | |||
a79719c21a | |||
5aea58df79 | |||
1833bfddfb | |||
6c2fc0289b | |||
5034ada458 | |||
e635cf6225 | |||
b901eef822 | |||
e7cdfc1453 | |||
7503335701 | |||
0b571e4565 | |||
f91c9bcfc2 | |||
b27b9136f9 | |||
865dad0f4f | |||
3178a1dea9 | |||
af1b6c8b35 | |||
89e8463b98 | |||
01eccb6655 | |||
e7f8a75df3 | |||
fa03e51d37 | |||
fe1a4c2c29 | |||
26afa49879 | |||
94bc6662ed | |||
06c1f5c372 | |||
4dd94ee59d | |||
69dd348c92 | |||
d823b2a49e | |||
756177826c | |||
c60632a37f | |||
324956c091 | |||
68c5816d4d | |||
643b722eb4 | |||
db0b2b147c | |||
b382bc9fbb | |||
454accd742 | |||
088de57cab | |||
5a992d6d5a | |||
f44cf65c43 | |||
46f3a459b6 | |||
161c1f46b0 | |||
fc2484227a | |||
e7bbf68dde | |||
10f7b97b64 | |||
c8a8b7a897 | |||
6560d2f9a2 | |||
3be397429a | |||
8b17fd035b | |||
8da8fe7efb | |||
59111f5da6 | |||
95e8d5c268 | |||
56d2c95c64 | |||
602d411bad | |||
4cd9572993 | |||
84d7fc9892 | |||
dab40e081a | |||
984a47d3b1 | |||
48cd96858a | |||
2cce4c572f | |||
2f783f2ba3 | |||
1ee22e3a9a | |||
450b211e7e | |||
19f3147f25 | |||
5d6d6fc68e | |||
ec55658fd1 | |||
d25b189952 | |||
a8b07cc365 | |||
70a30ac056 | |||
cfe1f1d1e2 | |||
3396918793 | |||
3ef842f359 | |||
e87cb5981c | |||
6e9419ed92 | |||
ab4e516ba8 | |||
5d2d26b3d9 | |||
50e16f9413 | |||
4653037f1e | |||
f192e53e7a | |||
b5a9da8011 | |||
cbbfb8724b | |||
0bbfe0b6b5 | |||
cc714dd898 | |||
4964e56298 | |||
fafd56612e | |||
3042a0ac19 | |||
9d2a423011 | |||
276c2024b4 | |||
81cffd471d | |||
61a808bad4 | |||
48045c0fee | |||
ef6964f3b4 | |||
7b7f426624 | |||
d1c0472b77 | |||
e6fd6128f4 | |||
e72be000b0 | |||
f50ddd48c8 | |||
3a2d5e2da6 | |||
c929bc6440 | |||
09563de935 | |||
a5615da7dc | |||
6babfae211 | |||
b471d0fa7a | |||
cf7d1b50f8 | |||
ddb5dc39aa | |||
3fd95643b0 | |||
d128511a21 | |||
5709afd835 | |||
f828c1c200 | |||
77708aebd9 | |||
f9ac9b1063 | |||
bdd6c603c4 | |||
31e607d0ad | |||
b2337d3c39 | |||
6428d4fa62 | |||
db315b31b4 | |||
340a64b87a | |||
89b5183f22 | |||
b4c08adea4 | |||
13972b1d66 | |||
352f515798 | |||
d84be966fc | |||
c9aa20c703 | |||
771d41254f | |||
90092c48ec | |||
159a6efe09 | |||
0008de7434 | |||
9826178c0e | |||
d2b1d95281 | |||
4c71797818 | |||
dba975fe86 | |||
1a9ab975d1 | |||
67251a6d8d | |||
967175df70 | |||
5561c85b43 | |||
05a8f4a49b | |||
a1f651010b | |||
3cecb8810c | |||
af753153f1 | |||
d2afdd56ae | |||
18fec1d058 | |||
6a0e70568a | |||
9b44d8f171 | |||
1cf3405103 | |||
7439d4bf39 | |||
316c33e66c | |||
c845ae2fd4 | |||
5bc10bef87 | |||
f0e1fc740f | |||
5826877ad2 | |||
d3b0f21313 | |||
b7d1921c4d | |||
de1337bf58 | |||
3cff7e090c | |||
21794891e7 | |||
20e5d7fef5 | |||
b6a6c761e9 | |||
fc4bd9e4a8 | |||
25e3de5058 | |||
9694467ba0 | |||
71e6780439 | |||
e6d0852be0 | |||
00564c0c40 | |||
57b38a417e | |||
7f9ce5925e | |||
5ce9a26441 | |||
73680961a0 | |||
c59e914430 | |||
e194003f8d | |||
3d6f57c324 | |||
ef2ee7b871 | |||
fc867d60cd | |||
d395347a29 | |||
080f7395e0 | |||
1475172bdb | |||
5d6dab3cab | |||
3e6232cbee | |||
8d72216f13 | |||
dd36a3bd82 | |||
0ed3633404 | |||
95e04de763 | |||
b1ebca57d2 | |||
939d17ada1 | |||
dfd52e2cd5 | |||
b589ba5d8a | |||
200f790ea1 | |||
9f561c822c | |||
1f0b04b89b | |||
38892b1135 | |||
9c2e004c8b | |||
bbb210ec4f | |||
984fca2021 | |||
b284b333c5 | |||
3aef23b746 | |||
5f36508d2b | |||
3387bea109 | |||
6f59ea9f22 | |||
8d09544663 | |||
cb15cc209b | |||
b390fff749 | |||
20456b444b | |||
cce6f6573f | |||
52b86efbb1 | |||
f41774f641 | |||
22cba9acac | |||
9e8bac6834 | |||
b07a8f5e20 | |||
8eb7ef0be7 | |||
22ab2acf66 | |||
d85e4b1593 | |||
6ea99eca5d | |||
60e779085e | |||
6abcdfa3bd | |||
0f0a64b5c4 | |||
edb4ec77ca | |||
3cc264a857 | |||
76a7480a1d | |||
9d4bf082c7 | |||
e86b2f184f | |||
d14054ab17 | |||
9b3d2e39c9 | |||
5a1a843ecd | |||
2ddd980436 | |||
febf1071af | |||
05adc8a221 | |||
a463212023 | |||
2457ade6eb | |||
88d52614a9 | |||
2c663347ee | |||
02fc29c482 | |||
21cbe29bd8 | |||
c0da8391ef | |||
d4e203a04c | |||
38480e0c0c | |||
ee58f7a4ee | |||
4c4e250fa1 | |||
ffe867e6a8 | |||
b599162090 | |||
4b0d68089a | |||
b304e529b4 | |||
2b0f03ba1f | |||
2c4f215b6e | |||
066ea8e440 | |||
cd0c93c6d9 | |||
78e9c817d0 | |||
53a8cc83ea | |||
1cf5f46adf | |||
5348cbdf61 | |||
140b410ea0 | |||
b282e76be4 | |||
a26f5dc2b5 | |||
b0fcee6707 | |||
46e633c8b9 | |||
7a74f0a504 | |||
bacf1ab1fa | |||
ddf48998db | |||
23f72c3c2e | |||
77d81742a9 | |||
13c7859a78 | |||
0f4914db95 | |||
25e56b7421 | |||
a6ec04db7e | |||
2a56c04e17 | |||
894a22cb2d | |||
eefed57929 | |||
494cf355e9 | |||
c88718b649 | |||
790cb4a9d0 | |||
e3d4b36613 | |||
18154b6579 | |||
fb44473d22 | |||
c1e89fb20e | |||
04e8b8834e | |||
472a2b965c | |||
79eba7f333 | |||
28418c4e37 | |||
fa797c81f8 | |||
d243d68c72 | |||
f4f5f19183 | |||
3a40bb7485 | |||
e8456e131b | |||
8d8dd8ad62 | |||
bad49cb2c3 | |||
c052813f6d | |||
ed19eaafd1 | |||
09de243bd3 | |||
82a1954c26 | |||
6815af21dc | |||
3269d5e247 | |||
d337ffff51 | |||
df5fba19f8 | |||
8cc158221d | |||
f391433584 | |||
241b2deb49 | |||
605824c1a4 | |||
e8f4ee52c3 | |||
6518db291f | |||
a6551ce043 | |||
b089ec4668 | |||
5970555572 | |||
1083ee4ff8 | |||
a2bbcf7f55 | |||
f388aee56c | |||
958ab8a96b | |||
3059241c1c | |||
fe938ec713 | |||
05f705d794 | |||
f67a44fa87 | |||
713b835f70 | |||
480d515302 | |||
2337db0bda | |||
1510c8c31f | |||
8f8012e435 | |||
8d389013ad | |||
d013f980a7 | |||
3c51dd0db6 | |||
7f0600580f | |||
05d5fcb8f9 | |||
ca7a4ed408 | |||
cf73ce8136 | |||
82344372dd | |||
34cf2a4483 | |||
efb3933f5a | |||
cd067cce69 | |||
0d9df06bce | |||
b4e5852f48 | |||
1a60c5e9db | |||
2d8a84c286 | |||
319106364a | |||
fd5d6ab141 | |||
4df1132eb7 | |||
f4d9897f21 | |||
634baf0a7e | |||
600fd06974 | |||
c9ab46696d | |||
b5790a2795 | |||
61f26315d5 | |||
4fefe54435 | |||
0833a0009c | |||
e349ac35b8 | |||
49c2c013a2 | |||
985b8bf13b | |||
8283480fd1 | |||
d6611ca7a2 | |||
a13083a264 | |||
ff4db1463e | |||
afedfcf187 | |||
2e3c376d73 | |||
59824adb3a | |||
8e32c16fd3 | |||
76c80dd31d | |||
57de089baf | |||
f9c09deb2a | |||
b06b6490f4 | |||
514244476d | |||
47590abc3a | |||
f69d233c39 | |||
9b97c9ac84 | |||
bda59eeb4a | |||
e7468ecc46 | |||
1b798f5af0 | |||
4406116203 | |||
c53f1470ee | |||
da89732001 | |||
2176a53c4a | |||
28576c1b8f | |||
64590c539b | |||
78b364afd7 | |||
f219ce45c8 | |||
5002c881f7 | |||
5859377802 | |||
e6dbed2e17 | |||
86076f0844 | |||
2aea76c0e3 | |||
42a5ad40de | |||
d4fa322fb1 | |||
3d73f8cab4 | |||
0df8af607d | |||
61d9b103b0 | |||
71d0d3ca14 | |||
d5b0405b99 | |||
3cad3d2fb0 | |||
2acd9b3478 | |||
bf4be11718 | |||
4d38d1094f | |||
183babd2f0 | |||
12682a57e1 | |||
31170a616f | |||
4502c5ff62 | |||
59bd3590a4 | |||
ebacff7250 | |||
763f0bbdda | |||
18505d4cbb | |||
a7c04b59ed | |||
d46e6dad6b | |||
5e4642b92e | |||
7ab78767d4 | |||
366a7f6157 | |||
fb47302f3b | |||
cda3ee0a4c | |||
0ed11de174 | |||
ab6f80fc18 | |||
d1f21ec874 | |||
cdcc90f85d | |||
f5674134fc | |||
d37cabfd9a | |||
6e117769c6 | |||
f648e92c28 | |||
43343b2824 | |||
ab9136af2c | |||
a7fe90b236 | |||
5557065c8b | |||
de1fae2baf | |||
2c310fd2f2 | |||
aa4dc4a0c2 | |||
44821ea344 | |||
cb60542980 | |||
3fe6911e2d | |||
afa62c5510 |
166
.github/workflows/arrow-aws.yml
vendored
Normal file
166
.github/workflows/arrow-aws.yml
vendored
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
name: Arrow (AWS)
|
||||||
|
|
||||||
|
run-name: Arrow (AWS) - ${{ inputs.rebuild && 'Rebuild and ' || '' }}${{ inputs.action == 'create' && 'Create' || ( inputs.action == 'destroy' && 'Destroy' || 'No Action' ) }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
TERRAFORM_DIRECTORY: hosts/arrow/aws
|
||||||
|
DEPLOY_IDENTITY_BASE64: ${{ secrets.DEPLOY_IDENTITY_BASE64 }}
|
||||||
|
ARROW_IDENTITY_BASE64: ${{ secrets.ARROW_IDENTITY_BASE64 }}
|
||||||
|
ZONE_NAME: masu.rs
|
||||||
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
rebuild:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
action:
|
||||||
|
type: choice
|
||||||
|
required: true
|
||||||
|
default: create
|
||||||
|
options:
|
||||||
|
- create
|
||||||
|
- destroy
|
||||||
|
- nothing
|
||||||
|
size:
|
||||||
|
type: choice
|
||||||
|
required: false
|
||||||
|
options:
|
||||||
|
- t3a.small # 2 GB RAM / $10
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-deploy:
|
||||||
|
name: Build and Deploy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repo Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Free Disk Space (Ubuntu)
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
uses: jlumbroso/free-disk-space@main
|
||||||
|
with:
|
||||||
|
tool-cache: true
|
||||||
|
|
||||||
|
# Enable access to KVM, required to build an image
|
||||||
|
- name: Enable KVM group perms
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
run: |
|
||||||
|
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
||||||
|
sudo udevadm control --reload-rules
|
||||||
|
sudo udevadm trigger --name-match=kvm
|
||||||
|
|
||||||
|
# Login to AWS
|
||||||
|
- name: AWS Assume Role
|
||||||
|
uses: aws-actions/configure-aws-credentials@v4
|
||||||
|
with:
|
||||||
|
role-to-assume: arn:aws:iam::286370965832:role/github_actions_admin
|
||||||
|
aws-region: us-east-1
|
||||||
|
|
||||||
|
# Install Nix
|
||||||
|
- name: Install Nix
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
uses: cachix/install-nix-action@v20
|
||||||
|
|
||||||
|
# Build the image
|
||||||
|
- name: Build Image
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
run: nix build .#arrow-aws
|
||||||
|
|
||||||
|
- name: Upload Image to S3
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
run: |
|
||||||
|
aws s3 cp \
|
||||||
|
result/nixos-amazon-image-*.vhd \
|
||||||
|
s3://${{ secrets.IMAGES_BUCKET }}/arrow.vhd \
|
||||||
|
|
||||||
|
# Installs the Terraform binary and some other accessory functions.
|
||||||
|
- name: Setup Terraform
|
||||||
|
uses: hashicorp/setup-terraform@v2
|
||||||
|
|
||||||
|
# Checks whether Terraform is formatted properly. If this fails, you
|
||||||
|
# should install the pre-commit hook.
|
||||||
|
- name: Check Formatting
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: |
|
||||||
|
terraform fmt -no-color -check -diff -recursive
|
||||||
|
|
||||||
|
# Connects to remote state backend and download providers.
|
||||||
|
- name: Terraform Init
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: |
|
||||||
|
terraform init \
|
||||||
|
-backend-config="bucket=${{ secrets.TERRAFORM_STATE_BUCKET }}" \
|
||||||
|
-backend-config="key=arrow.tfstate"
|
||||||
|
|
||||||
|
# Deploys infrastructure or changes to infrastructure.
|
||||||
|
- name: Terraform Apply
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
env:
|
||||||
|
TF_VAR_ec2_size: ${{ inputs.size }}
|
||||||
|
TF_VAR_images_bucket: ${{ secrets.IMAGES_BUCKET }}
|
||||||
|
run: |
|
||||||
|
terraform apply \
|
||||||
|
-auto-approve \
|
||||||
|
-input=false
|
||||||
|
|
||||||
|
# Removes infrastructure.
|
||||||
|
- name: Terraform Destroy
|
||||||
|
if: inputs.action == 'destroy'
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
env:
|
||||||
|
TF_VAR_ec2_size: ${{ inputs.size }}
|
||||||
|
TF_VAR_images_bucket: ${{ secrets.IMAGES_BUCKET }}
|
||||||
|
run: |
|
||||||
|
terraform destroy \
|
||||||
|
-auto-approve \
|
||||||
|
-input=false
|
||||||
|
|
||||||
|
- name: Get Host IP
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
id: host
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: terraform output -raw host_ip
|
||||||
|
|
||||||
|
- name: Wait on SSH
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
for i in $(seq 1 15); do
|
||||||
|
if $(nc -z -w 3 ${{ steps.host.outputs.stdout }} 22); then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Write Identity Keys to Files
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
echo "${{ env.DEPLOY_IDENTITY_BASE64 }}" | base64 -d > deploy_ed25519
|
||||||
|
chmod 0600 deploy_ed25519
|
||||||
|
echo "${{ env.ARROW_IDENTITY_BASE64 }}" | base64 -d > arrow_ed25519
|
||||||
|
chmod 0600 arrow_ed25519
|
||||||
|
|
||||||
|
- name: Copy Identity File to Host
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
ssh -i deploy_ed25519 -o StrictHostKeyChecking=accept-new noah@${{ steps.host.outputs.stdout }} 'mkdir -pv .ssh'
|
||||||
|
scp -i deploy_ed25519 arrow_ed25519 noah@${{ steps.host.outputs.stdout }}:~/.ssh/id_ed25519
|
||||||
|
|
||||||
|
- name: Wipe Records
|
||||||
|
if: ${{ inputs.action == 'destroy' }}
|
||||||
|
run: |
|
||||||
|
RECORD_ID=$(curl --request GET \
|
||||||
|
--url https://api.cloudflare.com/client/v4/zones/${{ env.CLOUDFLARE_ZONE_ID }}/dns_records \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--header "Authorization: Bearer ${{ env.CLOUDFLARE_API_TOKEN }}" | jq -r '.result[] | select(.name == "n8n2.${{ env.ZONE_NAME }}") | .id')
|
||||||
|
curl --request DELETE \
|
||||||
|
--url https://api.cloudflare.com/client/v4/zones/${{ env.CLOUDFLARE_ZONE_ID }}/dns_records/${RECORD_ID} \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--header "Authorization: Bearer ${{ env.CLOUDFLARE_API_TOKEN }}"
|
154
.github/workflows/arrow.yml
vendored
Normal file
154
.github/workflows/arrow.yml
vendored
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
name: Arrow
|
||||||
|
|
||||||
|
run-name: Arrow - ${{ inputs.rebuild && 'Rebuild and ' || '' }}${{ inputs.action == 'create' && 'Create' || ( inputs.action == 'destroy' && 'Destroy' || 'No Action' ) }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
TERRAFORM_DIRECTORY: hosts/arrow/vultr
|
||||||
|
DEPLOY_IDENTITY_BASE64: ${{ secrets.DEPLOY_IDENTITY_BASE64 }}
|
||||||
|
ARROW_IDENTITY_BASE64: ${{ secrets.ARROW_IDENTITY_BASE64 }}
|
||||||
|
CLOUDFLARE_R2_ENDPOINT: "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com"
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_KEY }}
|
||||||
|
AWS_DEFAULT_REGION: auto
|
||||||
|
AWS_ENDPOINT_URL_S3: "https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com"
|
||||||
|
TF_VAR_vultr_api_key: ${{ secrets.VULTR_API_KEY }}
|
||||||
|
ZONE_NAME: masu.rs
|
||||||
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
rebuild:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
action:
|
||||||
|
type: choice
|
||||||
|
required: true
|
||||||
|
default: create
|
||||||
|
options:
|
||||||
|
- create
|
||||||
|
- destroy
|
||||||
|
- nothing
|
||||||
|
plan:
|
||||||
|
type: choice
|
||||||
|
required: false
|
||||||
|
options:
|
||||||
|
- vc2-1c-1gb # 25 GB / $5
|
||||||
|
- vc2-1c-2gb # 55 GB / $10 (default)
|
||||||
|
- vc2-2c-2gb # 65 GB / $15
|
||||||
|
- vc2-2c-4gb # 80 GB / $20
|
||||||
|
- vc2-4c-8gb # 160 GB / $40
|
||||||
|
- vc2-6c-16gb # 320 GB / $80
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-deploy:
|
||||||
|
name: Build and Deploy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repo Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Enable access to KVM, required to build an image
|
||||||
|
- name: Enable KVM group perms
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
run: |
|
||||||
|
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
||||||
|
sudo udevadm control --reload-rules
|
||||||
|
sudo udevadm trigger --name-match=kvm
|
||||||
|
|
||||||
|
# Install Nix
|
||||||
|
- name: Install Nix
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
uses: cachix/install-nix-action@v17
|
||||||
|
|
||||||
|
# Build the image
|
||||||
|
- name: Build Image
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
run: nix build .#arrow
|
||||||
|
|
||||||
|
- name: Upload Image to S3
|
||||||
|
if: inputs.rebuild && inputs.action != 'destroy'
|
||||||
|
run: |
|
||||||
|
aws s3 cp \
|
||||||
|
result/iso/nixos.iso \
|
||||||
|
s3://noahmasur-arrow-images/arrow.iso \
|
||||||
|
--endpoint-url "https://${{ env.CLOUDFLARE_R2_ENDPOINT }}"
|
||||||
|
|
||||||
|
# Installs the Terraform binary and some other accessory functions.
|
||||||
|
- name: Setup Terraform
|
||||||
|
uses: hashicorp/setup-terraform@v2
|
||||||
|
|
||||||
|
# Checks whether Terraform is formatted properly. If this fails, you
|
||||||
|
# should install the pre-commit hook.
|
||||||
|
- name: Check Formatting
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: |
|
||||||
|
terraform fmt -no-color -check -diff -recursive
|
||||||
|
|
||||||
|
# Connects to remote state backend and download providers.
|
||||||
|
- name: Terraform Init
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: terraform init
|
||||||
|
|
||||||
|
# Deploys infrastructure or changes to infrastructure.
|
||||||
|
- name: Terraform Apply
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
env:
|
||||||
|
TF_VAR_vultr_plan: ${{ inputs.plan }}
|
||||||
|
run: |
|
||||||
|
terraform apply \
|
||||||
|
-auto-approve \
|
||||||
|
-input=false
|
||||||
|
|
||||||
|
# Removes infrastructure.
|
||||||
|
- name: Terraform Destroy
|
||||||
|
if: inputs.action == 'destroy'
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: |
|
||||||
|
terraform destroy \
|
||||||
|
-auto-approve \
|
||||||
|
-input=false
|
||||||
|
|
||||||
|
- name: Get Host IP
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
id: host
|
||||||
|
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
||||||
|
run: terraform output -raw host_ip
|
||||||
|
|
||||||
|
- name: Wait on SSH
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
for i in $(seq 1 15); do
|
||||||
|
if $(nc -z -w 3 ${{ steps.host.outputs.stdout }} 22); then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Write Identity Keys to Files
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
echo "${{ env.DEPLOY_IDENTITY_BASE64 }}" | base64 -d > deploy_ed25519
|
||||||
|
chmod 0600 deploy_ed25519
|
||||||
|
echo "${{ env.ARROW_IDENTITY_BASE64 }}" | base64 -d > arrow_ed25519
|
||||||
|
chmod 0600 arrow_ed25519
|
||||||
|
|
||||||
|
- name: Copy Identity File to Host
|
||||||
|
if: inputs.action == 'create'
|
||||||
|
run: |
|
||||||
|
ssh -i deploy_ed25519 -o StrictHostKeyChecking=accept-new noah@${{ steps.host.outputs.stdout }} 'mkdir -pv .ssh'
|
||||||
|
scp -i deploy_ed25519 arrow_ed25519 noah@${{ steps.host.outputs.stdout }}:~/.ssh/id_ed25519
|
||||||
|
|
||||||
|
- name: Wipe Records
|
||||||
|
if: ${{ inputs.action == 'destroy' }}
|
||||||
|
run: |
|
||||||
|
RECORD_ID=$(curl --request GET \
|
||||||
|
--url https://api.cloudflare.com/client/v4/zones/${{ env.CLOUDFLARE_ZONE_ID }}/dns_records \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--header "Authorization: Bearer ${{ env.CLOUDFLARE_API_TOKEN }}" | jq -r '.result[] | select(.name == "n8n2.${{ env.ZONE_NAME }}") | .id')
|
||||||
|
curl --request DELETE \
|
||||||
|
--url https://api.cloudflare.com/client/v4/zones/${{ env.CLOUDFLARE_ZONE_ID }}/dns_records/${RECORD_ID} \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--header "Authorization: Bearer ${{ env.CLOUDFLARE_API_TOKEN }}"
|
20
.github/workflows/check.yml
vendored
Normal file
20
.github/workflows/check.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
name: Check Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # allows manual triggering
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
name: Check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@v11
|
||||||
|
- name: Check Nixpkgs Inputs
|
||||||
|
uses: DeterminateSystems/flake-checker-action@v7
|
||||||
|
- name: Add Nix Cache
|
||||||
|
uses: DeterminateSystems/magic-nix-cache-action@v6
|
||||||
|
- name: Check the Flake
|
||||||
|
run: nix flake check
|
71
.github/workflows/update.yml
vendored
Normal file
71
.github/workflows/update.yml
vendored
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
name: Update Flake
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # allows manual triggering
|
||||||
|
schedule:
|
||||||
|
- cron: '33 3 * * 6' # runs weekly on Saturday at 03:33
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
checks: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lockfile:
|
||||||
|
name: Lockfile
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@v11
|
||||||
|
with:
|
||||||
|
nix-package-url: https://releases.nixos.org/nix/nix-2.18.4/nix-2.18.4-x86_64-linux.tar.xz
|
||||||
|
- name: Check Nixpkgs Inputs
|
||||||
|
uses: DeterminateSystems/flake-checker-action@v7
|
||||||
|
- name: Add Nix Cache
|
||||||
|
uses: DeterminateSystems/magic-nix-cache-action@v6
|
||||||
|
- name: Update flake.lock
|
||||||
|
uses: DeterminateSystems/update-flake-lock@v23
|
||||||
|
id: update
|
||||||
|
with:
|
||||||
|
pr-title: "Update flake.lock" # Title of PR to be created
|
||||||
|
pr-labels: | # Labels to be set on the PR
|
||||||
|
dependencies
|
||||||
|
automated
|
||||||
|
pr-body: |
|
||||||
|
Automated changes by the [update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock) GitHub Action.
|
||||||
|
|
||||||
|
```
|
||||||
|
{{ env.GIT_COMMIT_MESSAGE }}
|
||||||
|
```
|
||||||
|
- name: Check the Flake
|
||||||
|
id: check
|
||||||
|
run: nix flake check
|
||||||
|
- name: Update Check Status
|
||||||
|
uses: LouisBrunner/checks-action@v1.6.1
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
name: Update Flake
|
||||||
|
conclusion: ${{ job.status }}
|
||||||
|
output: |
|
||||||
|
{"summary":"${{ steps.check.outputs.stdout }}"}
|
||||||
|
- name: Enable Pull Request Automerge
|
||||||
|
if: success()
|
||||||
|
run: |
|
||||||
|
gh pr merge \
|
||||||
|
--rebase \
|
||||||
|
--auto \
|
||||||
|
${{ steps.update.outputs.pull-request-number }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
- name: Close Pull Request If Failed
|
||||||
|
if: failure()
|
||||||
|
run: |
|
||||||
|
gh pr close \
|
||||||
|
--comment "Auto-closing pull request" \
|
||||||
|
--delete-branch \
|
||||||
|
${{ steps.update.outputs.pull-request-number }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,9 +1,9 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
*.bak
|
*.bak
|
||||||
*.db
|
*.db
|
||||||
|
*.qcow2
|
||||||
**/.direnv/**
|
**/.direnv/**
|
||||||
result
|
result
|
||||||
.luarc.json
|
|
||||||
private/**
|
private/**
|
||||||
|
templates/**/flake.lock
|
||||||
!private/**.age
|
!private/**.age
|
||||||
!private/**.sha512
|
|
||||||
|
138
README.md
138
README.md
@ -6,21 +6,76 @@ hosts.
|
|||||||
They are organized and managed by [Nix](https://nixos.org), so some of the
|
They are organized and managed by [Nix](https://nixos.org), so some of the
|
||||||
configuration may be difficult to translate to a non-Nix system.
|
configuration may be difficult to translate to a non-Nix system.
|
||||||
|
|
||||||
However, some of the configurations are easier to lift directly:
|
## System Features
|
||||||
|
|
||||||
- [Neovim](https://github.com/nmasur/dotfiles/tree/master/modules/common/neovim/config)
|
| Feature | Program | Configuration |
|
||||||
- [Fish functions](https://github.com/nmasur/dotfiles/tree/master/modules/common/shell/fish/functions)
|
|----------------|-----------------------------------------------------|-----------------------------------------------|
|
||||||
- [More fish aliases](https://github.com/nmasur/dotfiles/blob/master/modules/common/shell/fish/default.nix)
|
| OS | [NixOS](https://nixos.org) | [Link](./modules/nixos) |
|
||||||
- [Git aliases](https://github.com/nmasur/dotfiles/blob/master/modules/common/shell/git.nix)
|
| Display Server | [X11](https://www.x.org/wiki/) | [Link](./modules/nixos/graphical/xorg.nix) |
|
||||||
- [Hammerspoon](https://github.com/nmasur/dotfiles/tree/master/modules/darwin/hammerspoon)
|
| Compositor | [Picom](https://github.com/yshui/picom) | [Link](./modules/nixos/graphical/picom.nix) |
|
||||||
|
| Window Manager | [i3](https://i3wm.org/) | [Link](./modules/nixos/graphical/i3.nix) |
|
||||||
|
| Panel | [Polybar](https://polybar.github.io/) | [Link](./modules/nixos/graphical/polybar.nix) |
|
||||||
|
| Font | [Victor Mono](https://rubjo.github.io/victor-mono/) | [Link](./modules/nixos/graphical/fonts.nix) |
|
||||||
|
| Launcher | [Rofi](https://github.com/davatorium/rofi) | [Link](./modules/nixos/graphical/rofi.nix) |
|
||||||
|
|
||||||
Try out my Neovim config (requires [nix](https://nixos.org/download.html)):
|
## User Features
|
||||||
|
|
||||||
|
| Feature | Program | Configuration |
|
||||||
|
|--------------|----------------------------------------------------------------------------------|----------------------------------------------------|
|
||||||
|
| Dotfiles | [Home-Manager](https://github.com/nix-community/home-manager) | [Link](./modules/common) |
|
||||||
|
| Terminal | [Kitty](https://sw.kovidgoyal.net/kitty/) | [Link](./modules/common/applications/kitty.nix) |
|
||||||
|
| Shell | [Fish](https://fishshell.com/) | [Link](./modules/common/shell/fish) |
|
||||||
|
| Shell Prompt | [Starship](https://starship.rs/) | [Link](./modules/common/shell/starship.nix) |
|
||||||
|
| Colorscheme | [Gruvbox](https://github.com/morhetz/gruvbox) | [Link](./colorscheme/gruvbox/default.nix) |
|
||||||
|
| Wallpaper | [Road](https://gitlab.com/exorcist365/wallpapers/-/blob/master/gruvbox/road.jpg) | [Link](./hosts/tempest/default.nix) |
|
||||||
|
| Text Editor | [Neovim](https://neovim.io/) | [Link](./modules/common/neovim/config) |
|
||||||
|
| Browser | [Firefox](https://www.mozilla.org/en-US/firefox/new/) | [Link](./modules/common/applications/firefox.nix) |
|
||||||
|
| E-Mail | [Aerc](https://aerc-mail.org/) | [Link](./modules/common/mail/aerc.nix) |
|
||||||
|
| File Manager | [Nautilus](https://wiki.gnome.org/action/show/Apps/Files) | [Link](./modules/common/applications/nautilus.nix) |
|
||||||
|
| PDF Reader | [Zathura](https://pwmt.org/projects/zathura/) | [Link](./modules/common/applications/media.nix) |
|
||||||
|
| Video Player | [mpv](https://mpv.io/) | [Link](./modules/common/applications/media.nix) |
|
||||||
|
|
||||||
|
## macOS Features
|
||||||
|
|
||||||
|
| Feature | Program | Configuration |
|
||||||
|
|----------|---------------------------------------------|--------------------------------------|
|
||||||
|
| Keybinds | [Hammerspoon](https://www.hammerspoon.org/) | [Link](./modules/darwin/hammerspoon) |
|
||||||
|
|
||||||
|
# Diagram
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Unique Configurations
|
||||||
|
|
||||||
|
This repo contains a few more elaborate elements of configuration.
|
||||||
|
|
||||||
|
- [Neovim config](./modules/common/neovim/default.nix) generated with Nix2Vim
|
||||||
|
and source-controlled plugins, differing based on installed LSPs, for example.
|
||||||
|
- [Caddy JSON](./modules/nixos/services/caddy.nix) file (routes, etc.) based
|
||||||
|
dynamically on enabled services rendered with Nix.
|
||||||
|
- [Grafana config](./modules/nixos/services/grafana.nix) rendered with Nix.
|
||||||
|
- Custom [secrets deployment](./modules/nixos/services/secrets.nix) similar to
|
||||||
|
agenix.
|
||||||
|
- Base16 [colorschemes](./colorscheme/) applied to multiple applications,
|
||||||
|
including Firefox userChrome.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
Click [here](./docs/installation.md) for detailed installation instructions.
|
||||||
|
|
||||||
|
# Neovim
|
||||||
|
|
||||||
|
Try out my Neovim config with nix:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nix run github:nmasur/dotfiles#neovim
|
nix run github:nmasur/dotfiles#neovim
|
||||||
```
|
```
|
||||||
|
|
||||||
Or build it as a package (requires [nix](https://nixos.org/download.html)):
|
Or build it as a package:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nix build github:nmasur/dotfiles#neovim
|
nix build github:nmasur/dotfiles#neovim
|
||||||
@ -30,73 +85,6 @@ If you already have a Neovim configuration, you may need to move it out of
|
|||||||
`~/.config/nvim` or set `XDG_CONFIG_HOME` to another value; otherwise both
|
`~/.config/nvim` or set `XDG_CONFIG_HOME` to another value; otherwise both
|
||||||
configs might conflict with each other.
|
configs might conflict with each other.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Full Installation
|
|
||||||
|
|
||||||
## NixOS - From Live Disk
|
|
||||||
|
|
||||||
Format drives and build system from any NixOS host, including the live
|
|
||||||
installer disk:
|
|
||||||
|
|
||||||
**This will erase your drives; use at your own risk!**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
lsblk # Choose the disk you want to wipe
|
|
||||||
nix-shell -p nixVersions.stable
|
|
||||||
nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest
|
|
||||||
```
|
|
||||||
|
|
||||||
## NixOS - From Existing System
|
|
||||||
|
|
||||||
If you're already running NixOS, you can switch to this configuration with the
|
|
||||||
following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nix-shell -p nixVersions.stable
|
|
||||||
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#tempest
|
|
||||||
```
|
|
||||||
|
|
||||||
## Windows - From NixOS WSL
|
|
||||||
|
|
||||||
After [installing NixOS on
|
|
||||||
WSL](https://xeiaso.net/blog/nix-flakes-4-wsl-2022-05-01), you can switch to
|
|
||||||
the WSL configuration:
|
|
||||||
|
|
||||||
```
|
|
||||||
nix-shell -p nixVersions.stable
|
|
||||||
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#hydra
|
|
||||||
```
|
|
||||||
|
|
||||||
You should also download the
|
|
||||||
[FiraCode](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.2.2/FiraCode.zip)
|
|
||||||
font and install it on Windows. Install [Alacritty](https://alacritty.org/) and
|
|
||||||
move the `windows/alacritty.yml` file to
|
|
||||||
`C:\Users\<user>\AppData\Roaming\alacritty`.
|
|
||||||
|
|
||||||
## macOS
|
|
||||||
|
|
||||||
To get started on a bare macOS installation, first install Nix:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sh -c "$(curl -L https://nixos.org/nix/install)"
|
|
||||||
```
|
|
||||||
|
|
||||||
Then use Nix to build nix-darwin:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
|
|
||||||
./result/bin/darwin-installer
|
|
||||||
```
|
|
||||||
|
|
||||||
Then switch to the macOS configuration:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
darwin-rebuild switch --flake github:nmasur/dotfiles#lookingglass
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Flake Templates
|
# Flake Templates
|
||||||
|
|
||||||
You can also use the [templates](./templates/) as flakes for starting new
|
You can also use the [templates](./templates/) as flakes for starting new
|
||||||
|
9
apps/README.md
Normal file
9
apps/README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Apps
|
||||||
|
|
||||||
|
These are all my miscellaneous utilies and scripts to accompany this project.
|
||||||
|
|
||||||
|
They can be run with:
|
||||||
|
|
||||||
|
```
|
||||||
|
nix run github:nmasur/dotfiles#appname
|
||||||
|
```
|
@ -1,45 +1,20 @@
|
|||||||
{ pkgs, ... }: rec {
|
{ pkgs, ... }:
|
||||||
|
rec {
|
||||||
|
|
||||||
default = {
|
# Show quick helper
|
||||||
type = "app";
|
default = import ./help.nix { inherit pkgs; };
|
||||||
program = builtins.toString (pkgs.writeShellScript "default" ''
|
|
||||||
${pkgs.gum}/bin/gum style --margin "1 2" --padding "0 2" --foreground "15" --background "55" "Options"
|
|
||||||
${pkgs.gum}/bin/gum format --type=template -- ' {{ Italic "Run with" }} {{ Color "15" "69" " nix run github:nmasur/dotfiles#" }}{{ Color "15" "62" "someoption" }}{{ Color "15" "69" " " }}.'
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
${pkgs.gum}/bin/gum format --type=template -- \
|
|
||||||
' • {{ Color "15" "57" " readme " }} {{ Italic "Documentation for this repository." }}' \
|
|
||||||
' • {{ Color "15" "57" " rebuild " }} {{ Italic "Switch to this configuration." }}' \
|
|
||||||
' • {{ Color "15" "57" " installer " }} {{ Italic "Format and install from nothing." }}' \
|
|
||||||
' • {{ Color "15" "57" " neovim " }} {{ Italic "Test out the Neovim package." }}' \
|
|
||||||
' • {{ Color "15" "57" " loadkey " }} {{ Italic "Load an ssh key for this machine using melt." }}' \
|
|
||||||
' • {{ Color "15" "57" " encrypt-secret " }} {{ Italic "Encrypt a secret for all machines." }}' \
|
|
||||||
' • {{ Color "15" "57" " reencrypt-secrets " }} {{ Italic "Reencrypt all secrets when new machine is added." }}' \
|
|
||||||
' • {{ Color "15" "57" " netdata " }} {{ Italic "Connect a machine to Netdata cloud." }}'
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
'');
|
|
||||||
};
|
|
||||||
|
|
||||||
# Format and install from nothing
|
# Format primary disk
|
||||||
|
format-root = import ./format-root.nix { inherit pkgs; };
|
||||||
|
|
||||||
|
# Format and install from nothing (deprecated)
|
||||||
installer = import ./installer.nix { inherit pkgs; };
|
installer = import ./installer.nix { inherit pkgs; };
|
||||||
|
|
||||||
# Display the readme for this repository
|
# Display the readme for this repository
|
||||||
readme = import ./readme.nix { inherit pkgs; };
|
readme = import ./readme.nix { inherit pkgs; };
|
||||||
|
|
||||||
# Rebuild
|
# Rebuild
|
||||||
rebuild = {
|
rebuild = import ./rebuild.nix { inherit pkgs; };
|
||||||
type = "app";
|
|
||||||
program = builtins.toString (pkgs.writeShellScript "rebuild" ''
|
|
||||||
echo ${pkgs.system}
|
|
||||||
SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"}
|
|
||||||
if [ "$SYSTEM" == "darwin" ]; then
|
|
||||||
darwin-rebuild switch --flake github:nmasur/dotfiles#lookingglass
|
|
||||||
else
|
|
||||||
nixos-rebuild switch --flake github:nmasur/dotfiles
|
|
||||||
fi
|
|
||||||
'');
|
|
||||||
};
|
|
||||||
|
|
||||||
# Load the SSH key for this machine
|
# Load the SSH key for this machine
|
||||||
loadkey = import ./loadkey.nix { inherit pkgs; };
|
loadkey = import ./loadkey.nix { inherit pkgs; };
|
||||||
@ -54,17 +29,6 @@
|
|||||||
netdata = import ./netdata-cloud.nix { inherit pkgs; };
|
netdata = import ./netdata-cloud.nix { inherit pkgs; };
|
||||||
|
|
||||||
# Run neovim as an app
|
# Run neovim as an app
|
||||||
neovim = {
|
neovim = import ./neovim.nix { inherit pkgs; };
|
||||||
type = "app";
|
|
||||||
program = "${
|
|
||||||
(import ../modules/common/neovim/package {
|
|
||||||
inherit pkgs;
|
|
||||||
colors =
|
|
||||||
import ../colorscheme/gruvbox/neovim-gruvbox.nix { inherit pkgs; };
|
|
||||||
})
|
|
||||||
}/bin/nvim";
|
|
||||||
};
|
|
||||||
|
|
||||||
nvim = neovim;
|
nvim = neovim;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
# nix run github:nmasur/dotfiles#encrypt-secret > private/mysecret.age
|
# nix run github:nmasur/dotfiles#encrypt-secret > private/mysecret.age
|
||||||
|
|
||||||
type = "app";
|
type = "app";
|
||||||
|
|
||||||
program = builtins.toString (pkgs.writeShellScript "encrypt-secret" ''
|
program = builtins.toString (
|
||||||
|
pkgs.writeShellScript "encrypt-secret" ''
|
||||||
printf "\nEnter the secret data to encrypt for all hosts...\n\n" 1>&2
|
printf "\nEnter the secret data to encrypt for all hosts...\n\n" 1>&2
|
||||||
read -p "Secret: " secret
|
read -p "Secret: " secret
|
||||||
printf "\nEncrypting...\n\n" 1>&2
|
printf "\nEncrypting...\n\n" 1>&2
|
||||||
tmpfile=$(mktemp)
|
tmpfile=$(mktemp)
|
||||||
echo "''${secret}" > ''${tmpfile}
|
echo "''${secret}" > ''${tmpfile}
|
||||||
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${
|
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${builtins.toString ../misc/public-keys} $tmpfile
|
||||||
builtins.toString ../public-keys
|
|
||||||
} $tmpfile
|
|
||||||
rm $tmpfile
|
rm $tmpfile
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
41
apps/format-root.nix
Normal file
41
apps/format-root.nix
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
|
# This script will partition and format drives; use at your own risk!
|
||||||
|
|
||||||
|
type = "app";
|
||||||
|
|
||||||
|
program = builtins.toString (
|
||||||
|
pkgs.writeShellScript "format-root" ''
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DISK=$1
|
||||||
|
|
||||||
|
if [ -z "''${DISK}" ]; then
|
||||||
|
${pkgs.gum}/bin/gum style --width 50 --margin "1 2" --padding "2 4" \
|
||||||
|
--foreground "#fb4934" \
|
||||||
|
"Missing required parameter." \
|
||||||
|
"Usage: format-root -- <disk>" \
|
||||||
|
"Flake example: nix run github:nmasur/dotfiles#format-root -- nvme0n1"
|
||||||
|
echo "(exiting)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
${pkgs.disko}/bin/disko \
|
||||||
|
--mode create \
|
||||||
|
--dry-run \
|
||||||
|
--flake "path:$(pwd)#root" \
|
||||||
|
--arg disk \""/dev/''${DISK}"\"
|
||||||
|
|
||||||
|
${pkgs.gum}/bin/gum confirm \
|
||||||
|
"This will ERASE ALL DATA on the disk /dev/''${DISK}. Are you sure you want to continue?" \
|
||||||
|
--default=false
|
||||||
|
|
||||||
|
${pkgs.disko}/bin/disko \
|
||||||
|
--mode create \
|
||||||
|
--flake "path:$(pwd)#root" \
|
||||||
|
--arg disk "/dev/''${DISK}"
|
||||||
|
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
25
apps/help.nix
Normal file
25
apps/help.nix
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
|
type = "app";
|
||||||
|
|
||||||
|
program = builtins.toString (
|
||||||
|
pkgs.writeShellScript "default" ''
|
||||||
|
${pkgs.gum}/bin/gum style --margin "1 2" --padding "0 2" --foreground "15" --background "55" "Options"
|
||||||
|
${pkgs.gum}/bin/gum format --type=template -- ' {{ Italic "Run with" }} {{ Color "15" "69" " nix run github:nmasur/dotfiles#" }}{{ Color "15" "62" "someoption" }}{{ Color "15" "69" " " }}.'
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
${pkgs.gum}/bin/gum format --type=template -- \
|
||||||
|
' • {{ Color "15" "57" " readme " }} {{ Italic "Documentation for this repository." }}' \
|
||||||
|
' • {{ Color "15" "57" " rebuild " }} {{ Italic "Switch to this configuration." }}' \
|
||||||
|
' • {{ Color "15" "57" " installer " }} {{ Italic "Format and install from nothing." }}' \
|
||||||
|
' • {{ Color "15" "57" " neovim " }} {{ Italic "Test out the Neovim package." }}' \
|
||||||
|
' • {{ Color "15" "57" " loadkey " }} {{ Italic "Load an ssh key for this machine using melt." }}' \
|
||||||
|
' • {{ Color "15" "57" " encrypt-secret " }} {{ Italic "Encrypt a secret for all machines." }}' \
|
||||||
|
' • {{ Color "15" "57" " reencrypt-secrets " }} {{ Italic "Reencrypt all secrets when new machine is added." }}' \
|
||||||
|
' • {{ Color "15" "57" " netdata " }} {{ Italic "Connect a machine to Netdata cloud." }}'
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
@ -1,11 +1,13 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
# Inspired by https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix
|
# Inspired by https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix
|
||||||
# This script will partition and format drives; use at your own risk!
|
# This script will partition and format drives; use at your own risk!
|
||||||
|
|
||||||
type = "app";
|
type = "app";
|
||||||
|
|
||||||
program = builtins.toString (pkgs.writeShellScript "installer" ''
|
program = builtins.toString (
|
||||||
|
pkgs.writeShellScript "installer" ''
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
DISK=$1
|
DISK=$1
|
||||||
@ -17,8 +19,8 @@
|
|||||||
--foreground "#fb4934" \
|
--foreground "#fb4934" \
|
||||||
"Missing required parameter." \
|
"Missing required parameter." \
|
||||||
"Usage: installer -- <disk> <host>" \
|
"Usage: installer -- <disk> <host>" \
|
||||||
"Example: installer -- nvme0n1 desktop" \
|
"Example: installer -- nvme0n1 tempest" \
|
||||||
"Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 desktop"
|
"Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest"
|
||||||
echo "(exiting)"
|
echo "(exiting)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -43,6 +45,6 @@
|
|||||||
mount /dev/disk/by-label/boot /mnt/boot
|
mount /dev/disk/by-label/boot /mnt/boot
|
||||||
|
|
||||||
${pkgs.nixos-install-tools}/bin/nixos-install --flake github:nmasur/dotfiles#''${FLAKE}
|
${pkgs.nixos-install-tools}/bin/nixos-install --flake github:nmasur/dotfiles#''${FLAKE}
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
type = "app";
|
type = "app";
|
||||||
|
|
||||||
program = builtins.toString (pkgs.writeShellScript "loadkey" ''
|
program = builtins.toString (
|
||||||
|
pkgs.writeShellScript "loadkey" ''
|
||||||
printf "\nEnter the seed phrase for your SSH key...\n"
|
printf "\nEnter the seed phrase for your SSH key...\n"
|
||||||
printf "\nThen press ^D when complete.\n\n"
|
printf "\nThen press ^D when complete.\n\n"
|
||||||
|
mkdir -p ~/.ssh/
|
||||||
${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
|
${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
|
||||||
printf "\n\nContinuing activation.\n\n"
|
printf "\n\nContinuing activation.\n\n"
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
12
apps/neovim.nix
Normal file
12
apps/neovim.nix
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
|
type = "app";
|
||||||
|
|
||||||
|
program = "${
|
||||||
|
(import ../modules/common/neovim/package {
|
||||||
|
inherit pkgs;
|
||||||
|
colors = (import ../colorscheme/nord).dark;
|
||||||
|
})
|
||||||
|
}/bin/nvim";
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
type = "app";
|
type = "app";
|
||||||
|
|
||||||
program = builtins.toString (pkgs.writeShellScript "netdata-cloud" ''
|
program = builtins.toString (
|
||||||
|
pkgs.writeShellScript "netdata-cloud" ''
|
||||||
if [ "$EUID" -ne 0 ]; then
|
if [ "$EUID" -ne 0 ]; then
|
||||||
echo "Please run as root"
|
echo "Please run as root"
|
||||||
exit 1
|
exit 1
|
||||||
@ -14,6 +16,6 @@
|
|||||||
chown -R netdata:netdata /var/lib/netdata
|
chown -R netdata:netdata /var/lib/netdata
|
||||||
${pkgs.netdata}/bin/netdata-claim.sh -id=$(uuidgen)
|
${pkgs.netdata}/bin/netdata-claim.sh -id=$(uuidgen)
|
||||||
printf "\n\nNow restart netdata service.\n\n"
|
printf "\n\nNow restart netdata service.\n\n"
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
type = "app";
|
type = "app";
|
||||||
|
|
||||||
program = builtins.toString (pkgs.writeShellScript "readme" ''
|
program = builtins.toString (
|
||||||
|
pkgs.writeShellScript "readme" ''
|
||||||
${pkgs.glow}/bin/glow --pager ${builtins.toString ../README.md}
|
${pkgs.glow}/bin/glow --pager ${builtins.toString ../README.md}
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
17
apps/rebuild.nix
Normal file
17
apps/rebuild.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
|
type = "app";
|
||||||
|
|
||||||
|
program = builtins.toString (
|
||||||
|
pkgs.writeShellScript "rebuild" ''
|
||||||
|
echo ${pkgs.system}
|
||||||
|
SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"}
|
||||||
|
if [ "$SYSTEM" == "darwin" ]; then
|
||||||
|
sudo darwin-rebuild switch --flake ${builtins.toString ../.}
|
||||||
|
else
|
||||||
|
doas nixos-rebuild switch --flake ${builtins.toString ../.}
|
||||||
|
fi
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
@ -1,10 +1,12 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
# nix run github:nmasur/dotfiles#reencrypt-secrets ./private
|
# nix run github:nmasur/dotfiles#reencrypt-secrets ./private
|
||||||
|
|
||||||
type = "app";
|
type = "app";
|
||||||
|
|
||||||
program = builtins.toString (pkgs.writeShellScript "reencrypt-secrets" ''
|
program = builtins.toString (
|
||||||
|
pkgs.writeShellScript "reencrypt-secrets" ''
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo "Must provide directory to reencrypt."
|
echo "Must provide directory to reencrypt."
|
||||||
exit 1
|
exit 1
|
||||||
@ -16,12 +18,10 @@
|
|||||||
${pkgs.age}/bin/age --decrypt \
|
${pkgs.age}/bin/age --decrypt \
|
||||||
--identity ~/.ssh/id_ed25519 $encryptedfile > $tmpfile
|
--identity ~/.ssh/id_ed25519 $encryptedfile > $tmpfile
|
||||||
echo "Encrypting ''${encryptedfile}..."
|
echo "Encrypting ''${encryptedfile}..."
|
||||||
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${
|
${pkgs.age}/bin/age --encrypt --armor --recipients-file ${builtins.toString ../misc/public-keys} $tmpfile > $encryptedfile
|
||||||
builtins.toString ../public-keys
|
|
||||||
} $tmpfile > $encryptedfile
|
|
||||||
rm $tmpfile
|
rm $tmpfile
|
||||||
done
|
done
|
||||||
echo "Finished."
|
echo "Finished."
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
5
colorscheme/README.md
Normal file
5
colorscheme/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Colorschemes
|
||||||
|
|
||||||
|
Color information for different themes is found here. The colors are sourced
|
||||||
|
and used with [base16](https://github.com/chriskempson/base16) format
|
||||||
|
consistently across the system.
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
name = "everforest"; # dark, hard
|
name = "everforest"; # dark, hard
|
||||||
author = "Sainnhe Park";
|
author = "Sainnhe Park";
|
||||||
|
dark = {
|
||||||
base00 = "#2b3339"; # Default Background
|
base00 = "#2b3339"; # Default Background
|
||||||
base01 = "#323c41"; # Lighter Background
|
base01 = "#323c41"; # Lighter Background
|
||||||
base02 = "#503946"; # Selection Background
|
base02 = "#503946"; # Selection Background
|
||||||
@ -17,4 +18,5 @@
|
|||||||
base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings
|
base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings
|
||||||
base0E = "#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed
|
base0E = "#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed
|
||||||
base0F = "#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ...
|
base0F = "#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ...
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
44
colorscheme/gruvbox-dark/default.nix
Normal file
44
colorscheme/gruvbox-dark/default.nix
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# Gruvbox with a darker background for greater contrast
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "gruvbox-dark"; # Dark, Medium
|
||||||
|
author = "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox), ElRastaOk (https://www.reddit.com/user/ElRastaOk)";
|
||||||
|
dark = {
|
||||||
|
base00 = "#1D2122"; # ---- This is the change from normal gruvbox
|
||||||
|
base01 = "#3c3836"; # ---
|
||||||
|
base02 = "#504945"; # --
|
||||||
|
base03 = "#665c54"; # -
|
||||||
|
base04 = "#bdae93"; # +
|
||||||
|
base05 = "#d5c4a1"; # ++
|
||||||
|
base06 = "#ebdbb2"; # +++
|
||||||
|
base07 = "#fbf1c7"; # ++++
|
||||||
|
base08 = "#fb4934"; # red
|
||||||
|
base09 = "#fe8019"; # orange
|
||||||
|
base0A = "#fabd2f"; # yellow
|
||||||
|
base0B = "#b8bb26"; # green
|
||||||
|
base0C = "#8ec07c"; # aqua/cyan
|
||||||
|
base0D = "#83a598"; # blue
|
||||||
|
base0E = "#d3869b"; # purple
|
||||||
|
base0F = "#d65d0e"; # brown
|
||||||
|
batTheme = "gruvbox-dark";
|
||||||
|
};
|
||||||
|
light = {
|
||||||
|
base00 = "#fbf1c7"; # ----
|
||||||
|
base01 = "#ebdbb2"; # ---
|
||||||
|
base02 = "#d5c4a1"; # --
|
||||||
|
base03 = "#bdae93"; # -
|
||||||
|
base04 = "#665c54"; # +
|
||||||
|
base05 = "#504945"; # ++
|
||||||
|
base06 = "#3c3836"; # +++
|
||||||
|
base07 = "#1D2122"; # ++++ Adjusted darker here
|
||||||
|
base08 = "#9d0006"; # red
|
||||||
|
base09 = "#af3a03"; # orange
|
||||||
|
base0A = "#b57614"; # yellow
|
||||||
|
base0B = "#79740e"; # green
|
||||||
|
base0C = "#427b58"; # aqua/cyan
|
||||||
|
base0D = "#076678"; # blue
|
||||||
|
base0E = "#8f3f71"; # purple
|
||||||
|
base0F = "#d65d0e"; # brown
|
||||||
|
batTheme = "gruvbox-light";
|
||||||
|
};
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
name = "gruvbox"; # Dark, Medium
|
name = "gruvbox"; # Dark, Medium
|
||||||
author =
|
author = "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)";
|
||||||
"Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)";
|
|
||||||
dark = {
|
dark = {
|
||||||
base00 = "#282828"; # ----
|
base00 = "#282828"; # ----
|
||||||
base01 = "#3c3836"; # ---
|
base01 = "#3c3836"; # ---
|
||||||
@ -19,7 +18,6 @@
|
|||||||
base0D = "#83a598"; # blue
|
base0D = "#83a598"; # blue
|
||||||
base0E = "#d3869b"; # purple
|
base0E = "#d3869b"; # purple
|
||||||
base0F = "#d65d0e"; # brown
|
base0F = "#d65d0e"; # brown
|
||||||
neovimConfig = ./neovim-gruvbox.nix;
|
|
||||||
batTheme = "gruvbox-dark";
|
batTheme = "gruvbox-dark";
|
||||||
};
|
};
|
||||||
light = {
|
light = {
|
||||||
@ -39,7 +37,6 @@
|
|||||||
base0D = "#076678"; # blue
|
base0D = "#076678"; # blue
|
||||||
base0E = "#8f3f71"; # purple
|
base0E = "#8f3f71"; # purple
|
||||||
base0F = "#d65d0e"; # brown
|
base0F = "#d65d0e"; # brown
|
||||||
neovimConfig = ./neovim-gruvbox.nix;
|
|
||||||
batTheme = "gruvbox-light";
|
batTheme = "gruvbox-light";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
{ pkgs, ... }: {
|
|
||||||
|
|
||||||
plugins = [ pkgs.vimPlugins.vim-gruvbox8 ];
|
|
||||||
|
|
||||||
vim.g.gruvbox_italicize_strings = 0;
|
|
||||||
vim.o.background = "dark";
|
|
||||||
vimscript = ''
|
|
||||||
let g:gruvbox_italicize_strings = 0
|
|
||||||
colorscheme gruvbox8
|
|
||||||
'';
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
name = "nord";
|
name = "nord";
|
||||||
author = "arcticicestudio";
|
author = "arcticicestudio";
|
||||||
|
dark = {
|
||||||
base00 = "#2E3440";
|
base00 = "#2E3440";
|
||||||
base01 = "#3B4252";
|
base01 = "#3B4252";
|
||||||
base02 = "#434C5E";
|
base02 = "#434C5E";
|
||||||
@ -17,5 +18,6 @@
|
|||||||
base0D = "#EBCB8B";
|
base0D = "#EBCB8B";
|
||||||
base0E = "#A3BE8C";
|
base0E = "#A3BE8C";
|
||||||
base0F = "#B48EAD";
|
base0F = "#B48EAD";
|
||||||
neovimConfig = ./neovim.lua;
|
batTheme = "nord";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
M.packer = function(use)
|
|
||||||
use({
|
|
||||||
"shaunsingh/nord.nvim",
|
|
||||||
config = function()
|
|
||||||
vim.g.nord_italic = true
|
|
||||||
vim.cmd("colorscheme nord")
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
5
disks/README.md
Normal file
5
disks/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Disks
|
||||||
|
|
||||||
|
These are my [disko](https://github.com/nix-community/disko) configurations,
|
||||||
|
which allow me to save desired disk formatting layouts as a declarative file so
|
||||||
|
I don't have to remember how to format my disks later on.
|
39
disks/root.nix
Normal file
39
disks/root.nix
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{ disk, ... }:
|
||||||
|
{
|
||||||
|
disk = {
|
||||||
|
boot = {
|
||||||
|
type = "disk";
|
||||||
|
device = disk;
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
# Boot partition
|
||||||
|
ESP = rec {
|
||||||
|
size = "512MiB";
|
||||||
|
type = "EF00";
|
||||||
|
label = "boot";
|
||||||
|
device = "/dev/disk/by-label/${label}";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
extraArgs = [ "-n ${label}" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
# Root partition ext4
|
||||||
|
root = rec {
|
||||||
|
size = "100%";
|
||||||
|
label = "nixos";
|
||||||
|
device = "/dev/disk/by-label/${label}";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
extraArgs = [ "-L ${label}" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
98
disks/zfs.nix
Normal file
98
disks/zfs.nix
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
{ pool, disks, ... }:
|
||||||
|
{
|
||||||
|
disk = lib.genAttrs disks (disk: {
|
||||||
|
"${disk}" = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/${disk}";
|
||||||
|
content = {
|
||||||
|
type = "table";
|
||||||
|
format = "gpt";
|
||||||
|
partitions = [
|
||||||
|
{
|
||||||
|
type = "partition";
|
||||||
|
name = "zfs";
|
||||||
|
start = "128MiB";
|
||||||
|
end = "100%";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = pool;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
zpool = {
|
||||||
|
"${pool}" = {
|
||||||
|
type = "zpool";
|
||||||
|
mode = "raidz1";
|
||||||
|
rootFsOptions = {
|
||||||
|
compression = "on"; # lz4 by default
|
||||||
|
"com.sun:auto-snapshot" = "false";
|
||||||
|
ashift = "12";
|
||||||
|
};
|
||||||
|
# mountpoint = "/";
|
||||||
|
|
||||||
|
datasets = {
|
||||||
|
root = {
|
||||||
|
zfs_type = "filesystem";
|
||||||
|
mountpoint = null;
|
||||||
|
options."com.sun:auto-snapshot" = "false";
|
||||||
|
};
|
||||||
|
# "media/movies" = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# mountpoint = "/media/movies";
|
||||||
|
# options.recordsize = "1M";
|
||||||
|
# };
|
||||||
|
# "media/tv" = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# mountpoint = "/media/tv";
|
||||||
|
# options.recordsize = "1M";
|
||||||
|
# };
|
||||||
|
# "media/books" = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# mountpoint = "/media/books";
|
||||||
|
# };
|
||||||
|
# archive = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# mountpoint = "/archive";
|
||||||
|
# options.compression = "zstd";
|
||||||
|
# options."com.sun:auto-snapshot" = "true";
|
||||||
|
# };
|
||||||
|
# zfs_unmounted_fs = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# options.mountpoint = "none";
|
||||||
|
# };
|
||||||
|
# zfs_legacy_fs = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# options.mountpoint = "legacy";
|
||||||
|
# mountpoint = "/zfs_legacy_fs";
|
||||||
|
# };
|
||||||
|
# zfs_testvolume = {
|
||||||
|
# zfs_type = "volume";
|
||||||
|
# size = "10M";
|
||||||
|
# content = {
|
||||||
|
# type = "filesystem";
|
||||||
|
# format = "ext4";
|
||||||
|
# mountpoint = "/ext4onzfs";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# encrypted = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# size = "20M";
|
||||||
|
# options = {
|
||||||
|
# mountpoint = "none";
|
||||||
|
# encryption = "aes-256-gcm";
|
||||||
|
# keyformat = "passphrase";
|
||||||
|
# keylocation = "file:///tmp/secret.key";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# "encrypted/test" = {
|
||||||
|
# zfs_type = "filesystem";
|
||||||
|
# size = "2M";
|
||||||
|
# mountpoint = "/zfs_crypted";
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
4
docs/README.md
Normal file
4
docs/README.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Documentation
|
||||||
|
|
||||||
|
Reference documents for some of the more complicated services and maintenance
|
||||||
|
tasks.
|
73
docs/installation.md
Normal file
73
docs/installation.md
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
[Back to README](../README.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
## NixOS - From Live Disk
|
||||||
|
|
||||||
|
Format drives and build system from any NixOS host, including the live
|
||||||
|
installer disk:
|
||||||
|
|
||||||
|
**This will erase your drives; use at your own risk!**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lsblk # Choose the disk you want to wipe
|
||||||
|
nix-shell -p nixVersions.stable
|
||||||
|
nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest
|
||||||
|
```
|
||||||
|
|
||||||
|
## NixOS - From Existing System
|
||||||
|
|
||||||
|
If you're already running NixOS, you can switch to this configuration with the
|
||||||
|
following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix-shell -p nixVersions.stable
|
||||||
|
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#tempest
|
||||||
|
```
|
||||||
|
|
||||||
|
## Windows - From NixOS WSL
|
||||||
|
|
||||||
|
After [installing NixOS on
|
||||||
|
WSL](https://xeiaso.net/blog/nix-flakes-4-wsl-2022-05-01), you can switch to
|
||||||
|
the WSL configuration:
|
||||||
|
|
||||||
|
```
|
||||||
|
nix-shell -p nixVersions.stable
|
||||||
|
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#hydra
|
||||||
|
```
|
||||||
|
|
||||||
|
You should also download the
|
||||||
|
[FiraCode](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.2.2/FiraCode.zip)
|
||||||
|
font and install it on Windows. Install [Alacritty](https://alacritty.org/) and
|
||||||
|
move the `windows/alacritty.yml` file to
|
||||||
|
`C:\Users\<user>\AppData\Roaming\alacritty`.
|
||||||
|
|
||||||
|
## macOS
|
||||||
|
|
||||||
|
To get started on a bare macOS installation, first install Nix:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
||||||
|
```
|
||||||
|
|
||||||
|
Launch a new shell. Then use Nix to switch to the macOS configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo rm /etc/bashrc
|
||||||
|
sudo rm /etc/nix/nix.conf
|
||||||
|
export NIX_SSL_CERT_FILE="$HOME/Documents/t2-ca-bundle.pem"
|
||||||
|
nix \
|
||||||
|
--extra-experimental-features flakes \
|
||||||
|
--extra-experimental-features nix-command \
|
||||||
|
run nix-darwin -- switch \
|
||||||
|
--flake github:nmasur/dotfiles#lookingglass
|
||||||
|
```
|
||||||
|
|
||||||
|
Once installed, you can continue to update the macOS configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
darwin-rebuild switch --flake ~/dev/personal/dotfiles
|
||||||
|
```
|
||||||
|
|
82
docs/repair-nextcloud.md
Normal file
82
docs/repair-nextcloud.md
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
# Repairing Nextcloud
|
||||||
|
|
||||||
|
You can run the maintenance commands like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo -u nextcloud nextcloud-occ maintenance:mode --on
|
||||||
|
sudo -u nextcloud nextcloud-occ maintenance:repair
|
||||||
|
sudo -u nextcloud nextcloud-occ maintenance:mode --off
|
||||||
|
```
|
||||||
|
|
||||||
|
## Rescan Files
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo -u nextcloud nextcloud-occ files:scan --all
|
||||||
|
```
|
||||||
|
|
||||||
|
## Converting from SQLite to MySQL (mariadb)
|
||||||
|
|
||||||
|
First: keep Nextcloud set to SQLite as its dbtype, and separately launch MySQL
|
||||||
|
as a service by copying the configuration found
|
||||||
|
[here](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/web-apps/nextcloud.nix).
|
||||||
|
|
||||||
|
No password is necessary, since the user-based auth works with UNIX sockets.
|
||||||
|
|
||||||
|
You can connect to the MySQL instance like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo -u nextcloud mysql -S /run/mysqld/mysqld.sock
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a blank database for Nextcloud:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
create database nextcloud;
|
||||||
|
```
|
||||||
|
|
||||||
|
Now setup the [conversion](https://docs.nextcloud.com/server/17/admin_manual/configuration_database/db_conversion.html):
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo -u nextcloud nextcloud-occ db:convert-type mysql nextcloud localhost nextcloud
|
||||||
|
```
|
||||||
|
|
||||||
|
Ignore the password prompt. Proceed with the conversion.
|
||||||
|
|
||||||
|
Now `config.php` will be updated but the override config from NixOS will not
|
||||||
|
be. Now update your NixOS configuration:
|
||||||
|
|
||||||
|
- Remove the `mysql` service you created.
|
||||||
|
- Set `dbtype` to `mysql`.
|
||||||
|
- Set `database.createLocally` to `true`.
|
||||||
|
|
||||||
|
Rebuild your configuration.
|
||||||
|
|
||||||
|
Now, make sure to enable [4-byte
|
||||||
|
support](https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/mysql_4byte_support.html)
|
||||||
|
in the database.
|
||||||
|
|
||||||
|
## Backing Up MySQL Database
|
||||||
|
|
||||||
|
Use this mysqldump command:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo -u nextcloud mysqldump -S /run/mysqld/mysqld.sock --default-character-set=utf8mb4 nextcloud > backup.sql
|
||||||
|
```
|
||||||
|
|
||||||
|
## Converting to Postgres
|
||||||
|
|
||||||
|
Same as MySQL, but run this command instead:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo -u nextcloud nextcloud-occ db:convert-type pgsql nextcloud /run/postgresql/ nextcloud
|
||||||
|
```
|
||||||
|
|
||||||
|
Then set the `dbtype` to `pgsql`.
|
||||||
|
|
||||||
|
## Backing Up Postgres Database
|
||||||
|
|
||||||
|
Use this pg_dump command:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo -u nextcloud pg_dump nextcloud > backup.sql
|
||||||
|
```
|
23
docs/restore-calibre.md
Normal file
23
docs/restore-calibre.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Restoring Calibre From Backup
|
||||||
|
|
||||||
|
The `metadata.db` holds the library and `app.db` and `gdrive.db` contain the
|
||||||
|
web/account information.
|
||||||
|
|
||||||
|
Place books directories in `/data/books/`.
|
||||||
|
|
||||||
|
Place `metadata.db` in `/var/lib/calibre-web-db/`.
|
||||||
|
|
||||||
|
Symlink `metadata.db` to the library:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo ln -s /var/lib/calibre-web-db/metadata.db /data/books/metadata.db
|
||||||
|
```
|
||||||
|
|
||||||
|
Place `app.db` and `gdrive.db` in `/var/lib/calibre-web/`.
|
||||||
|
|
||||||
|
Restart Calibre:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo systemctl restart calibre-web.service
|
||||||
|
```
|
||||||
|
|
45
docs/zfs.md
Normal file
45
docs/zfs.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# ZFS
|
||||||
|
|
||||||
|
Swan runs its root on ext4. The ZFS drives are managed imperatively (this
|
||||||
|
[disko configuration](../disks/zfs.nix) is an unused work-in-progress).
|
||||||
|
|
||||||
|
The basic ZFS settings are managed [here](../modules/nixos/hardware/zfs.nix).
|
||||||
|
|
||||||
|
## Creating a New Dataset
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo zfs create tank/mydataset
|
||||||
|
sudo zfs set compression=zstd tank/myzstddataset
|
||||||
|
sudo zfs set mountpoint=/data/mydataset tank/mydataset
|
||||||
|
```
|
||||||
|
|
||||||
|
## Maintenance
|
||||||
|
|
||||||
|
### Get Status
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo zpool status
|
||||||
|
```
|
||||||
|
|
||||||
|
### Replace Disk
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo zdb
|
||||||
|
sudo zpool status -g # Show by GUID
|
||||||
|
sudo zpool offline tank <GUID>
|
||||||
|
sudo zpool status
|
||||||
|
# Remove old disk, insert new disk
|
||||||
|
sudo zdb
|
||||||
|
sudo zpool replace tank <OLD GUID> /dev/disk/by-id/<NEW PATH>
|
||||||
|
sudo zpool status
|
||||||
|
```
|
||||||
|
|
||||||
|
## Initial Setup
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo zpool create tank raidz1 sda sdb sdc
|
||||||
|
sudo zpool set ashift=12 tank
|
||||||
|
sudo zpool set autoexpand=on tank
|
||||||
|
sudo zpool set compression=on tank
|
||||||
|
```
|
||||||
|
|
828
flake.lock
generated
828
flake.lock
generated
File diff suppressed because it is too large
Load Diff
415
flake.nix
415
flake.nix
@ -7,27 +7,44 @@
|
|||||||
# Used for system packages
|
# Used for system packages
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
# Used for specific stable packages
|
||||||
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||||
|
|
||||||
|
# Used for caddy plugins
|
||||||
|
nixpkgs-caddy.url = "github:jpds/nixpkgs/caddy-external-plugins";
|
||||||
|
|
||||||
# Used for MacOS system config
|
# Used for MacOS system config
|
||||||
darwin = {
|
darwin = {
|
||||||
url = "github:/lnl7/nix-darwin/master";
|
url = "github:lnl7/nix-darwin/master";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Used for Windows Subsystem for Linux compatibility
|
# Used for Windows Subsystem for Linux compatibility
|
||||||
wsl.url = "github:nix-community/NixOS-WSL";
|
wsl = {
|
||||||
|
url = "github:nix-community/NixOS-WSL";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
# Used for user packages
|
# Used for user packages and dotfiles
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager/master";
|
url = "github:nix-community/home-manager/master";
|
||||||
inputs.nixpkgs.follows =
|
inputs.nixpkgs.follows = "nixpkgs"; # Use system packages list for their inputs
|
||||||
"nixpkgs"; # Use system packages list where available
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Community packages; used for Firefox extensions
|
# Community packages; used for Firefox extensions
|
||||||
nur.url = "github:nix-community/nur";
|
nur.url = "github:nix-community/nur";
|
||||||
|
|
||||||
# Use official Firefox binary for macOS
|
# Use official Firefox binary for macOS
|
||||||
firefox-darwin.url = "github:bandithedoge/nixpkgs-firefox-darwin";
|
firefox-darwin = {
|
||||||
|
url = "github:bandithedoge/nixpkgs-firefox-darwin";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Better App install management in macOS
|
||||||
|
mac-app-util = {
|
||||||
|
url = "github:hraban/mac-app-util";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs"; # Use system packages list for their inputs
|
||||||
|
};
|
||||||
|
|
||||||
# Manage disk format and partitioning
|
# Manage disk format and partitioning
|
||||||
disko = {
|
disko = {
|
||||||
@ -53,32 +70,33 @@
|
|||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Nix language server
|
|
||||||
nil.url = "github:oxalica/nil";
|
|
||||||
|
|
||||||
# Neovim plugins
|
# Neovim plugins
|
||||||
|
base16-nvim-src = {
|
||||||
|
url = "github:RRethy/base16-nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
nvim-lspconfig-src = {
|
nvim-lspconfig-src = {
|
||||||
url = "github:neovim/nvim-lspconfig";
|
# https://github.com/neovim/nvim-lspconfig/tags
|
||||||
|
url = "github:neovim/nvim-lspconfig/v0.1.8";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
cmp-nvim-lsp-src = {
|
cmp-nvim-lsp-src = {
|
||||||
url = "github:hrsh7th/cmp-nvim-lsp";
|
url = "github:hrsh7th/cmp-nvim-lsp";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
null-ls-nvim-src = {
|
baleia-nvim-src = {
|
||||||
url = "github:jose-elias-alvarez/null-ls.nvim";
|
# https://github.com/m00qek/baleia.nvim/tags
|
||||||
flake = false;
|
url = "github:m00qek/baleia.nvim";
|
||||||
};
|
|
||||||
Comment-nvim-src = {
|
|
||||||
url = "github:numToStr/Comment.nvim";
|
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
nvim-treesitter-src = {
|
nvim-treesitter-src = {
|
||||||
url = "github:nvim-treesitter/nvim-treesitter";
|
# https://github.com/nvim-treesitter/nvim-treesitter/tags
|
||||||
|
url = "github:nvim-treesitter/nvim-treesitter/v0.9.2";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
telescope-nvim-src = {
|
telescope-nvim-src = {
|
||||||
url = "github:nvim-telescope/telescope.nvim";
|
# https://github.com/nvim-telescope/telescope.nvim/releases
|
||||||
|
url = "github:nvim-telescope/telescope.nvim/0.1.8";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
telescope-project-nvim-src = {
|
telescope-project-nvim-src = {
|
||||||
@ -86,128 +104,352 @@
|
|||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
toggleterm-nvim-src = {
|
toggleterm-nvim-src = {
|
||||||
url = "github:akinsho/toggleterm.nvim";
|
# https://github.com/akinsho/toggleterm.nvim/tags
|
||||||
|
url = "github:akinsho/toggleterm.nvim/v2.12.0";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
bufferline-nvim-src = {
|
bufferline-nvim-src = {
|
||||||
url = "github:akinsho/bufferline.nvim";
|
# https://github.com/akinsho/bufferline.nvim/releases
|
||||||
|
url = "github:akinsho/bufferline.nvim/v4.6.1";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
nvim-tree-lua-src = {
|
nvim-tree-lua-src = {
|
||||||
url = "github:kyazdani42/nvim-tree.lua";
|
url = "github:kyazdani42/nvim-tree.lua";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
hmts-nvim-src = {
|
||||||
|
url = "github:calops/hmts.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
fidget-nvim-src = {
|
||||||
|
# https://github.com/j-hui/fidget.nvim/tags
|
||||||
|
url = "github:j-hui/fidget.nvim/v1.4.5";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
nvim-lint-src = {
|
||||||
|
url = "github:mfussenegger/nvim-lint";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
tiny-inline-diagnostic-nvim-src = {
|
||||||
|
url = "github:rachartier/tiny-inline-diagnostic.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
snipe-nvim-src = {
|
||||||
|
url = "github:leath-dub/snipe.nvim";
|
||||||
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { nixpkgs, ... }@inputs:
|
# Tree-Sitter Grammars
|
||||||
|
tree-sitter-bash = {
|
||||||
|
url = "github:tree-sitter/tree-sitter-bash/master";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
tree-sitter-python = {
|
||||||
|
url = "github:tree-sitter/tree-sitter-python/master";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
tree-sitter-lua = {
|
||||||
|
url = "github:MunifTanjim/tree-sitter-lua/main";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
tree-sitter-ini = {
|
||||||
|
url = "github:justinmk/tree-sitter-ini";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
tree-sitter-puppet = {
|
||||||
|
url = "github:amaanq/tree-sitter-puppet";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
tree-sitter-rasi = {
|
||||||
|
url = "github:Fymyte/tree-sitter-rasi";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
tree-sitter-vimdoc = {
|
||||||
|
url = "github:neovim/tree-sitter-vimdoc";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# MPV Scripts
|
||||||
|
zenyd-mpv-scripts = {
|
||||||
|
url = "github:zenyd/mpv-scripts";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Git alternative
|
||||||
|
# Fixes: https://github.com/martinvonz/jj/issues/4784
|
||||||
|
jujutsu = {
|
||||||
|
url = "github:martinvonz/jj";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Ren and rep - CLI find and replace
|
||||||
|
rep = {
|
||||||
|
url = "github:robenkleene/rep-grep";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
ren = {
|
||||||
|
url = "github:robenkleene/ren-find";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
gh-collaborators = {
|
||||||
|
url = "github:katiem0/gh-collaborators";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Clipboard over SSH
|
||||||
|
osc = {
|
||||||
|
url = "github:theimpostor/osc/v0.4.6";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Nextcloud Apps
|
||||||
|
nextcloud-news = {
|
||||||
|
# https://github.com/nextcloud/news/releases
|
||||||
|
url = "https://github.com/nextcloud/news/releases/download/25.0.0-alpha12/news.tar.gz";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
nextcloud-external = {
|
||||||
|
# https://github.com/nextcloud-releases/external/releases
|
||||||
|
url = "https://github.com/nextcloud-releases/external/releases/download/v5.5.2/external-v5.5.2.tar.gz";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
nextcloud-cookbook = {
|
||||||
|
# https://github.com/christianlupus-nextcloud/cookbook-releases/releases/
|
||||||
|
url = "https://github.com/christianlupus-nextcloud/cookbook-releases/releases/download/v0.11.2/cookbook-0.11.2.tar.gz";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
nextcloud-snappymail = {
|
||||||
|
# https://github.com/the-djmaze/snappymail/releases
|
||||||
|
# https://snappymail.eu/repository/nextcloud
|
||||||
|
url = "https://snappymail.eu/repository/nextcloud/snappymail-2.38.2-nextcloud.tar.gz";
|
||||||
|
# url = "https://github.com/nmasur/snappymail-nextcloud/releases/download/v2.36.3/snappymail-2.36.3-nextcloud.tar.gz";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ nixpkgs, ... }@inputs:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
# Global configuration for my systems
|
# Global configuration for my systems
|
||||||
globals = rec {
|
globals =
|
||||||
|
let
|
||||||
|
baseName = "masu.rs";
|
||||||
|
in
|
||||||
|
rec {
|
||||||
user = "noah";
|
user = "noah";
|
||||||
fullName = "Noah Masur";
|
fullName = "Noah Masur";
|
||||||
gitName = fullName;
|
gitName = fullName;
|
||||||
gitEmail = "7386960+nmasur@users.noreply.github.com";
|
gitEmail = "7386960+nmasur@users.noreply.github.com";
|
||||||
mail.server = "noahmasur.com";
|
mail.server = "noahmasur.com";
|
||||||
dotfilesRepo = "git@github.com:nmasur/dotfiles";
|
mail.imapHost = "imap.purelymail.com";
|
||||||
|
mail.smtpHost = "smtp.purelymail.com";
|
||||||
|
dotfilesRepo = "https://github.com/nmasur/dotfiles";
|
||||||
|
hostnames = {
|
||||||
|
audiobooks = "read.${baseName}";
|
||||||
|
budget = "money.${baseName}";
|
||||||
|
files = "files.${baseName}";
|
||||||
|
git = "git.${baseName}";
|
||||||
|
influxdb = "influxdb.${baseName}";
|
||||||
|
irc = "irc.${baseName}";
|
||||||
|
metrics = "metrics.${baseName}";
|
||||||
|
minecraft = "minecraft.${baseName}";
|
||||||
|
n8n = "n8n.${baseName}";
|
||||||
|
notifications = "ntfy.${baseName}";
|
||||||
|
prometheus = "prom.${baseName}";
|
||||||
|
paperless = "paper.${baseName}";
|
||||||
|
photos = "photos.${baseName}";
|
||||||
|
secrets = "vault.${baseName}";
|
||||||
|
stream = "stream.${baseName}";
|
||||||
|
content = "cloud.${baseName}";
|
||||||
|
books = "books.${baseName}";
|
||||||
|
download = "download.${baseName}";
|
||||||
|
status = "status.${baseName}";
|
||||||
|
transmission = "transmission.${baseName}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Common overlays to always use
|
# Common overlays to always use
|
||||||
overlays = [
|
overlays = [
|
||||||
inputs.nur.overlay
|
inputs.nur.overlays.default
|
||||||
inputs.nix2vim.overlay
|
inputs.nix2vim.overlay
|
||||||
|
inputs.jujutsu.overlays.default # Fix: https://github.com/martinvonz/jj/issues/4784
|
||||||
(import ./overlays/neovim-plugins.nix inputs)
|
(import ./overlays/neovim-plugins.nix inputs)
|
||||||
(import ./overlays/calibre-web.nix)
|
(import ./overlays/tree-sitter.nix inputs)
|
||||||
|
(import ./overlays/mpv-scripts.nix inputs)
|
||||||
|
(import ./overlays/nextcloud-apps.nix inputs)
|
||||||
|
(import ./overlays/betterlockscreen.nix)
|
||||||
|
(import ./overlays/gh-collaborators.nix inputs)
|
||||||
|
(import ./overlays/osc.nix inputs)
|
||||||
|
(import ./overlays/ren-rep.nix inputs)
|
||||||
|
(import ./overlays/volnoti.nix)
|
||||||
];
|
];
|
||||||
|
|
||||||
# System types to support.
|
# System types to support.
|
||||||
supportedSystems =
|
supportedSystems = [
|
||||||
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
"x86_64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||||
|
in
|
||||||
|
rec {
|
||||||
|
|
||||||
in rec {
|
# Contains my full system builds, including home-manager
|
||||||
|
# nixos-rebuild switch --flake .#tempest
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
|
arrow = import ./hosts/arrow { inherit inputs globals overlays; };
|
||||||
tempest = import ./hosts/tempest { inherit inputs globals overlays; };
|
tempest = import ./hosts/tempest { inherit inputs globals overlays; };
|
||||||
hydra = import ./hosts/hydra { inherit inputs globals overlays; };
|
hydra = import ./hosts/hydra { inherit inputs globals overlays; };
|
||||||
flame = import ./hosts/flame { inherit inputs globals overlays; };
|
flame = import ./hosts/flame { inherit inputs globals overlays; };
|
||||||
swan = import ./hosts/swan { inherit inputs globals overlays; };
|
swan = import ./hosts/swan { inherit inputs globals overlays; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Contains my full Mac system builds, including home-manager
|
||||||
|
# darwin-rebuild switch --flake .#lookingglass
|
||||||
darwinConfigurations = {
|
darwinConfigurations = {
|
||||||
lookingglass =
|
lookingglass = import ./hosts/lookingglass { inherit inputs globals overlays; };
|
||||||
import ./hosts/lookingglass { inherit inputs globals overlays; };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# For quickly applying local settings with:
|
# For quickly applying home-manager settings with:
|
||||||
# home-manager switch --flake .#tempest
|
# home-manager switch --flake .#tempest
|
||||||
homeConfigurations = {
|
homeConfigurations = {
|
||||||
tempest =
|
tempest = nixosConfigurations.tempest.config.home-manager.users.${globals.user}.home;
|
||||||
nixosConfigurations.tempest.config.home-manager.users.${globals.user}.home;
|
lookingglass = darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home;
|
||||||
lookingglass =
|
|
||||||
darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
diskoConfigurations = { swan = import ./hosts/swan/disks.nix; };
|
# Disk formatting, only used once
|
||||||
|
diskoConfigurations = {
|
||||||
# Package servers into images with a generator
|
root = import ./disks/root.nix;
|
||||||
packages = forAllSystems (system: {
|
|
||||||
|
|
||||||
aws = {
|
|
||||||
"${system}" =
|
|
||||||
import ./generators/aws { inherit inputs globals system overlays; };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
staff = {
|
packages =
|
||||||
"${system}" = import ./generators/staff {
|
let
|
||||||
inherit inputs globals system overlays;
|
staff =
|
||||||
|
system:
|
||||||
|
import ./hosts/staff {
|
||||||
|
inherit
|
||||||
|
inputs
|
||||||
|
globals
|
||||||
|
overlays
|
||||||
|
system
|
||||||
|
;
|
||||||
};
|
};
|
||||||
};
|
neovim =
|
||||||
|
system:
|
||||||
neovim = let pkgs = import nixpkgs { inherit system overlays; };
|
let
|
||||||
in import ./modules/common/neovim/package {
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
in
|
||||||
|
import ./modules/common/neovim/package {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
colors =
|
colors = (import ./colorscheme/gruvbox-dark).dark;
|
||||||
import ./colorscheme/gruvbox/neovim-gruvbox.nix { inherit pkgs; };
|
|
||||||
};
|
};
|
||||||
|
in
|
||||||
});
|
{
|
||||||
|
x86_64-linux.staff = staff "x86_64-linux";
|
||||||
apps = forAllSystems (system:
|
x86_64-linux.arrow = inputs.nixos-generators.nixosGenerate rec {
|
||||||
let pkgs = import nixpkgs { inherit system overlays; };
|
system = "x86_64-linux";
|
||||||
in import ./apps { inherit pkgs; });
|
format = "iso";
|
||||||
|
specialArgs = {
|
||||||
devShells = forAllSystems (system:
|
pkgs-stable = import inputs.nixpkgs-stable { inherit system; };
|
||||||
let pkgs = import nixpkgs { inherit system overlays; };
|
pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
|
||||||
in {
|
|
||||||
|
|
||||||
# Used to run commands and edit files in this repo
|
|
||||||
default = pkgs.mkShell {
|
|
||||||
buildInputs = with pkgs; [ git stylua nixfmt shfmt shellcheck ];
|
|
||||||
};
|
};
|
||||||
|
modules = import ./hosts/arrow/modules.nix { inherit inputs globals overlays; };
|
||||||
# Used for cloud and systems development and administration
|
};
|
||||||
devops = pkgs.mkShell {
|
x86_64-linux.arrow-aws = inputs.nixos-generators.nixosGenerate rec {
|
||||||
buildInputs = with pkgs; [
|
system = "x86_64-linux";
|
||||||
git
|
format = "amazon";
|
||||||
terraform
|
specialArgs = {
|
||||||
consul
|
pkgs-stable = import inputs.nixpkgs-stable { inherit system; };
|
||||||
vault
|
pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
|
||||||
awscli2
|
};
|
||||||
google-cloud-sdk
|
modules = import ./hosts/arrow/modules.nix { inherit inputs globals overlays; } ++ [
|
||||||
ansible
|
(
|
||||||
kubectl
|
{ ... }:
|
||||||
kubernetes-helm
|
{
|
||||||
kustomize
|
boot.kernelPackages = inputs.nixpkgs.legacyPackages.x86_64-linux.linuxKernel.packages.linux_6_6;
|
||||||
fluxcd
|
amazonImage.sizeMB = 16 * 1024;
|
||||||
|
permitRootLogin = "prohibit-password";
|
||||||
|
boot.loader.systemd-boot.enable = inputs.nixpkgs.lib.mkForce false;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = inputs.nixpkgs.lib.mkForce false;
|
||||||
|
services.amazon-ssm-agent.enable = true;
|
||||||
|
users.users.ssm-user.extraGroups = [ "wheel" ];
|
||||||
|
}
|
||||||
|
)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
# Package Neovim config into standalone package
|
||||||
|
x86_64-linux.neovim = neovim "x86_64-linux";
|
||||||
|
x86_64-darwin.neovim = neovim "x86_64-darwin";
|
||||||
|
aarch64-linux.neovim = neovim "aarch64-linux";
|
||||||
|
aarch64-darwin.neovim = neovim "aarch64-darwin";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Programs that can be run by calling this flake
|
||||||
|
apps = forAllSystems (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
in
|
||||||
|
import ./apps { inherit pkgs; }
|
||||||
|
);
|
||||||
|
|
||||||
|
# Development environments
|
||||||
|
devShells = forAllSystems (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
# Used to run commands and edit files in this repo
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
git
|
||||||
|
stylua
|
||||||
|
nixfmt-rfc-style
|
||||||
|
shfmt
|
||||||
|
shellcheck
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
checks = forAllSystems (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
neovim =
|
||||||
|
pkgs.runCommand "neovim-check-health" { buildInputs = [ inputs.self.packages.${system}.neovim ]; }
|
||||||
|
''
|
||||||
|
mkdir -p $out
|
||||||
|
export HOME=$TMPDIR
|
||||||
|
nvim -c "checkhealth" -c "write $out/health.log" -c "quitall"
|
||||||
|
|
||||||
|
# Check for errors inside the health log
|
||||||
|
if $(grep "ERROR" $out/health.log); then
|
||||||
|
cat $out/health.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
formatter = forAllSystems (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
in
|
||||||
|
pkgs.nixfmt-rfc-style
|
||||||
|
);
|
||||||
|
|
||||||
# Templates for starting other projects quickly
|
# Templates for starting other projects quickly
|
||||||
templates = rec {
|
templates = rec {
|
||||||
@ -228,7 +470,10 @@
|
|||||||
path = ./templates/haskell;
|
path = ./templates/haskell;
|
||||||
description = "Haskell template";
|
description = "Haskell template";
|
||||||
};
|
};
|
||||||
|
rust = {
|
||||||
|
path = ./templates/rust;
|
||||||
|
description = "Rust template";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
{ inputs, globals, ... }:
|
|
||||||
|
|
||||||
with inputs;
|
|
||||||
|
|
||||||
nixos-generators.nixosGenerate {
|
|
||||||
inherit system;
|
|
||||||
format = "amazon";
|
|
||||||
modules = [
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
|
||||||
user = globals.user;
|
|
||||||
fullName = globals.fullName;
|
|
||||||
dotfilesRepo = globals.dotfilesRepo;
|
|
||||||
gitName = globals.gitName;
|
|
||||||
gitEmail = globals.gitEmail;
|
|
||||||
networking.hostName = "sheep";
|
|
||||||
gui.enable = false;
|
|
||||||
colorscheme = (import ../colorscheme/gruvbox);
|
|
||||||
passwordHash = null;
|
|
||||||
publicKey =
|
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
|
|
||||||
# AWS settings require this
|
|
||||||
permitRootLogin = "prohibit-password";
|
|
||||||
}
|
|
||||||
../../modules/common
|
|
||||||
../../modules/nixos
|
|
||||||
../../modules/common/services/sshd.nix
|
|
||||||
] ++ [
|
|
||||||
# Required to fix diskSize errors during build
|
|
||||||
({ ... }: { amazonImage.sizeMB = 16 * 1024; })
|
|
||||||
];
|
|
||||||
}
|
|
@ -1,260 +0,0 @@
|
|||||||
name: 'Terraform'
|
|
||||||
env:
|
|
||||||
|
|
||||||
|
|
||||||
AWS_ACCOUNT_NUMBER: ''
|
|
||||||
AWS_PLAN_ROLE_NAME: github_actions_plan
|
|
||||||
AWS_APPLY_ROLE_NAME: github_actions_admin
|
|
||||||
|
|
||||||
# Always required. Used for authenticating to AWS, but can also act as your
|
|
||||||
# default region if you don't want to specify in the provider configuration.
|
|
||||||
AWS_REGION: us-east-1
|
|
||||||
|
|
||||||
# You must change these to fit your project.
|
|
||||||
TF_VAR_project: change-me
|
|
||||||
TF_VAR_label: change-me
|
|
||||||
TF_VAR_owner: Your Name Here
|
|
||||||
|
|
||||||
# If storing Terraform in a subdirectory, specify it here.
|
|
||||||
TERRAFORM_DIRECTORY: .
|
|
||||||
|
|
||||||
# Pinned versions of tools to use.
|
|
||||||
# Check for new releases:
|
|
||||||
# - https://github.com/hashicorp/terraform/releases
|
|
||||||
# - https://github.com/fugue/regula/releases
|
|
||||||
# - https://github.com/terraform-linters/tflint/releases
|
|
||||||
TERRAFORM_VERSION: 1.2.6
|
|
||||||
REGULA_VERSION: 2.9.0
|
|
||||||
TFLINT_VERSION: 0.39.1
|
|
||||||
|
|
||||||
# Terraform configuration options
|
|
||||||
TERRAFORM_PARALLELISM: 10
|
|
||||||
|
|
||||||
# These variables are passed to Terraform based on GitHub information.
|
|
||||||
TF_VAR_repo: ${{ github.repository }}
|
|
||||||
|
|
||||||
# This workflow is triggered in the following ways.
|
|
||||||
on:
|
|
||||||
|
|
||||||
# Any push or merge to these branches.
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
- prod
|
|
||||||
|
|
||||||
# Any pull request targeting these branches (plan only).
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
- prod
|
|
||||||
|
|
||||||
|
|
||||||
# Any manual trigger on these branches.
|
|
||||||
workflow_dispatch:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
- prod
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
|
||||||
# The rest of this workflow can operate without adjustments. Edit the
|
|
||||||
# below content at your own risk!
|
|
||||||
# -------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Used to connect to AWS IAM
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
# Only run one workflow at a time for each Terraform state. This prevents
|
|
||||||
# lockfile conflicts, especially during PR vs push.
|
|
||||||
concurrency: terraform-${{ github.base_ref || github.ref }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
terraform:
|
|
||||||
|
|
||||||
name: 'Terraform'
|
|
||||||
|
|
||||||
# Change this if you need to run your deployment on-prem.
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
|
|
||||||
# Downloads the current repo code to the runner.
|
|
||||||
- name: Checkout Repo Code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
# Install Nix
|
|
||||||
- name: Install Nix
|
|
||||||
uses: cachix/install-nix-action@v17
|
|
||||||
|
|
||||||
# Build the image
|
|
||||||
- name: Build Image
|
|
||||||
run: nix build .#aws
|
|
||||||
|
|
||||||
# Login to AWS
|
|
||||||
- name: AWS Assume Role
|
|
||||||
uses: aws-actions/configure-aws-credentials@v1.6.1
|
|
||||||
with:
|
|
||||||
role-to-assume: ${{ env.AWS_ROLE_ARN }}
|
|
||||||
aws-region: ${{ env.AWS_REGION }}
|
|
||||||
|
|
||||||
# Exports all GitHub Secrets as environment variables prefixed by
|
|
||||||
# "TF_VAR_", which exposes them to Terraform. The name of each GitHub
|
|
||||||
# Secret must match its Terraform variable name exactly.
|
|
||||||
- name: Export Secrets to Terraform Variables
|
|
||||||
env:
|
|
||||||
ALL_SECRETS: ${{ toJson(secrets) }}
|
|
||||||
run: |
|
|
||||||
echo "$ALL_SECRETS" \
|
|
||||||
| jq "to_entries | .[] | \"TF_VAR_\" + ( .key | ascii_downcase ) + \"=\" + .value" \
|
|
||||||
| tr -d \" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Installs the Terraform binary and some other accessory functions.
|
|
||||||
- name: Setup Terraform
|
|
||||||
uses: hashicorp/setup-terraform@v2
|
|
||||||
with:
|
|
||||||
terraform_version: ${{ env.TERRAFORM_VERSION }}
|
|
||||||
|
|
||||||
# Checks whether Terraform is formatted properly. If this fails, you
|
|
||||||
# should install the pre-commit hook.
|
|
||||||
- name: Check Formatting
|
|
||||||
run: |
|
|
||||||
terraform fmt -no-color -check -diff -recursive
|
|
||||||
|
|
||||||
# Downloads a Terraform code lint test.
|
|
||||||
- uses: terraform-linters/setup-tflint@v1
|
|
||||||
name: Setup TFLint
|
|
||||||
with:
|
|
||||||
tflint_version: v${{ env.TFLINT_VERSION }}
|
|
||||||
|
|
||||||
# Sets up linting with this codebase.
|
|
||||||
- name: Init TFLint
|
|
||||||
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
|
||||||
run: tflint --init
|
|
||||||
|
|
||||||
# Lints the current code.
|
|
||||||
- name: Run TFLint
|
|
||||||
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
|
||||||
run: |
|
|
||||||
tflint -f compact
|
|
||||||
find ./modules/* -type d -maxdepth 0 | xargs -I __ tflint -f compact --disable-rule=terraform_required_providers --disable-rule=terraform_required_version __
|
|
||||||
|
|
||||||
# Connects to remote state backend and download providers.
|
|
||||||
- name: Terraform Init
|
|
||||||
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
|
||||||
run: |
|
|
||||||
terraform init \
|
|
||||||
-backend-config="role_arn=${{ env.AWS_STATE_ROLE_ARN }}" \
|
|
||||||
-backend-config="region=us-east-1" \
|
|
||||||
-backend-config="workspace_key_prefix=accounts/${{ env.AWS_ACCOUNT_NUMBER }}/${{ github.repository }}" \
|
|
||||||
-backend-config="key=state.tfstate" \
|
|
||||||
-backend-config="dynamodb_table=global-tf-state-lock"
|
|
||||||
|
|
||||||
# Set the Terraform Workspace to the current branch name.
|
|
||||||
- name: Set Terraform Workspace
|
|
||||||
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
export WORKSPACE=${{ github.base_ref || github.ref_name }}
|
|
||||||
terraform workspace select ${WORKSPACE} || terraform workspace new $WORKSPACE
|
|
||||||
echo "TF_WORKSPACE=$(echo ${WORKSPACE} | sed 's/\//_/g')" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Checks differences between current code and infrastructure state.
|
|
||||||
- name: Terraform Plan
|
|
||||||
id: plan
|
|
||||||
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
|
||||||
run: |
|
|
||||||
terraform plan \
|
|
||||||
-input=false \
|
|
||||||
-no-color \
|
|
||||||
-out=tfplan \
|
|
||||||
-parallelism=${TERRAFORM_PARALLELISM} \
|
|
||||||
-var-file=variables-${TF_WORKSPACE}.tfvars
|
|
||||||
|
|
||||||
# Gets the results of the plan for pull requests.
|
|
||||||
- name: Terraform Show Plan
|
|
||||||
id: show
|
|
||||||
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
|
||||||
run: terraform show -no-color tfplan
|
|
||||||
|
|
||||||
# Adds the results of the plan to the pull request.
|
|
||||||
- name: Comment Plan
|
|
||||||
uses: actions/github-script@v6
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
env:
|
|
||||||
STDOUT: "```terraform\n${{ steps.show.outputs.stdout }}```"
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
script: |
|
|
||||||
// 1. Retrieve existing bot comments for the PR
|
|
||||||
const { data: comments } = await github.rest.issues.listComments({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
})
|
|
||||||
const botComment = comments.find(comment => {
|
|
||||||
return comment.user.type === 'Bot' && comment.body.includes('Terraform Format and Style')
|
|
||||||
})
|
|
||||||
|
|
||||||
// 2. Prepare format of the comment
|
|
||||||
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
|
|
||||||
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
|
|
||||||
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
|
|
||||||
<details><summary>Validation Output</summary>
|
|
||||||
|
|
||||||
\`\`\`\n
|
|
||||||
${{ steps.validate.outputs.stdout }}
|
|
||||||
\`\`\`
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
|
|
||||||
|
|
||||||
<details><summary>Show Plan</summary>
|
|
||||||
|
|
||||||
\`\`\`\n
|
|
||||||
${process.env.PLAN}
|
|
||||||
\`\`\`
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`;
|
|
||||||
|
|
||||||
// 3. If we have a comment, update it, otherwise create a new one
|
|
||||||
if (botComment) {
|
|
||||||
github.rest.issues.updateComment({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
comment_id: botComment.id,
|
|
||||||
body: output
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
github.rest.issues.createComment({
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
body: output
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
# Downloads Regula and checks whether the plan meets compliance requirements.
|
|
||||||
- name: Regula Compliance Check
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
|
||||||
run: |
|
|
||||||
REGULA_URL="https://github.com/fugue/regula/releases/download/v${REGULA_VERSION}/regula_${REGULA_VERSION}_Linux_x86_64.tar.gz"
|
|
||||||
curl -sL "$REGULA_URL" -o regula.tar.gz
|
|
||||||
tar xzf regula.tar.gz
|
|
||||||
terraform show -json tfplan | ./regula run
|
|
||||||
|
|
||||||
# Deploys infrastructure or changes to infrastructure.
|
|
||||||
- name: Terraform Apply
|
|
||||||
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
|
||||||
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
|
|
||||||
run: |
|
|
||||||
terraform apply \
|
|
||||||
-auto-approve \
|
|
||||||
-input=false \
|
|
||||||
-parallelism=${TERRAFORM_PARALLELISM} \
|
|
||||||
tfplan
|
|
@ -1,47 +0,0 @@
|
|||||||
# The Staff
|
|
||||||
# ISO configuration for my USB drive
|
|
||||||
|
|
||||||
{ inputs, system, overlays, ... }:
|
|
||||||
|
|
||||||
with inputs;
|
|
||||||
|
|
||||||
nixos-generators.nixosGenerate {
|
|
||||||
inherit system;
|
|
||||||
format = "install-iso";
|
|
||||||
modules = [{
|
|
||||||
nixpkgs.overlays = overlays;
|
|
||||||
networking.hostName = "staff";
|
|
||||||
users.extraUsers.root.openssh.authorizedKeys.keys = [
|
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s"
|
|
||||||
];
|
|
||||||
services.openssh = {
|
|
||||||
enable = true;
|
|
||||||
ports = [ 22 ];
|
|
||||||
allowSFTP = true;
|
|
||||||
settings = {
|
|
||||||
GatewayPorts = "no";
|
|
||||||
X11Forwarding = false;
|
|
||||||
PasswordAuthentication = false;
|
|
||||||
PermitRootLogin = "yes";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
environment.systemPackages =
|
|
||||||
let pkgs = import inputs.nixpkgs { inherit system overlays; };
|
|
||||||
in with pkgs; [
|
|
||||||
git
|
|
||||||
vim
|
|
||||||
wget
|
|
||||||
curl
|
|
||||||
(import ../../modules/common/neovim/package {
|
|
||||||
inherit pkgs;
|
|
||||||
# colors = import ../../colorscheme/gruvbox.dark.neovimConfig {
|
|
||||||
# inherit pkgs;
|
|
||||||
# };
|
|
||||||
})
|
|
||||||
];
|
|
||||||
nix.extraOptions = ''
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
warn-dirty = false
|
|
||||||
'';
|
|
||||||
}];
|
|
||||||
}
|
|
26
hosts/README.md
Normal file
26
hosts/README.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Hosts
|
||||||
|
|
||||||
|
These are the individual machines managed by this flake.
|
||||||
|
|
||||||
|
| Host | Purpose |
|
||||||
|
| --- | --- |
|
||||||
|
| [aws](./aws/default.nix) | AWS AMI |
|
||||||
|
| [staff](./staff/default.nix) | Live USB stick |
|
||||||
|
| [flame](./flame/default.nix) | Oracle cloud server |
|
||||||
|
| [hydra](./hydra/default.nix) | WSL config |
|
||||||
|
| [lookingglass](./lookingglass/default.nix) | Work MacBook |
|
||||||
|
| [swan](./swan/default.nix) | Home server |
|
||||||
|
| [tempest](./tempest/default.nix) | Linux desktop |
|
||||||
|
|
||||||
|
## NixOS Workflow
|
||||||
|
|
||||||
|
Each hosts file is imported into [nixosConfigurations](../flake.nix) and passed
|
||||||
|
the arguments from the flake (inputs, globals, overlays). The `nixosSystem`
|
||||||
|
function in that hosts file will be called by the NixOS module system during a
|
||||||
|
nixos-rebuild.
|
||||||
|
|
||||||
|
Each module in the each host's `modules` list is either a function or an
|
||||||
|
attrset. The attrsets will simply apply values to options that have been
|
||||||
|
declared in the config by other modules. Meanwhile, the functions will be
|
||||||
|
passed various arguments, several of which you will see listed at the top of
|
||||||
|
each of their files.
|
98
hosts/arrow/aws/ec2.tf
Normal file
98
hosts/arrow/aws/ec2.tf
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
resource "aws_instance" "instance" {
|
||||||
|
ami = aws_ami.image.id
|
||||||
|
iam_instance_profile = aws_iam_instance_profile.instance.name
|
||||||
|
instance_type = var.ec2_size
|
||||||
|
vpc_security_group_ids = [aws_security_group.instance.id]
|
||||||
|
|
||||||
|
tags = {
|
||||||
|
Name = "aws-nixos"
|
||||||
|
}
|
||||||
|
|
||||||
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_ec2_instance_state" "instance" {
|
||||||
|
instance_id = aws_instance.instance.id
|
||||||
|
state = "running"
|
||||||
|
}
|
||||||
|
|
||||||
|
data "aws_vpc" "vpc" {
|
||||||
|
default = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_security_group" "instance" {
|
||||||
|
name = "aws-nixos"
|
||||||
|
description = "Allow SSH and HTTPS"
|
||||||
|
vpc_id = data.aws_vpc.vpc.id
|
||||||
|
|
||||||
|
ingress {
|
||||||
|
description = "Ping"
|
||||||
|
from_port = -1
|
||||||
|
to_port = -1
|
||||||
|
protocol = "icmp"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
|
||||||
|
ingress {
|
||||||
|
description = "SSH"
|
||||||
|
from_port = 22
|
||||||
|
to_port = 22
|
||||||
|
protocol = "tcp"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
|
||||||
|
ingress {
|
||||||
|
description = "HTTPS"
|
||||||
|
from_port = 443
|
||||||
|
to_port = 443
|
||||||
|
protocol = "tcp"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
}
|
||||||
|
|
||||||
|
egress {
|
||||||
|
from_port = 0
|
||||||
|
to_port = 0
|
||||||
|
protocol = "-1"
|
||||||
|
cidr_blocks = ["0.0.0.0/0"]
|
||||||
|
ipv6_cidr_blocks = ["::/0"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Setup IAM for the instance to use SSM
|
||||||
|
data "aws_iam_policy_document" "ec2_assume_role" {
|
||||||
|
statement {
|
||||||
|
actions = ["sts:AssumeRole"]
|
||||||
|
principals {
|
||||||
|
type = "Service"
|
||||||
|
identifiers = ["ec2.amazonaws.com"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data "aws_iam_policy_document" "instance_profile" {
|
||||||
|
statement {
|
||||||
|
actions = [
|
||||||
|
"s3:ListAllMyBuckets",
|
||||||
|
]
|
||||||
|
resources = ["*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_iam_role" "instance_profile" {
|
||||||
|
name = "nixos"
|
||||||
|
assume_role_policy = data.aws_iam_policy_document.ec2_assume_role.json
|
||||||
|
inline_policy {
|
||||||
|
name = "instance-profile"
|
||||||
|
policy = data.aws_iam_policy_document.instance_profile.json
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resource "aws_iam_role_policy_attachment" "instance_ssm" {
|
||||||
|
role = aws_iam_role.instance_profile.name
|
||||||
|
policy_arn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
|
||||||
|
}
|
||||||
|
resource "aws_iam_instance_profile" "instance" {
|
||||||
|
name = "nixos"
|
||||||
|
role = aws_iam_role.instance_profile.name
|
||||||
|
}
|
@ -1,13 +1,23 @@
|
|||||||
locals {
|
# locals {
|
||||||
image_file = one(fileset(path.root, "result/nixos-amazon-image-*.vhd"))
|
# image_file = one(fileset(path.root, "../../../result/nixos-amazon-image-*.vhd"))
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# # Upload image to S3
|
||||||
|
# resource "aws_s3_object" "image" {
|
||||||
|
# bucket = var.images_bucket
|
||||||
|
# key = basename(local.image_file)
|
||||||
|
# source = local.image_file
|
||||||
|
# etag = filemd5(local.image_file)
|
||||||
|
# }
|
||||||
|
|
||||||
|
# Use existing image in S3
|
||||||
|
data "aws_s3_object" "image" {
|
||||||
|
bucket = var.images_bucket
|
||||||
|
key = "arrow.vhd"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Upload to S3
|
resource "terraform_data" "image_replacement" {
|
||||||
resource "aws_s3_object" "image" {
|
input = data.aws_s3_object.image.etag
|
||||||
bucket = "your_bucket_name"
|
|
||||||
key = basename(local.image_file)
|
|
||||||
source = local.image_file
|
|
||||||
etag = filemd5(local.image_file)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Setup IAM access for the VM Importer
|
# Setup IAM access for the VM Importer
|
||||||
@ -29,8 +39,8 @@ data "aws_iam_policy_document" "vmimport" {
|
|||||||
"s3:ListBucket",
|
"s3:ListBucket",
|
||||||
]
|
]
|
||||||
resources = [
|
resources = [
|
||||||
"arn:aws:s3:::${aws_s3_object.image.bucket}",
|
"arn:aws:s3:::${data.aws_s3_object.image.bucket}",
|
||||||
"arn:aws:s3:::${aws_s3_object.image.bucket}/*",
|
"arn:aws:s3:::${data.aws_s3_object.image.bucket}/*",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
statement {
|
statement {
|
||||||
@ -58,23 +68,28 @@ resource "aws_ebs_snapshot_import" "image" {
|
|||||||
disk_container {
|
disk_container {
|
||||||
format = "VHD"
|
format = "VHD"
|
||||||
user_bucket {
|
user_bucket {
|
||||||
s3_bucket = aws_s3_object.image.bucket
|
s3_bucket = data.aws_s3_object.image.bucket
|
||||||
s3_key = aws_s3_object.image.key
|
s3_key = data.aws_s3_object.image.key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
role_name = aws_iam_role.vmimport.name
|
role_name = aws_iam_role.vmimport.name
|
||||||
|
lifecycle {
|
||||||
|
replace_triggered_by = [terraform_data.image_replacement]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Convert to AMI
|
# Convert to AMI
|
||||||
resource "aws_ami" "image" {
|
resource "aws_ami" "image" {
|
||||||
description = "Created with NixOS."
|
description = "Created with NixOS."
|
||||||
name = replace(basename(local.image_file), "/\\.vhd$/", "")
|
name = replace(basename(data.aws_s3_object.image.key), "/\\.vhd$/", "")
|
||||||
virtualization_type = "hvm"
|
virtualization_type = "hvm"
|
||||||
|
root_device_name = "/dev/xvda"
|
||||||
|
ena_support = true
|
||||||
|
|
||||||
ebs_block_device {
|
ebs_block_device {
|
||||||
device_name = "/dev/xvda"
|
device_name = "/dev/xvda"
|
||||||
snapshot_id = aws_ebs_snapshot_import.image.id
|
snapshot_id = aws_ebs_snapshot_import.image.id
|
||||||
volume_size = 8
|
volume_size = 17
|
||||||
}
|
}
|
||||||
}
|
}
|
13
hosts/arrow/aws/main.tf
Normal file
13
hosts/arrow/aws/main.tf
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
terraform {
|
||||||
|
backend "s3" {
|
||||||
|
region = "us-east-1"
|
||||||
|
dynamodb_table = "terraform-state-lock"
|
||||||
|
}
|
||||||
|
required_version = ">= 1.0.0"
|
||||||
|
required_providers {
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "5.42.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
hosts/arrow/aws/outputs.tf
Normal file
3
hosts/arrow/aws/outputs.tf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
output "host_ip" {
|
||||||
|
value = aws_instance.instance.public_ip
|
||||||
|
}
|
10
hosts/arrow/aws/variables.tf
Normal file
10
hosts/arrow/aws/variables.tf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
variable "ec2_size" {
|
||||||
|
type = string
|
||||||
|
description = "Size of instance to launch"
|
||||||
|
default = "t3a.small" # 2 GB RAM ($14/mo)
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "images_bucket" {
|
||||||
|
description = "Name of the bucket in which to store the NixOS VM images."
|
||||||
|
type = string
|
||||||
|
}
|
41
hosts/arrow/default.nix
Normal file
41
hosts/arrow/default.nix
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# The Arrow
|
||||||
|
# System configuration for temporary VM
|
||||||
|
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
globals,
|
||||||
|
overlays,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
inputs.nixpkgs.lib.nixosSystem rec {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
specialArgs = {
|
||||||
|
pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
|
||||||
|
};
|
||||||
|
modules = import ./modules.nix { inherit inputs globals overlays; } ++ [
|
||||||
|
{
|
||||||
|
# This is the root filesystem containing NixOS
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-label/nixos";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
# This is the boot filesystem for Grub
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-label/boot";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.vmVariant = {
|
||||||
|
virtualisation.forwardPorts = [
|
||||||
|
{
|
||||||
|
from = "host";
|
||||||
|
host.port = 2222;
|
||||||
|
guest.port = 22;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
32
hosts/arrow/modules.nix
Normal file
32
hosts/arrow/modules.nix
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
globals,
|
||||||
|
overlays,
|
||||||
|
}:
|
||||||
|
|
||||||
|
[
|
||||||
|
globals
|
||||||
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
{
|
||||||
|
nixpkgs.overlays = overlays;
|
||||||
|
networking.hostName = "arrow";
|
||||||
|
physical = false;
|
||||||
|
server = true;
|
||||||
|
gui.enable = false;
|
||||||
|
theme.colors = (import ../../colorscheme/gruvbox).dark;
|
||||||
|
publicKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal"
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKpPU2G9rSF8Q6waH62IJexDCQ6lY+8ZyVufGE3xMDGw deploy"
|
||||||
|
];
|
||||||
|
identityFile = "/home/${globals.user}/.ssh/id_ed25519";
|
||||||
|
cloudflare.enable = true;
|
||||||
|
services.openssh.enable = true;
|
||||||
|
services.caddy.enable = true;
|
||||||
|
services.n8n.enable = true;
|
||||||
|
|
||||||
|
# nix-index seems to eat up too much memory for Vultr
|
||||||
|
home-manager.users.${globals.user}.programs.nix-index.enable = inputs.nixpkgs.lib.mkForce false;
|
||||||
|
}
|
||||||
|
../../modules/common
|
||||||
|
../../modules/nixos
|
||||||
|
]
|
78
hosts/arrow/vultr/main.tf
Normal file
78
hosts/arrow/vultr/main.tf
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
terraform {
|
||||||
|
backend "s3" {
|
||||||
|
bucket = "noahmasur-terraform"
|
||||||
|
key = "arrow.tfstate"
|
||||||
|
region = "auto"
|
||||||
|
skip_credentials_validation = true
|
||||||
|
skip_metadata_api_check = true
|
||||||
|
skip_region_validation = true
|
||||||
|
skip_requesting_account_id = true
|
||||||
|
skip_s3_checksum = true
|
||||||
|
use_path_style = true
|
||||||
|
/*
|
||||||
|
ENVIRONMENT VARIABLES
|
||||||
|
---------------------
|
||||||
|
AWS_ACCESS_KEY_ID - R2 token
|
||||||
|
AWS_SECRET_ACCESS_KEY - R2 secret
|
||||||
|
AWS_ENDPOINT_URL_S3 - R2 location: https://ACCOUNT_ID.r2.cloudflarestorage.com
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
required_version = ">= 1.0.0"
|
||||||
|
required_providers {
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "5.42.0"
|
||||||
|
}
|
||||||
|
vultr = {
|
||||||
|
source = "vultr/vultr"
|
||||||
|
version = "2.19.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "vultr_api_key" {
|
||||||
|
type = string
|
||||||
|
description = "API key for Vultr management"
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
# https://api.vultr.com/v2/plans
|
||||||
|
variable "vultr_plan" {
|
||||||
|
type = string
|
||||||
|
description = "Size of instance to launch"
|
||||||
|
default = "vc2-1c-2gb" # 55 GB SSD ($10/mo)
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
region = "auto"
|
||||||
|
skip_credentials_validation = true
|
||||||
|
skip_metadata_api_check = true
|
||||||
|
skip_region_validation = true
|
||||||
|
skip_requesting_account_id = true
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "vultr" {
|
||||||
|
api_key = var.vultr_api_key
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "vultr_iso_private" "image" {
|
||||||
|
# url = "https://${var.cloudflare_account_id}.r2.cloudflarestorage.com/${data.aws_s3_bucket.images.id}/${aws_s3_object.image.key}"
|
||||||
|
url = "https://arrow-images.masu.rs/arrow.iso"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "vultr_instance" "arrow" {
|
||||||
|
plan = var.vultr_plan
|
||||||
|
region = "ewr"
|
||||||
|
iso_id = vultr_iso_private.image.id
|
||||||
|
label = "arrow"
|
||||||
|
tags = ["arrow"]
|
||||||
|
enable_ipv6 = false
|
||||||
|
disable_public_ipv4 = false
|
||||||
|
backups = "disabled"
|
||||||
|
ddos_protection = false
|
||||||
|
activation_email = false
|
||||||
|
}
|
||||||
|
|
||||||
|
output "host_ip" {
|
||||||
|
value = vultr_instance.arrow.main_ip
|
||||||
|
}
|
@ -1,98 +1,141 @@
|
|||||||
# The Flame
|
# The Flame
|
||||||
# System configuration for an Oracle free server
|
# System configuration for an Oracle free server
|
||||||
|
|
||||||
|
# See [readme](../README.md) to explain how this file works.
|
||||||
|
|
||||||
# How to install:
|
# How to install:
|
||||||
# https://blog.korfuri.fr/posts/2022/08/nixos-on-an-oracle-free-tier-ampere-machine/
|
# https://blog.korfuri.fr/posts/2022/08/nixos-on-an-oracle-free-tier-ampere-machine/
|
||||||
|
# These days, probably use nixos-anywhere instead.
|
||||||
|
|
||||||
{ inputs, globals, overlays, ... }:
|
{
|
||||||
|
inputs,
|
||||||
|
globals,
|
||||||
|
overlays,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
with inputs;
|
inputs.nixpkgs.lib.nixosSystem rec {
|
||||||
|
|
||||||
nixpkgs.lib.nixosSystem {
|
|
||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
specialArgs = { };
|
specialArgs = {
|
||||||
|
pkgs-stable = import inputs.nixpkgs-stable { inherit system; };
|
||||||
|
pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./hardware-configuration.nix
|
globals
|
||||||
|
inputs.home-manager.nixosModules.home-manager
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/nixos
|
../../modules/nixos
|
||||||
(removeAttrs globals [ "mail.server" ])
|
|
||||||
wsl.nixosModules.wsl
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
{
|
||||||
server = true;
|
|
||||||
gui.enable = false;
|
|
||||||
theme = { colors = (import ../../colorscheme/gruvbox).dark; };
|
|
||||||
nixpkgs.overlays = overlays;
|
nixpkgs.overlays = overlays;
|
||||||
wsl.enable = false;
|
|
||||||
caddy.enable = true;
|
|
||||||
|
|
||||||
# FQDNs for various services
|
# Hardware
|
||||||
|
server = true;
|
||||||
networking.hostName = "flame";
|
networking.hostName = "flame";
|
||||||
bookServer = "books.masu.rs";
|
|
||||||
streamServer = "stream.masu.rs";
|
|
||||||
nextcloudServer = "cloud.masu.rs";
|
|
||||||
transmissionServer = "download.masu.rs";
|
|
||||||
metricsServer = "metrics.masu.rs";
|
|
||||||
vaultwardenServer = "vault.masu.rs";
|
|
||||||
giteaServer = "git.masu.rs";
|
|
||||||
|
|
||||||
# Disable passwords, only use SSH key
|
# Not sure what's necessary but too afraid to remove anything
|
||||||
publicKey =
|
imports = [ (inputs.nixpkgs + "/nixos/modules/profiles/qemu-guest.nix") ];
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
|
boot.initrd.availableKernelModules = [
|
||||||
|
"xhci_pci"
|
||||||
|
"virtio_pci"
|
||||||
|
"usbhid"
|
||||||
|
];
|
||||||
|
|
||||||
|
# File systems must be declared in order to boot
|
||||||
|
|
||||||
|
# This is the root filesystem containing NixOS
|
||||||
|
# I forgot to set a clean label for it
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-uuid/e1b6bd50-306d-429a-9f45-78f57bc597c3";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
# This is the boot filesystem for systemd-boot
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-uuid/D5CA-237A";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Theming
|
||||||
|
|
||||||
|
# Server doesn't require GUI
|
||||||
|
gui.enable = false;
|
||||||
|
|
||||||
|
# Still require colors for programs like Neovim, K9S
|
||||||
|
theme = {
|
||||||
|
colors = (import ../../colorscheme/gruvbox-dark).dark;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Programs and services
|
||||||
|
atuin.enable = true;
|
||||||
|
cloudflare.enable = true; # Proxy traffic with Cloudflare
|
||||||
|
dotfiles.enable = true; # Clone dotfiles
|
||||||
|
neovim.enable = true;
|
||||||
|
giteaRunner.enable = true;
|
||||||
|
services.actualbudget.enable = true;
|
||||||
|
services.caddy.enable = true;
|
||||||
|
services.grafana.enable = true;
|
||||||
|
services.thelounge.enable = true;
|
||||||
|
services.openssh.enable = true;
|
||||||
|
services.victoriametrics.enable = true;
|
||||||
|
services.influxdb2.enable = true;
|
||||||
|
services.gitea.enable = true;
|
||||||
|
services.vaultwarden.enable = true;
|
||||||
|
services.minecraft-server.enable = true; # Setup Minecraft server
|
||||||
|
services.n8n.enable = true;
|
||||||
|
services.ntfy-sh.enable = true;
|
||||||
|
services.postgresql.enable = true;
|
||||||
|
services.uptime-kuma.enable = true;
|
||||||
|
system.autoUpgrade.enable = true;
|
||||||
|
|
||||||
|
# Allows private remote access over the internet
|
||||||
|
cloudflareTunnel = {
|
||||||
|
enable = true;
|
||||||
|
id = "bd250ee1-ed2e-42d2-b627-039f1eb5a4d2";
|
||||||
|
credentialsFile = ../../private/cloudflared-flame.age;
|
||||||
|
ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK/6oyVqjFGX3Uvrc3VS8J9sphxzAnRzKC85xgkHfYgR3TK6qBGXzHrknEj21xeZrr3G2y1UsGzphWJd9ZfIcdA= open-ssh-ca@cloudflareaccess.org";
|
||||||
|
};
|
||||||
|
|
||||||
# Nextcloud backup config
|
# Nextcloud backup config
|
||||||
backup.s3 = {
|
backup.s3 = {
|
||||||
endpoint = "s3.us-west-002.backblazeb2.com";
|
endpoint = "s3.us-west-002.backblazeb2.com";
|
||||||
bucket = "noahmasur-backup";
|
bucket = "noahmasur-backup";
|
||||||
accessKeyId = "0026b0e73b2e2c80000000005";
|
accessKeyId = "0026b0e73b2e2c80000000005";
|
||||||
|
resticBucket = "noahmasur-restic";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Grant access to Jellyfin directories from Nextcloud
|
# Disable passwords, only use SSH key
|
||||||
users.users.nextcloud.extraGroups = [ "jellyfin" ];
|
publicKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal"
|
||||||
|
];
|
||||||
|
|
||||||
# Wireguard config for Transmission
|
# # Wireguard config for Transmission
|
||||||
wireguard.enable = true;
|
# wireguard.enable = true;
|
||||||
networking.wireguard.interfaces.wg0 = {
|
# networking.wireguard.interfaces.wg0 = {
|
||||||
|
#
|
||||||
# The local IPs for this machine within the Wireguard network
|
# # The local IPs for this machine within the Wireguard network
|
||||||
# Any inbound traffic bound for these IPs should be kept on localhost
|
# # Any inbound traffic bound for these IPs should be kept on localhost
|
||||||
ips = [ "10.66.13.200/32" "fc00:bbbb:bbbb:bb01::3:dc7/128" ];
|
# ips = [ "10.66.13.200/32" "fc00:bbbb:bbbb:bb01::3:dc7/128" ];
|
||||||
|
#
|
||||||
peers = [{
|
# peers = [{
|
||||||
|
#
|
||||||
# Identity of Wireguard target peer (VPN)
|
# # Identity of Wireguard target peer (VPN)
|
||||||
publicKey = "bOOP5lIjqCdDx5t+mP/kEcSbHS4cZqE0rMlBI178lyY=";
|
# publicKey = "bOOP5lIjqCdDx5t+mP/kEcSbHS4cZqE0rMlBI178lyY=";
|
||||||
|
#
|
||||||
# The public internet address of the target peer
|
# # The public internet address of the target peer
|
||||||
endpoint = "86.106.143.132:51820";
|
# endpoint = "86.106.143.132:51820";
|
||||||
|
#
|
||||||
# Which outgoing IP ranges should be sent through Wireguard
|
# # Which outgoing IP ranges should be sent through Wireguard
|
||||||
allowedIPs = [ "0.0.0.0/0" "::0/0" ];
|
# allowedIPs = [ "0.0.0.0/0" "::0/0" ];
|
||||||
|
#
|
||||||
# Send heartbeat signal within the network
|
# # Send heartbeat signal within the network
|
||||||
persistentKeepalive = 25;
|
# persistentKeepalive = 25;
|
||||||
|
#
|
||||||
}];
|
# }];
|
||||||
|
#
|
||||||
};
|
# };
|
||||||
|
|
||||||
# VPN port forwarding
|
|
||||||
services.transmission.settings.peer-port = 57599;
|
|
||||||
|
|
||||||
# Grant access to Transmission directories from Jellyfin
|
|
||||||
users.users.jellyfin.extraGroups = [ "transmission" ];
|
|
||||||
|
|
||||||
# Proxy traffic with Cloudflare
|
|
||||||
cloudflare.enable = true;
|
|
||||||
|
|
||||||
# Setup Minecraft server
|
|
||||||
gaming.minecraft-server.enable = true;
|
|
||||||
|
|
||||||
# Clone dotfiles
|
|
||||||
dotfiles.enable = true;
|
|
||||||
|
|
||||||
neovim.enable = true;
|
|
||||||
|
|
||||||
|
# # VPN port forwarding
|
||||||
|
# services.transmission.settings.peer-port = 57599;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ lib, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-uuid/e1b6bd50-306d-429a-9f45-78f57bc597c3";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
|
||||||
device = "/dev/disk/by-uuid/D5CA-237A";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [ ];
|
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eth0.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
|
|
||||||
}
|
|
@ -1,31 +1,35 @@
|
|||||||
# The Hydra
|
# The Hydra
|
||||||
# System configuration for WSL
|
# System configuration for WSL
|
||||||
|
|
||||||
{ inputs, globals, overlays, ... }:
|
# See [readme](../README.md) to explain how this file works.
|
||||||
|
|
||||||
with inputs;
|
{
|
||||||
|
inputs,
|
||||||
|
globals,
|
||||||
|
overlays,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
nixpkgs.lib.nixosSystem {
|
inputs.nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
specialArgs = { };
|
specialArgs = { };
|
||||||
modules = [
|
modules = [
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/nixos
|
../../modules/nixos
|
||||||
|
../../modules/wsl
|
||||||
globals
|
globals
|
||||||
wsl.nixosModules.wsl
|
inputs.wsl.nixosModules.wsl
|
||||||
home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
networking.hostName = "hydra";
|
networking.hostName = "hydra";
|
||||||
nixpkgs.overlays = overlays;
|
nixpkgs.overlays = overlays;
|
||||||
# Set registry to flake packages, used for nix X commands
|
|
||||||
nix.registry.nixpkgs.flake = nixpkgs;
|
|
||||||
identityFile = "/home/${globals.user}/.ssh/id_ed25519";
|
identityFile = "/home/${globals.user}/.ssh/id_ed25519";
|
||||||
gui.enable = false;
|
gui.enable = false;
|
||||||
theme = {
|
theme = {
|
||||||
colors = (import ../../colorscheme/gruvbox).dark;
|
colors = (import ../../colorscheme/gruvbox).dark;
|
||||||
dark = true;
|
dark = true;
|
||||||
};
|
};
|
||||||
passwordHash = nixpkgs.lib.fileContents ../../private/password.sha512;
|
passwordHash = inputs.nixpkgs.lib.fileContents ../../misc/password.sha512;
|
||||||
wsl = {
|
wsl = {
|
||||||
enable = true;
|
enable = true;
|
||||||
wslConf.automount.root = "/mnt";
|
wslConf.automount.root = "/mnt";
|
||||||
@ -33,8 +37,7 @@ nixpkgs.lib.nixosSystem {
|
|||||||
startMenuLaunchers = true;
|
startMenuLaunchers = true;
|
||||||
nativeSystemd = true;
|
nativeSystemd = true;
|
||||||
wslConf.network.generateResolvConf = true; # Turn off if it breaks VPN
|
wslConf.network.generateResolvConf = true; # Turn off if it breaks VPN
|
||||||
interop.includePath =
|
interop.includePath = false; # Including Windows PATH will slow down Neovim command mode
|
||||||
false; # Including Windows PATH will slow down Neovim command mode
|
|
||||||
};
|
};
|
||||||
|
|
||||||
neovim.enable = true;
|
neovim.enable = true;
|
||||||
@ -42,7 +45,6 @@ nixpkgs.lib.nixosSystem {
|
|||||||
mail.aerc.enable = true;
|
mail.aerc.enable = true;
|
||||||
mail.himalaya.enable = true;
|
mail.himalaya.enable = true;
|
||||||
dotfiles.enable = true;
|
dotfiles.enable = true;
|
||||||
nixlang.enable = true;
|
|
||||||
lua.enable = true;
|
lua.enable = true;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -1,49 +1,60 @@
|
|||||||
# The Looking Glass
|
# The Looking Glass
|
||||||
# System configuration for my work Macbook
|
# System configuration for my work Macbook
|
||||||
|
|
||||||
{ inputs, globals, overlays, ... }:
|
{
|
||||||
|
inputs,
|
||||||
|
globals,
|
||||||
|
overlays,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
with inputs;
|
inputs.darwin.lib.darwinSystem {
|
||||||
|
system = "aarch64-darwin";
|
||||||
darwin.lib.darwinSystem {
|
|
||||||
system = "x86_64-darwin";
|
|
||||||
specialArgs = { };
|
specialArgs = { };
|
||||||
modules = [
|
modules = [
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/darwin
|
../../modules/darwin
|
||||||
(globals // {
|
(
|
||||||
|
globals
|
||||||
|
// rec {
|
||||||
user = "Noah.Masur";
|
user = "Noah.Masur";
|
||||||
gitName = "Noah-Masur_1701";
|
gitName = "Noah-Masur_1701";
|
||||||
gitEmail = "Noah.Masur@take2games.com";
|
gitEmail = "${user}@take2games.com";
|
||||||
})
|
}
|
||||||
home-manager.darwinModules.home-manager
|
)
|
||||||
|
inputs.home-manager.darwinModules.home-manager
|
||||||
|
inputs.mac-app-util.darwinModules.default
|
||||||
{
|
{
|
||||||
networking.hostName = "noah-masur-mac";
|
nixpkgs.overlays = [ inputs.firefox-darwin.overlay ] ++ overlays;
|
||||||
|
networking.hostName = "NYCM-NMASUR2";
|
||||||
|
networking.computerName = "NYCM-NMASUR2";
|
||||||
identityFile = "/Users/Noah.Masur/.ssh/id_ed25519";
|
identityFile = "/Users/Noah.Masur/.ssh/id_ed25519";
|
||||||
gui.enable = true;
|
gui.enable = true;
|
||||||
theme = {
|
theme = {
|
||||||
colors = (import ../../colorscheme/gruvbox).dark;
|
colors = (import ../../colorscheme/gruvbox-dark).dark;
|
||||||
dark = true;
|
dark = true;
|
||||||
};
|
};
|
||||||
mail.user = globals.user;
|
mail.user = globals.user;
|
||||||
nixpkgs.overlays = [ firefox-darwin.overlay ] ++ overlays;
|
atuin.enable = true;
|
||||||
# Set registry to flake packages, used for nix X commands
|
|
||||||
nix.registry.nixpkgs.flake = nixpkgs;
|
|
||||||
charm.enable = true;
|
charm.enable = true;
|
||||||
neovim.enable = true;
|
neovim.enable = true;
|
||||||
mail.enable = true;
|
mail.enable = true;
|
||||||
mail.aerc.enable = true;
|
mail.aerc.enable = true;
|
||||||
mail.himalaya.enable = true;
|
mail.himalaya.enable = false;
|
||||||
kitty.enable = true;
|
kitty.enable = true;
|
||||||
discord.enable = true;
|
discord.enable = true;
|
||||||
firefox.enable = true;
|
firefox.enable = true;
|
||||||
dotfiles.enable = true;
|
dotfiles.enable = true;
|
||||||
nixlang.enable = true;
|
|
||||||
terraform.enable = true;
|
terraform.enable = true;
|
||||||
python.enable = true;
|
python.enable = true;
|
||||||
|
rust.enable = true;
|
||||||
lua.enable = true;
|
lua.enable = true;
|
||||||
|
obsidian.enable = true;
|
||||||
kubernetes.enable = true;
|
kubernetes.enable = true;
|
||||||
_1password.enable = true;
|
_1password.enable = true;
|
||||||
|
slack.enable = true;
|
||||||
|
wezterm.enable = true;
|
||||||
|
yt-dlp.enable = true;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
53
hosts/staff/default.nix
Normal file
53
hosts/staff/default.nix
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# The Staff
|
||||||
|
# ISO configuration for my USB drive
|
||||||
|
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
system,
|
||||||
|
overlays,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
inputs.nixos-generators.nixosGenerate {
|
||||||
|
inherit system;
|
||||||
|
format = "install-iso";
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
|
nixpkgs.overlays = overlays;
|
||||||
|
networking.hostName = "staff";
|
||||||
|
users.extraUsers.root.openssh.authorizedKeys.keys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s"
|
||||||
|
];
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
ports = [ 22 ];
|
||||||
|
allowSFTP = true;
|
||||||
|
settings = {
|
||||||
|
GatewayPorts = "no";
|
||||||
|
X11Forwarding = false;
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
PermitRootLogin = "yes";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
environment.systemPackages =
|
||||||
|
let
|
||||||
|
pkgs = import inputs.nixpkgs { inherit system overlays; };
|
||||||
|
in
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
git
|
||||||
|
vim
|
||||||
|
wget
|
||||||
|
curl
|
||||||
|
(import ../../modules/common/neovim/package {
|
||||||
|
inherit pkgs;
|
||||||
|
colors = (import ../../colorscheme/gruvbox).dark;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
nix.extraOptions = ''
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
warn-dirty = false
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
@ -1,55 +1,146 @@
|
|||||||
# The Swan
|
# The Swan
|
||||||
# System configuration for my home NAS server
|
# System configuration for my home NAS server
|
||||||
|
|
||||||
{ inputs, globals, overlays, ... }:
|
{
|
||||||
|
inputs,
|
||||||
|
globals,
|
||||||
|
overlays,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
with inputs;
|
inputs.nixpkgs.lib.nixosSystem rec {
|
||||||
|
|
||||||
nixpkgs.lib.nixosSystem {
|
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
specialArgs = { };
|
specialArgs = {
|
||||||
|
pkgs-stable = import inputs.nixpkgs-stable { inherit system; };
|
||||||
|
pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./hardware-configuration.nix
|
globals
|
||||||
./disks.nix
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
inputs.disko.nixosModules.disko
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/nixos
|
../../modules/nixos
|
||||||
(removeAttrs globals [ "mail.server" ])
|
|
||||||
wsl.nixosModules.wsl
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
disko.nixosModules.disko
|
|
||||||
{
|
{
|
||||||
server = true;
|
|
||||||
zfs.enable = true;
|
|
||||||
|
|
||||||
# head -c 8 /etc/machine-id
|
|
||||||
networking.hostId = "600279f4"; # Random ID required for ZFS
|
|
||||||
|
|
||||||
gui.enable = false;
|
|
||||||
theme = { colors = (import ../../colorscheme/gruvbox).dark; };
|
|
||||||
nixpkgs.overlays = overlays;
|
nixpkgs.overlays = overlays;
|
||||||
wsl.enable = false;
|
|
||||||
caddy.enable = true;
|
|
||||||
|
|
||||||
|
# Hardware
|
||||||
|
server = true;
|
||||||
|
physical = true;
|
||||||
networking.hostName = "swan";
|
networking.hostName = "swan";
|
||||||
|
|
||||||
# Disable passwords, only use SSH key
|
# Not sure what's necessary but too afraid to remove anything
|
||||||
publicKey =
|
boot.initrd.availableKernelModules = [
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
|
"xhci_pci"
|
||||||
|
"ahci"
|
||||||
|
"nvme"
|
||||||
|
"usb_storage"
|
||||||
|
"sd_mod"
|
||||||
|
];
|
||||||
|
|
||||||
# Clone dotfiles
|
# Required for transcoding
|
||||||
dotfiles.enable = true;
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
|
boot.kernelParams = [
|
||||||
|
"radeon.si_support=0"
|
||||||
|
"amdgpu.si_support=1"
|
||||||
|
"radeon.cik_support=0"
|
||||||
|
"amdgpu.cik_support=1"
|
||||||
|
"amdgpu.dc=1"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Required binary blobs to boot on this machine
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
|
||||||
|
# Prioritize efficiency over performance
|
||||||
|
powerManagement.cpuFreqGovernor = "powersave";
|
||||||
|
|
||||||
|
# Allow firmware updates
|
||||||
|
hardware.cpu.intel.updateMicrocode = true;
|
||||||
|
|
||||||
|
# ZFS
|
||||||
|
zfs.enable = true;
|
||||||
|
# Generated with: head -c 8 /etc/machine-id
|
||||||
|
networking.hostId = "600279f4"; # Random ID required for ZFS
|
||||||
|
|
||||||
|
# Sets root ext4 filesystem instead of declaring it manually
|
||||||
|
disko = {
|
||||||
|
enableConfig = true;
|
||||||
|
devices = (import ../../disks/root.nix { disk = "/dev/nvme0n1"; });
|
||||||
|
};
|
||||||
|
|
||||||
|
zramSwap.enable = true;
|
||||||
|
swapDevices = [
|
||||||
|
{
|
||||||
|
device = "/swapfile";
|
||||||
|
size = 4 * 1024; # 4 GB
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.zfs = {
|
||||||
|
# Automatically load the ZFS pool on boot
|
||||||
|
extraPools = [ "tank" ];
|
||||||
|
# Only try to decrypt datasets with keyfiles
|
||||||
|
requestEncryptionCredentials = [
|
||||||
|
"tank/archive"
|
||||||
|
"tank/generic"
|
||||||
|
"tank/nextcloud"
|
||||||
|
"tank/generic/git"
|
||||||
|
];
|
||||||
|
# If password is requested and fails, continue to boot eventually
|
||||||
|
passwordTimeout = 300;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Theming
|
||||||
|
|
||||||
|
# Server doesn't require GUI
|
||||||
|
gui.enable = false;
|
||||||
|
|
||||||
|
# Still require colors for programs like Neovim, K9S
|
||||||
|
theme = {
|
||||||
|
colors = (import ../../colorscheme/gruvbox-dark).dark;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Programs and services
|
||||||
|
atuin.enable = true;
|
||||||
neovim.enable = true;
|
neovim.enable = true;
|
||||||
|
cloudflare.enable = true;
|
||||||
|
dotfiles.enable = true;
|
||||||
|
arrs.enable = true;
|
||||||
|
filebrowser.enable = true;
|
||||||
|
services.audiobookshelf.enable = true;
|
||||||
|
services.bind.enable = true;
|
||||||
|
services.caddy.enable = true;
|
||||||
|
services.immich.enable = true;
|
||||||
|
services.jellyfin.enable = true;
|
||||||
|
services.nextcloud.enable = true;
|
||||||
|
services.calibre-web.enable = true;
|
||||||
|
services.openssh.enable = true;
|
||||||
|
services.prometheus.enable = false;
|
||||||
|
services.vmagent.enable = true;
|
||||||
|
services.samba.enable = true;
|
||||||
|
services.paperless.enable = true;
|
||||||
|
services.postgresql.enable = true;
|
||||||
|
system.autoUpgrade.enable = false;
|
||||||
|
|
||||||
# boot.zfs.enabled = true;
|
# Allows private remote access over the internet
|
||||||
# boot.kernelPackages =
|
cloudflareTunnel = {
|
||||||
# config.boot.zfs.package.latestCompatibleLinuxPackages;
|
enable = true;
|
||||||
# boot.zfs.extraPools = [ "mypool" ];
|
id = "646754ac-2149-4a58-b51a-e1d0a1f3ade2";
|
||||||
# services.zfs.autoScrub.enable = true;
|
credentialsFile = ../../private/cloudflared-swan.age;
|
||||||
# services.zfs.autoScrub.interval = "daily";
|
ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCHF/UMtJqPFrf6f6GRY0ZFnkCW7b6sYgUTjTtNfRj1RdmNic1NoJZql7y6BrqQinZvy7nsr1UFDNWoHn6ah3tg= open-ssh-ca@cloudflareaccess.org";
|
||||||
|
};
|
||||||
|
|
||||||
# services.nfs.server.enable = true;
|
# Send regular backups and litestream for DBs to an S3-like bucket
|
||||||
|
backup.s3 = {
|
||||||
|
endpoint = "s3.us-west-002.backblazeb2.com";
|
||||||
|
bucket = "noahmasur-backup";
|
||||||
|
accessKeyId = "0026b0e73b2e2c80000000005";
|
||||||
|
resticBucket = "noahmasur-restic";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Disable passwords, only use SSH key
|
||||||
|
publicKeys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1,172 +0,0 @@
|
|||||||
{ ... }: {
|
|
||||||
disko.enableConfig = false;
|
|
||||||
disko.devices = {
|
|
||||||
disk = {
|
|
||||||
boot = {
|
|
||||||
type = "disk";
|
|
||||||
device = "/dev/nvme0n1";
|
|
||||||
content = {
|
|
||||||
type = "table";
|
|
||||||
format = "gpt";
|
|
||||||
partitions = [
|
|
||||||
{
|
|
||||||
type = "partition";
|
|
||||||
name = "ESP";
|
|
||||||
start = "0";
|
|
||||||
end = "512MiB";
|
|
||||||
fs-type = "fat32";
|
|
||||||
bootable = true;
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "vfat";
|
|
||||||
mountpoint = "/boot";
|
|
||||||
extraArgs = [ "-n boot" ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "partition";
|
|
||||||
name = "root";
|
|
||||||
start = "512MiB";
|
|
||||||
end = "100%";
|
|
||||||
part-type = "primary";
|
|
||||||
bootable = true;
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "ext4";
|
|
||||||
mountpoint = "/";
|
|
||||||
extraArgs = [ "-L nixos" ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
sda = {
|
|
||||||
type = "disk";
|
|
||||||
device = "/dev/sda";
|
|
||||||
content = {
|
|
||||||
type = "table";
|
|
||||||
format = "gpt";
|
|
||||||
partitions = [{
|
|
||||||
type = "partition";
|
|
||||||
name = "zfs";
|
|
||||||
start = "128MiB";
|
|
||||||
end = "100%";
|
|
||||||
content = {
|
|
||||||
type = "zfs";
|
|
||||||
pool = "tank";
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
sdb = {
|
|
||||||
type = "disk";
|
|
||||||
device = "/dev/sdb";
|
|
||||||
content = {
|
|
||||||
type = "table";
|
|
||||||
format = "gpt";
|
|
||||||
partitions = [{
|
|
||||||
type = "partition";
|
|
||||||
name = "zfs";
|
|
||||||
start = "128MiB";
|
|
||||||
end = "100%";
|
|
||||||
content = {
|
|
||||||
type = "zfs";
|
|
||||||
pool = "tank";
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
sdc = {
|
|
||||||
type = "disk";
|
|
||||||
device = "/dev/sdc";
|
|
||||||
content = {
|
|
||||||
type = "table";
|
|
||||||
format = "gpt";
|
|
||||||
partitions = [{
|
|
||||||
type = "partition";
|
|
||||||
name = "zfs";
|
|
||||||
start = "128MiB";
|
|
||||||
end = "100%";
|
|
||||||
content = {
|
|
||||||
type = "zfs";
|
|
||||||
pool = "tank";
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
zpool = {
|
|
||||||
tank = {
|
|
||||||
type = "zpool";
|
|
||||||
mode = "raidz1";
|
|
||||||
rootFsOptions = {
|
|
||||||
compression = "on"; # lz4 by default
|
|
||||||
"com.sun:auto-snapshot" = "false";
|
|
||||||
ashift = "12";
|
|
||||||
};
|
|
||||||
# mountpoint = "/";
|
|
||||||
|
|
||||||
datasets = {
|
|
||||||
media = {
|
|
||||||
zfs_type = "filesystem";
|
|
||||||
mountpoint = "/media";
|
|
||||||
options."com.sun:auto-snapshot" = "false";
|
|
||||||
};
|
|
||||||
# "media/movies" = {
|
|
||||||
# zfs_type = "filesystem";
|
|
||||||
# mountpoint = "/media/movies";
|
|
||||||
# options.recordsize = "1M";
|
|
||||||
# };
|
|
||||||
# "media/tv" = {
|
|
||||||
# zfs_type = "filesystem";
|
|
||||||
# mountpoint = "/media/tv";
|
|
||||||
# options.recordsize = "1M";
|
|
||||||
# };
|
|
||||||
# "media/books" = {
|
|
||||||
# zfs_type = "filesystem";
|
|
||||||
# mountpoint = "/media/books";
|
|
||||||
# };
|
|
||||||
# archive = {
|
|
||||||
# zfs_type = "filesystem";
|
|
||||||
# mountpoint = "/archive";
|
|
||||||
# options.compression = "zstd";
|
|
||||||
# options."com.sun:auto-snapshot" = "true";
|
|
||||||
# };
|
|
||||||
# zfs_unmounted_fs = {
|
|
||||||
# zfs_type = "filesystem";
|
|
||||||
# options.mountpoint = "none";
|
|
||||||
# };
|
|
||||||
# zfs_legacy_fs = {
|
|
||||||
# zfs_type = "filesystem";
|
|
||||||
# options.mountpoint = "legacy";
|
|
||||||
# mountpoint = "/zfs_legacy_fs";
|
|
||||||
# };
|
|
||||||
# zfs_testvolume = {
|
|
||||||
# zfs_type = "volume";
|
|
||||||
# size = "10M";
|
|
||||||
# content = {
|
|
||||||
# type = "filesystem";
|
|
||||||
# format = "ext4";
|
|
||||||
# mountpoint = "/ext4onzfs";
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
# encrypted = {
|
|
||||||
# zfs_type = "filesystem";
|
|
||||||
# size = "20M";
|
|
||||||
# options = {
|
|
||||||
# mountpoint = "none";
|
|
||||||
# encryption = "aes-256-gcm";
|
|
||||||
# keyformat = "passphrase";
|
|
||||||
# keylocation = "file:///tmp/secret.key";
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
# "encrypted/test" = {
|
|
||||||
# zfs_type = "filesystem";
|
|
||||||
# size = "2M";
|
|
||||||
# mountpoint = "/zfs_crypted";
|
|
||||||
# };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules =
|
|
||||||
[ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-label/nixos";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
|
||||||
device = "/dev/disk/by-label/boot";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [ ];
|
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
|
||||||
hardware.cpu.intel.updateMicrocode =
|
|
||||||
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
@ -1,41 +1,114 @@
|
|||||||
# The Tempest
|
# The Tempest
|
||||||
# System configuration for my desktop
|
# System configuration for my desktop
|
||||||
|
|
||||||
{ inputs, globals, overlays, ... }:
|
{
|
||||||
|
inputs,
|
||||||
|
globals,
|
||||||
|
overlays,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
with inputs;
|
inputs.nixpkgs.lib.nixosSystem rec {
|
||||||
|
|
||||||
nixpkgs.lib.nixosSystem {
|
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
specialArgs = { };
|
specialArgs = {
|
||||||
|
pkgs-stable = import inputs.nixpkgs-stable { inherit system; };
|
||||||
|
pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./hardware-configuration.nix
|
globals
|
||||||
|
inputs.home-manager.nixosModules.home-manager
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/nixos
|
../../modules/nixos
|
||||||
globals
|
|
||||||
wsl.nixosModules.wsl
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
{
|
||||||
|
nixpkgs.overlays = overlays;
|
||||||
|
|
||||||
|
# Hardware
|
||||||
physical = true;
|
physical = true;
|
||||||
networking.hostName = "tempest";
|
networking.hostName = "tempest";
|
||||||
nixpkgs.overlays = [ nur.overlay ] ++ overlays;
|
|
||||||
# Set registry to flake packages, used for nix X commands
|
# Not sure what's necessary but too afraid to remove anything
|
||||||
nix.registry.nixpkgs.flake = nixpkgs;
|
boot.initrd.availableKernelModules = [
|
||||||
identityFile = "/home/${globals.user}/.ssh/id_ed25519";
|
"nvme"
|
||||||
|
"xhci_pci"
|
||||||
|
"ahci"
|
||||||
|
"usb_storage"
|
||||||
|
"usbhid"
|
||||||
|
"sd_mod"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Graphics and VMs
|
||||||
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
|
boot.kernelModules = [ "kvm-amd" ];
|
||||||
|
services.xserver.videoDrivers = [ "amdgpu" ];
|
||||||
|
|
||||||
|
# I don't think I need this?
|
||||||
|
# boot.kernelParams = [
|
||||||
|
# "video=DP-0:2560x1440@165"
|
||||||
|
# "video=DP-1:1920x1080@60"
|
||||||
|
# ];
|
||||||
|
|
||||||
|
# Required binary blobs to boot on this machine
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
|
||||||
|
# Prioritize performance over efficiency
|
||||||
|
powerManagement.cpuFreqGovernor = "performance";
|
||||||
|
|
||||||
|
# Allow firmware updates
|
||||||
|
hardware.cpu.amd.updateMicrocode = true;
|
||||||
|
|
||||||
|
# Helps reduce GPU fan noise under idle loads
|
||||||
|
hardware.fancontrol.enable = true;
|
||||||
|
hardware.fancontrol.config = ''
|
||||||
|
# Configuration file generated by pwmconfig, changes will be lost
|
||||||
|
INTERVAL=10
|
||||||
|
DEVPATH=hwmon0=devices/pci0000:00/0000:00:03.1/0000:06:00.0/0000:07:00.0/0000:08:00.0
|
||||||
|
DEVNAME=hwmon0=amdgpu
|
||||||
|
FCTEMPS=hwmon0/pwm1=hwmon0/temp1_input
|
||||||
|
FCFANS= hwmon0/pwm1=hwmon0/fan1_input
|
||||||
|
MINTEMP=hwmon0/pwm1=50
|
||||||
|
MAXTEMP=hwmon0/pwm1=70
|
||||||
|
MINSTART=hwmon0/pwm1=100
|
||||||
|
MINSTOP=hwmon0/pwm1=10
|
||||||
|
MINPWM=hwmon0/pwm1=10
|
||||||
|
MAXPWM=hwmon0/pwm1=240
|
||||||
|
'';
|
||||||
|
|
||||||
|
# File systems must be declared in order to boot
|
||||||
|
|
||||||
|
# This is the root filesystem containing NixOS
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-label/nixos";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
# This is the boot filesystem for Grub
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-label/boot";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Secrets must be prepared ahead before deploying
|
||||||
|
passwordHash = inputs.nixpkgs.lib.fileContents ../../misc/password.sha512;
|
||||||
|
|
||||||
|
# Theming
|
||||||
|
|
||||||
|
# Turn on all features related to desktop and graphical applications
|
||||||
gui.enable = true;
|
gui.enable = true;
|
||||||
|
|
||||||
|
# Set the system-wide theme, also used for non-graphical programs
|
||||||
theme = {
|
theme = {
|
||||||
colors = (import ../../colorscheme/gruvbox).dark;
|
colors = (import ../../colorscheme/gruvbox-dark).dark;
|
||||||
dark = true;
|
dark = true;
|
||||||
};
|
};
|
||||||
wallpaper = "${wallpapers}/gruvbox/road.jpg";
|
wallpaper = "${inputs.wallpapers}/gruvbox/road.jpg";
|
||||||
gtk.theme.name = nixpkgs.lib.mkDefault "Adwaita-dark";
|
gtk.theme.name = inputs.nixpkgs.lib.mkDefault "Adwaita-dark";
|
||||||
passwordHash = nixpkgs.lib.fileContents ../../private/password.sha512;
|
|
||||||
wsl.enable = false;
|
|
||||||
publicKey = null;
|
|
||||||
|
|
||||||
|
# Programs and services
|
||||||
|
atuin.enable = true;
|
||||||
charm.enable = true;
|
charm.enable = true;
|
||||||
neovim.enable = true;
|
neovim.enable = true;
|
||||||
media.enable = true;
|
media.enable = true;
|
||||||
|
dotfiles.enable = true;
|
||||||
firefox.enable = true;
|
firefox.enable = true;
|
||||||
kitty.enable = true;
|
kitty.enable = true;
|
||||||
_1password.enable = true;
|
_1password.enable = true;
|
||||||
@ -46,18 +119,35 @@ nixpkgs.lib.nixosSystem {
|
|||||||
mail.aerc.enable = true;
|
mail.aerc.enable = true;
|
||||||
mail.himalaya.enable = true;
|
mail.himalaya.enable = true;
|
||||||
keybase.enable = true;
|
keybase.enable = true;
|
||||||
# mullvad.enable = true;
|
mullvad.enable = false;
|
||||||
nixlang.enable = true;
|
rust.enable = true;
|
||||||
dotfiles.enable = true;
|
terraform.enable = true;
|
||||||
|
wezterm.enable = true;
|
||||||
|
yt-dlp.enable = true;
|
||||||
gaming = {
|
gaming = {
|
||||||
|
dwarf-fortress.enable = true;
|
||||||
enable = true;
|
enable = true;
|
||||||
steam.enable = true;
|
steam.enable = true;
|
||||||
|
moonlight.enable = true;
|
||||||
legendary.enable = true;
|
legendary.enable = true;
|
||||||
lutris.enable = true;
|
lutris.enable = true;
|
||||||
leagueoflegends.enable = true;
|
ryujinx.enable = true;
|
||||||
|
};
|
||||||
|
services.vmagent.enable = true; # Enables Prometheus metrics
|
||||||
|
services.openssh.enable = true; # Required for Cloudflare tunnel and identity file
|
||||||
|
|
||||||
|
# Allows private remote access over the internet
|
||||||
|
cloudflareTunnel = {
|
||||||
|
enable = true;
|
||||||
|
id = "ac133a82-31fb-480c-942a-cdbcd4c58173";
|
||||||
|
credentialsFile = ../../private/cloudflared-tempest.age;
|
||||||
|
ca = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPY6C0HmdFCaxYtJxFr3qV4/1X4Q8KrYQ1hlme3u1hJXK+xW+lc9Y9glWHrhiTKilB7carYTB80US0O47gI5yU4= open-ssh-ca@cloudflareaccess.org";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Allows requests to force machine to wake up
|
||||||
|
# This network interface might change, needs to be set specifically for each machine.
|
||||||
|
# Or set usePredictableInterfaceNames = false
|
||||||
|
networking.interfaces.enp5s0.wakeOnLan.enable = true;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules =
|
|
||||||
[ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
|
||||||
boot.kernelModules = [ "kvm-amd" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
services.xserver.videoDrivers = [ "amdgpu" ];
|
|
||||||
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-label/nixos";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
|
||||||
device = "/dev/disk/by-label/boot";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [ ];
|
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp5s0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
|
|
||||||
hardware.cpu.amd.updateMicrocode =
|
|
||||||
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
21
misc/README.md
Normal file
21
misc/README.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Miscellaneous
|
||||||
|
|
||||||
|
These files contain important data sourced by the configuration, or simply
|
||||||
|
information to store for safekeeping later.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Creating hashed password for [password.sha512](./password.sha512):
|
||||||
|
|
||||||
|
```
|
||||||
|
mkpasswd -m sha-512
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Getting key for [public-keys](./public-keys):
|
||||||
|
|
||||||
|
```
|
||||||
|
ssh-keyscan -t ed25519 <hostname>
|
||||||
|
```
|
||||||
|
|
23
misc/libratbag-profile
Normal file
23
misc/libratbag-profile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Profile 1: (active)
|
||||||
|
Name: n/a
|
||||||
|
Report Rate: 1000Hz
|
||||||
|
Resolutions:
|
||||||
|
0: 400dpi (active) (default)
|
||||||
|
1: 800dpi
|
||||||
|
2: 1600dpi
|
||||||
|
3: 2400dpi
|
||||||
|
4: 0dpi
|
||||||
|
Button: 0 is mapped to 'button 1'
|
||||||
|
Button: 1 is mapped to 'button 2'
|
||||||
|
Button: 2 is mapped to 'button 3'
|
||||||
|
Button: 3 is mapped to 'button 4'
|
||||||
|
Button: 4 is mapped to 'button 5'
|
||||||
|
Button: 5 is mapped to macro '↕F11'
|
||||||
|
Button: 6 is mapped to macro '↕VOLUMEDOWN'
|
||||||
|
Button: 7 is mapped to macro '↕VOLUMEUP'
|
||||||
|
Button: 8 is mapped to 'unknown'
|
||||||
|
Button: 9 is mapped to 'wheel-right'
|
||||||
|
Button: 10 is mapped to 'wheel-left'
|
||||||
|
LED: 0, depth: monochrome, mode: on, color: 000000
|
||||||
|
LED: 1, depth: monochrome, mode: on, color: 000000
|
||||||
|
LED: 2, depth: monochrome, mode: on, color: 000000
|
7
misc/public-keys
Normal file
7
misc/public-keys
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Scan hosts: ssh-keyscan -t ed25519 <hostnames>
|
||||||
|
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s personal
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHVknmPi7sG6ES0G0jcsvebzKGWWaMfJTYgvOue6EULI flame
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ9mwXlZnIALt9SnH3FOZvdgHLM5ZqwYUERXBbM7Rwh6 swan
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC3yHivgEXr2ecwe58h9bkhwTYivf3GwL8xenQKMeiUb tempest
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICmGHIWBZzRx35/yFgnPJSHN2+35WJ30G9c5tDhPsCrl arrow
|
9
modules/README.md
Normal file
9
modules/README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Modules
|
||||||
|
|
||||||
|
| Module | Purpose |
|
||||||
|
| --- | --- |
|
||||||
|
| [common](./common/default.nix) | User programs and OS-agnostic configuration |
|
||||||
|
| [darwin](./darwin/default.nix) | macOS-specific configuration |
|
||||||
|
| [nixos](./nixos/default.nix) | NixOS-specific configuration |
|
||||||
|
| [wsl](./wsl/default.nix) | WSL-specific configuration |
|
||||||
|
|
9
modules/aws/default.nix
Normal file
9
modules/aws/default.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
# AWS settings require this
|
||||||
|
permitRootLogin = "prohibit-password";
|
||||||
|
|
||||||
|
# Make sure disk size is large enough
|
||||||
|
# https://github.com/nix-community/nixos-generators/issues/150
|
||||||
|
amazonImage.sizeMB = 16 * 1024;
|
||||||
|
}
|
@ -1,4 +1,10 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
_1password = {
|
_1password = {
|
||||||
@ -9,12 +15,27 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf
|
config = lib.mkIf (config.gui.enable && config._1password.enable) {
|
||||||
(config.gui.enable && config._1password.enable && pkgs.stdenv.isLinux) {
|
unfreePackages = [
|
||||||
unfreePackages = [ "1password" "_1password-gui" ];
|
"1password"
|
||||||
|
"_1password-gui"
|
||||||
|
"1password-cli"
|
||||||
|
];
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
home.packages = with pkgs; [ _1password-gui ];
|
home.packages = [
|
||||||
};
|
pkgs._1password-cli
|
||||||
|
] ++ (if pkgs.stdenv.isLinux then [ pkgs._1password-gui ] else [ ]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# https://1password.community/discussion/135462/firefox-extension-does-not-connect-to-linux-app
|
||||||
|
# On Mac, does not apply: https://1password.community/discussion/142794/app-and-browser-integration
|
||||||
|
# However, the button doesn't work either:
|
||||||
|
# https://1password.community/discussion/140735/extending-support-for-trusted-web-browsers
|
||||||
|
environment.etc."1password/custom_allowed_browsers".text = ''
|
||||||
|
${
|
||||||
|
config.home-manager.users.${config.user}.programs.firefox.package
|
||||||
|
}/Applications/Firefox.app/Contents/MacOS/firefox
|
||||||
|
firefox
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
alacritty = {
|
alacritty = {
|
||||||
@ -28,7 +34,9 @@
|
|||||||
opacity = 1.0;
|
opacity = 1.0;
|
||||||
};
|
};
|
||||||
scrolling.history = 10000;
|
scrolling.history = 10000;
|
||||||
font = { size = 14.0; };
|
font = {
|
||||||
|
size = 14.0;
|
||||||
|
};
|
||||||
key_bindings = [
|
key_bindings = [
|
||||||
# Used for word completion in fish_user_key_bindings
|
# Used for word completion in fish_user_key_bindings
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{ ... }: {
|
{ ... }:
|
||||||
|
{
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./1password.nix
|
./1password.nix
|
||||||
@ -9,7 +10,8 @@
|
|||||||
./media.nix
|
./media.nix
|
||||||
./obsidian.nix
|
./obsidian.nix
|
||||||
./qbittorrent.nix
|
./qbittorrent.nix
|
||||||
./nautilus.nix
|
./slack.nix
|
||||||
|
./wezterm.nix
|
||||||
|
./yt-dlp.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
discord = {
|
discord = {
|
||||||
@ -11,8 +17,8 @@
|
|||||||
|
|
||||||
config = lib.mkIf (config.gui.enable && config.discord.enable) {
|
config = lib.mkIf (config.gui.enable && config.discord.enable) {
|
||||||
unfreePackages = [ "discord" ];
|
unfreePackages = [ "discord" ];
|
||||||
|
environment.systemPackages = [ pkgs.discord ];
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
home.packages = with pkgs; [ discord ];
|
|
||||||
xdg.configFile."discord/settings.json".text = ''
|
xdg.configFile."discord/settings.json".text = ''
|
||||||
{
|
{
|
||||||
"BACKGROUND_COLOR": "#202225",
|
"BACKGROUND_COLOR": "#202225",
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -22,55 +27,52 @@
|
|||||||
|
|
||||||
programs.firefox = {
|
programs.firefox = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package =
|
package = if pkgs.stdenv.isDarwin then pkgs.firefox-bin else pkgs.firefox;
|
||||||
if pkgs.stdenv.isDarwin then pkgs.firefox-bin else pkgs.firefox;
|
|
||||||
profiles.default = {
|
profiles.default = {
|
||||||
id = 0;
|
id = 0;
|
||||||
name = "default";
|
name = "default";
|
||||||
isDefault = true;
|
isDefault = true;
|
||||||
|
# https://nur.nix-community.org/repos/rycee/
|
||||||
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
|
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
|
||||||
ublock-origin
|
|
||||||
vimium
|
|
||||||
multi-account-containers
|
|
||||||
facebook-container
|
|
||||||
temporary-containers
|
|
||||||
(lib.mkIf config._1password.enable onepassword-password-manager)
|
(lib.mkIf config._1password.enable onepassword-password-manager)
|
||||||
|
darkreader
|
||||||
|
don-t-fuck-with-paste
|
||||||
|
facebook-container
|
||||||
|
markdownload
|
||||||
|
multi-account-containers
|
||||||
okta-browser-plugin
|
okta-browser-plugin
|
||||||
sponsorblock
|
|
||||||
reddit-enhancement-suite
|
reddit-enhancement-suite
|
||||||
return-youtube-dislikes
|
return-youtube-dislikes
|
||||||
markdownload
|
sponsorblock
|
||||||
darkreader
|
ublock-origin
|
||||||
snowflake
|
ublacklist
|
||||||
don-t-fuck-with-paste
|
vimium
|
||||||
i-dont-care-about-cookies
|
|
||||||
wappalyzer
|
|
||||||
];
|
];
|
||||||
settings = {
|
settings = {
|
||||||
"app.update.auto" = false;
|
"app.update.auto" = false;
|
||||||
"browser.aboutConfig.showWarning" = false;
|
"browser.aboutConfig.showWarning" = false;
|
||||||
"browser.warnOnQuit" = false;
|
"browser.warnOnQuit" = false;
|
||||||
"browser.quitShortcut.disabled" =
|
"browser.quitShortcut.disabled" = if pkgs.stdenv.isLinux then true else false;
|
||||||
if pkgs.stdenv.isLinux then true else false;
|
|
||||||
"browser.theme.dark-private-windows" = true;
|
"browser.theme.dark-private-windows" = true;
|
||||||
"browser.toolbars.bookmarks.visibility" = false;
|
"browser.toolbars.bookmarks.visibility" = false;
|
||||||
"browser.startup.page" = 3; # Restore previous session
|
"browser.startup.page" = 3; # Restore previous session
|
||||||
"browser.newtabpage.enabled" = false; # Make new tabs blank
|
"browser.newtabpage.enabled" = false; # Make new tabs blank
|
||||||
"trailhead.firstrun.didSeeAboutWelcome" =
|
"trailhead.firstrun.didSeeAboutWelcome" = true; # Disable welcome splash
|
||||||
true; # Disable welcome splash
|
|
||||||
"dom.forms.autocomplete.formautofill" = false; # Disable autofill
|
"dom.forms.autocomplete.formautofill" = false; # Disable autofill
|
||||||
"extensions.formautofill.creditCards.enabled" =
|
"extensions.formautofill.creditCards.enabled" = false; # Disable credit cards
|
||||||
false; # Disable credit cards
|
|
||||||
"dom.payments.defaults.saveAddress" = false; # Disable address save
|
"dom.payments.defaults.saveAddress" = false; # Disable address save
|
||||||
"general.autoScroll" = true; # Drag middle-mouse to scroll
|
"general.autoScroll" = true; # Drag middle-mouse to scroll
|
||||||
"services.sync.prefs.sync.general.autoScroll" =
|
"services.sync.prefs.sync.general.autoScroll" = false; # Prevent disabling autoscroll
|
||||||
false; # Prevent disabling autoscroll
|
|
||||||
"extensions.pocket.enabled" = false;
|
"extensions.pocket.enabled" = false;
|
||||||
"toolkit.legacyUserProfileCustomizations.stylesheets" =
|
"toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Allow userChrome.css
|
||||||
true; # Allow userChrome.css
|
|
||||||
"layout.css.color-mix.enabled" = true;
|
"layout.css.color-mix.enabled" = true;
|
||||||
"ui.systemUsesDarkTheme" =
|
"ui.systemUsesDarkTheme" = if config.theme.dark == true then 1 else 0;
|
||||||
if config.theme.dark == true then 1 else 0;
|
"media.ffmpeg.vaapi.enabled" = true; # Enable hardware video acceleration
|
||||||
|
"cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups
|
||||||
|
"devtools.command-button-screenshot.enabled" = true; # Scrolling screenshot of entire page
|
||||||
|
"svg.context-properties.content.enabled" = true; # Sidebery styling
|
||||||
|
"browser.tabs.hoverPreview.enabled" = false; # Disable tab previews
|
||||||
|
"browser.tabs.hoverPreview.showThumbnails" = false; # Disable tab previews
|
||||||
};
|
};
|
||||||
userChrome = ''
|
userChrome = ''
|
||||||
:root {
|
:root {
|
||||||
@ -111,7 +113,7 @@
|
|||||||
background-color: ${config.theme.colors.base00};
|
background-color: ${config.theme.colors.base00};
|
||||||
color: ${config.theme.colors.base06} !important;
|
color: ${config.theme.colors.base06} !important;
|
||||||
}
|
}
|
||||||
.tab-content[selected=true] {
|
.tab-content[selected] {
|
||||||
border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 25%, transparent);
|
border-bottom: 2px solid color-mix(in srgb, var(--identity-tab-color) 25%, transparent);
|
||||||
background-color: ${config.theme.colors.base01} !important;
|
background-color: ${config.theme.colors.base01} !important;
|
||||||
color: ${config.theme.colors.base07} !important;
|
color: ${config.theme.colors.base07} !important;
|
||||||
@ -155,10 +157,47 @@
|
|||||||
|
|
||||||
extraConfig = "";
|
extraConfig = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Mimic nixpkgs package environment for read-only profiles.ini management
|
||||||
|
# From: https://github.com/booxter/home-manager/commit/dd1602e306fec366280f5953c5e1b553e3d9672a
|
||||||
|
home.sessionVariables = {
|
||||||
|
MOZ_LEGACY_PROFILES = 1;
|
||||||
|
MOZ_ALLOW_DOWNGRADE = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
# launchd.user.envVariables = config.home-manager.users.${config.user}.home.sessionVariables;
|
||||||
|
|
||||||
|
xdg.mimeApps = {
|
||||||
|
associations.added = {
|
||||||
|
"text/html" = [ "firefox.desktop" ];
|
||||||
|
};
|
||||||
|
defaultApplications = {
|
||||||
|
"text/html" = [ "firefox.desktop" ];
|
||||||
|
};
|
||||||
|
associations.removed = {
|
||||||
|
"text/html" = [ "wine-extension-htm.desktop" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
|
||||||
|
"${
|
||||||
|
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
|
||||||
|
}+Shift+b" = "exec ${
|
||||||
|
# Don't name the script `firefox` or it will affect grep
|
||||||
|
builtins.toString (
|
||||||
|
pkgs.writeShellScript "focus-ff.sh" ''
|
||||||
|
count=$(ps aux | grep -c firefox)
|
||||||
|
if [ "$count" -eq 1 ]; then
|
||||||
|
i3-msg "exec --no-startup-id firefox"
|
||||||
|
sleep 0.5
|
||||||
|
fi
|
||||||
|
i3-msg "[class=firefox] focus"
|
||||||
|
''
|
||||||
|
)
|
||||||
|
}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
kitty = {
|
kitty = {
|
||||||
@ -10,16 +16,42 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (config.gui.enable && config.kitty.enable) {
|
config = lib.mkIf (config.gui.enable && config.kitty.enable) {
|
||||||
|
|
||||||
|
# Set the Rofi-Systemd terminal for viewing logs
|
||||||
|
# Using optionalAttrs because only available in NixOS
|
||||||
|
environment =
|
||||||
|
{ }
|
||||||
|
// lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
|
||||||
|
sessionVariables.ROFI_SYSTEMD_TERM = lib.mkDefault "${pkgs.kitty}/bin/kitty";
|
||||||
|
};
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
# xsession.windowManager.i3.config.terminal = "kitty";
|
|
||||||
# programs.rofi.terminal = "${pkgs.kitty}/bin/kitty";
|
# Set the i3 terminal
|
||||||
|
xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "kitty";
|
||||||
|
|
||||||
|
# Set the Rofi terminal for running programs
|
||||||
|
programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux (lib.mkDefault "${pkgs.kitty}/bin/kitty");
|
||||||
|
|
||||||
|
# Display images in the terminal
|
||||||
|
programs.fish.interactiveShellInit = # fish
|
||||||
|
''
|
||||||
|
if test "$TERM" = "xterm-kitty"
|
||||||
|
alias icat="kitty +kitten icat"
|
||||||
|
alias ssh="kitty +kitten ssh"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
programs.kitty = {
|
programs.kitty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
environment = { };
|
environment = { };
|
||||||
extraConfig = "";
|
extraConfig = "";
|
||||||
font.size = 14;
|
font.size = 14;
|
||||||
keybindings = {
|
keybindings = {
|
||||||
|
# Use shift+enter to complete text suggestions in fish
|
||||||
"shift+enter" = "send_text all \\x1F";
|
"shift+enter" = "send_text all \\x1F";
|
||||||
|
|
||||||
|
# Easy fullscreen toggle (for macOS)
|
||||||
"super+f" = "toggle_fullscreen";
|
"super+f" = "toggle_fullscreen";
|
||||||
};
|
};
|
||||||
settings = {
|
settings = {
|
||||||
@ -68,10 +100,8 @@
|
|||||||
color21 = config.theme.colors.base06;
|
color21 = config.theme.colors.base06;
|
||||||
|
|
||||||
# Scrollback
|
# Scrollback
|
||||||
scrolling_lines = 10000;
|
scrollback_lines = 10000;
|
||||||
scrollback_pager_history_size = 10; # MB
|
scrollback_pager_history_size = 300; # MB
|
||||||
scrollback_pager = ''
|
|
||||||
${pkgs.neovim}/bin/nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -'';
|
|
||||||
|
|
||||||
# Window
|
# Window
|
||||||
window_padding_width = 6;
|
window_padding_width = 6;
|
||||||
@ -79,7 +109,7 @@
|
|||||||
tab_bar_edge = "top";
|
tab_bar_edge = "top";
|
||||||
tab_bar_style = "slant";
|
tab_bar_style = "slant";
|
||||||
|
|
||||||
# Audio
|
# Disable audio
|
||||||
enable_audio_bell = false;
|
enable_audio_bell = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
media = {
|
media = {
|
||||||
@ -12,19 +18,50 @@
|
|||||||
config = lib.mkIf (config.gui.enable && config.media.enable) {
|
config = lib.mkIf (config.gui.enable && config.media.enable) {
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
mpv # Video viewer
|
nsxiv # Image viewer
|
||||||
sxiv # Image viewer
|
|
||||||
mupdf # PDF viewer
|
mupdf # PDF viewer
|
||||||
zathura # PDF viewer
|
zathura # PDF viewer
|
||||||
];
|
];
|
||||||
|
|
||||||
# Set default for opening PDFs
|
# Video player
|
||||||
xdg.mimeApps.defaultApplications."application/pdf" =
|
programs.mpv = {
|
||||||
[ "zathura.desktop" ];
|
enable = true;
|
||||||
xdg.mimeApps.defaultApplications."image/*" = [ "sxiv.desktop" ];
|
bindings = { };
|
||||||
|
config = {
|
||||||
|
image-display-duration = 2; # For cycling through images
|
||||||
|
hwdec = "auto-safe"; # Attempt to use GPU decoding for video
|
||||||
|
};
|
||||||
|
scripts = [
|
||||||
|
|
||||||
|
# Automatically load playlist entries before and after current file
|
||||||
|
pkgs.mpvScripts.autoload
|
||||||
|
|
||||||
|
# Delete current file after quitting
|
||||||
|
pkgs.mpvScripts.mpv-delete-file
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Set default programs for opening PDFs and other media
|
||||||
|
xdg.mimeApps = {
|
||||||
|
associations.added = {
|
||||||
|
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
||||||
|
"image/jpeg" = [ "nsxiv.desktop" ];
|
||||||
|
"image/png" = [ "nsxiv.desktop" ];
|
||||||
|
"image/*" = [ "nsxiv.desktop" ];
|
||||||
|
};
|
||||||
|
associations.removed = {
|
||||||
|
"application/pdf" = [
|
||||||
|
"mupdf.desktop"
|
||||||
|
"wine-extension-pdf.desktop"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
defaultApplications = {
|
||||||
|
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
||||||
|
"image/jpeg" = [ "nsxiv.desktop" ];
|
||||||
|
"image/png" = [ "nsxiv.desktop" ];
|
||||||
|
"image/*" = [ "nsxiv.desktop" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
|
||||||
|
|
||||||
options = {
|
|
||||||
nautilus = {
|
|
||||||
enable = lib.mkEnableOption {
|
|
||||||
description = "Enable Nautilus file manager.";
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Install Nautilus file manager
|
|
||||||
config = lib.mkIf (config.gui.enable && config.nautilus.enable) {
|
|
||||||
home-manager.users.${config.user} = {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
gnome.nautilus
|
|
||||||
gnome.sushi # Quick preview with spacebar
|
|
||||||
];
|
|
||||||
|
|
||||||
# Set default for opening directories
|
|
||||||
xdg.mimeApps.defaultApplications."inode/directory" =
|
|
||||||
[ "nautilus.desktop" ];
|
|
||||||
|
|
||||||
programs.fish.functions = {
|
|
||||||
qr = {
|
|
||||||
body =
|
|
||||||
"${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.gnome.sushi}/bin/sushi /tmp/qr.png";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,10 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
obsidian = {
|
obsidian = {
|
||||||
@ -14,6 +20,9 @@
|
|||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
home.packages = with pkgs; [ obsidian ];
|
home.packages = with pkgs; [ obsidian ];
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
|
# Broken on 2023-12-11
|
||||||
|
# https://forum.obsidian.md/t/electron-25-is-now-eol-please-upgrade-to-a-newer-version/72878/8
|
||||||
|
insecurePackages = [ "electron-25.9.0" ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
qbittorrent = {
|
qbittorrent = {
|
||||||
@ -14,8 +20,6 @@
|
|||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
home.packages = with pkgs; [ qbittorrent ];
|
home.packages = with pkgs; [ qbittorrent ];
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
26
modules/common/applications/slack.nix
Normal file
26
modules/common/applications/slack.nix
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
|
options = {
|
||||||
|
slack = {
|
||||||
|
enable = lib.mkEnableOption {
|
||||||
|
description = "Enable Slack.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf (config.gui.enable && config.slack.enable) {
|
||||||
|
unfreePackages = [ "slack" ];
|
||||||
|
home-manager.users.${config.user} = {
|
||||||
|
home.packages = with pkgs; [ slack ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Theme string: #1D2122,#665C54,#8EC07C,#BDAE93
|
||||||
|
}
|
286
modules/common/applications/wezterm.nix
Normal file
286
modules/common/applications/wezterm.nix
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
|
options = {
|
||||||
|
wezterm = {
|
||||||
|
enable = lib.mkEnableOption {
|
||||||
|
description = "Enable WezTerm terminal.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
font = config.home-manager.users.${config.user}.programs.kitty.font.name;
|
||||||
|
in
|
||||||
|
lib.mkIf (config.gui.enable && config.wezterm.enable) {
|
||||||
|
|
||||||
|
# Set the Rofi-Systemd terminal for viewing logs
|
||||||
|
# Using optionalAttrs because only available in NixOS
|
||||||
|
environment =
|
||||||
|
{ }
|
||||||
|
// lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
|
||||||
|
sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.wezterm}/bin/wezterm";
|
||||||
|
};
|
||||||
|
|
||||||
|
terminal = "${pkgs.wezterm}/bin/wezterm";
|
||||||
|
terminalLaunchCommand = "${config.terminal} start --";
|
||||||
|
|
||||||
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
|
# Set the i3 terminal
|
||||||
|
xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "wezterm";
|
||||||
|
|
||||||
|
# Display images in the terminal
|
||||||
|
programs.fish.shellAliases = {
|
||||||
|
icat = lib.mkForce "wezterm imgcat";
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.wezterm = {
|
||||||
|
enable = true;
|
||||||
|
colorSchemes = {
|
||||||
|
myTheme = {
|
||||||
|
background = config.theme.colors.base00;
|
||||||
|
foreground = config.theme.colors.base05;
|
||||||
|
cursor_bg = config.theme.colors.base05;
|
||||||
|
cursor_fg = config.theme.colors.base00;
|
||||||
|
cursor_border = config.theme.colors.base05;
|
||||||
|
selection_bg = config.theme.colors.base05;
|
||||||
|
selection_fg = config.theme.colors.base00;
|
||||||
|
scrollbar_thumb = config.theme.colors.base03;
|
||||||
|
ansi = [
|
||||||
|
config.theme.colors.base01 # black
|
||||||
|
config.theme.colors.base0F # maroon
|
||||||
|
config.theme.colors.base0B # green
|
||||||
|
config.theme.colors.base0A # olive
|
||||||
|
config.theme.colors.base0D # navy
|
||||||
|
config.theme.colors.base0E # purple
|
||||||
|
config.theme.colors.base0C # teal
|
||||||
|
config.theme.colors.base06 # silver
|
||||||
|
];
|
||||||
|
brights = [
|
||||||
|
config.theme.colors.base03 # grey
|
||||||
|
config.theme.colors.base08 # red
|
||||||
|
config.theme.colors.base0B # lime
|
||||||
|
config.theme.colors.base0A # yellow
|
||||||
|
config.theme.colors.base0D # blue
|
||||||
|
config.theme.colors.base0E # fuchsia
|
||||||
|
config.theme.colors.base0C # aqua
|
||||||
|
config.theme.colors.base07 # white
|
||||||
|
];
|
||||||
|
compose_cursor = config.theme.colors.base09; # orange
|
||||||
|
copy_mode_active_highlight_bg = {
|
||||||
|
Color = config.theme.colors.base03;
|
||||||
|
};
|
||||||
|
copy_mode_active_highlight_fg = {
|
||||||
|
Color = config.theme.colors.base07;
|
||||||
|
};
|
||||||
|
copy_mode_inactive_highlight_bg = {
|
||||||
|
Color = config.theme.colors.base02;
|
||||||
|
};
|
||||||
|
copy_mode_inactive_highlight_fg = {
|
||||||
|
Color = config.theme.colors.base06;
|
||||||
|
};
|
||||||
|
quick_select_label_bg = {
|
||||||
|
Color = config.theme.colors.base02;
|
||||||
|
};
|
||||||
|
quick_select_label_fg = {
|
||||||
|
Color = config.theme.colors.base06;
|
||||||
|
};
|
||||||
|
quick_select_match_bg = {
|
||||||
|
Color = config.theme.colors.base03;
|
||||||
|
};
|
||||||
|
quick_select_match_fg = {
|
||||||
|
Color = config.theme.colors.base07;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraConfig = ''
|
||||||
|
local wezterm = require("wezterm")
|
||||||
|
local config = wezterm.config_builder()
|
||||||
|
config.check_for_updates = false
|
||||||
|
config.color_scheme = "myTheme"
|
||||||
|
|
||||||
|
-- Scrollback
|
||||||
|
config.scrollback_lines = 10000
|
||||||
|
|
||||||
|
-- Window
|
||||||
|
config.window_padding = {
|
||||||
|
left = 10,
|
||||||
|
right = 10,
|
||||||
|
top = 10,
|
||||||
|
bottom = 12,
|
||||||
|
}
|
||||||
|
|
||||||
|
config.font = wezterm.font('${font}', { weight = 'Bold'})
|
||||||
|
config.font_size = ${if pkgs.stdenv.isLinux then "14.0" else "18.0"}
|
||||||
|
|
||||||
|
-- Fix color blocks instead of text
|
||||||
|
config.front_end = "WebGpu"
|
||||||
|
|
||||||
|
-- Tab Bar
|
||||||
|
config.hide_tab_bar_if_only_one_tab = true
|
||||||
|
config.window_frame = {
|
||||||
|
font = wezterm.font('${font}', { weight = 'Bold'}),
|
||||||
|
font_size = ${if pkgs.stdenv.isLinux then "12.0" else "16.0"},
|
||||||
|
}
|
||||||
|
|
||||||
|
config.colors = {
|
||||||
|
tab_bar = {
|
||||||
|
active_tab = {
|
||||||
|
bg_color = '${config.theme.colors.base00}',
|
||||||
|
fg_color = '${config.theme.colors.base04}',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Disable audio
|
||||||
|
config.audible_bell = "Disabled"
|
||||||
|
|
||||||
|
config.initial_rows = 80
|
||||||
|
config.initial_cols = 200
|
||||||
|
|
||||||
|
config.unix_domains = {
|
||||||
|
{
|
||||||
|
name = 'unix',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- This causes `wezterm` to act as though it was started as
|
||||||
|
-- `wezterm connect unix` by default, connecting to the unix
|
||||||
|
-- domain on startup.
|
||||||
|
-- If you prefer to connect manually, leave out this line.
|
||||||
|
config.default_gui_startup_args = { 'connect', 'unix' }
|
||||||
|
|
||||||
|
config.leader = {
|
||||||
|
key = 'a',
|
||||||
|
mods = 'CTRL',
|
||||||
|
timeout_milliseconds = 2000,
|
||||||
|
}
|
||||||
|
|
||||||
|
config.keys = {
|
||||||
|
-- Attach to muxer
|
||||||
|
{
|
||||||
|
key = 'a',
|
||||||
|
mods = 'LEADER',
|
||||||
|
action = wezterm.action.AttachDomain 'unix',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Detach from muxer
|
||||||
|
{
|
||||||
|
key = 'd',
|
||||||
|
mods = 'LEADER',
|
||||||
|
action = wezterm.action.DetachDomain { DomainName = 'unix' },
|
||||||
|
},
|
||||||
|
-- sends completion string for fish autosuggestions
|
||||||
|
{
|
||||||
|
key = 'Enter',
|
||||||
|
mods = 'SHIFT',
|
||||||
|
action = wezterm.action.SendString '\x1F'
|
||||||
|
},
|
||||||
|
-- ctrl-shift-h was "hide"
|
||||||
|
{
|
||||||
|
key = 'H',
|
||||||
|
mods = 'SHIFT|CTRL',
|
||||||
|
action = wezterm.action.DisableDefaultAssignment
|
||||||
|
},
|
||||||
|
-- alt-enter was "fullscreen"
|
||||||
|
{
|
||||||
|
key = 'Enter',
|
||||||
|
mods = 'ALT',
|
||||||
|
action = wezterm.action.DisableDefaultAssignment
|
||||||
|
},
|
||||||
|
-- make super-f "fullscreen"
|
||||||
|
{
|
||||||
|
key = 'f',
|
||||||
|
mods = 'SUPER',
|
||||||
|
action = wezterm.action.ToggleFullScreen
|
||||||
|
},
|
||||||
|
-- super-t open new tab in new dir
|
||||||
|
{
|
||||||
|
key = 't',
|
||||||
|
mods = ${if pkgs.stdenv.isDarwin then "'SUPER'" else "'ALT'"},
|
||||||
|
action = wezterm.action.SpawnCommandInNewTab {
|
||||||
|
cwd = wezterm.home_dir,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- shift-super-t open new tab in same dir
|
||||||
|
{
|
||||||
|
key = 't',
|
||||||
|
mods = 'SUPER|SHIFT',
|
||||||
|
action = wezterm.action.SpawnTab 'CurrentPaneDomain'
|
||||||
|
},
|
||||||
|
-- project switcher
|
||||||
|
{
|
||||||
|
key = 'P',
|
||||||
|
mods = 'SUPER',
|
||||||
|
action = wezterm.action_callback(function(window, pane)
|
||||||
|
local choices = {}
|
||||||
|
|
||||||
|
wezterm.log_info "working?"
|
||||||
|
|
||||||
|
function scandir(directory)
|
||||||
|
local i, t, popen = 0, {}, io.popen
|
||||||
|
local pfile = popen('${pkgs.fd}/bin/fd --search-path "'..directory..'" --type directory --exact-depth 2 | ${pkgs.proximity-sort}/bin/proximity-sort "'..os.getenv("HOME").."/dev/work"..'"')
|
||||||
|
for filename in pfile:lines() do
|
||||||
|
i = i + 1
|
||||||
|
t[i] = filename
|
||||||
|
end
|
||||||
|
pfile:close()
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, v in pairs(scandir(os.getenv("HOME").."/dev")) do
|
||||||
|
table.insert(choices, { label = v })
|
||||||
|
end
|
||||||
|
|
||||||
|
window:perform_action(
|
||||||
|
wezterm.action.InputSelector {
|
||||||
|
action = wezterm.action_callback(function(window, pane, id, label)
|
||||||
|
if not id and not label then
|
||||||
|
wezterm.log_info "cancelled"
|
||||||
|
else
|
||||||
|
window:perform_action(
|
||||||
|
wezterm.action.SpawnCommandInNewTab {
|
||||||
|
cwd = label,
|
||||||
|
},
|
||||||
|
pane
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
fuzzy = true,
|
||||||
|
title = "Select Project",
|
||||||
|
choices = choices,
|
||||||
|
},
|
||||||
|
pane
|
||||||
|
)
|
||||||
|
end),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- print the workspace name at the upper right
|
||||||
|
wezterm.on("update-right-status", function(window, pane)
|
||||||
|
window:set_right_status(window:active_workspace())
|
||||||
|
end)
|
||||||
|
-- load plugin
|
||||||
|
local workspace_switcher = wezterm.plugin.require("https://github.com/MLFlexer/smart_workspace_switcher.wezterm")
|
||||||
|
-- set path to zoxide
|
||||||
|
workspace_switcher.zoxide_path = "${pkgs.zoxide}/bin/zoxide"
|
||||||
|
-- keymaps
|
||||||
|
table.insert(config.keys, { key = "s", mods = "CTRL|SHIFT", action = workspace_switcher.switch_workspace() })
|
||||||
|
-- table.insert(config.keys, { key = "t", mods = "CTRL|SHIFT", action = wezterm.action.ShowLauncherArgs({ flags = "FUZZY|WORKSPACES" }) })
|
||||||
|
table.insert(config.keys, { key = "[", mods = "CTRL|SHIFT", action = wezterm.action.SwitchWorkspaceRelative(1) })
|
||||||
|
table.insert(config.keys, { key = "]", mods = "CTRL|SHIFT", action = wezterm.action.SwitchWorkspaceRelative(-1) })
|
||||||
|
|
||||||
|
return config
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
38
modules/common/applications/yt-dlp.nix
Normal file
38
modules/common/applications/yt-dlp.nix
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
|
options = {
|
||||||
|
yt-dlp = {
|
||||||
|
enable = lib.mkEnableOption {
|
||||||
|
description = "Enable YouTube downloader.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf (config.yt-dlp.enable) {
|
||||||
|
home-manager.users.${config.user} = {
|
||||||
|
programs.yt-dlp = {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = "";
|
||||||
|
settings = {
|
||||||
|
no-continue = true; # Always re-download each fragment
|
||||||
|
no-overwrites = true; # Don't overwrite existing files
|
||||||
|
download-archive = "archive.log"; # Log of archives
|
||||||
|
embed-metadata = true;
|
||||||
|
embed-thumbnail = true;
|
||||||
|
embed-subs = true;
|
||||||
|
sub-langs = "en.*";
|
||||||
|
concurrent-fragments = 4; # Parallel download chunks
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.fish.shellAbbrs.yt = "yt-dlp";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -1,7 +1,19 @@
|
|||||||
{ config, lib, pkgs, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
imports =
|
imports = [
|
||||||
[ ./applications ./mail ./neovim ./programming ./repositories ./shell ];
|
./applications
|
||||||
|
./mail
|
||||||
|
./neovim
|
||||||
|
./programming
|
||||||
|
./repositories
|
||||||
|
./shell
|
||||||
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
user = lib.mkOption {
|
user = lib.mkOption {
|
||||||
@ -17,8 +29,7 @@
|
|||||||
download = lib.mkOption {
|
download = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "XDG directory for downloads";
|
description = "XDG directory for downloads";
|
||||||
default =
|
default = if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
|
||||||
if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
identityFile = lib.mkOption {
|
identityFile = lib.mkOption {
|
||||||
@ -44,20 +55,13 @@
|
|||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# colorscheme = lib.mkOption {
|
|
||||||
# type = types.attrs;
|
|
||||||
# description = "Base16 color scheme";
|
|
||||||
# };
|
|
||||||
homePath = lib.mkOption {
|
homePath = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
description = "Path of user's home directory.";
|
description = "Path of user's home directory.";
|
||||||
default = builtins.toPath (if pkgs.stdenv.isDarwin then
|
default = builtins.toPath (
|
||||||
"/Users/${config.user}"
|
if pkgs.stdenv.isDarwin then "/Users/${config.user}" else "/home/${config.user}"
|
||||||
else
|
);
|
||||||
"/home/${config.user}");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
dotfilesPath = lib.mkOption {
|
dotfilesPath = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
description = "Path of dotfiles repository.";
|
description = "Path of dotfiles repository.";
|
||||||
@ -65,26 +69,115 @@
|
|||||||
};
|
};
|
||||||
dotfilesRepo = lib.mkOption {
|
dotfilesRepo = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Link to dotfiles repository.";
|
description = "Link to dotfiles repository HTTPS URL.";
|
||||||
};
|
};
|
||||||
unfreePackages = lib.mkOption {
|
unfreePackages = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
description = "List of unfree packages to allow.";
|
description = "List of unfree packages to allow.";
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
|
insecurePackages = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
description = "List of insecure packages to allow.";
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
hostnames = {
|
||||||
|
audiobooks = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for audiobook server (Audiobookshelf).";
|
||||||
|
};
|
||||||
|
budget = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for budgeting server (ActualBudget).";
|
||||||
|
};
|
||||||
|
files = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for files server (Filebrowser).";
|
||||||
|
};
|
||||||
|
git = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for git server (Gitea).";
|
||||||
|
};
|
||||||
|
metrics = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for metrics server.";
|
||||||
|
};
|
||||||
|
minecraft = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for Minecraft server.";
|
||||||
|
};
|
||||||
|
paperless = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for document server (paperless-ngx).";
|
||||||
|
};
|
||||||
|
photos = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for photo management (Immich).";
|
||||||
|
};
|
||||||
|
prometheus = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for Prometheus server.";
|
||||||
|
};
|
||||||
|
influxdb = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for InfluxDB2 server.";
|
||||||
|
};
|
||||||
|
secrets = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for passwords and secrets (Vaultwarden).";
|
||||||
|
};
|
||||||
|
stream = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for video/media library (Jellyfin).";
|
||||||
|
};
|
||||||
|
content = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for personal content system (Nextcloud).";
|
||||||
|
};
|
||||||
|
books = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for books library (Calibre-Web).";
|
||||||
|
};
|
||||||
|
download = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for download services.";
|
||||||
|
};
|
||||||
|
irc = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for IRC services.";
|
||||||
|
};
|
||||||
|
n8n = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for n8n automation.";
|
||||||
|
};
|
||||||
|
notifications = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for push notification services (ntfy).";
|
||||||
|
};
|
||||||
|
status = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for status page (Uptime-Kuma).";
|
||||||
|
};
|
||||||
|
transmission = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for peer2peer downloads (Transmission).";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let stateVersion = "23.05";
|
config =
|
||||||
in {
|
let
|
||||||
|
stateVersion = "23.05";
|
||||||
# Enable features in Nix commands
|
in
|
||||||
nix.extraOptions = ''
|
{
|
||||||
experimental-features = nix-command flakes
|
|
||||||
warn-dirty = false
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Basic common system packages for all devices
|
# Basic common system packages for all devices
|
||||||
environment.systemPackages = with pkgs; [ git vim wget curl ];
|
environment.systemPackages = with pkgs; [
|
||||||
|
git
|
||||||
|
vim
|
||||||
|
wget
|
||||||
|
curl
|
||||||
|
];
|
||||||
|
|
||||||
# Use the system-level nixpkgs instead of Home Manager's
|
# Use the system-level nixpkgs instead of Home Manager's
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
@ -95,13 +188,13 @@
|
|||||||
|
|
||||||
# Allow specified unfree packages (identified elsewhere)
|
# Allow specified unfree packages (identified elsewhere)
|
||||||
# Retrieves package object based on string name
|
# Retrieves package object based on string name
|
||||||
nixpkgs.config.allowUnfreePredicate = pkg:
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.unfreePackages;
|
||||||
builtins.elem (lib.getName pkg) config.unfreePackages;
|
|
||||||
|
# Allow specified insecure packages (identified elsewhere)
|
||||||
|
nixpkgs.config.permittedInsecurePackages = config.insecurePackages;
|
||||||
|
|
||||||
# Pin a state version to prevent warnings
|
# Pin a state version to prevent warnings
|
||||||
home-manager.users.${config.user}.home.stateVersion = stateVersion;
|
home-manager.users.${config.user}.home.stateVersion = stateVersion;
|
||||||
home-manager.users.root.home.stateVersion = stateVersion;
|
home-manager.users.root.home.stateVersion = stateVersion;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
options.mail.aerc.enable = lib.mkEnableOption "Aerc email.";
|
options.mail.aerc.enable = lib.mkEnableOption "Aerc email.";
|
||||||
|
|
||||||
@ -68,14 +74,16 @@
|
|||||||
"!" = ":term<space>";
|
"!" = ":term<space>";
|
||||||
"|" = ":pipe<space>";
|
"|" = ":pipe<space>";
|
||||||
|
|
||||||
"/" = ":search<space>";
|
"/" = ":search<space>-a<space>";
|
||||||
"\\" = ":filter <space>";
|
"\\" = ":filter <space>";
|
||||||
n = ":next-result<Enter>";
|
n = ":next-result<Enter>";
|
||||||
N = ":prev-result<Enter>";
|
N = ":prev-result<Enter>";
|
||||||
"<Esc>" = ":clear<Enter>";
|
"<Esc>" = ":clear<Enter>";
|
||||||
};
|
};
|
||||||
|
|
||||||
"messages:folder=Drafts" = { "<Enter>" = ":recall<Enter>"; };
|
"messages:folder=Drafts" = {
|
||||||
|
"<Enter>" = ":recall<Enter>";
|
||||||
|
};
|
||||||
|
|
||||||
view = {
|
view = {
|
||||||
"/" = ":toggle-key-passthrough <Enter> /";
|
"/" = ":toggle-key-passthrough <Enter> /";
|
||||||
@ -148,28 +156,29 @@
|
|||||||
"<C-p>" = ":prev-tab<Enter>";
|
"<C-p>" = ":prev-tab<Enter>";
|
||||||
"<C-n>" = ":next-tab<Enter>";
|
"<C-n>" = ":next-tab<Enter>";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
general.unsafe-accounts-conf = true;
|
general = {
|
||||||
viewer = { pager = "${pkgs.less}/bin/less -R"; };
|
unsafe-accounts-conf = true;
|
||||||
|
# log-file = "~/.cache/aerc.log";
|
||||||
|
# log-level = "debug";
|
||||||
|
};
|
||||||
|
viewer = {
|
||||||
|
pager = "${pkgs.less}/bin/less -R";
|
||||||
|
};
|
||||||
filters = {
|
filters = {
|
||||||
"text/plain" =
|
"text/plain" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
|
||||||
"${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
|
"text/calendar" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/libexec/aerc/filters/calendar";
|
||||||
"text/calendar" =
|
|
||||||
"${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/calendar";
|
|
||||||
"text/html" =
|
"text/html" =
|
||||||
"${pkgs.aerc}/share/aerc/filters/html"; # Requires w3m, dante
|
"${pkgs.aerc}/libexec/aerc/filters/html | ${pkgs.aerc}/libexec/aerc/filters/colorize"; # Requires w3m, dante
|
||||||
# "text/html" =
|
|
||||||
# "${pkgs.aerc}/share/aerc/filters/html | ${pkgs.aerc}/share/aerc/filters/colorize";
|
|
||||||
# "text/*" =
|
# "text/*" =
|
||||||
# ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "'';
|
# ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "'';
|
||||||
"message/delivery-status" =
|
"message/delivery-status" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
|
||||||
"${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
|
"message/rfc822" = "${pkgs.aerc}/libexec/aerc/filters/colorize";
|
||||||
"message/rfc822" =
|
|
||||||
"${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
|
|
||||||
"application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
|
"application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
|
||||||
"application/pdf" = "${pkgs.zathura}/bin/zathura -";
|
"application/pdf" = "${pkgs.zathura}/bin/zathura -";
|
||||||
|
"audio/*" = "${pkgs.mpv}/bin/mpv -";
|
||||||
|
"image/*" = "${pkgs.feh}/bin/feh -";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -178,12 +187,34 @@
|
|||||||
extraAccounts = {
|
extraAccounts = {
|
||||||
check-mail = "5m";
|
check-mail = "5m";
|
||||||
check-mail-cmd = "${pkgs.isync}/bin/mbsync -a";
|
check-mail-cmd = "${pkgs.isync}/bin/mbsync -a";
|
||||||
|
check-mail-timeout = "15s";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.fish.shellAbbrs = { ae = "aerc"; };
|
xdg.desktopEntries.aerc = lib.mkIf (pkgs.stdenv.isLinux && config.gui.enable) {
|
||||||
|
name = "aerc";
|
||||||
|
exec = "${config.terminalLaunchCommand} aerc %u";
|
||||||
|
};
|
||||||
|
xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
|
||||||
|
"${config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier}+Shift+e" =
|
||||||
|
"exec ${
|
||||||
|
# Don't name the script `aerc` or it will affect grep
|
||||||
|
builtins.toString (
|
||||||
|
pkgs.writeShellScript "focus-mail.sh" ''
|
||||||
|
count=$(ps aux | grep -c aerc)
|
||||||
|
if [ "$count" -eq 1 ]; then
|
||||||
|
i3-msg "exec --no-startup-id ${config.terminal} start --class aerc -- aerc"
|
||||||
|
sleep 0.25
|
||||||
|
fi
|
||||||
|
i3-msg "[class=aerc] focus"
|
||||||
|
''
|
||||||
|
)
|
||||||
|
}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.fish.shellAbbrs = {
|
||||||
|
ae = "aerc";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
imports = [ ./himalaya.nix ./aerc.nix ];
|
imports = [
|
||||||
|
./himalaya.nix
|
||||||
|
./aerc.nix
|
||||||
|
./system.nix
|
||||||
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
mail.enable = lib.mkEnableOption "Mail service.";
|
mail.enable = lib.mkEnableOption "Mail service.";
|
||||||
@ -10,24 +20,60 @@
|
|||||||
default = config.user;
|
default = config.user;
|
||||||
};
|
};
|
||||||
mail.server = lib.mkOption {
|
mail.server = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.nullOr lib.types.str;
|
||||||
description = "Server name for the email address.";
|
description = "Server name for the email address.";
|
||||||
};
|
};
|
||||||
|
mail.imapHost = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
description = "Server host for IMAP (reading mail).";
|
||||||
|
};
|
||||||
|
mail.smtpHost = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
description = "Server host for SMTP (sending mail).";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.mail.enable {
|
config = lib.mkIf config.mail.enable {
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
programs.mbsync = { enable = true; };
|
programs.mbsync = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Automatically check for mail and keep files synced locally
|
||||||
services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
|
services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
|
||||||
enable = true;
|
enable = true;
|
||||||
frequency = "*:0/5";
|
frequency = "*:0/5";
|
||||||
|
postExec = "${pkgs.notmuch}/bin/notmuch new";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Used to watch for new mail and trigger sync
|
||||||
|
services.imapnotify.enable = pkgs.stdenv.isLinux;
|
||||||
|
|
||||||
|
# Allows sending email from CLI/sendmail
|
||||||
|
programs.msmtp.enable = true;
|
||||||
|
|
||||||
|
# Better local mail search
|
||||||
|
programs.notmuch = {
|
||||||
|
enable = true;
|
||||||
|
new.ignore = [
|
||||||
|
".mbsyncstate.lock"
|
||||||
|
".mbsyncstate.journal"
|
||||||
|
".mbsyncstate.new"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
accounts.email = {
|
accounts.email = {
|
||||||
|
|
||||||
|
# Where email files are stored
|
||||||
maildirBasePath = "${config.homePath}/mail";
|
maildirBasePath = "${config.homePath}/mail";
|
||||||
|
|
||||||
accounts = {
|
accounts = {
|
||||||
home = let address = "${config.mail.user}@${config.mail.server}";
|
home =
|
||||||
in {
|
let
|
||||||
|
address = "${config.mail.user}@${config.mail.server}";
|
||||||
|
in
|
||||||
|
{
|
||||||
userName = address;
|
userName = address;
|
||||||
realName = config.fullName;
|
realName = config.fullName;
|
||||||
primary = true;
|
primary = true;
|
||||||
@ -37,48 +83,57 @@
|
|||||||
"hey"
|
"hey"
|
||||||
"admin"
|
"admin"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Options for contact completion
|
||||||
alot = { };
|
alot = { };
|
||||||
flavor = "plain";
|
|
||||||
folders = { };
|
|
||||||
getmail = { };
|
|
||||||
imap = {
|
imap = {
|
||||||
host = "imap.purelymail.com";
|
host = config.mail.imapHost;
|
||||||
port = 993;
|
port = 993;
|
||||||
tls.enable = true;
|
tls.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Watch for mail and run notifications or sync
|
||||||
imapnotify = {
|
imapnotify = {
|
||||||
enable = false;
|
enable = true;
|
||||||
boxes = [ ];
|
boxes = [ "Inbox" ];
|
||||||
onNotify = "";
|
onNotify = "${pkgs.isync}/bin/mbsync -a";
|
||||||
onNotifyPost = "";
|
onNotifyPost =
|
||||||
|
lib.mkIf config.home-manager.users.${config.user}.services.dunst.enable
|
||||||
|
"${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
|
||||||
};
|
};
|
||||||
maildir = { path = "main"; };
|
|
||||||
|
# Name of the directory in maildir for this account
|
||||||
|
maildir = {
|
||||||
|
path = "main";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Bi-directional syncing options for local files
|
||||||
mbsync = {
|
mbsync = {
|
||||||
enable = true;
|
enable = true;
|
||||||
create = "maildir";
|
create = "both";
|
||||||
expunge = "none";
|
expunge = "both";
|
||||||
remove = "none";
|
remove = "both";
|
||||||
patterns = [ "*" ];
|
patterns = [ "*" ];
|
||||||
extraConfig.channel = {
|
extraConfig.channel = {
|
||||||
CopyArrivalDate = "yes"; # Sync time of original message
|
CopyArrivalDate = "yes"; # Sync time of original message
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mu.enable = false;
|
|
||||||
notmuch.enable = false;
|
# Enable indexing
|
||||||
passwordCommand =
|
notmuch.enable = true;
|
||||||
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
|
|
||||||
builtins.toString ../../private/mailpass.age
|
# Used to login and send and receive emails
|
||||||
}";
|
passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ~/.ssh/id_ed25519 ${pkgs.writeText "mailpass.age" (builtins.readFile ../../../private/mailpass.age)}";
|
||||||
|
|
||||||
smtp = {
|
smtp = {
|
||||||
host = "smtp.purelymail.com";
|
host = config.mail.smtpHost;
|
||||||
port = 465;
|
port = 465;
|
||||||
tls.enable = true;
|
tls.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{ config, lib, ... }: {
|
{ config, lib, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
options.mail.himalaya.enable = lib.mkEnableOption "Himalaya email.";
|
options.mail.himalaya.enable = lib.mkEnableOption "Himalaya email.";
|
||||||
|
|
||||||
@ -6,20 +7,20 @@
|
|||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
programs.himalaya = { enable = true; };
|
programs.himalaya = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
accounts.email.accounts.home.himalaya = {
|
accounts.email.accounts.home.himalaya = {
|
||||||
enable = true;
|
enable = true;
|
||||||
backend = "imap";
|
|
||||||
sender = "smtp";
|
|
||||||
settings = {
|
settings = {
|
||||||
downloads-dir = config.userDirs.download;
|
downloads-dir = config.userDirs.download;
|
||||||
smtp-insecure = true;
|
smtp-insecure = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.fish.shellAbbrs = { hi = "himalaya"; };
|
programs.fish.shellAbbrs = {
|
||||||
|
hi = "himalaya";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
35
modules/common/mail/system.nix
Normal file
35
modules/common/mail/system.nix
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
|
config = lib.mkIf (config.mail.enable || config.server) {
|
||||||
|
|
||||||
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
|
programs.msmtp.enable = true;
|
||||||
|
|
||||||
|
# The system user for sending automatic notifications
|
||||||
|
accounts.email.accounts.system =
|
||||||
|
let
|
||||||
|
address = "system@${config.mail.server}";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
userName = address;
|
||||||
|
realName = "NixOS System";
|
||||||
|
primary = !config.mail.enable; # Only primary if mail not enabled
|
||||||
|
inherit address;
|
||||||
|
passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}";
|
||||||
|
msmtp.enable = true;
|
||||||
|
smtp = {
|
||||||
|
host = config.mail.smtpHost;
|
||||||
|
port = 465;
|
||||||
|
tls.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
13
modules/common/neovim/config/align.nix
Normal file
13
modules/common/neovim/config/align.nix
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
|
# Plugin for aligning text programmatically
|
||||||
|
|
||||||
|
plugins = [ pkgs.vimPlugins.tabular ];
|
||||||
|
lua = ''
|
||||||
|
-- Align
|
||||||
|
vim.keymap.set("", "<Leader>ta", ":Tabularize /")
|
||||||
|
vim.keymap.set("", "<Leader>t#", ":Tabularize /#<CR>")
|
||||||
|
vim.keymap.set("", "<Leader>tl", ":Tabularize /---<CR>")
|
||||||
|
'';
|
||||||
|
}
|
@ -1,16 +1,22 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
|
# Shows buffers in a VSCode-style tab layout
|
||||||
|
|
||||||
plugins = [
|
plugins = [
|
||||||
pkgs.vimPlugins.bufferline-nvim
|
pkgs.vimPlugins.bufferline-nvim
|
||||||
pkgs.vimPlugins.vim-bbye # Better closing of buffers
|
pkgs.vimPlugins.vim-bbye # Better closing of buffers
|
||||||
|
pkgs.vimPlugins.snipe-nvim # Jump between open buffers
|
||||||
];
|
];
|
||||||
setup.bufferline = {
|
setup.bufferline = {
|
||||||
options = {
|
options = {
|
||||||
diagnostics = "nvim_lsp";
|
diagnostics = "nvim_lsp";
|
||||||
always_show_bufferline = false;
|
always_show_bufferline = false;
|
||||||
separator_style = "slant";
|
separator_style = "slant";
|
||||||
offsets = [{ filetype = "NvimTree"; }];
|
offsets = [ { filetype = "NvimTree"; } ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
setup.snipe = { };
|
||||||
lua = ''
|
lua = ''
|
||||||
-- Move buffers
|
-- Move buffers
|
||||||
vim.keymap.set("n", "L", ":BufferLineCycleNext<CR>", { silent = true })
|
vim.keymap.set("n", "L", ":BufferLineCycleNext<CR>", { silent = true })
|
||||||
@ -18,5 +24,7 @@
|
|||||||
|
|
||||||
-- Kill buffer
|
-- Kill buffer
|
||||||
vim.keymap.set("n", "<Leader>x", " :Bdelete<CR>", { silent = true })
|
vim.keymap.set("n", "<Leader>x", " :Bdelete<CR>", { silent = true })
|
||||||
'';
|
|
||||||
|
-- Jump to buffer
|
||||||
|
vim.keymap.set("n", "gb", require("snipe").open_buffer_menu, { silent = true }) '';
|
||||||
}
|
}
|
||||||
|
27
modules/common/neovim/config/colors.nix
Normal file
27
modules/common/neovim/config/colors.nix
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
|
# Sets Neovim colors based on Nix colorscheme
|
||||||
|
|
||||||
|
options.colors = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf lib.types.str;
|
||||||
|
description = "Attrset of base16 colorscheme key value pairs.";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
plugins = [ pkgs.vimPlugins.base16-nvim ];
|
||||||
|
setup.base16-colorscheme = config.colors;
|
||||||
|
|
||||||
|
# Telescope isn't working, shut off for now
|
||||||
|
lua = ''
|
||||||
|
require('base16-colorscheme').with_config {
|
||||||
|
telescope = false,
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
{ pkgs, dsl, ... }: {
|
{ pkgs, dsl, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
plugins = [
|
plugins = [
|
||||||
|
pkgs.vimPlugins.nvim-cmp
|
||||||
pkgs.vimPlugins.cmp-nvim-lsp
|
pkgs.vimPlugins.cmp-nvim-lsp
|
||||||
pkgs.vimPlugins.cmp-buffer
|
pkgs.vimPlugins.cmp-buffer
|
||||||
pkgs.vimPlugins.cmp-path
|
pkgs.vimPlugins.cmp-path
|
||||||
@ -9,7 +11,6 @@
|
|||||||
pkgs.vimPlugins.luasnip
|
pkgs.vimPlugins.luasnip
|
||||||
pkgs.vimPlugins.cmp_luasnip
|
pkgs.vimPlugins.cmp_luasnip
|
||||||
pkgs.vimPlugins.cmp-rg
|
pkgs.vimPlugins.cmp-rg
|
||||||
pkgs.vimPlugins.friendly-snippets
|
|
||||||
];
|
];
|
||||||
|
|
||||||
use.cmp.setup = dsl.callWith {
|
use.cmp.setup = dsl.callWith {
|
||||||
@ -24,28 +25,23 @@
|
|||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
snippet.expand = dsl.rawLua ''
|
# Basic completion keybinds
|
||||||
function(args)
|
|
||||||
require("luasnip").lsp_expand(args.body)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"['<C-n>']" = dsl.rawLua
|
"['<C-n>']" =
|
||||||
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })";
|
||||||
"['<C-p>']" = dsl.rawLua
|
"['<C-p>']" =
|
||||||
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })";
|
||||||
"['<Down>']" = dsl.rawLua
|
"['<Down>']" =
|
||||||
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })";
|
dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select }, { 'i', 'c' })";
|
||||||
"['<Up>']" = dsl.rawLua
|
"['<Up>']" =
|
||||||
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })";
|
dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select }, { 'i', 'c' })";
|
||||||
"['<C-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)";
|
"['<C-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)";
|
||||||
"['<C-f>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(4)";
|
"['<C-f>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(4)";
|
||||||
"['<C-e>']" = dsl.rawLua "require('cmp').mapping.abort()";
|
"['<C-e>']" = dsl.rawLua "require('cmp').mapping.abort()";
|
||||||
"['<CR>']" = dsl.rawLua
|
"['<C-y>']" =
|
||||||
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
|
dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Insert, select = true, }, { 'i', 'c' })";
|
||||||
"['<C-r>']" = dsl.rawLua
|
"['<C-r>']" =
|
||||||
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
|
dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, }, { 'i', 'c' })";
|
||||||
"['<Esc>']" = dsl.rawLua ''
|
"['<Esc>']" = dsl.rawLua ''
|
||||||
function(_)
|
function(_)
|
||||||
cmp.mapping({
|
cmp.mapping({
|
||||||
@ -55,7 +51,7 @@
|
|||||||
vim.cmd("stopinsert") --- Abort and leave insert mode
|
vim.cmd("stopinsert") --- Abort and leave insert mode
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
"['<C-l>']" = dsl.rawLua ''
|
"['<C-k>']" = dsl.rawLua ''
|
||||||
cmp.mapping(function(_)
|
cmp.mapping(function(_)
|
||||||
if require("luasnip").expand_or_jumpable() then
|
if require("luasnip").expand_or_jumpable() then
|
||||||
require("luasnip").expand_or_jump()
|
require("luasnip").expand_or_jump()
|
||||||
@ -64,26 +60,33 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# These are where the completion engine gets its suggestions
|
||||||
sources = [
|
sources = [
|
||||||
{ name = "nvim_lua"; }
|
{ name = "nvim_lua"; } # Fills in common Neovim lua functions
|
||||||
{ name = "nvim_lsp"; }
|
{ name = "nvim_lsp"; } # LSP results
|
||||||
{ name = "luasnip"; }
|
{ name = "path"; } # Shell completion from current PATH
|
||||||
{ name = "path"; }
|
|
||||||
{
|
{
|
||||||
name = "buffer";
|
name = "buffer"; # Grep for text from the current text buffer
|
||||||
keyword_length = 3;
|
keyword_length = 3;
|
||||||
max_item_count = 10;
|
max_item_count = 10;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "rg";
|
name = "rg"; # Grep for text from the current directory
|
||||||
keyword_length = 6;
|
keyword_length = 6;
|
||||||
max_item_count = 10;
|
max_item_count = 10;
|
||||||
option = { additional_arguments = "--ignore-case"; };
|
option = {
|
||||||
|
additional_arguments = "--ignore-case";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Styling of the completion menu
|
||||||
formatting = {
|
formatting = {
|
||||||
fields = [ "kind" "abbr" "menu" ];
|
fields = [
|
||||||
|
"kind"
|
||||||
|
"abbr"
|
||||||
|
"menu"
|
||||||
|
];
|
||||||
format = dsl.rawLua ''
|
format = dsl.rawLua ''
|
||||||
function(entry, vim_item)
|
function(entry, vim_item)
|
||||||
local kind_icons = {
|
local kind_icons = {
|
||||||
@ -115,7 +118,6 @@
|
|||||||
}
|
}
|
||||||
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||||
vim_item.menu = ({
|
vim_item.menu = ({
|
||||||
luasnip = "[Snippet]",
|
|
||||||
buffer = "[Buffer]",
|
buffer = "[Buffer]",
|
||||||
path = "[Path]",
|
path = "[Path]",
|
||||||
rg = "[Grep]",
|
rg = "[Grep]",
|
||||||
@ -131,19 +133,46 @@
|
|||||||
native_menu = false; # Use cmp menu instead of Vim menu
|
native_menu = false; # Use cmp menu instead of Vim menu
|
||||||
ghost_text = true; # Show preview auto-completion
|
ghost_text = true; # Show preview auto-completion
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lua = ''
|
lua' = ''
|
||||||
-- Use buffer source for `/`
|
-- Use buffer source for `/`
|
||||||
require('cmp').setup.cmdline("/", {
|
require('cmp').setup.cmdline("/", {
|
||||||
sources = {
|
mapping = {
|
||||||
{ name = "buffer", keyword_length = 5 },
|
['<C-n>'] = {
|
||||||
|
c = require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })
|
||||||
},
|
},
|
||||||
|
['<C-p>'] = {
|
||||||
|
c = require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })
|
||||||
|
},
|
||||||
|
['<C-y>'] = {
|
||||||
|
c = require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Insert, select = true, }, { 'i', 'c' })
|
||||||
|
},
|
||||||
|
['<C-r>'] = {
|
||||||
|
c = require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, }, { 'i', 'c' })
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sources = require('cmp').config.sources({
|
||||||
|
{ name = "buffer", keyword_length = 5 },
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Use cmdline & path source for ':'
|
-- Use cmdline & path source for ':'
|
||||||
require('cmp').setup.cmdline(":", {
|
require('cmp').setup.cmdline(":", {
|
||||||
|
mapping = {
|
||||||
|
['<C-n>'] = {
|
||||||
|
c = require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })
|
||||||
|
},
|
||||||
|
['<C-p>'] = {
|
||||||
|
c = require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert }, { 'i', 'c' })
|
||||||
|
},
|
||||||
|
['<C-y>'] = {
|
||||||
|
c = require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Insert, select = true, }, { 'i', 'c' })
|
||||||
|
},
|
||||||
|
['<C-r>'] = {
|
||||||
|
c = require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, }, { 'i', 'c' })
|
||||||
|
},
|
||||||
|
},
|
||||||
sources = require('cmp').config.sources({
|
sources = require('cmp').config.sources({
|
||||||
{ name = "path" },
|
{ name = "path" },
|
||||||
}, {
|
}, {
|
||||||
@ -151,5 +180,4 @@
|
|||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
'';
|
'';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
17
modules/common/neovim/config/github.lua
Normal file
17
modules/common/neovim/config/github.lua
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
-- Keymap to open file in GitHub web
|
||||||
|
vim.keymap.set("n", "<Leader>gr", ":!gh browse %<CR><CR>", { silent = true })
|
||||||
|
|
||||||
|
-- Pop a terminal to watch the current run
|
||||||
|
local gitwatch = require("toggleterm.terminal").Terminal:new({
|
||||||
|
cmd = "fish --interactive --init-command 'gh run watch'",
|
||||||
|
hidden = true,
|
||||||
|
direction = "float",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Set a toggle for this terminal
|
||||||
|
function GITWATCH_TOGGLE()
|
||||||
|
gitwatch:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Keymap to toggle the run
|
||||||
|
vim.keymap.set("n", "<Leader>W", GITWATCH_TOGGLE)
|
@ -1,4 +1,5 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
plugins = [ pkgs.vimPlugins.gitsigns-nvim ];
|
plugins = [ pkgs.vimPlugins.gitsigns-nvim ];
|
||||||
setup.gitsigns = { };
|
setup.gitsigns = { };
|
||||||
lua = builtins.readFile ./gitsigns.lua;
|
lua = builtins.readFile ./gitsigns.lua;
|
||||||
|
6
modules/common/neovim/config/kubernetes.lua
Normal file
6
modules/common/neovim/config/kubernetes.lua
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
local k9s = require("toggleterm.terminal").Terminal:new({ cmd = "k9s" })
|
||||||
|
function K9S_TOGGLE()
|
||||||
|
k9s:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<Leader>9", K9S_TOGGLE)
|
@ -1,66 +1,146 @@
|
|||||||
{ pkgs, dsl, ... }: {
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
dsl,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
|
# Terraform optional because non-free
|
||||||
|
options.terraform = lib.mkEnableOption "Whether to enable Terraform LSP";
|
||||||
|
options.github = lib.mkEnableOption "Whether to enable GitHub features";
|
||||||
|
options.kubernetes = lib.mkEnableOption "Whether to enable Kubernetes features";
|
||||||
|
|
||||||
|
config = {
|
||||||
plugins = [
|
plugins = [
|
||||||
pkgs.vimPlugins.nvim-lspconfig
|
pkgs.vimPlugins.nvim-lspconfig
|
||||||
pkgs.vimPlugins.lsp-colors-nvim
|
pkgs.vimPlugins.conform-nvim
|
||||||
pkgs.vimPlugins.null-ls-nvim
|
pkgs.vimPlugins.fidget-nvim
|
||||||
|
pkgs.vimPlugins.nvim-lint
|
||||||
|
pkgs.vimPlugins.vim-table-mode
|
||||||
|
pkgs.vimPlugins.tiny-inline-diagnostic-nvim
|
||||||
];
|
];
|
||||||
|
|
||||||
|
setup.fidget = { };
|
||||||
|
setup.tiny-inline-diagnostic = { };
|
||||||
|
|
||||||
use.lspconfig.lua_ls.setup = dsl.callWith {
|
use.lspconfig.lua_ls.setup = dsl.callWith {
|
||||||
settings = { Lua = { diagnostics = { globals = [ "vim" "hs" ]; }; }; };
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = [
|
||||||
|
"vim"
|
||||||
|
"hs"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
|
capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
|
||||||
cmd = [ "${pkgs.lua-language-server}/bin/lua-language-server" ];
|
cmd = [ "${pkgs.lua-language-server}/bin/lua-language-server" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
use.lspconfig.nil_ls.setup = dsl.callWith {
|
use.lspconfig.nixd.setup = dsl.callWith {
|
||||||
cmd = [ "${pkgs.nil}/bin/nil" ];
|
cmd = [ "${pkgs.nixd}/bin/nixd" ];
|
||||||
capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
|
capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
|
||||||
};
|
};
|
||||||
|
|
||||||
use.lspconfig.pyright.setup = dsl.callWith {
|
use.lspconfig.pyright.setup = dsl.callWith {
|
||||||
cmd = [ "${pkgs.pyright}/bin/pyright-langserver" "--stdio" ];
|
cmd = [
|
||||||
|
"${pkgs.pyright}/bin/pyright-langserver"
|
||||||
|
"--stdio"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
use.lspconfig.terraformls.setup =
|
use.lspconfig.terraformls.setup = dsl.callWith {
|
||||||
dsl.callWith { cmd = [ "${pkgs.terraform-ls}/bin/terraform-ls" "serve" ]; };
|
cmd =
|
||||||
|
if config.terraform then
|
||||||
|
[
|
||||||
|
"${pkgs.terraform-ls}/bin/terraform-ls"
|
||||||
|
"serve"
|
||||||
|
]
|
||||||
|
else
|
||||||
|
[ "echo" ];
|
||||||
|
};
|
||||||
|
|
||||||
vim.api.nvim_create_augroup = dsl.callWith [ "LspFormatting" { } ];
|
use.lspconfig.rust_analyzer.setup = dsl.callWith {
|
||||||
|
cmd = [ "${pkgs.rust-analyzer}/bin/rust-analyzer" ];
|
||||||
|
settings = {
|
||||||
|
"['rust-analyzer']" = {
|
||||||
|
check = {
|
||||||
|
command = "clippy";
|
||||||
|
};
|
||||||
|
files = {
|
||||||
|
excludeDirs = [ ".direnv" ];
|
||||||
|
};
|
||||||
|
cargo = {
|
||||||
|
features = "all";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
setup.conform = {
|
||||||
|
format_on_save = {
|
||||||
|
# These options will be passed to conform.format()
|
||||||
|
timeout_ms = 1500;
|
||||||
|
lsp_fallback = true;
|
||||||
|
};
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = [ "stylua" ];
|
||||||
|
python = [ "black" ];
|
||||||
|
fish = [ "fish_indent" ];
|
||||||
|
nix = [ "nixfmt" ];
|
||||||
|
rust = [ "rustfmt" ];
|
||||||
|
sh = [ "shfmt" ];
|
||||||
|
terraform = if config.terraform then [ "terraform_fmt" ] else [ ];
|
||||||
|
hcl = [ "hcl" ];
|
||||||
|
};
|
||||||
|
formatters = {
|
||||||
|
lua.command = "${pkgs.stylua}/bin/stylua";
|
||||||
|
black.command = "${pkgs.black}/bin/black";
|
||||||
|
fish_indent.command = "${pkgs.fish}/bin/fish_indent";
|
||||||
|
nixfmt.command = "${pkgs.nixfmt-rfc-style}/bin/nixfmt";
|
||||||
|
rustfmt.command = "${pkgs.rustfmt}/bin/rustfmt";
|
||||||
|
shfmt = {
|
||||||
|
command = "${pkgs.shfmt}/bin/shfmt";
|
||||||
|
prepend_args = [
|
||||||
|
"-i"
|
||||||
|
"4"
|
||||||
|
"-ci"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
terraform_fmt.command = if config.terraform then "${pkgs.terraform}/bin/terraform" else "";
|
||||||
|
hcl.command = "${pkgs.hclfmt}/bin/hclfmt";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
use.lint = {
|
||||||
|
linters_by_ft = dsl.toTable {
|
||||||
|
python = [ "ruff" ];
|
||||||
|
sh = [ "shellcheck" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd = dsl.callWith [
|
||||||
|
(dsl.toTable [
|
||||||
|
"BufEnter"
|
||||||
|
"BufWritePost"
|
||||||
|
])
|
||||||
|
(dsl.rawLua "{ callback = function() require('lint').try_lint() end }")
|
||||||
|
];
|
||||||
|
|
||||||
lua = ''
|
lua = ''
|
||||||
${builtins.readFile ./lsp.lua}
|
${builtins.readFile ./lsp.lua}
|
||||||
|
|
||||||
require("null-ls").setup({
|
local ruff = require('lint').linters.ruff; ruff.cmd = "${pkgs.ruff}/bin/ruff"
|
||||||
sources = {
|
local shellcheck = require('lint').linters.shellcheck; shellcheck.cmd = "${pkgs.shellcheck}/bin/shellcheck"
|
||||||
require("null-ls").builtins.formatting.stylua.with({ command = "${pkgs.stylua}/bin/stylua" }),
|
|
||||||
require("null-ls").builtins.formatting.black.with({ command = "${pkgs.black}/bin/black" }),
|
|
||||||
require("null-ls").builtins.diagnostics.flake8.with({ command = "${pkgs.python310Packages.flake8}/bin/flake8" }),
|
|
||||||
require("null-ls").builtins.formatting.fish_indent.with({ command = "${pkgs.fish}/bin/fish_indent" }),
|
|
||||||
require("null-ls").builtins.formatting.nixfmt.with({ command = "${pkgs.nixfmt}/bin/nixfmt" }),
|
|
||||||
require("null-ls").builtins.formatting.rustfmt.with({ command = "${pkgs.rustfmt}/bin/rustfmt" }),
|
|
||||||
require("null-ls").builtins.diagnostics.shellcheck.with({ command = "${pkgs.shellcheck}/bin/shellcheck" }),
|
|
||||||
require("null-ls").builtins.formatting.shfmt.with({
|
|
||||||
command = "${pkgs.shfmt}/bin/shfmt",
|
|
||||||
extra_args = { "-i", "4", "-ci" },
|
|
||||||
}),
|
|
||||||
require("null-ls").builtins.formatting.terraform_fmt.with({
|
|
||||||
command = "${pkgs.terraform}/bin/terraform",
|
|
||||||
extra_filetypes = { "hcl" },
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
|
|
||||||
on_attach = function(client, bufnr)
|
-- Prevent infinite log size (change this when debugging)
|
||||||
if client.supports_method("textDocument/formatting") then
|
vim.lsp.set_log_level("off")
|
||||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
-- Hide buffer diagnostics (use tiny-inline-diagnostic.nvim instead)
|
||||||
group = augroup,
|
vim.diagnostic.config({ virtual_text = false })
|
||||||
buffer = bufnr,
|
|
||||||
callback = function()
|
|
||||||
vim.lsp.buf.format({ bufnr = bufnr })
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,29 @@
|
|||||||
{ pkgs, dsl, lib, ... }: {
|
{
|
||||||
|
pkgs,
|
||||||
|
dsl,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
plugins = [
|
plugins = [
|
||||||
pkgs.vimPlugins.vim-surround # Keybinds for surround characters
|
pkgs.vimPlugins.vim-surround # Keybinds for surround characters
|
||||||
pkgs.vimPlugins.vim-eunuch # File manipulation commands
|
pkgs.vimPlugins.vim-eunuch # File manipulation commands
|
||||||
pkgs.vimPlugins.vim-fugitive # Git commands
|
pkgs.vimPlugins.vim-fugitive # Git commands
|
||||||
pkgs.vimPlugins.vim-repeat # Better repeat using .
|
pkgs.vimPlugins.vim-repeat # Better repeat using .
|
||||||
pkgs.vimPlugins.comment-nvim # Smart comment commands
|
pkgs.vimPlugins.vim-abolish # Keep capitalization in substitute (Subvert)
|
||||||
pkgs.vimPlugins.impatient-nvim # Faster load times
|
pkgs.vimPlugins.markview-nvim # Markdown preview
|
||||||
pkgs.vimPlugins.glow-nvim # Markdown preview popup
|
|
||||||
pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews
|
pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews
|
||||||
|
pkgs.vimPlugins.which-key-nvim # Keybind helper
|
||||||
];
|
];
|
||||||
|
|
||||||
setup.Comment = { };
|
# Initialize some plugins
|
||||||
setup.colorizer = { };
|
setup.colorizer = {
|
||||||
|
user_default_options = {
|
||||||
|
names = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
setup.markview = { };
|
||||||
|
setup.which-key = { };
|
||||||
|
|
||||||
vim.o = {
|
vim.o = {
|
||||||
termguicolors = true; # Set to truecolor
|
termguicolors = true; # Set to truecolor
|
||||||
@ -29,7 +41,6 @@
|
|||||||
scrolloff = 3; # Margin of lines to see while scrolling
|
scrolloff = 3; # Margin of lines to see while scrolling
|
||||||
splitright = true; # Vertical splits on the right side
|
splitright = true; # Vertical splits on the right side
|
||||||
splitbelow = true; # Horizontal splits on the bottom side
|
splitbelow = true; # Horizontal splits on the bottom side
|
||||||
pastetoggle = "<F3>"; # Use F3 to enter raw paste mode
|
|
||||||
clipboard = "unnamedplus"; # Uses system clipboard for yanking
|
clipboard = "unnamedplus"; # Uses system clipboard for yanking
|
||||||
updatetime = 300; # Faster diagnostics
|
updatetime = 300; # Faster diagnostics
|
||||||
mouse = "nv"; # Mouse interaction / scrolling
|
mouse = "nv"; # Mouse interaction / scrolling
|
||||||
@ -41,17 +52,26 @@
|
|||||||
relativenumber = true; # Relative numbers instead of absolute
|
relativenumber = true; # Relative numbers instead of absolute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# For which-key-nvim
|
||||||
|
vim.o.timeout = true;
|
||||||
|
vim.o.timeoutlen = 300;
|
||||||
|
|
||||||
# Better backup, swap and undo storage
|
# Better backup, swap and undo storage
|
||||||
vim.o.backup = true; # Easier to recover and more secure
|
vim.o.backup = true; # Easier to recover and more secure
|
||||||
vim.bo.swapfile = false; # Instead of swaps, create backups
|
vim.opt.undofile = true; # Keeps undos after quit
|
||||||
vim.bo.undofile = true; # Keeps undos after quit
|
vim.opt.swapfile = false; # Instead of swaps, create backups
|
||||||
vim.o.backupdir = dsl.rawLua ''vim.fn.stdpath("cache") .. "/backup"'';
|
vim.o.backupdir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/backup//")'';
|
||||||
|
vim.o.undodir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/undo//")'';
|
||||||
|
|
||||||
# Required for nvim-cmp completion
|
# Required for nvim-cmp completion
|
||||||
vim.opt.completeopt = [ "menu" "menuone" "noselect" ];
|
vim.opt.completeopt = [
|
||||||
|
"menu"
|
||||||
|
"menuone"
|
||||||
|
"noselect"
|
||||||
|
];
|
||||||
|
|
||||||
lua = lib.mkBefore ''
|
lua = lib.mkBefore ''
|
||||||
require("impatient")
|
vim.loader.enable()
|
||||||
${builtins.readFile ../lua/keybinds.lua};
|
${builtins.readFile ../lua/keybinds.lua};
|
||||||
${builtins.readFile ../lua/settings.lua};
|
${builtins.readFile ../lua/settings.lua};
|
||||||
'';
|
'';
|
||||||
@ -60,10 +80,6 @@
|
|||||||
" Remember last position when reopening file
|
" Remember last position when reopening file
|
||||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||||
|
|
||||||
" LaTeX options
|
|
||||||
au FileType tex inoremap ;bf \textbf{}<Esc>i
|
|
||||||
au BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw!
|
|
||||||
|
|
||||||
" Flash highlight when yanking
|
" Flash highlight when yanking
|
||||||
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
|
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
|
||||||
'';
|
'';
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
plugins = [ pkgs.vimPlugins.lualine-nvim ];
|
plugins = [ pkgs.vimPlugins.lualine-nvim ];
|
||||||
setup.lualine = {
|
setup.lualine = {
|
||||||
options = {
|
options = {
|
||||||
theme = "gruvbox";
|
theme = "base16";
|
||||||
icons_enabled = true;
|
icons_enabled = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,26 +1,49 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, lib, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
plugins = [
|
plugins = [
|
||||||
(pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins:
|
(pkgs.vimPlugins.nvim-treesitter.withPlugins (
|
||||||
with pkgs.tree-sitter-grammars; [
|
_plugins: with pkgs.tree-sitter-grammars; [
|
||||||
tree-sitter-hcl
|
tree-sitter-bash
|
||||||
tree-sitter-python
|
tree-sitter-c
|
||||||
tree-sitter-lua
|
|
||||||
tree-sitter-nix
|
|
||||||
tree-sitter-fish
|
tree-sitter-fish
|
||||||
tree-sitter-toml
|
tree-sitter-hcl
|
||||||
tree-sitter-yaml
|
tree-sitter-ini
|
||||||
tree-sitter-json
|
tree-sitter-json
|
||||||
]))
|
tree-sitter-lua
|
||||||
|
tree-sitter-markdown
|
||||||
|
tree-sitter-markdown-inline
|
||||||
|
tree-sitter-nix
|
||||||
|
tree-sitter-puppet
|
||||||
|
tree-sitter-python
|
||||||
|
tree-sitter-rasi
|
||||||
|
tree-sitter-toml
|
||||||
|
tree-sitter-vimdoc
|
||||||
|
tree-sitter-yaml
|
||||||
|
]
|
||||||
|
))
|
||||||
pkgs.vimPlugins.vim-matchup # Better % jumping in languages
|
pkgs.vimPlugins.vim-matchup # Better % jumping in languages
|
||||||
|
pkgs.vimPlugins.playground # Tree-sitter experimenting
|
||||||
pkgs.vimPlugins.nginx-vim
|
pkgs.vimPlugins.nginx-vim
|
||||||
pkgs.vimPlugins.vim-helm
|
pkgs.vimPlugins.vim-helm
|
||||||
pkgs.vimPlugins.vim-puppet
|
# pkgs.vimPlugins.hmts-nvim # Tree-sitter injections for home-manager
|
||||||
|
(pkgs.vimUtils.buildVimPlugin {
|
||||||
|
pname = "nmasur";
|
||||||
|
version = "0.1";
|
||||||
|
src = ../plugin;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
setup."nvim-treesitter.configs" = {
|
setup."nvim-treesitter.configs" = {
|
||||||
highlight = { enable = true; };
|
highlight = {
|
||||||
indent = { enable = true; };
|
enable = true;
|
||||||
|
};
|
||||||
|
indent = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
matchup = {
|
||||||
|
enable = true;
|
||||||
|
}; # Uses vim-matchup
|
||||||
|
|
||||||
textobjects = {
|
textobjects = {
|
||||||
select = {
|
select = {
|
||||||
@ -49,4 +72,9 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Use mkAfter to ensure tree-sitter is already loaded
|
||||||
|
lua = lib.mkAfter ''
|
||||||
|
-- Use HCL parser with .tf files
|
||||||
|
vim.treesitter.language.register('hcl', 'terraform')
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
|
|||||||
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
|
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
|
||||||
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
|
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
|
||||||
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
|
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
|
||||||
|
vim.keymap.set("n", "<Leader>rr", telescope.resume)
|
||||||
|
|
||||||
vim.keymap.set("n", "<Leader>N", function()
|
vim.keymap.set("n", "<Leader>N", function()
|
||||||
local opts = {
|
local opts = {
|
||||||
@ -45,7 +46,7 @@ end)
|
|||||||
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
|
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
|
||||||
|
|
||||||
-- Project
|
-- Project
|
||||||
require("telescope").load_extension("project")
|
require("telescope").load_extension("projects")
|
||||||
vim.keymap.set("n", "<C-p>", function()
|
vim.keymap.set("n", "<C-p>", function()
|
||||||
local opts = require("telescope.themes").get_ivy({
|
local opts = require("telescope.themes").get_ivy({
|
||||||
layout_config = {
|
layout_config = {
|
||||||
@ -54,7 +55,7 @@ vim.keymap.set("n", "<C-p>", function()
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
require("telescope").extensions.project.project(opts)
|
require("telescope").extensions.projects.projects(opts)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- File browser
|
-- File browser
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
{ pkgs, dsl, ... }: {
|
{ pkgs, dsl, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
|
# Telescope is a fuzzy finder that can work with different sub-plugins
|
||||||
|
|
||||||
plugins = [
|
plugins = [
|
||||||
pkgs.vimPlugins.telescope-nvim
|
pkgs.vimPlugins.telescope-nvim
|
||||||
pkgs.vimPlugins.telescope-project-nvim
|
pkgs.vimPlugins.project-nvim
|
||||||
pkgs.vimPlugins.telescope-fzy-native-nvim
|
pkgs.vimPlugins.telescope-fzy-native-nvim
|
||||||
pkgs.vimPlugins.telescope-file-browser-nvim
|
pkgs.vimPlugins.telescope-file-browser-nvim
|
||||||
pkgs.vimPlugins.telescope-zoxide
|
pkgs.vimPlugins.telescope-zoxide
|
||||||
@ -18,17 +21,23 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
pickers = {
|
pickers = {
|
||||||
find_files = { theme = "ivy"; };
|
find_files = {
|
||||||
oldfiles = { theme = "ivy"; };
|
theme = "ivy";
|
||||||
buffers = { theme = "dropdown"; };
|
};
|
||||||
|
oldfiles = {
|
||||||
|
theme = "ivy";
|
||||||
|
};
|
||||||
|
buffers = {
|
||||||
|
theme = "dropdown";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
extensions = {
|
extensions = {
|
||||||
fzy_native = { };
|
fzy_native = { };
|
||||||
zoxide = { };
|
zoxide = { };
|
||||||
project = { base_dirs = [ "~/dev" ]; };
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setup.project_nvim = { };
|
||||||
|
|
||||||
lua = builtins.readFile ./telescope.lua;
|
lua = builtins.readFile ./telescope.lua;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@ vim.api.nvim_create_autocmd("TermOpen", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- These are all the different types of terminals we can trigger
|
||||||
|
|
||||||
local terminal = require("toggleterm.terminal").Terminal
|
local terminal = require("toggleterm.terminal").Terminal
|
||||||
|
|
||||||
local basicterminal = terminal:new()
|
local basicterminal = terminal:new()
|
||||||
@ -19,22 +21,10 @@ function TERM_TOGGLE()
|
|||||||
basicterminal:toggle()
|
basicterminal:toggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
local nixpkgs = terminal:new({ cmd = "nix repl '<nixpkgs>'" })
|
local nixpkgs = terminal:new({ cmd = "nix repl --expr 'import <nixpkgs>{}'" })
|
||||||
function NIXPKGS_TOGGLE()
|
function NIXPKGS_TOGGLE()
|
||||||
nixpkgs:toggle()
|
nixpkgs:toggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
local gitwatch = terminal:new({ cmd = "fish --interactive --init-command 'gh run watch'" })
|
|
||||||
function GITWATCH_TOGGLE()
|
|
||||||
gitwatch:toggle()
|
|
||||||
end
|
|
||||||
|
|
||||||
local k9s = terminal:new({ cmd = "k9s" })
|
|
||||||
function K9S_TOGGLE()
|
|
||||||
k9s:toggle()
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<Leader>t", TERM_TOGGLE)
|
vim.keymap.set("n", "<Leader>t", TERM_TOGGLE)
|
||||||
vim.keymap.set("n", "<Leader>P", NIXPKGS_TOGGLE)
|
vim.keymap.set("n", "<Leader>P", NIXPKGS_TOGGLE)
|
||||||
vim.keymap.set("n", "<Leader>gw", GITWATCH_TOGGLE)
|
|
||||||
vim.keymap.set("n", "<Leader>9", K9S_TOGGLE)
|
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
{ pkgs, dsl, ... }: {
|
{
|
||||||
|
pkgs,
|
||||||
|
dsl,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
|
# Toggleterm provides a floating terminal inside the editor for quick access
|
||||||
|
|
||||||
plugins = [ pkgs.vimPlugins.toggleterm-nvim ];
|
plugins = [ pkgs.vimPlugins.toggleterm-nvim ];
|
||||||
|
|
||||||
@ -8,6 +16,9 @@
|
|||||||
direction = "float";
|
direction = "float";
|
||||||
};
|
};
|
||||||
|
|
||||||
lua = builtins.readFile ./toggleterm.lua;
|
lua = ''
|
||||||
|
${builtins.readFile ./toggleterm.lua}
|
||||||
|
${if config.github then (builtins.readFile ./github.lua) else ""}
|
||||||
|
${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""}
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
{ pkgs, dsl, ... }: {
|
{ pkgs, dsl, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ];
|
# This plugin creates a side drawer for navigating the current project
|
||||||
|
|
||||||
|
plugins = [
|
||||||
|
pkgs.vimPlugins.nvim-tree-lua
|
||||||
|
pkgs.vimPlugins.nvim-web-devicons
|
||||||
|
];
|
||||||
|
|
||||||
# Disable netrw eagerly
|
# Disable netrw eagerly
|
||||||
# https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
|
# https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
|
||||||
@ -10,14 +16,18 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
setup.nvim-tree = {
|
setup.nvim-tree = {
|
||||||
disable_netrw = true;
|
disable_netrw = true; # Disable the built-in file manager
|
||||||
hijack_netrw = true;
|
hijack_netrw = true; # Works as the file manager
|
||||||
|
sync_root_with_cwd = true; # Change project whenever currend dir changes
|
||||||
|
respect_buf_cwd = true; # Change to exact location of focused buffer
|
||||||
update_focused_file = {
|
update_focused_file = {
|
||||||
|
# Change project based on the focused buffer
|
||||||
enable = true;
|
enable = true;
|
||||||
update_cwd = true;
|
update_root = true;
|
||||||
ignore_list = { };
|
ignore_list = { };
|
||||||
};
|
};
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
|
# Enable LSP and linter integration
|
||||||
enable = true;
|
enable = true;
|
||||||
icons = {
|
icons = {
|
||||||
hint = "";
|
hint = "";
|
||||||
@ -27,6 +37,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
renderer = {
|
renderer = {
|
||||||
|
# Show files with changes vs. current commit
|
||||||
icons = {
|
icons = {
|
||||||
glyphs = {
|
glyphs = {
|
||||||
git = {
|
git = {
|
||||||
@ -41,37 +52,33 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
# Set keybinds and initialize program
|
||||||
|
on_attach = dsl.rawLua ''
|
||||||
|
function (bufnr)
|
||||||
|
local api = require('nvim-tree.api')
|
||||||
|
local function opts(desc)
|
||||||
|
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||||
|
end
|
||||||
|
api.config.mappings.default_on_attach(bufnr)
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'l', api.node.open.edit, opts('Open'))
|
||||||
|
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('Open'))
|
||||||
|
vim.keymap.set('n', 'o', api.node.open.edit, opts('Open'))
|
||||||
|
vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('Close Directory'))
|
||||||
|
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split'))
|
||||||
|
end
|
||||||
|
'';
|
||||||
view = {
|
view = {
|
||||||
|
# Set look and feel
|
||||||
width = 30;
|
width = 30;
|
||||||
hide_root_folder = false;
|
|
||||||
side = "left";
|
side = "left";
|
||||||
mappings = {
|
|
||||||
custom_only = false;
|
|
||||||
list = [
|
|
||||||
{
|
|
||||||
key = [ "l" "<CR>" "o" ];
|
|
||||||
cb = dsl.rawLua
|
|
||||||
"require('nvim-tree.config').nvim_tree_callback('edit')";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "h";
|
|
||||||
cb = dsl.rawLua
|
|
||||||
"require('nvim-tree.config').nvim_tree_callback('close_node')";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "v";
|
|
||||||
cb = dsl.rawLua
|
|
||||||
"require('nvim-tree.config').nvim_tree_callback('vsplit')";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
number = false;
|
number = false;
|
||||||
relativenumber = false;
|
relativenumber = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Toggle the sidebar
|
||||||
lua = ''
|
lua = ''
|
||||||
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
|
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
|
||||||
'';
|
'';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,21 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
neovim = import ./package {
|
neovim = import ./package {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
colors = import config.theme.colors.neovimConfig { inherit pkgs; };
|
colors = config.theme.colors;
|
||||||
|
terraform = config.terraform.enable;
|
||||||
|
github = true;
|
||||||
|
kubernetes = config.kubernetes.enable;
|
||||||
};
|
};
|
||||||
|
in
|
||||||
in {
|
{
|
||||||
|
|
||||||
options.neovim.enable = lib.mkEnableOption "Neovim.";
|
options.neovim.enable = lib.mkEnableOption "Neovim.";
|
||||||
|
|
||||||
@ -18,27 +26,42 @@ in {
|
|||||||
|
|
||||||
home.packages = [ neovim ];
|
home.packages = [ neovim ];
|
||||||
|
|
||||||
|
# Use Neovim as the editor for git commit messages
|
||||||
programs.git.extraConfig.core.editor = "nvim";
|
programs.git.extraConfig.core.editor = "nvim";
|
||||||
|
programs.jujutsu.settings.ui.editor = "nvim";
|
||||||
|
|
||||||
|
# Set Neovim as the default app for text editing and manual pages
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim";
|
||||||
MANPAGER = "nvim +Man!";
|
MANPAGER = "nvim +Man!";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Create quick aliases for launching Neovim
|
||||||
programs.fish = {
|
programs.fish = {
|
||||||
shellAliases = { vim = "nvim"; };
|
shellAliases = {
|
||||||
|
vim = "nvim";
|
||||||
|
};
|
||||||
shellAbbrs = {
|
shellAbbrs = {
|
||||||
v = lib.mkForce "nvim";
|
v = lib.mkForce "nvim";
|
||||||
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
|
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
|
||||||
vll = "nvim -c 'Telescope oldfiles'";
|
vll = "nvim -c 'Telescope oldfiles'";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
programs.kitty.settings.scrollback_pager = lib.mkForce ''
|
|
||||||
${neovim}/bin/nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -'';
|
|
||||||
|
|
||||||
|
# Create a desktop option for launching Neovim from a file manager
|
||||||
|
# (Requires launching the terminal and then executing Neovim)
|
||||||
|
xdg.desktopEntries.nvim = lib.mkIf (pkgs.stdenv.isLinux && config.gui.enable) {
|
||||||
|
name = "Neovim wrapper";
|
||||||
|
exec = "${config.home-manager.users.${config.user}.programs.rofi.terminal} nvim %F";
|
||||||
|
mimeType = [
|
||||||
|
"text/plain"
|
||||||
|
"text/markdown"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
|
||||||
|
"text/plain" = [ "nvim.desktop" ];
|
||||||
|
"text/markdown" = [ "nvim.desktop" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# # Used for icons in Vim
|
|
||||||
# fonts.fonts = with pkgs; [ nerdfonts ];
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
require("packer_init")
|
|
||||||
require("settings")
|
|
||||||
require("keybinds")
|
|
||||||
require("background")
|
|
@ -39,7 +39,6 @@ key("n", "<Leader>fs", ":write<CR>")
|
|||||||
key("n", "<Leader>fd", ":lcd %:p:h<CR>", { silent = true })
|
key("n", "<Leader>fd", ":lcd %:p:h<CR>", { silent = true })
|
||||||
key("n", "<Leader>fu", ":lcd ..<CR>", { silent = true })
|
key("n", "<Leader>fu", ":lcd ..<CR>", { silent = true })
|
||||||
key("n", "<Leader><Tab>", ":b#<CR>", { silent = true })
|
key("n", "<Leader><Tab>", ":b#<CR>", { silent = true })
|
||||||
key("n", "<Leader>gr", ":!gh repo view -w<CR><CR>", { silent = true })
|
|
||||||
key("n", "<Leader>tt", [[<Cmd>exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]])
|
key("n", "<Leader>tt", [[<Cmd>exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]])
|
||||||
key("n", "<Leader>jj", ":!journal<CR>:e<CR>")
|
key("n", "<Leader>jj", ":!journal<CR>:e<CR>")
|
||||||
|
|
||||||
@ -48,11 +47,6 @@ key("n", "<Leader>wv", ":vsplit<CR>")
|
|||||||
key("n", "<Leader>wh", ":split<CR>")
|
key("n", "<Leader>wh", ":split<CR>")
|
||||||
key("n", "<Leader>wm", ":only<CR>")
|
key("n", "<Leader>wm", ":only<CR>")
|
||||||
|
|
||||||
-- Vimrc editing
|
|
||||||
key("n", "<Leader>rr", ":luafile $HOME/.config/nvim/init.lua<CR>")
|
|
||||||
key("n", "<Leader>rp", ":luafile $HOME/.config/nvim/init.lua<CR>:PackerInstall<CR>:")
|
|
||||||
key("n", "<Leader>rc", ":luafile $HOME/.config/nvim/init.lua<CR>:PackerCompile<CR>")
|
|
||||||
|
|
||||||
-- Keep cursor in place
|
-- Keep cursor in place
|
||||||
key("n", "n", "nzz")
|
key("n", "n", "nzz")
|
||||||
key("n", "N", "Nzz")
|
key("n", "N", "Nzz")
|
||||||
@ -70,6 +64,12 @@ key("n", "<C-Down>", ":resize -2<CR>", { silent = true })
|
|||||||
key("n", "<C-Left>", ":vertical resize -2<CR>", { silent = true })
|
key("n", "<C-Left>", ":vertical resize -2<CR>", { silent = true })
|
||||||
key("n", "<C-Right>", ":vertical resize +2<CR>", { silent = true })
|
key("n", "<C-Right>", ":vertical resize +2<CR>", { silent = true })
|
||||||
|
|
||||||
|
-- Quickfix
|
||||||
|
key("n", "]q", ":cnext<CR>")
|
||||||
|
key("n", "[q", ":cprevious<CR>")
|
||||||
|
key("n", "co", ":copen<CR>")
|
||||||
|
key("n", "cq", ":cclose<CR>")
|
||||||
|
|
||||||
-- Other
|
-- Other
|
||||||
key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki
|
key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki
|
||||||
key("n", "Y", "y$") --- Copy to end of line
|
key("n", "Y", "y$") --- Copy to end of line
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user