Compare commits
513 Commits
76e8c9c6e1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
c7eefea616
|
|||
|
7608249b0b
|
|||
|
61b35e5f4a
|
|||
|
1ccc0041d6
|
|||
|
2856e30cbf
|
|||
|
3e577066c1
|
|||
|
3f10536deb
|
|||
|
25e995dfb3
|
|||
|
f2faa9047b
|
|||
|
22fc403563
|
|||
|
d5e11e4909
|
|||
|
bcc764dd50
|
|||
|
4e317cfd81
|
|||
|
2ad5372267
|
|||
|
6e93e251d6
|
|||
|
770ecc6c02
|
|||
|
86fb493a80
|
|||
|
3057f13858
|
|||
|
155c4f3525
|
|||
|
3abfa5cb84
|
|||
|
5d1b075adb
|
|||
|
6a3fbf2d80
|
|||
|
9a35cefd62
|
|||
|
0fa3b9de30
|
|||
|
4e56c58d7a
|
|||
|
f9a04a4492
|
|||
|
b2c983ee22
|
|||
|
28399165fc
|
|||
|
42df5964f1
|
|||
|
90b38fcf08
|
|||
|
f4ba4e8a89
|
|||
|
156d8b04e5
|
|||
|
ef69519de7
|
|||
|
e4175767a3
|
|||
|
0127dbc975
|
|||
|
848d652ac7
|
|||
|
40838848c3
|
|||
| e82ab26d23 | |||
|
31d582bc9a
|
|||
|
a5f9244996
|
|||
|
68d7c22549
|
|||
|
acf5a23ed5
|
|||
|
e3e91bc934
|
|||
|
28a2e71b65
|
|||
|
a23c52cdf3
|
|||
|
78f3761754
|
|||
|
db447ddb8b
|
|||
|
45562df6cf
|
|||
|
0b3e10fd70
|
|||
|
f2386e8020
|
|||
|
9504d4c5a1
|
|||
|
9335bdeac9
|
|||
|
3b471f8e32
|
|||
|
ccd5019abd
|
|||
|
a0573d8aab
|
|||
|
a389e1395d
|
|||
|
b8ae40febd
|
|||
|
0d3da95ae2
|
|||
|
52a1cbd382
|
|||
|
5f5dc1cbcd
|
|||
| f4cdf6a4af | |||
| 7d929a20c0 | |||
| 1667f3c438 | |||
| 184d4bcae7 | |||
| 37545de214 | |||
| fb81d57367 | |||
| f10dee5a2e | |||
| 141ef7812e | |||
| 910ed61c42 | |||
| 995a0ce5c0 | |||
| 1253034342 | |||
| 530c117a43 | |||
| 427f4177ec | |||
| 1a8479e2b9 | |||
| b9591ba3c3 | |||
| 5cf36ac84b | |||
| 5076cf0f66 | |||
| 832008b78a | |||
| acb1410a03 | |||
| 28422827f0 | |||
| 03f1d62e5e | |||
| 504c099939 | |||
| ee16adf370 | |||
| 990bf3f50b | |||
| effd16b7ec | |||
| 75891cf86c | |||
| ab4c2ac31a | |||
| 46a4cb8fb9 | |||
| e66752f7cd | |||
| a60132a3ed | |||
| 4ddc236256 | |||
| 60144cc4ea | |||
| 1dddf3fd33 | |||
| 273835799a | |||
| 83b83d05b3 | |||
| 85772f9a0e | |||
| ce9698d295 | |||
| 167d4a44c3 | |||
| 2d429053bd | |||
| a6592a6d1b | |||
| 87c7d0b220 | |||
| c36b690bdf | |||
| 5ff6d39fe1 | |||
| 46bfbce7e1 | |||
| c186fb2982 | |||
| 23b16a1ed3 | |||
| f8bd2ef460 | |||
| 384319843e | |||
|
9d600f8c95
|
|||
|
8d6ec59a29
|
|||
|
8a901e7871
|
|||
| 3e87eec0eb | |||
| 2e3f58e46b | |||
| 56cf903377 | |||
| 784d7e4567 | |||
| d495aeb646 | |||
| 6092be6eda | |||
| 62ea5f6ad7 | |||
| e3d39e1001 | |||
| dc9a7216ae | |||
| 5db249f8ba | |||
| a72ac6547a | |||
| 28a575063f | |||
| 6c3fa0c13d | |||
| ccf5534c4d | |||
| a8a5ef7f2e | |||
| 6222ad5404 | |||
| 425a783b85 | |||
| f20ba07496 | |||
| 6b71ed6e59 | |||
| 77a0b25261 | |||
| e2c28d03dd | |||
| df28c981b3 | |||
| 156d057428 | |||
| f103bbe21c | |||
| 731e0b8cb1 | |||
| d4ebe7f7e2 | |||
| 0eba277720 | |||
|
b37fa0c007
|
|||
|
255cb34846
|
|||
|
bd493ea8ea
|
|||
| d43c5b151d | |||
| e8ce90e315 | |||
| 0873d2769d | |||
| 16490294c5 | |||
| ee6e17f87e | |||
| 9b3a863a0b | |||
| cf31242ee4 | |||
| 73d8acea17 | |||
| 97402d75e1 | |||
| d6d8084247 | |||
| af32a32c3d | |||
| 1e6f4c6b43 | |||
| c1887474b8 | |||
| c758f008ac | |||
| da996bc201 | |||
| 0f0b9041e4 | |||
| a2466270ab | |||
| e9500eba20 | |||
| d7c64bc980 | |||
| 1cf470fb94 | |||
| e8305eda4b | |||
| 1e0242e23d | |||
| ebbe09759a | |||
|
e05d42152e
|
|||
| 7620df5f88 | |||
| 8e8bba700e | |||
| 56fb1bde66 | |||
| c2447e7b00 | |||
|
9bc37d34ba
|
|||
|
2abdb9e5a7
|
|||
| 6251adf032 | |||
| 57af5ad38f | |||
| 97a5f43206 | |||
|
9c80604f26
|
|||
|
0d3e7d6d73
|
|||
|
b58296b936
|
|||
|
d9b011585b
|
|||
|
f1c6450ec4
|
|||
|
1723a4a872
|
|||
|
add2bee896
|
|||
|
ef9f204237
|
|||
|
d208ad22db
|
|||
|
5df1d226c8
|
|||
|
299e8b3227
|
|||
|
378916ed35
|
|||
|
ea7dfca0db
|
|||
| 4493b8aa70 | |||
| e6b6f82159 | |||
| f11d03598b | |||
| 3e1d07ec6a | |||
| fa76a73aae | |||
| 1a0f0d8396 | |||
| bec49b6a37 | |||
| d4bdc12b2b | |||
| 778f9c7de9 | |||
| bd83574023 | |||
| 617e91ccff | |||
| 4ab9d58c15 | |||
| f45b67985d | |||
| 265f94039a | |||
| 43809626cf | |||
| 7e36a08fa9 | |||
| 9ed6a7734f | |||
| 71f28fe85e | |||
| 46d2d42415 | |||
| 8a9fe8f2de | |||
| 247148887f | |||
| f2cbd92196 | |||
| 56057f7354 | |||
| 680ae01bb5 | |||
| e7a4f83588 | |||
| fdca61069c | |||
| 83fd49ce16 | |||
| bfa164d3c6 | |||
| 61e0fadadf | |||
| cbd2a589d0 | |||
| 03212b2db3 | |||
| f9191533ae | |||
| 2769968777 | |||
| ec4dc87b25 | |||
|
8de5ae1ffa
|
|||
| 6189015df2 | |||
| e4b43cb099 | |||
| 185aca8147 | |||
|
9e6c6d26a1
|
|||
| 4d612c4722 | |||
| 4d9af80429 | |||
| 26f555b275 | |||
| 86539653f4 | |||
| 3a7296d447 | |||
| b391f5a391 | |||
| f57c611f92 | |||
| 8f092c433e | |||
| a23ec0110b | |||
| eaa5f9161f | |||
| f16af72c25 | |||
|
bca5f1353e
|
|||
| 22bbd33c84 | |||
|
c433b99cff
|
|||
| 4218a9dc6e | |||
| 78996afd31 | |||
| 2ee7e0937e | |||
| 4a0165ceac | |||
| 08269a4f90 | |||
| 39c3fd921a | |||
| 899e146adb | |||
| 6228e1daf4 | |||
|
6c210d09df
|
|||
|
134be027e2
|
|||
|
0a3bcc27ad
|
|||
|
477b5abfa8
|
|||
|
0a7d8585ae
|
|||
| bec36a738f | |||
| ced8ec6511 | |||
| 898dcdcde4 | |||
| 74931c1e80 | |||
| 6b8d301279 | |||
| 859b3470f4 | |||
| 3491c8cf32 | |||
|
5ec7b56a91
|
|||
|
8e0bf3ac03
|
|||
|
3d09831ef9
|
|||
| 0f5fc5529b | |||
|
f3d415c853
|
|||
|
4e85e1f46a
|
|||
|
d3f9ba91db
|
|||
|
9b5a6c9bb8
|
|||
|
55fe10af93
|
|||
|
349f57e474
|
|||
|
2384ed8061
|
|||
|
97a5237373
|
|||
|
13a91c8948
|
|||
|
27f170070c
|
|||
|
110a98c3d4
|
|||
|
95a024a6e7
|
|||
|
2e8e66dca6
|
|||
|
701e47473a
|
|||
| 98f1492da8 | |||
| cba8751c58 | |||
|
5672d34426
|
|||
| 71da7fdd23 | |||
| 286cc3c50a | |||
| 0c8135a2dc | |||
| b960a348ec | |||
|
c25837dc7e
|
|||
| 483e10e57a | |||
| 11c128281c | |||
| 8e7825c71a | |||
| d9ffbfe76f | |||
| 5cab60f1b7 | |||
| 454d093d14 | |||
| e59460f127 | |||
| cd41c51ef0 | |||
| 0cf7e0916f | |||
| 408b6a6c67 | |||
| 5694f34897 | |||
| 36e6bd693a | |||
| ac13526e18 | |||
| e9a993050e | |||
|
61152f5349
|
|||
|
65452f3699
|
|||
|
80259e6afd
|
|||
|
841ee6758d
|
|||
|
ee7648653e
|
|||
|
22067b477a
|
|||
| 0896b18073 | |||
| 09d8bf4850 | |||
| 55443bcfe3 | |||
| efa9d6ec0e | |||
| 9f0e402116 | |||
| fe82ae7b53 | |||
|
fb3f2bf87d
|
|||
|
0102218afc
|
|||
| c6959c723f | |||
| 3514649e13 | |||
| a591304042 | |||
| 0d96a414dd | |||
| 2eb4e8dadc | |||
| 59635ff9f8 | |||
| a7a44c9408 | |||
| 0a7bd14ec0 | |||
|
4336861678
|
|||
|
231a4b663e
|
|||
| d0a3ad118f | |||
| 5aae3e5c8d | |||
| 417ee08b7d | |||
| 6e5ae87971 | |||
| b0361b4718 | |||
| 065f66cea7 | |||
| eaf42c0cbc | |||
| 53b0bd8185 | |||
| c806a17f21 | |||
| d0ec63589c | |||
| 8cf07806db | |||
| a78b9464df | |||
| 95d4cea4b3 | |||
| bb3dbcfec5 | |||
| 248af053a2 | |||
| fe7eee317f | |||
| fe1b50cdc5 | |||
| 5dd876d76d | |||
|
8b0aa0b5d3
|
|||
|
1c6f4af430
|
|||
| 2ec952360f | |||
| 714b3d4a20 | |||
| aa6679dba2 | |||
| 65c869a73a | |||
| fe29b4137c | |||
|
68fa9ec21e
|
|||
|
5d2bec9d58
|
|||
| d2ed4afa86 | |||
| aa14ecbbfe | |||
| 57087ff557 | |||
| 6841ce0fd2 | |||
| ba0882e915 | |||
|
2263671c67
|
|||
|
63b442c6c9
|
|||
|
52d7f68cf7
|
|||
|
b046b9d5a6
|
|||
| 30166262d6 | |||
| 716333682f | |||
| 46b1b8c01d | |||
| 68def72266 | |||
| 9841dc168a | |||
|
02f4f0d80e
|
|||
|
2ba0ddcb49
|
|||
| 01e0c8466f | |||
| 4e4a20b978 | |||
| 6ae3206a90 | |||
| ed2a425623 | |||
| 88d5671f8e | |||
| f41d5c0665 | |||
| 4922905cab | |||
| 9bd0511200 | |||
| 5e17e73106 | |||
|
980a840b55
|
|||
|
d4b2c7dcf7
|
|||
| cbf6de5e08 | |||
|
58ab34e560
|
|||
|
40286bb0da
|
|||
|
77c34b132a
|
|||
| c49d9d1b17 | |||
| d9dcf7dda3 | |||
| 39a9174e7d | |||
|
b46edde9bf
|
|||
|
c3b1a294ae
|
|||
| a800a99590 | |||
| d41b54496c | |||
| 05986d65e8 | |||
| 739f42d2c4 | |||
| e8b19aced6 | |||
| e859b3f327 | |||
| c1ae6b6707 | |||
| dc95ea2282 | |||
| db98717fef | |||
| 5d89c0a4d5 | |||
| 792599b3a0 | |||
| b38c892d76 | |||
| 91dfcca004 | |||
| fcd91ba924 | |||
|
3a48ca63cb
|
|||
|
1ca2f99608
|
|||
|
5433a0285f
|
|||
|
d564a94aa7
|
|||
|
39e2d8f4e5
|
|||
|
663e5cb739
|
|||
|
8ea60d90df
|
|||
| 0b1ee5c886 | |||
| 4922fbb743 | |||
| 1fcd851ede | |||
|
2cb3ca418e
|
|||
| bb05892204 | |||
| f0c85d0ce5 | |||
| 26fb2d5ddd | |||
|
001a293264
|
|||
|
4ec5710dba
|
|||
|
50df6944ea
|
|||
|
6c1b579418
|
|||
| 4b70ad228c | |||
| aae6d8eb8f | |||
| 29dffb4e5b | |||
| d6cf839b91 | |||
| 0f2f0144b0 | |||
| 534c3232df | |||
| 6aa09dd89d | |||
| 59afaeb7c0 | |||
| 2d054552fd | |||
|
a75c32c3f5
|
|||
|
af6cd31897
|
|||
| 2774418579 | |||
| 82a30442fe | |||
|
9bc6e561e6
|
|||
|
ba5bdfd9d2
|
|||
|
429aac2eb0
|
|||
|
bc55759f84
|
|||
|
0864532f54
|
|||
| ad6409f5a8 | |||
| 424ef599be | |||
| 34d0f18d6c | |||
| 2d84e22cca | |||
|
9a153a8ba4
|
|||
|
e16626c48f
|
|||
|
d0a799f752
|
|||
| 15eb16a71e | |||
| 95ee70d419 | |||
| b3eb56c992 | |||
| bcf344cc20 | |||
| 94bfd73372 | |||
| 5dcfcd1f1f | |||
|
4156fb2962
|
|||
|
8682f11eb9
|
|||
|
46f7e43335
|
|||
|
27d21a548d
|
|||
|
dc1bb22d9d
|
|||
|
801bc6f07d
|
|||
|
bc5c561775
|
|||
| f60d776fc6 | |||
|
76ae7e1f16
|
|||
|
b97f417549
|
|||
| aa8a129cbe | |||
| 9c16bbca73 | |||
| de605cebe6 | |||
| 1a77bce9c0 | |||
| 8783abba5b | |||
| 067bb7d50a | |||
| 94b20b660f | |||
| 3031264819 | |||
| 239474afce | |||
| 99271f73f2 | |||
|
c98a00cc3f
|
|||
| 06ce326008 | |||
| 5af37ea502 | |||
| c216953598 | |||
| 471a7c9cff | |||
| 3c037bf46d | |||
| 58b984a883 | |||
| 9900caf46b | |||
| f237f14431 | |||
| afb6a154d6 | |||
| c8b15017cf | |||
| fad5951a87 | |||
| 3f4484e109 | |||
| 08d27e674f | |||
| 687bbeb79b | |||
| def85bbf03 | |||
|
43f6d96aff
|
|||
|
aec8d6b1be
|
|||
| 166c4318fd | |||
| 3c404d3a0d | |||
|
9c0bcd4660
|
|||
|
79e64d7475
|
|||
| b07a3f4dbc | |||
| 5a9d76856c | |||
| bdb3e26020 | |||
| a35aafd634 | |||
| c7b4c75091 | |||
| 3274244899 | |||
| 56468a3f05 | |||
| acacf7d163 | |||
| 9aa696c74e | |||
| 75937388d4 | |||
|
ae413bd36c
|
|||
|
037e1ce951
|
|||
| 3625a7a078 | |||
| 47ba47dca5 | |||
|
d1e4d48291
|
|||
|
03e31460a5
|
|||
|
bf6a8a3859
|
|||
|
a28456fc64
|
|||
|
af18ffd29e
|
|||
|
d1eaf76099
|
|||
|
3213dba96a
|
@@ -1 +0,0 @@
|
|||||||
((nil . ((ssh-deploy-root-remote . "/ssh:zion:/home/coolneng/system"))))
|
|
||||||
7
Makefile
Normal file
7
Makefile
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
DIR=$(HOME)/Projects/zion
|
||||||
|
|
||||||
|
switch:
|
||||||
|
nixos-rebuild switch --no-reexec --target-host root@zion \
|
||||||
|
--build-host root@zion --flake path://$(DIR)#zion
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := switch
|
||||||
19
README.org
19
README.org
@@ -20,39 +20,34 @@
|
|||||||
** Installation
|
** Installation
|
||||||
|
|
||||||
1. Download the sdcard image
|
1. Download the sdcard image
|
||||||
2. Connect a keyboard to the Raspberry Pi and set the password
|
2. Use initial config file
|
||||||
|
|
||||||
#+begin_src shell
|
#+begin_src shell
|
||||||
passwd
|
cp install.nix configuration.nix
|
||||||
sudo su
|
|
||||||
passwd
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
The default user is nixos
|
|
||||||
|
|
||||||
3. Move the repo to the server and the agenix key
|
3. Move the repo to the server and the agenix key
|
||||||
|
|
||||||
#+begin_src shell
|
#+begin_src shell
|
||||||
scp -R Projects/zion zion:/home/nixos/system
|
scp -r Projects/zion zion:/home/nixos/system
|
||||||
scp .ssh/zion root@zion:/etc/ssh/id_ed25519
|
scp .ssh/zion root@zion:/etc/ssh/id_ed25519
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
4. Increase the size of tmpfs
|
4. Mount the firmware partition
|
||||||
|
|
||||||
#+begin_src shell
|
#+begin_src shell
|
||||||
sudo mount -o remount,size=4G /run/user/0
|
mount /dev/mmcblk1p1 /boot
|
||||||
sudo mount -o remount,size=2G /run/user/1000
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
5. Rebuild the system using Flakes
|
5. Rebuild the system using Flakes
|
||||||
|
|
||||||
#+begin_src shell
|
#+begin_src shell
|
||||||
nix-shell -p git
|
nix-shell -p git
|
||||||
sudo nixos-rebuild switch --flake /home/nixos/system#zion --impure
|
sudo nixos-rebuild switch --flake /home/nixos/system#zion
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
6. Restore the SQL databases
|
6. Restore the SQL databases
|
||||||
|
|
||||||
#+begin_src shell
|
#+begin_src shell
|
||||||
psql -U postgres -f /vault/backups/zion/databases/all.sql
|
gunzip -c /vault/backups/zion/databases/all.sql.gz | psql -U postgres
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|||||||
@@ -1,56 +1,90 @@
|
|||||||
{ config, inputs, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
# Kernel configuration
|
||||||
|
boot = {
|
||||||
|
blacklistedKernelModules = [
|
||||||
|
"btusb"
|
||||||
|
"bluetooth"
|
||||||
|
];
|
||||||
|
kernelParams = [
|
||||||
|
"zfs.zfs_arc_max=8589934592"
|
||||||
|
"zfs.zfs_arc_min=1073741824"
|
||||||
|
];
|
||||||
|
supportedFilesystems = [ "zfs" ];
|
||||||
|
zfs = {
|
||||||
|
requestEncryptionCredentials = false;
|
||||||
|
extraPools = [ "vault" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Secure boot using lanzaboote
|
||||||
|
boot.loader = {
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
systemd-boot = {
|
||||||
|
enable = true;
|
||||||
|
configurationLimit = 50;
|
||||||
|
editor = false;
|
||||||
|
};
|
||||||
|
timeout = 3;
|
||||||
|
};
|
||||||
|
|
||||||
# Declare system packages
|
# Declare system packages
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
libraspberrypi
|
libraspberrypi
|
||||||
htop
|
htop
|
||||||
neovim
|
neovim
|
||||||
git
|
git
|
||||||
inputs.agenix.defaultPackage.aarch64-linux
|
inputs.agenix.packages.${config.nixpkgs.localSystem.system}.default
|
||||||
];
|
];
|
||||||
|
|
||||||
# Add a swap file
|
|
||||||
swapDevices = [{
|
|
||||||
device = "/swapfile";
|
|
||||||
size = 4096;
|
|
||||||
}];
|
|
||||||
|
|
||||||
# Configure basic SSH access
|
# Configure basic SSH access
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
permitRootLogin = "yes";
|
settings = {
|
||||||
|
PermitRootLogin = "yes";
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Cleanup tmp on startup
|
# Cleanup tmp on startup
|
||||||
boot.cleanTmpDir = true;
|
boot.tmp.cleanOnBoot = true;
|
||||||
|
|
||||||
# Create coolneng user
|
# Create coolneng user
|
||||||
users.users.coolneng = {
|
users.users.coolneng = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
home = "/home/coolneng";
|
home = "/home/coolneng";
|
||||||
extraGroups = [ "wheel" "docker" ];
|
extraGroups = [
|
||||||
|
"wheel"
|
||||||
|
"docker"
|
||||||
|
];
|
||||||
openssh.authorizedKeys.keys = [
|
openssh.authorizedKeys.keys = [
|
||||||
|
# panacea
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea"
|
||||||
|
# caravanserai
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIX0poiPhFLFh88fhpLFX7n1oCevVRyTxe9ZvGmjPq8n zion"
|
||||||
];
|
];
|
||||||
shell = "${fish}/bin/fish";
|
shell = "${fish}/bin/fish";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Set neovim as default editor
|
# Set neovim as default editor
|
||||||
programs.neovim.defaultEditor = true;
|
programs.neovim = {
|
||||||
|
enable = true;
|
||||||
|
defaultEditor = true;
|
||||||
|
};
|
||||||
|
|
||||||
# Set timezone and synchronize NTP
|
# Set timezone and synchronize NTP
|
||||||
time.timeZone = "Europe/Brussels";
|
time.timeZone = "Europe/Brussels";
|
||||||
services.timesyncd.enable = true;
|
services.timesyncd.enable = true;
|
||||||
|
|
||||||
# Enable ZFS support
|
|
||||||
boot.supportedFilesystems = [ "zfs" ];
|
|
||||||
|
|
||||||
# Don't import encrypted datasets
|
|
||||||
boot.zfs.requestEncryptionCredentials = false;
|
|
||||||
|
|
||||||
# Scrub zpool monthly
|
# Scrub zpool monthly
|
||||||
services.zfs.autoScrub = {
|
services.zfs.autoScrub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -59,10 +93,19 @@ with pkgs;
|
|||||||
|
|
||||||
# Run Nix garbage collector, while avoiding recompilation and enable flakes
|
# Run Nix garbage collector, while avoiding recompilation and enable flakes
|
||||||
nix = {
|
nix = {
|
||||||
settings.auto-optimise-store = true;
|
settings = {
|
||||||
|
auto-optimise-store = true;
|
||||||
|
trusted-users = [
|
||||||
|
"root"
|
||||||
|
"coolneng"
|
||||||
|
];
|
||||||
|
lazy-trees = true;
|
||||||
|
eval-cores = 2;
|
||||||
|
};
|
||||||
gc = {
|
gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
options = "--delete-older-than 14d";
|
options = "--delete-older-than 14d";
|
||||||
|
dates = "Mon 03:00";
|
||||||
};
|
};
|
||||||
extraOptions = ''
|
extraOptions = ''
|
||||||
keep-outputs = true
|
keep-outputs = true
|
||||||
@@ -70,37 +113,48 @@ with pkgs;
|
|||||||
gc-keep-outputs = true
|
gc-keep-outputs = true
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
'';
|
'';
|
||||||
package = nixFlakes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Use same version of nixpkgs for nix-shell
|
# Use same version of nixpkgs for nix-shell
|
||||||
nix.nixPath = let path = toString ./.;
|
nix.nixPath =
|
||||||
in [ "nixpkgs=${inputs.nixpkgs}" "nixos-config=${path}/configuration.nix" ];
|
let
|
||||||
|
path = toString ./.;
|
||||||
|
in
|
||||||
|
[
|
||||||
|
"nixpkgs=${inputs.nixpkgs}"
|
||||||
|
"nixos-config=${path}/configuration.nix"
|
||||||
|
];
|
||||||
|
|
||||||
# Configure fish shell
|
# Configure fish shell
|
||||||
programs.fish.enable = true;
|
programs.fish.enable = true;
|
||||||
users.users.root = {
|
users.users.root = {
|
||||||
shell = "${fish}/bin/fish";
|
shell = "${fish}/bin/fish";
|
||||||
openssh.authorizedKeys.keys = [
|
openssh.authorizedKeys.keys = config.users.users.coolneng.openssh.authorizedKeys.keys;
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW coolneng@panacea"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Keep logs for a week
|
# Keep logs for a month
|
||||||
services.journald.extraConfig = "MaxRetentionSec=1week";
|
services.journald.extraConfig = "MaxRetentionSec=4week";
|
||||||
|
|
||||||
# Increase inotify limits
|
# Increase inotify limits and maximum buffer size
|
||||||
boot.kernel.sysctl = { "fs.inotify.max_user_watches" = 204800; };
|
boot.kernel.sysctl = {
|
||||||
|
"fs.inotify.max_user_watches" = 204800;
|
||||||
|
"net.core.rmem_max" = 2500000;
|
||||||
|
"net.core.wmem_max" = 2500000;
|
||||||
|
};
|
||||||
|
|
||||||
# MOTD message
|
# MOTD message
|
||||||
programs.fish.interactiveShellInit = "${./scripts/motd.sh}";
|
programs.fish.interactiveShellInit = "${./scripts/motd.sh}";
|
||||||
|
|
||||||
# NixOS version
|
# NixOS version
|
||||||
system.stateVersion = "22.05";
|
system.stateVersion = "24.11";
|
||||||
|
|
||||||
# Specify secrets
|
# Specify secrets
|
||||||
age = {
|
age = {
|
||||||
secrets.wireguard.file = secrets/wireguard.age;
|
secrets.wireguard = {
|
||||||
|
file = secrets/wireguard.age;
|
||||||
|
owner = "systemd-network";
|
||||||
|
group = "systemd-network";
|
||||||
|
};
|
||||||
secrets.syncthing.file = secrets/syncthing.age;
|
secrets.syncthing.file = secrets/syncthing.age;
|
||||||
secrets.msmtp.file = secrets/msmtp.age;
|
secrets.msmtp.file = secrets/msmtp.age;
|
||||||
secrets.gitea = {
|
secrets.gitea = {
|
||||||
@@ -108,7 +162,6 @@ with pkgs;
|
|||||||
owner = "gitea";
|
owner = "gitea";
|
||||||
group = "gitea";
|
group = "gitea";
|
||||||
};
|
};
|
||||||
secrets.ddclient.file = secrets/ddclient.age;
|
|
||||||
secrets.miniflux = {
|
secrets.miniflux = {
|
||||||
file = secrets/miniflux.age;
|
file = secrets/miniflux.age;
|
||||||
owner = "miniflux";
|
owner = "miniflux";
|
||||||
@@ -119,16 +172,80 @@ with pkgs;
|
|||||||
owner = "coolneng";
|
owner = "coolneng";
|
||||||
group = "users";
|
group = "users";
|
||||||
};
|
};
|
||||||
|
# HACK The owner and group is set by systemd due to the use of DynamicUser
|
||||||
|
secrets.dendrite = {
|
||||||
|
file = secrets/dendrite.age;
|
||||||
|
owner = "63026";
|
||||||
|
group = "63026";
|
||||||
|
};
|
||||||
|
secrets.dendrite-postgres = {
|
||||||
|
file = secrets/dendrite-postgres.age;
|
||||||
|
owner = "63026";
|
||||||
|
group = "63026";
|
||||||
|
};
|
||||||
|
secrets.telegram = {
|
||||||
|
file = secrets/telegram.age;
|
||||||
|
};
|
||||||
|
secrets.mqtt-sender = {
|
||||||
|
file = secrets/mqtt-sender.age;
|
||||||
|
owner = "mosquitto";
|
||||||
|
group = "mosquitto";
|
||||||
|
};
|
||||||
|
secrets.mqtt-receiver = {
|
||||||
|
file = secrets/mqtt-receiver.age;
|
||||||
|
owner = "mosquitto";
|
||||||
|
group = "mosquitto";
|
||||||
|
};
|
||||||
|
secrets.facebook = {
|
||||||
|
file = secrets/facebook.age;
|
||||||
|
};
|
||||||
|
secrets.signal = {
|
||||||
|
file = secrets/signal.age;
|
||||||
|
};
|
||||||
|
secrets.inadyn-duckdns = {
|
||||||
|
file = secrets/inadyn-duckdns.age;
|
||||||
|
owner = "inadyn";
|
||||||
|
group = "inadyn";
|
||||||
|
};
|
||||||
|
secrets.inadyn-porkbun = {
|
||||||
|
file = secrets/inadyn-porkbun.age;
|
||||||
|
owner = "inadyn";
|
||||||
|
group = "inadyn";
|
||||||
|
};
|
||||||
|
secrets.inadyn-porkbun-secret = {
|
||||||
|
file = secrets/inadyn-porkbun-secret.age;
|
||||||
|
owner = "inadyn";
|
||||||
|
group = "inadyn";
|
||||||
|
};
|
||||||
|
secrets.acme-duckdns = {
|
||||||
|
file = secrets/acme-duckdns.age;
|
||||||
|
owner = "acme";
|
||||||
|
group = "nginx";
|
||||||
|
};
|
||||||
|
secrets.acme-porkbun = {
|
||||||
|
file = secrets/acme-porkbun.age;
|
||||||
|
owner = "acme";
|
||||||
|
group = "nginx";
|
||||||
|
};
|
||||||
|
secrets.microbin = {
|
||||||
|
file = secrets/microbin.age;
|
||||||
|
owner = "63026";
|
||||||
|
group = "63026";
|
||||||
|
};
|
||||||
|
secrets.readeck = {
|
||||||
|
file = secrets/readeck.age;
|
||||||
|
owner = "63026";
|
||||||
|
group = "63026";
|
||||||
|
};
|
||||||
identityPaths = [ "/etc/ssh/id_ed25519" ];
|
identityPaths = [ "/etc/ssh/id_ed25519" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Auto-upgrade the system
|
# Auto-upgrade the system
|
||||||
system.autoUpgrade = {
|
system.autoUpgrade = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
allowReboot = true;
|
||||||
flake = "/home/coolneng/system";
|
flake = "/home/coolneng/system";
|
||||||
flags = [
|
flags = [
|
||||||
"--update-input"
|
|
||||||
"agenix"
|
|
||||||
"--update-input"
|
"--update-input"
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
"--commit-lock-file"
|
"--commit-lock-file"
|
||||||
@@ -146,6 +263,9 @@ with pkgs;
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Disable man pages
|
||||||
|
documentation.man.enable = false;
|
||||||
|
|
||||||
# Import other configuration modules
|
# Import other configuration modules
|
||||||
imports = [
|
imports = [
|
||||||
./modules/hardware-configuration.nix
|
./modules/hardware-configuration.nix
|
||||||
@@ -157,7 +277,7 @@ with pkgs;
|
|||||||
./modules/periodic.nix
|
./modules/periodic.nix
|
||||||
./modules/communication.nix
|
./modules/communication.nix
|
||||||
./modules/information.nix
|
./modules/information.nix
|
||||||
./modules/device.nix
|
./modules/containers.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
363
flake.lock
generated
363
flake.lock
generated
@@ -2,16 +2,19 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"agenix": {
|
"agenix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"darwin": "darwin",
|
||||||
|
"home-manager": "home-manager",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
],
|
||||||
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1652712410,
|
"lastModified": 1762618334,
|
||||||
"narHash": "sha256-hMJ2TqLt0DleEnQFGUHK9sV2aAzJPU8pZeiZoqRozbE=",
|
"narHash": "sha256-wyT7Pl6tMFbFrs8Lk/TlEs81N6L+VSybPfiIgzU8lbQ=",
|
||||||
"owner": "ryantm",
|
"owner": "ryantm",
|
||||||
"repo": "agenix",
|
"repo": "agenix",
|
||||||
"rev": "7e5e58b98c3dcbf497543ff6f22591552ebfe65b",
|
"rev": "fcdea223397448d35d9b31f798479227e80183f6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -20,41 +23,373 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"agenix",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1744478979,
|
||||||
|
"narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=",
|
||||||
|
"owner": "lnl7",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"rev": "43975d782b418ebf4969e9ccba82466728c2851b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "lnl7",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"determinate": {
|
||||||
|
"inputs": {
|
||||||
|
"determinate-nixd-aarch64-darwin": "determinate-nixd-aarch64-darwin",
|
||||||
|
"determinate-nixd-aarch64-linux": "determinate-nixd-aarch64-linux",
|
||||||
|
"determinate-nixd-x86_64-linux": "determinate-nixd-x86_64-linux",
|
||||||
|
"nix": "nix",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1766177528,
|
||||||
|
"narHash": "sha256-Bl+p766mM7qNCZtMqmTz13RuUbOMKsFa+/vnGYoxgPk=",
|
||||||
|
"rev": "b159c082f0f9bdefa6c386189a13c5fa0734d8d8",
|
||||||
|
"revCount": 317,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/determinate/3.15.0/019b3865-57a1-7d80-98c5-962fac29c404/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/DeterminateSystems/determinate/%2A"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"determinate-nixd-aarch64-darwin": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"narHash": "sha256-vDaEQ5T4eA7kEPREmm68IVWGR6zT0aDL5slZxA6dkSc=",
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.15.0/macOS"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.15.0/macOS"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"determinate-nixd-aarch64-linux": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"narHash": "sha256-Hf4JsIv5G3IR0Q0RHGLSNdmDzFv97sVQQKwzY6A0vV4=",
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.15.0/aarch64-linux"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.15.0/aarch64-linux"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"determinate-nixd-x86_64-linux": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"narHash": "sha256-J+J4E02XpEl0ZkpzMbUmGCf6S4yk0gYCYmiGzZ058ik=",
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.15.0/x86_64-linux"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://install.determinate.systems/determinate-nixd/tag/v3.15.0/x86_64-linux"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devshell": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1642188268,
|
||||||
|
"narHash": "sha256-DNz4xScpXIn7rSDohdayBpPR9H9OWCMDOgTYegX081k=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"rev": "696acc29668b644df1740b69e1601119bf6da83b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat_2": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1641205782,
|
||||||
|
"narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": [
|
||||||
|
"determinate",
|
||||||
|
"nix",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1748821116,
|
||||||
|
"narHash": "sha256-F82+gS044J1APL0n4hH50GYdPRv/5JWm34oCJYmVKdE=",
|
||||||
|
"rev": "49f0870db23e8c1ca0b5259734a02cd9e1e371a1",
|
||||||
|
"revCount": 377,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/hercules-ci/flake-parts/0.1.377%2Brev-49f0870db23e8c1ca0b5259734a02cd9e1e371a1/01972f28-554a-73f8-91f4-d488cc502f08/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/hercules-ci/flake-parts/0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"git-hooks-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"gitignore": [
|
||||||
|
"determinate",
|
||||||
|
"nix"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"determinate",
|
||||||
|
"nix",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1747372754,
|
||||||
|
"narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=",
|
||||||
|
"rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46",
|
||||||
|
"revCount": 1026,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/cachix/git-hooks.nix/0.1.1026%2Brev-80479b6ec16fefd9c1db3ea13aeb038c60530f46/0196d79a-1b35-7b8e-a021-c894fb62163d/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/cachix/git-hooks.nix/0.1.941"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"agenix",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1745494811,
|
||||||
|
"narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"git-hooks-nix": "git-hooks-nix",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-23-11": "nixpkgs-23-11",
|
||||||
|
"nixpkgs-regression": "nixpkgs-regression"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1766174426,
|
||||||
|
"narHash": "sha256-0ZofAQZNgg5nfIKsVb7g4It6ufmIyLtfFRPOf+6WRkk=",
|
||||||
|
"rev": "15d6091194b5b90d292e8d6283db77f09c303b1e",
|
||||||
|
"revCount": 24285,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nix-src/3.15.0/019b3854-cca6-7298-a91c-0fd8551a7270/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/DeterminateSystems/nix-src/%2A"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-matrix-appservices": {
|
||||||
|
"inputs": {
|
||||||
|
"devshell": "devshell",
|
||||||
|
"flake-compat": "flake-compat_2",
|
||||||
|
"nixlib": "nixlib",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1683490239,
|
||||||
|
"narHash": "sha256-QKzpvl2XrqbobWq/I/smDa9hEniwctjJybXPVILHP0w=",
|
||||||
|
"owner": "coffeetables",
|
||||||
|
"repo": "nix-matrix-appservices",
|
||||||
|
"rev": "e795d2fbc61da45d49802bb3e8f8d0c70ddc1e68",
|
||||||
|
"type": "gitlab"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "coffeetables",
|
||||||
|
"repo": "nix-matrix-appservices",
|
||||||
|
"type": "gitlab"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixlib": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1643502816,
|
||||||
|
"narHash": "sha256-Wrbt6Gs+hjXD3HUICPBJHKnHEUqiyx8rzHCgvqC1Bok=",
|
||||||
|
"owner": "divnix",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"rev": "ebed7ec5bcb5d01e298535989c6c321df18b631a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "divnix",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1656933710,
|
"lastModified": 1764440730,
|
||||||
"narHash": "sha256-SVG8EqY1OTJWBRY4hpct2ZR2Rk0L8hCFkug3m0ABoZE=",
|
"narHash": "sha256-ZlJTNLUKQRANlLDomuRWLBCH5792x+6XUJ4YdFRjtO4=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "3bf48d3587d3f34f745a19ebc968b002ef5b5c5a",
|
"rev": "9154f4569b6cdfd3c595851a6ba51bfaa472d9f3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
|
"ref": "master",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1658161305,
|
"lastModified": 1761597516,
|
||||||
"narHash": "sha256-X/nhnMCa1Wx4YapsspyAs6QYz6T/85FofrI6NpdPDHg=",
|
"narHash": "sha256-wxX7u6D2rpkJLWkZ2E932SIvDJW8+ON/0Yy8+a5vsDU=",
|
||||||
|
"rev": "daf6dc47aa4b44791372d6139ab7b25269184d55",
|
||||||
|
"revCount": 811874,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2505.811874%2Brev-daf6dc47aa4b44791372d6139ab7b25269184d55/019a3494-3498-707e-9086-1fb81badc7fe/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.2505"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-23-11": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1717159533,
|
||||||
|
"narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e4d49de45a3b5dbcb881656b4e3986e666141ea9",
|
"rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-unstable",
|
"repo": "nixpkgs",
|
||||||
"type": "indirect"
|
"rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-regression": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1643052045,
|
||||||
|
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1765772535,
|
||||||
|
"narHash": "sha256-aq+dQoaPONOSjtFIBnAXseDm9TUhIbe215TPmkfMYww=",
|
||||||
|
"rev": "09b8fda8959d761445f12b55f380d90375a1d6bb",
|
||||||
|
"revCount": 911985,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.911985%2Brev-09b8fda8959d761445f12b55f380d90375a1d6bb/019b25ab-7c11-79e0-a0b0-c94d455b7190/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_3": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1766201043,
|
||||||
|
"narHash": "sha256-eplAP+rorKKd0gNjV3rA6+0WMzb1X1i16F5m5pASnjA=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "b3aad468604d3e488d627c0b43984eb60e75e782",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-25.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"agenix": "agenix",
|
"agenix": "agenix",
|
||||||
|
"determinate": "determinate",
|
||||||
|
"nix-matrix-appservices": "nix-matrix-appservices",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs_3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
33
flake.nix
33
flake.nix
@@ -1,32 +1,49 @@
|
|||||||
{
|
{
|
||||||
description = "System configuration for zion";
|
description = "System configuration for zion";
|
||||||
|
|
||||||
|
nixConfig = {
|
||||||
|
extra-substituters = "https://install.determinate.systems";
|
||||||
|
extra-trusted-public-keys = ''
|
||||||
|
cache.flakehub.com-3:hJuILl5sVK4iKm86JzgdXW12Y2Hwd5G07qKtHTOcDCM=
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||||
|
determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*";
|
||||||
agenix = {
|
agenix = {
|
||||||
url = "github:ryantm/agenix";
|
url = "github:ryantm/agenix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||||
|
nix-matrix-appservices = {
|
||||||
|
url = "gitlab:coffeetables/nix-matrix-appservices";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, agenix, nixos-hardware, ... }@inputs:
|
outputs =
|
||||||
|
{ self, nixpkgs, ... }@inputs:
|
||||||
let
|
let
|
||||||
system = "aarch64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
pkgs = import pkgs { inherit system; };
|
pkgs = import pkgs { inherit system; };
|
||||||
|
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
nixosConfigurations.zion = lib.nixosSystem {
|
nixosConfigurations.zion = lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = [
|
modules = [
|
||||||
(import ./configuration.nix)
|
(import ./configuration.nix)
|
||||||
agenix.nixosModules.age
|
inputs.agenix.nixosModules.age
|
||||||
nixos-hardware.nixosModules.raspberry-pi-4
|
inputs.nixos-hardware.nixosModules.aoostar-r1-n100
|
||||||
|
inputs.determinate.nixosModules.default
|
||||||
];
|
];
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,41 +1,103 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with pkgs;
|
||||||
|
|
||||||
|
# NOTE Reference the environment variable set in the corresponding agenix secret
|
||||||
|
let
|
||||||
|
database = {
|
||||||
|
connection_string = "$DB_STRING";
|
||||||
|
max_open_conns = 100;
|
||||||
|
max_idle_conns = 5;
|
||||||
|
conn_max_lifetime = -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
{
|
{
|
||||||
# Matrix server configuration
|
# Matrix server configuration
|
||||||
services.matrix-synapse = {
|
services.dendrite = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
httpPort = 8008;
|
||||||
|
environmentFile = config.age.secrets.dendrite-postgres.path;
|
||||||
|
loadCredential = [ "private_key:${config.age.secrets.dendrite.path}" ];
|
||||||
settings = {
|
settings = {
|
||||||
server_name = "coolneng.duckdns.org";
|
global = {
|
||||||
public_baseurl = "https://matrix.coolneng.duckdns.org";
|
server_name = "coolneng.duckdns.org";
|
||||||
listeners = [{
|
private_key = config.age.secrets.dendrite.path;
|
||||||
port = 8008;
|
inherit database;
|
||||||
tls = false;
|
dns_cache.enabled = true;
|
||||||
resources = [{
|
};
|
||||||
compress = true;
|
# HACK Inherit postgres connection string for the rest of the DBs
|
||||||
names = [ "client" ];
|
app_service_api = {
|
||||||
}];
|
inherit database;
|
||||||
bind_addresses = [ "127.0.0.1" ];
|
};
|
||||||
}];
|
media_api = {
|
||||||
app_service_config_files =
|
inherit database;
|
||||||
[ "/var/lib/matrix-synapse/telegram-registration.yaml" ];
|
};
|
||||||
|
room_server = {
|
||||||
|
inherit database;
|
||||||
|
};
|
||||||
|
push_server = {
|
||||||
|
inherit database;
|
||||||
|
};
|
||||||
|
mscs = {
|
||||||
|
inherit database;
|
||||||
|
mscs = [
|
||||||
|
"msc2836"
|
||||||
|
"msc2946"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
sync_api = {
|
||||||
|
inherit database;
|
||||||
|
};
|
||||||
|
key_server = {
|
||||||
|
inherit database;
|
||||||
|
};
|
||||||
|
federation_api = {
|
||||||
|
inherit database;
|
||||||
|
};
|
||||||
|
user_api = {
|
||||||
|
account_database = database;
|
||||||
|
device_database = database;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Telegram bridge for Matrix
|
# Start dendrite after config files are mounted
|
||||||
services.mautrix-telegram = {
|
systemd.services.dendrite.unitConfig.RequiresMountsFor = [
|
||||||
|
/var/lib/matrix-as-facebook
|
||||||
|
/var/lib/matrix-as-signal
|
||||||
|
/var/lib/matrix-as-telegram
|
||||||
|
];
|
||||||
|
|
||||||
|
# MQTT configuration
|
||||||
|
services.mosquitto = {
|
||||||
enable = true;
|
enable = true;
|
||||||
environmentFile = /var/lib/mautrix-telegram/telegram.env;
|
dataDir = "/vault/mosquitto";
|
||||||
settings = {
|
logType = [
|
||||||
homeserver = {
|
"websockets"
|
||||||
address = "https://matrix.coolneng.duckdns.org";
|
"error"
|
||||||
domain = "coolneng.duckdns.org";
|
"warning"
|
||||||
};
|
"notice"
|
||||||
appservice = {
|
"information"
|
||||||
address = "http://localhost:8118";
|
];
|
||||||
port = 8118;
|
logDest = [ "syslog" ];
|
||||||
};
|
listeners = [
|
||||||
bridge.permissions."@coolneng:coolneng.duckdns.org" = "admin";
|
{
|
||||||
};
|
users.homeostasis = {
|
||||||
serviceDependencies = [ "matrix-synapse.service" ];
|
acl = [ "write #" ];
|
||||||
|
hashedPasswordFile = config.age.secrets.mqtt-sender.path;
|
||||||
|
};
|
||||||
|
users.prometheus = {
|
||||||
|
acl = [ "read #" ];
|
||||||
|
hashedPasswordFile = config.age.secrets.mqtt-receiver.path;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
68
modules/containers.nix
Normal file
68
modules/containers.nix
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Podman setup
|
||||||
|
virtualisation = {
|
||||||
|
containers.enable = true;
|
||||||
|
podman = {
|
||||||
|
enable = true;
|
||||||
|
dockerCompat = true;
|
||||||
|
extraPackages = with pkgs; [ zfs ];
|
||||||
|
};
|
||||||
|
|
||||||
|
oci-containers = {
|
||||||
|
backend = "podman";
|
||||||
|
containers = {
|
||||||
|
# Openbooks configuration
|
||||||
|
openbooks = {
|
||||||
|
image = "evanbuss/openbooks@sha256:4fa9188885368c2303b7dc527d48b3159aaa7022010e29b3ed96842018793590";
|
||||||
|
ports = [ "127.0.0.1:9000:80" ];
|
||||||
|
cmd = [
|
||||||
|
"--name"
|
||||||
|
"bradar"
|
||||||
|
"--searchbot"
|
||||||
|
"searchook"
|
||||||
|
"--persist"
|
||||||
|
"--tls"
|
||||||
|
"false"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
# Prometheus MQTT integration
|
||||||
|
mqtt2prometheus = {
|
||||||
|
image = "hikhvar/mqtt2prometheus@sha256:8e166d36feaa5ddcad703eef3a2c5167a154d6eef306a40fe6509861580c0714";
|
||||||
|
ports = [ "127.0.0.1:9641:9641" ];
|
||||||
|
volumes = [ "/vault/mqtt2prometheus/config.yaml:/config.yaml" ];
|
||||||
|
};
|
||||||
|
# Podcast synchronization
|
||||||
|
opodsync = {
|
||||||
|
image = "ganeshlab/opodsync@sha256:32626b732fe38687a5dfd703d515136e413c4b16f286b38656718ad03f0d94c1";
|
||||||
|
ports = [ "127.0.0.1:9090:8080" ];
|
||||||
|
volumes = [ "/vault/opodsync:/var/www/server/data" ];
|
||||||
|
};
|
||||||
|
# Photo gallery
|
||||||
|
pigallery2 = {
|
||||||
|
image = "bpatrik/pigallery2@sha256:c936e4504cfe7158198542a8db794b24afb0301155d89e911f13bd04e0b406c2";
|
||||||
|
ports = [ "127.0.0.1:9191:80" ];
|
||||||
|
volumes = [
|
||||||
|
"/vault/pigallery2/config:/app/data/config"
|
||||||
|
"/vault/pigallery2/db:/app/data/db"
|
||||||
|
"/vault/pigallery2/tmp:/app/data/tmp"
|
||||||
|
"/vault/syncthing/Photos:/app/data/images"
|
||||||
|
];
|
||||||
|
cmd = [
|
||||||
|
"-e"
|
||||||
|
"NODE_ENV=production"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Start services after ZFS mount
|
||||||
|
systemd.services.podman-mqtt2prometheus.unitConfig.RequiresMountsFor = [ /vault/mqtt2prometheus ];
|
||||||
|
}
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
# Syncthing configuration
|
# Syncthing configuration
|
||||||
services.syncthing = {
|
services.syncthing = {
|
||||||
@@ -7,67 +13,102 @@
|
|||||||
guiAddress = "0.0.0.0:8384";
|
guiAddress = "0.0.0.0:8384";
|
||||||
dataDir = "/vault/syncthing";
|
dataDir = "/vault/syncthing";
|
||||||
key = config.age.secrets.syncthing.path;
|
key = config.age.secrets.syncthing.path;
|
||||||
devices = {
|
settings = {
|
||||||
panacea.id =
|
extraOptions.options = {
|
||||||
"NF4SYEJ-RSGPDEF-CDEYC3A-JWZMKNC-KG4FVQP-CZ5HRFY-XM22BZD-N7B6VAH";
|
maxFolderConcurrency = 4;
|
||||||
caravanserai.id =
|
progressUpdateIntervalS = -1;
|
||||||
"P6BJYCN-LWMB7HN-5JLNYM7-VHCG2S2-IC6YA3C-DOWMW7T-PX7GC3S-3BAZUAS";
|
|
||||||
};
|
|
||||||
folders = {
|
|
||||||
Documents = {
|
|
||||||
id = "wusdj-bfjkr";
|
|
||||||
type = "receiveonly";
|
|
||||||
path = "/vault/syncthing/Documents";
|
|
||||||
devices = [ "panacea" "caravanserai" ];
|
|
||||||
};
|
};
|
||||||
|
devices = {
|
||||||
Notes = {
|
panacea.id = "VEGVHKF-P4FT3BD-4T3ML7J-65URQOU-3XKNMI5-6LGWSCI-BIQZOUE-RKQ6PQX";
|
||||||
id = "kafhz-bfmzm";
|
caravanserai.id = "XQAXYEU-FWLAFZM-GTZYDGH-AIRBEXI-4CZD365-JUBTHDA-GOXXOYV-E5LEYQE";
|
||||||
type = "receiveonly";
|
|
||||||
path = "/vault/syncthing/Notes";
|
|
||||||
devices = [ "panacea" "caravanserai" ];
|
|
||||||
};
|
};
|
||||||
|
folders = {
|
||||||
|
Documents = {
|
||||||
|
id = "wusdj-bfjkr";
|
||||||
|
type = "receiveonly";
|
||||||
|
path = "/vault/syncthing/Documents";
|
||||||
|
devices = [
|
||||||
|
"panacea"
|
||||||
|
"caravanserai"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
Music = {
|
Notes = {
|
||||||
id = "2aqt7-vpprc";
|
id = "kafhz-bfmzm";
|
||||||
type = "receiveonly";
|
type = "receiveonly";
|
||||||
path = "/vault/syncthing/Music";
|
path = "/vault/syncthing/Notes";
|
||||||
devices = [ "panacea" "caravanserai" ];
|
devices = [
|
||||||
};
|
"panacea"
|
||||||
|
"caravanserai"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
Photos = {
|
Music = {
|
||||||
id = "mjibc-ustcg";
|
id = "2aqt7-vpprc";
|
||||||
type = "receiveonly";
|
type = "receiveonly";
|
||||||
path = "/vault/syncthing/Photos";
|
path = "/vault/syncthing/Music";
|
||||||
devices = [ "panacea" "caravanserai" ];
|
devices = [
|
||||||
};
|
"panacea"
|
||||||
|
"caravanserai"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
Projects = {
|
Photos = {
|
||||||
id = "cjhmu-avy9v";
|
id = "mjibc-ustcg";
|
||||||
type = "receiveonly";
|
type = "receiveonly";
|
||||||
path = "/vault/syncthing/Projects";
|
path = "/vault/syncthing/Photos";
|
||||||
devices = [ "panacea" ];
|
devices = [
|
||||||
};
|
"panacea"
|
||||||
|
"caravanserai"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
Phone = {
|
Projects = {
|
||||||
id = "m2007j20cg_vc7r-photos";
|
id = "cjhmu-avy9v";
|
||||||
type = "receiveonly";
|
type = "receiveonly";
|
||||||
path = "/vault/syncthing/Photos/Phone";
|
path = "/vault/syncthing/Projects";
|
||||||
devices = [ "panacea" "caravanserai" ];
|
devices = [ "panacea" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Files = {
|
Phone = {
|
||||||
id = "tsk52-u6rbk";
|
id = "m2007j20cg_vc7r-photos";
|
||||||
type = "receiveonly";
|
type = "receiveonly";
|
||||||
path = "/vault/syncthing/Files";
|
path = "/vault/syncthing/Photos/Phone";
|
||||||
devices = [ "panacea" "caravanserai" ];
|
devices = [
|
||||||
};
|
"panacea"
|
||||||
|
"caravanserai"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
Phone-screenshots = {
|
Files = {
|
||||||
id = "pp70r-pbr70";
|
id = "tsk52-u6rbk";
|
||||||
type = "receiveonly";
|
type = "receiveonly";
|
||||||
path = "/vault/syncthing/Photos/Phone-screenshots";
|
path = "/vault/syncthing/Files";
|
||||||
devices = [ "panacea" "caravanserai" ];
|
devices = [
|
||||||
|
"panacea"
|
||||||
|
"caravanserai"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
Phone-screenshots = {
|
||||||
|
id = "pp70r-pbr70";
|
||||||
|
type = "receiveonly";
|
||||||
|
path = "/vault/syncthing/Photos/Phone-screenshots";
|
||||||
|
devices = [
|
||||||
|
"panacea"
|
||||||
|
"caravanserai"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
Audio = {
|
||||||
|
id = "tarrs-5mxck";
|
||||||
|
type = "receiveonly";
|
||||||
|
path = "/vault/syncthing/Audio";
|
||||||
|
devices = [
|
||||||
|
"panacea"
|
||||||
|
"caravanserai"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -97,4 +138,8 @@
|
|||||||
monthly = 12;
|
monthly = 12;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Start services after ZFS mount
|
||||||
|
systemd.services.syncthing.unitConfig.RequiresMountsFor = [ /vault/syncthing ];
|
||||||
|
systemd.services.radicale.unitConfig.RequiresMountsFor = [ /vault/radicale ];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
with pkgs;
|
|
||||||
|
|
||||||
{
|
|
||||||
# A bunch of boot parameters needed for optimal runtime on RPi 4B
|
|
||||||
boot.kernelPackages = linuxPackages_rpi4;
|
|
||||||
boot.kernelParams = [
|
|
||||||
"zfs.zfs_arc_max=134217728"
|
|
||||||
"console=TTYAMA0,115200"
|
|
||||||
"console=tty1"
|
|
||||||
"8250.nr_uarts=1"
|
|
||||||
"iomem=relaxed"
|
|
||||||
"strict-devmem=0"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Enable SATA-HAT GPIO features
|
|
||||||
boot.loader = {
|
|
||||||
grub.enable = false;
|
|
||||||
generic-extlinux-compatible.enable = lib.mkForce false;
|
|
||||||
};
|
|
||||||
boot.loader.raspberryPi = {
|
|
||||||
enable = true;
|
|
||||||
version = 4;
|
|
||||||
firmwareConfig = ''
|
|
||||||
iomem=relaxed
|
|
||||||
strict-devmem=0
|
|
||||||
dtoverlay=w1-gpio
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.kernelModules = [ "pwm_bcm2835" "w1-gpio" "w1-therm" ];
|
|
||||||
# Load PWM hardware timers
|
|
||||||
hardware.raspberry-pi."4".pwm0.enable = true;
|
|
||||||
|
|
||||||
# Enable I2C
|
|
||||||
hardware.raspberry-pi."4".i2c1.enable = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,19 +1,35 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
# Set up Gitea with LFS support
|
# Set up Gitea with LFS support
|
||||||
services.gitea = {
|
services.gitea = {
|
||||||
enable = true;
|
enable = true;
|
||||||
domain = "git.coolneng.duckdns.org";
|
|
||||||
rootUrl = "https://git.coolneng.duckdns.org";
|
|
||||||
database = {
|
database = {
|
||||||
type = "postgres";
|
type = "postgres";
|
||||||
passwordFile = config.age.secrets.gitea.path;
|
passwordFile = config.age.secrets.gitea.path;
|
||||||
};
|
};
|
||||||
cookieSecure = true;
|
|
||||||
disableRegistration = true;
|
|
||||||
repositoryRoot = "/vault/git";
|
repositoryRoot = "/vault/git";
|
||||||
appName = "Gitea";
|
appName = "Gitea";
|
||||||
lfs.enable = true;
|
lfs = {
|
||||||
settings.ui.DEFAULT_THEME = "arc-green";
|
enable = true;
|
||||||
|
contentDir = "${config.services.gitea.repositoryRoot}/data/lfs";
|
||||||
|
};
|
||||||
|
settings = {
|
||||||
|
server = {
|
||||||
|
DISABLE_SSH = true;
|
||||||
|
DOMAIN = "git.psydnd.org";
|
||||||
|
ROOT_URL = "https://git.psydnd.org";
|
||||||
|
};
|
||||||
|
service.DISABLE_REGISTRATION = true;
|
||||||
|
session.COOKIE_SECURE = true;
|
||||||
|
actions.ENABLED = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Start services after ZFS mount
|
||||||
|
systemd.services.gitea.unitConfig.RequiresMountsFor = [ /vault/git ];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,69 +4,55 @@
|
|||||||
{ config, lib, pkgs, modulesPath, ... }:
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
imports =
|
||||||
|
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ ];
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" = {
|
fileSystems."/" =
|
||||||
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
|
{ device = "sysion/stateful/root";
|
||||||
fsType = "ext4";
|
fsType = "zfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
fileSystems."/nix" =
|
||||||
device = "/dev/disk/by-uuid/2178-694E";
|
{ device = "sysion/ephemeral/nix";
|
||||||
fsType = "vfat";
|
fsType = "zfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/vault" = {
|
fileSystems."/tmp" =
|
||||||
device = "vault";
|
{ device = "sysion/ephemeral/tmp";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/vault/git" = {
|
fileSystems."/home/coolneng" =
|
||||||
device = "vault/git";
|
{ device = "sysion/stateful/home";
|
||||||
fsType = "zfs";
|
fsType = "zfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/vault/nextcloud" = {
|
fileSystems."/boot" =
|
||||||
device = "vault/nextcloud";
|
{ device = "/dev/disk/by-uuid/C332-4650";
|
||||||
fsType = "zfs";
|
fsType = "vfat";
|
||||||
};
|
options = [ "fmask=0022" "dmask=0022" ];
|
||||||
|
};
|
||||||
|
|
||||||
fileSystems."/vault/syncthing" = {
|
swapDevices =
|
||||||
device = "vault/syncthing";
|
[ { device = "/dev/disk/by-uuid/d388feef-a651-4dae-8161-f666136de240"; }
|
||||||
fsType = "zfs";
|
];
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/vault/backups" = {
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
device = "vault/backups";
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
fsType = "zfs";
|
# 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.enp2s0.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.enp3s0.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.wg0.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
fileSystems."/vault/backups/zion" = {
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
device = "vault/backups/zion";
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
fsType = "zfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/vault/backups/zion/databases" = {
|
|
||||||
device = "vault/backups/zion/databases";
|
|
||||||
fsType = "zfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/vault/backups/monolith" = {
|
|
||||||
device = "vault/backups/monolith";
|
|
||||||
fsType = "zfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/vault/radicale" = {
|
|
||||||
device = "vault/radicale";
|
|
||||||
fsType = "zfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [ ];
|
|
||||||
|
|
||||||
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +1,44 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
# Miniflux configuration
|
# Miniflux configuration
|
||||||
services.miniflux = {
|
services.miniflux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
adminCredentialsFile = config.age.secrets.miniflux.path;
|
adminCredentialsFile = config.age.secrets.miniflux.path;
|
||||||
config = {
|
|
||||||
BASE_URL = "https://rss.coolneng.duckdns.org";
|
|
||||||
RUN_MIGRATIONS = "1";
|
|
||||||
DISABLE_HSTS = "1";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Php-fpm pool for Wallabag
|
# Microbin configuration
|
||||||
services.phpfpm.pools.wallabag = {
|
services.microbin = {
|
||||||
user = "nginx";
|
enable = true;
|
||||||
group = "nginx";
|
passwordFile = config.age.secrets.microbin.path;
|
||||||
settings = {
|
settings = {
|
||||||
"listen.owner" = config.services.nginx.user;
|
MICROBIN_PORT = 9091;
|
||||||
"listen.group" = config.services.nginx.group;
|
MICROBIN_PUBLIC_PATH = "https://bin.psydnd.org";
|
||||||
"listen.mode" = 600;
|
MICROBIN_QR = true;
|
||||||
"pm" = "ondemand";
|
MICROBIN_WIDE = true;
|
||||||
"pm.max_children " = 4;
|
|
||||||
"pm.max_requests" = 32;
|
|
||||||
"env[WALLABAG_DATA]" = "/var/lib/wallabag";
|
|
||||||
};
|
|
||||||
phpEnv."PATH" = lib.makeBinPath [ pkgs.php ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Set environment variable pointing to wallabag configuration directory
|
|
||||||
environment.variables.WALLABAG_DATA = "/var/lib/wallabag";
|
|
||||||
|
|
||||||
# Openbooks configuration
|
|
||||||
virtualisation.oci-containers.containers = {
|
|
||||||
openbooks = {
|
|
||||||
image = "evanbuss/openbooks";
|
|
||||||
ports = [ "127.0.0.1:9000:80" ];
|
|
||||||
extraOptions = [ "--label=io.containers.autoupdate=registry" ];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Readeck configuration
|
||||||
|
services.readeck = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
server = {
|
||||||
|
host = "127.0.0.1";
|
||||||
|
port = 9092;
|
||||||
|
allowed_hosts = [ "read.psydnd.org" ];
|
||||||
|
trusted_proxies = [ "127.0.0.1" ];
|
||||||
|
environmentFile = config.age.secrets.readeck.path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# NOTE Load credentials using environment variables
|
||||||
|
systemd.services.readeck.serviceConfig.EnvironmentFile = config.age.secrets.readeck.path;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
||||||
@@ -42,4 +47,46 @@ with pkgs;
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Metrics collection
|
||||||
|
services.prometheus = {
|
||||||
|
enable = true;
|
||||||
|
port = 9001;
|
||||||
|
retentionTime = "10y";
|
||||||
|
extraFlags = [ "--web.enable-admin-api" ];
|
||||||
|
exporters = {
|
||||||
|
node = {
|
||||||
|
enable = true;
|
||||||
|
enabledCollectors = [ "systemd" ];
|
||||||
|
port = 9002;
|
||||||
|
};
|
||||||
|
postgres.enable = true;
|
||||||
|
smartctl.enable = true;
|
||||||
|
};
|
||||||
|
scrapeConfigs = [
|
||||||
|
{
|
||||||
|
job_name = "zion";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = [
|
||||||
|
"localhost:${toString config.services.prometheus.exporters.node.port}"
|
||||||
|
"localhost:${toString config.services.prometheus.exporters.postgres.port}"
|
||||||
|
"localhost:${toString config.services.prometheus.exporters.smartctl.port}"
|
||||||
|
"localhost:9641" # MQTT2Prometheus
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Grafana configuration
|
||||||
|
services.grafana = {
|
||||||
|
enable = true;
|
||||||
|
settings.server = {
|
||||||
|
domain = "grafana.psydnd.org";
|
||||||
|
http_port = 9009;
|
||||||
|
http_addr = "127.0.0.1";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +1,61 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let wireguard_port = 443;
|
let
|
||||||
|
wireguard_port = 1194;
|
||||||
|
|
||||||
in {
|
in
|
||||||
# Assign a static IP
|
{
|
||||||
|
# Enable systemd-networkd
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "zion";
|
hostName = "zion";
|
||||||
hostId = "4e74ea68";
|
hostId = "760bfad7";
|
||||||
interfaces.eth0 = {
|
useDHCP = false;
|
||||||
useDHCP = false;
|
useNetworkd = true;
|
||||||
ipv4.addresses = [{
|
dhcpcd.enable = false;
|
||||||
address = "192.168.13.2";
|
|
||||||
prefixLength = 24;
|
|
||||||
}];
|
|
||||||
};
|
|
||||||
defaultGateway = {
|
|
||||||
address = "192.168.13.1";
|
|
||||||
interface = "eth0";
|
|
||||||
};
|
|
||||||
nameservers = [ "51.158.108.203" "195.10.195.195" ];
|
|
||||||
enableIPv6 = false;
|
|
||||||
};
|
};
|
||||||
|
systemd.network.wait-online.enable = false;
|
||||||
|
|
||||||
# Enable zeroconf
|
# Assign a static IP
|
||||||
services.avahi = {
|
systemd.network.networks."24-home" = {
|
||||||
enable = true;
|
name = "enp2s0";
|
||||||
nssmdns = true;
|
matchConfig.Name = "enp2s0";
|
||||||
publish = {
|
address = [ "192.168.128.2/23" ];
|
||||||
enable = true;
|
gateway = [ "192.168.128.1" ];
|
||||||
userServices = true;
|
dns = [
|
||||||
domain = true;
|
"127.0.0.1"
|
||||||
workstation = true;
|
"::1"
|
||||||
};
|
];
|
||||||
reflector = true;
|
networkConfig.DNSSEC = "no";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Dynamic DNS configuration
|
# Dynamic DNS configuration
|
||||||
services.ddclient = {
|
services.inadyn = {
|
||||||
enable = true;
|
enable = true;
|
||||||
quiet = true;
|
interval = "*:0/30";
|
||||||
protocol = "duckdns";
|
settings.provider."duckdns" = {
|
||||||
domains = [ "coolneng.duckdns.org" ];
|
hostname = "coolneng.duckdns.org";
|
||||||
passwordFile = config.age.secrets.ddclient.path;
|
include = config.age.secrets.inadyn-duckdns.path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Dynamic DNS configuration for Porkbun
|
||||||
|
# NOTE Temporary workaround until Inadyn fixes the Porkbun module
|
||||||
|
services.oink = {
|
||||||
|
enable = true;
|
||||||
|
apiKeyFile = config.age.secrets.inadyn-porkbun.path;
|
||||||
|
secretApiKeyFile = config.age.secrets.inadyn-porkbun-secret.path;
|
||||||
|
settings.interval = 1800;
|
||||||
|
domains = [
|
||||||
|
{
|
||||||
|
domain = "psydnd.org";
|
||||||
|
subdomain = "";
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Firewall configuration
|
# Firewall configuration
|
||||||
@@ -51,64 +65,125 @@ in {
|
|||||||
443 # HTTPS
|
443 # HTTPS
|
||||||
53 # DNS
|
53 # DNS
|
||||||
8448 # Matrix
|
8448 # Matrix
|
||||||
|
1883 # MQTT
|
||||||
];
|
];
|
||||||
allowedUDPPorts = [
|
allowedUDPPorts = [
|
||||||
wireguard_port # Wireguard
|
wireguard_port # Wireguard
|
||||||
53 # DNS
|
53 # DNS
|
||||||
];
|
];
|
||||||
extraCommands = ''
|
extraCommands = ''
|
||||||
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
|
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o ${
|
||||||
|
config.systemd.network.networks."24-home".name
|
||||||
|
} -j MASQUERADE
|
||||||
|
ip6tables -t nat -A POSTROUTING -s fd00::0/128 -o ${
|
||||||
|
config.systemd.network.networks."24-home".name
|
||||||
|
} -j MASQUERADE
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable NAT for wireguard
|
# Wireguard setup
|
||||||
networking.nat = {
|
systemd.network.netdevs."wg0" = {
|
||||||
enable = true;
|
netdevConfig = {
|
||||||
externalInterface = "eth0";
|
Kind = "wireguard";
|
||||||
internalInterfaces = [ "wg0" ];
|
Name = "wg0";
|
||||||
|
};
|
||||||
|
wireguardConfig = {
|
||||||
|
ListenPort = wireguard_port;
|
||||||
|
PrivateKeyFile = config.age.secrets.wireguard.path;
|
||||||
|
};
|
||||||
|
wireguardPeers = [
|
||||||
|
# panacea
|
||||||
|
{
|
||||||
|
PublicKey = "XMkTztU2Y8hw6Fu/2o4Gszij+EmNacvFMXuZyHS1n38=";
|
||||||
|
AllowedIPs = [
|
||||||
|
"10.8.0.2/32"
|
||||||
|
"fd00::2/128"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
# caravanserai
|
||||||
|
{
|
||||||
|
PublicKey = "mCsTj09H7lfDDs8vMQkJOlItHtHQ6MPUyfGO5ZjBbVs=";
|
||||||
|
AllowedIPs = [
|
||||||
|
"10.8.0.3/32"
|
||||||
|
"fd00::3/128"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
# kathreftis
|
||||||
|
{
|
||||||
|
PublicKey = "qfHtv6LSZjtxvH46d8pysr+/yPo2tV9cZumgIpxBNF4=";
|
||||||
|
AllowedIPs = [
|
||||||
|
"10.8.0.4/32"
|
||||||
|
"fd00::4/128"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Wireguard setup
|
systemd.network.networks."wg0" = {
|
||||||
networking.wireguard.interfaces = {
|
matchConfig.Name = "wg0";
|
||||||
wg0 = {
|
networkConfig = {
|
||||||
ips = [ "10.8.0.1/24" ];
|
Address = [
|
||||||
listenPort = wireguard_port;
|
"10.8.0.1/24"
|
||||||
privateKeyFile = config.age.secrets.wireguard.path;
|
"fd00::1/128"
|
||||||
peers = [
|
|
||||||
# panacea
|
|
||||||
{
|
|
||||||
publicKey = "XMkTztU2Y8hw6Fu/2o4Gszij+EmNacvFMXuZyHS1n38=";
|
|
||||||
allowedIPs = [ "10.8.0.2/32" ];
|
|
||||||
}
|
|
||||||
# caravanserai
|
|
||||||
{
|
|
||||||
publicKey = "eFykHmnMALRUluApRfSM32Xw80kTNo7yUsxs47URkX4=";
|
|
||||||
allowedIPs = [ "10.8.0.3/32" ];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
IPv4Forwarding = true;
|
||||||
|
IPv6Forwarding = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Disable systemd-resolved DNS stub
|
||||||
|
services.resolved = {
|
||||||
|
enable = true;
|
||||||
|
llmnr = "false";
|
||||||
|
extraConfig = ''
|
||||||
|
MulticastDNS=yes
|
||||||
|
DNSStubListener=no
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
# DNS server with ad-block
|
# DNS server with ad-block
|
||||||
services.dnsmasq = {
|
services.dnsmasq = {
|
||||||
enable = true;
|
enable = true;
|
||||||
servers = config.networking.nameservers;
|
settings = {
|
||||||
extraConfig = ''
|
domain-needed = true;
|
||||||
domain-needed
|
bogus-priv = true;
|
||||||
bogus-priv
|
no-resolv = true;
|
||||||
no-resolv
|
|
||||||
|
|
||||||
listen-address=127.0.0.1,192.168.13.2,10.8.0.1
|
listen-address = [
|
||||||
bind-interfaces
|
"127.0.0.1"
|
||||||
|
"192.168.128.2"
|
||||||
|
"10.8.0.1"
|
||||||
|
"::1"
|
||||||
|
"fd00::1"
|
||||||
|
];
|
||||||
|
bind-interfaces = true;
|
||||||
|
server = [ "127.0.0.1#43" ];
|
||||||
|
|
||||||
cache-size=10000
|
cache-size = 10000;
|
||||||
local-ttl=300
|
local-ttl = 300;
|
||||||
|
|
||||||
conf-file=/var/lib/dnsmasq/dnsmasq.blacklist.txt
|
conf-file = "${pkgs.dnsmasq}/share/dnsmasq/trust-anchors.conf";
|
||||||
|
dnssec = false;
|
||||||
|
address = "/psydnd.org/192.168.128.2";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
address=/coolneng.duckdns.org/192.168.13.2
|
# Encrypted DNS
|
||||||
'';
|
services.dnscrypt-proxy = {
|
||||||
|
enable = true;
|
||||||
|
upstreamDefaults = true;
|
||||||
|
settings = {
|
||||||
|
listen_addresses = [
|
||||||
|
"127.0.0.1:43"
|
||||||
|
"[::1]:43"
|
||||||
|
];
|
||||||
|
sources.public-resolvers = {
|
||||||
|
urls = [ "https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md" ];
|
||||||
|
cache_file = "/var/lib/dnscrypt-proxy2/public-resolvers.md";
|
||||||
|
minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3";
|
||||||
|
};
|
||||||
|
blocked_names.blocked_names_file = "/var/lib/dnscrypt-proxy/blocklist.txt";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
stateDir = "/var/lib/dnsmasq";
|
stateDir = "/var/lib/dnscrypt-proxy";
|
||||||
blocklist = "${stateDir}/dnsmasq.blacklist.txt";
|
blocklist = "${stateDir}/blocklist.txt";
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# PostgreSQL daily backups
|
# PostgreSQL daily backups
|
||||||
services.postgresqlBackup = {
|
services.postgresqlBackup = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -14,67 +20,21 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Fetch hosts-blocklists daily
|
# Fetch hosts-blocklists daily
|
||||||
|
# TODO Download the list if the file doesn't exist the first time
|
||||||
systemd.services.download-dns-blocklist = {
|
systemd.services.download-dns-blocklist = {
|
||||||
description = "Download hosts-blocklists";
|
description = "Download hosts-blocklists";
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
path = with pkgs; [ curl ];
|
path = with pkgs; [
|
||||||
script =
|
curl
|
||||||
"curl -L https://github.com/notracking/hosts-blocklists/raw/master/dnsmasq/dnsmasq.blacklist.txt -o ${blocklist}";
|
coreutils
|
||||||
serviceConfig.Type = "oneshot";
|
];
|
||||||
postStop = ''
|
script = ''
|
||||||
chown -R dnsmasq ${stateDir}
|
curl -L https://download.dnscrypt.info/blacklists/domains/mybase.txt -o ${blocklist}
|
||||||
systemctl restart dnsmasq
|
|
||||||
'';
|
'';
|
||||||
after = [ "wireguard-wg0.service" ];
|
serviceConfig.Type = "oneshot";
|
||||||
startAt = "02:00:00";
|
startAt = "02:00:00";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable SATA HAT
|
|
||||||
systemd.services.sata-hat = {
|
|
||||||
description = "Enable software support for SATA Hat";
|
|
||||||
wantedBy = [ "zfs-import.target" ];
|
|
||||||
script = ''
|
|
||||||
${pkgs.bash}/bin/bash -c "/home/coolneng/system/scripts/SATA-hat.sh on"
|
|
||||||
'';
|
|
||||||
preStop = ''
|
|
||||||
${pkgs.bash}/bin/bash -c "/home/coolneng/system/scripts/SATA-hat.sh off"
|
|
||||||
'';
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
RemainAfterExit = "yes";
|
|
||||||
};
|
|
||||||
before = [ "zfs-import.target" "zfs-import-vault.service" "umount.target" ];
|
|
||||||
requires = [ "systemd-udev-settle.service" ];
|
|
||||||
after = [ "systemd-udev-settle.service" ];
|
|
||||||
conflicts = [ "umount.target" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# HACK: restart services dependent on ZFS afer mount
|
|
||||||
systemd.services.restart-services-mount = {
|
|
||||||
description = "Restart services after the ZFS dataset is mounted";
|
|
||||||
wantedBy = [ "default.target" ];
|
|
||||||
script = ''
|
|
||||||
sleep 5
|
|
||||||
systemctl restart syncthing
|
|
||||||
systemctl restart radicale
|
|
||||||
systemctl restart gitea
|
|
||||||
'';
|
|
||||||
serviceConfig.Type = "oneshot";
|
|
||||||
requires = [ "sata-hat.service" ];
|
|
||||||
after = [ "vault.mount" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Idle HDDs when not used
|
|
||||||
systemd.services.hd-idle = {
|
|
||||||
description = "Idle HDDs when not in use";
|
|
||||||
wantedBy = [ "default.target" ];
|
|
||||||
path = with pkgs; [ hd-idle ];
|
|
||||||
script = "${pkgs.hd-idle}/bin/hd-idle";
|
|
||||||
serviceConfig.Type = "simple";
|
|
||||||
requires = [ "sata-hat.service" ];
|
|
||||||
after = [ "vault.mount" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Push zion changes to git daily
|
# Push zion changes to git daily
|
||||||
systemd.user.services.zion-push = {
|
systemd.user.services.zion-push = {
|
||||||
description = "Push zion changes to git";
|
description = "Push zion changes to git";
|
||||||
|
|||||||
@@ -1,54 +1,69 @@
|
|||||||
# Web services configuration
|
# Web services configuration
|
||||||
{ config, pkgs, lib, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
# Reverse proxy configuration
|
# Reverse proxy configuration
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
recommendedTlsSettings = true;
|
recommendedTlsSettings = true;
|
||||||
recommendedGzipSettings = true;
|
recommendedBrotliSettings = true;
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
recommendedOptimisation = true;
|
recommendedOptimisation = true;
|
||||||
clientMaxBodySize = "0";
|
clientMaxBodySize = "0";
|
||||||
sslCiphers =
|
sslCiphers = "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK:!AES128";
|
||||||
"ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK:!AES128";
|
|
||||||
sslProtocols = "TLSv1.2 TLSv1.3";
|
sslProtocols = "TLSv1.2 TLSv1.3";
|
||||||
sslDhparam = "/var/lib/dhparams/nginx.pem";
|
sslDhparam = "/var/lib/dhparams/nginx.pem";
|
||||||
commonHttpConfig = ''
|
commonHttpConfig = ''
|
||||||
# Add HSTS header with preloading to HTTPS requests.
|
# Add HSTS header with preloading to HTTPS requests.
|
||||||
# Adding this header to HTTP requests is discouraged
|
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
|
||||||
map $scheme $hsts_header {
|
|
||||||
https "max-age=31536000; includeSubdomains; preload";
|
|
||||||
}
|
|
||||||
add_header Strict-Transport-Security $hsts_header;
|
|
||||||
|
|
||||||
# Minimize information leaked to other domains
|
# Minimize information leaked to other domains
|
||||||
add_header 'Referrer-Policy' 'origin-when-cross-origin';
|
add_header 'Referrer-Policy' 'strict-origin-when-cross-origin';
|
||||||
|
|
||||||
# Disable embedding as a frame, except from the same origin
|
|
||||||
add_header Content-Security-Policy "frame-src git.coolneng.duckdns.org; frame-ancestors git.coolneng.duckdns.org";
|
|
||||||
|
|
||||||
# Prevent injection of code in other mime types (XSS Attacks)
|
# Prevent injection of code in other mime types (XSS Attacks)
|
||||||
add_header X-Content-Type-Options nosniff;
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Frame-Options SAMEORIGIN;
|
||||||
|
|
||||||
# This might create errors
|
# This might create errors
|
||||||
proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
|
proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
|
||||||
'';
|
'';
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
|
# Old domain being redirected
|
||||||
"coolneng.duckdns.org" = {
|
"coolneng.duckdns.org" = {
|
||||||
enableACME = true;
|
useACMEHost = "coolneng.duckdns.org";
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
# Redirect from legacy subdirectory URL to subdomain
|
|
||||||
locations = {
|
locations = {
|
||||||
"/radicale/".return = "301 https://radicale.coolneng.duckdns.org";
|
"/".return = "301 https://psydnd.org$request_uri";
|
||||||
"/syncthing/".return = "301 https://sync.coolneng.duckdns.org";
|
# Delegation for Matrix
|
||||||
"/gitea/".extraConfig =
|
"/.well-known/" = {
|
||||||
"rewrite ^/gitea/(.*)$ https://git.coolneng.duckdns.org/$1 last;";
|
alias = "${../well-known}" + "/";
|
||||||
"/miniflux/".extraConfig =
|
extraConfig = ''
|
||||||
"rewrite ^/miniflux/(.*)$ https://rss.coolneng.duckdns.org/$1 last;";
|
${config.services.nginx.commonHttpConfig}
|
||||||
|
default_type application/json;
|
||||||
|
add_header Access-Control-Allow-Origin * always;
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"radicale.coolneng.duckdns.org" = {
|
# Redirect subdomains
|
||||||
enableACME = true;
|
"~^(?<subdomain>.+)\.coolneng\.duckdns\.org$" = {
|
||||||
|
useACMEHost = "coolneng.duckdns.org";
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/".return = "301 https://$subdomain.psydnd.org$request_uri";
|
||||||
|
};
|
||||||
|
# Current domain
|
||||||
|
"psydnd.org" = {
|
||||||
|
useACMEHost = "psydnd.org";
|
||||||
|
forceSSL = true;
|
||||||
|
};
|
||||||
|
"radicale.psydnd.org" = {
|
||||||
|
useACMEHost = "psydnd.org";
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://localhost:5232/";
|
proxyPass = "http://localhost:5232/";
|
||||||
@@ -58,25 +73,33 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"sync.coolneng.duckdns.org" = {
|
"sync.psydnd.org" = {
|
||||||
enableACME = true;
|
useACMEHost = "psydnd.org";
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
locations."/".proxyPass = "http://localhost:8384/";
|
locations."/".proxyPass = "http://localhost:8384/";
|
||||||
};
|
};
|
||||||
"git.coolneng.duckdns.org" = {
|
"git.psydnd.org" = {
|
||||||
enableACME = true;
|
useACMEHost = "psydnd.org";
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
locations."/".proxyPass = "http://localhost:3000/";
|
locations."/" = {
|
||||||
|
proxyPass = "http://localhost:3000/";
|
||||||
|
extraConfig = ''
|
||||||
|
${config.services.nginx.commonHttpConfig}
|
||||||
|
# Disable embedding as a frame, except from the same origin
|
||||||
|
add_header Content-Security-Policy "frame-src git.psydnd.org; frame-ancestors git.psydnd.org";
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
"rss.coolneng.duckdns.org" = {
|
"rss.psydnd.org" = {
|
||||||
enableACME = true;
|
useACMEHost = "psydnd.org";
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
locations."/".proxyPass = "http://localhost:8080/";
|
locations."/".proxyPass = "http://localhost:8080/";
|
||||||
};
|
};
|
||||||
"matrix.coolneng.duckdns.org" = {
|
"matrix.psydnd.org" = {
|
||||||
enableACME = true;
|
useACMEHost = "psydnd.org";
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
listen = [
|
listen = [
|
||||||
|
# IPv4
|
||||||
{
|
{
|
||||||
addr = "0.0.0.0";
|
addr = "0.0.0.0";
|
||||||
port = 8448;
|
port = 8448;
|
||||||
@@ -87,81 +110,106 @@
|
|||||||
port = 443;
|
port = 443;
|
||||||
ssl = true;
|
ssl = true;
|
||||||
}
|
}
|
||||||
|
# IPv6
|
||||||
|
{
|
||||||
|
addr = "[::]";
|
||||||
|
port = 8448;
|
||||||
|
ssl = true;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
addr = "[::]";
|
||||||
|
port = 443;
|
||||||
|
ssl = true;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
locations."/".proxyPass = "http://localhost:8008/";
|
locations."~ ^(/_matrix|/_synapse/client)".proxyPass = "http://localhost:8008";
|
||||||
};
|
};
|
||||||
"element.coolneng.duckdns.org" = {
|
"element.psydnd.org" = {
|
||||||
enableACME = true;
|
useACMEHost = "psydnd.org";
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
locations."/".root = pkgs.element-web.override {
|
locations."/".root = pkgs.element-web.override {
|
||||||
conf.default_server_config."m.homeserver" = {
|
conf.default_server_config = {
|
||||||
"base_url" = "https://matrix.coolneng.duckdns.org";
|
"m.homeserver"."base_url" = "https://matrix.psydnd.org";
|
||||||
"server_name" = "coolneng.duckdns.org";
|
"m.identity_server"."base_url" = "https://vector.im";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"wallabag.coolneng.duckdns.org" = {
|
"books.psydnd.org" = {
|
||||||
enableACME = true;
|
useACMEHost = "psydnd.org";
|
||||||
forceSSL = true;
|
|
||||||
root = "${pkgs.wallabag}/web";
|
|
||||||
locations = {
|
|
||||||
"/".tryFiles = "$uri /app.php$is_args$args";
|
|
||||||
"/assets".root = "${config.environment.variables.WALLABAG_DATA}/web";
|
|
||||||
"~ ^/app.php(/|$)" = {
|
|
||||||
fastcgiParams = {
|
|
||||||
SCRIPT_FILENAME = "${pkgs.wallabag}/web/$fastcgi_script_name";
|
|
||||||
DOCUMENT_ROOT = "${pkgs.wallabag}/web";
|
|
||||||
};
|
|
||||||
extraConfig = ''
|
|
||||||
fastcgi_pass unix:${config.services.phpfpm.pools.wallabag.socket};
|
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
|
||||||
include ${pkgs.nginx}/conf/fastcgi_params;
|
|
||||||
internal;
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"books.coolneng.duckdns.org" = {
|
|
||||||
enableACME = true;
|
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://localhost:9000/";
|
proxyPass = "http://localhost:9000/";
|
||||||
|
proxyWebsockets = true;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "Upgrade";
|
proxy_set_header Connection "Upgrade";
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
"grafana.psydnd.org" = {
|
||||||
|
useACMEHost = "psydnd.org";
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://localhost:9009/";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"podcast.psydnd.org" = {
|
||||||
|
useACMEHost = "psydnd.org";
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/".proxyPass = "http://localhost:9090/";
|
||||||
|
};
|
||||||
|
"bin.psydnd.org" = {
|
||||||
|
useACMEHost = "psydnd.org";
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/".proxyPass = "http://localhost:9091/";
|
||||||
|
};
|
||||||
|
"read.psydnd.org" = {
|
||||||
|
useACMEHost = "psydnd.org";
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/".proxyPass = "http://localhost:9092/";
|
||||||
|
};
|
||||||
|
"photos.psydnd.org" = {
|
||||||
|
useACMEHost = "psydnd.org";
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/".proxyPass = "http://localhost:9191/";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# ACME certs configuration
|
# ACME certs configuration
|
||||||
security.acme = {
|
security.acme = {
|
||||||
acceptTerms = true;
|
acceptTerms = true;
|
||||||
defaults.email = "akasroua@gmail.com";
|
defaults = {
|
||||||
certs."coolneng.duckdns.org".extraDomainNames = [
|
email = "akasroua@disroot.org";
|
||||||
"radicale.coolneng.duckdns.org"
|
group = "nginx";
|
||||||
"sync.coolneng.duckdns.org"
|
};
|
||||||
"git.coolneng.duckdns.org"
|
certs = {
|
||||||
"rss.coolneng.duckdns.org"
|
"coolneng.duckdns.org" = {
|
||||||
"matrix.coolneng.duckdns.org"
|
domain = "*.coolneng.duckdns.org";
|
||||||
"element.coolneng.duckdns.org"
|
dnsProvider = "duckdns";
|
||||||
"wallabag.coolneng.duckdns.org"
|
environmentFile = config.age.secrets.acme-duckdns.path;
|
||||||
"books.coolneng.duckdns.org"
|
};
|
||||||
];
|
"psydnd.org" = {
|
||||||
|
domain = "psydnd.org";
|
||||||
|
extraDomainNames = [ "*.psydnd.org" ];
|
||||||
|
dnsProvider = "porkbun";
|
||||||
|
environmentFile = config.age.secrets.acme-porkbun.path;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Generate dhparams
|
# Generate dhparams
|
||||||
security.dhparams = {
|
security.dhparams = {
|
||||||
enable = true;
|
enable = true;
|
||||||
params.nginx.bits = 2048;
|
defaultBitSize = 4096;
|
||||||
|
params.nginx.bits = 4096;
|
||||||
};
|
};
|
||||||
|
|
||||||
# PostgreSQL databases configuration
|
# PostgreSQL databases configuration
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.postgresql_11;
|
package = pkgs.postgresql_16;
|
||||||
authentication = lib.mkForce ''
|
authentication = lib.mkForce ''
|
||||||
# Generated file; do not edit!
|
# Generated file; do not edit!
|
||||||
# TYPE DATABASE USER ADDRESS METHOD
|
# TYPE DATABASE USER ADDRESS METHOD
|
||||||
@@ -169,6 +217,10 @@
|
|||||||
host all all 127.0.0.1/32 trust
|
host all all 127.0.0.1/32 trust
|
||||||
host all all ::1/128 trust
|
host all all ::1/128 trust
|
||||||
'';
|
'';
|
||||||
|
settings = {
|
||||||
|
max_connections = "300";
|
||||||
|
shared_buffers = "1024MB";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Restart reverse proxy after services startup
|
# Restart reverse proxy after services startup
|
||||||
@@ -177,7 +229,10 @@
|
|||||||
"syncthing.service"
|
"syncthing.service"
|
||||||
"miniflux.service"
|
"miniflux.service"
|
||||||
"radicale.service"
|
"radicale.service"
|
||||||
"matrix-synapse.service"
|
"dendrite.service"
|
||||||
"phpfpm-wallabag.service"
|
"grafana.service"
|
||||||
|
"podman-openbooks.service"
|
||||||
|
"podman-mqtt2prometheus.service"
|
||||||
|
"podman-opodsync.service"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
BASE_PATH=/sys/class
|
|
||||||
GPIO_PATH="$BASE_PATH"/gpio
|
|
||||||
PWM_PATH="$BASE_PATH"/pwm/pwmchip0
|
|
||||||
|
|
||||||
# GPIO pins
|
|
||||||
SATA0=26
|
|
||||||
SATA1=25
|
|
||||||
CPU_FAN=12
|
|
||||||
|
|
||||||
# Values
|
|
||||||
LOW=0
|
|
||||||
HIGH=1
|
|
||||||
|
|
||||||
export_pin() {
|
|
||||||
if [ ! -e $GPIO_PATH/gpio"$1" ]; then
|
|
||||||
echo "$1" >$GPIO_PATH/export
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
unexport_pin() {
|
|
||||||
if [ -e $GPIO_PATH/gpio"$1" ]; then
|
|
||||||
echo "$1" >$GPIO_PATH/unexport
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set_gpio() {
|
|
||||||
export_pin "$1"
|
|
||||||
echo "out" >$GPIO_PATH/gpio"$1"/direction
|
|
||||||
echo "$2" >$GPIO_PATH/gpio"$1"/value
|
|
||||||
if [ "$3" = "clean" ]; then
|
|
||||||
unexport_pin "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
enable_pwm_channel() {
|
|
||||||
echo "$1" >$PWM_PATH/export
|
|
||||||
echo 40000 >$PWM_PATH/pwm"$1"/period
|
|
||||||
echo 30000 >$PWM_PATH/pwm"$1"/duty_cycle
|
|
||||||
echo 1 >$PWM_PATH/pwm"$1"/enable
|
|
||||||
}
|
|
||||||
|
|
||||||
set_pwm() {
|
|
||||||
enable_pwm_channel 1
|
|
||||||
if [ "$1" = "clean" ]; then
|
|
||||||
echo 1 >$PWM_PATH/unexport
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
turn_on() {
|
|
||||||
set_gpio $SATA0 $HIGH
|
|
||||||
sleep 1
|
|
||||||
set_gpio $SATA1 $HIGH
|
|
||||||
set_gpio $CPU_FAN $HIGH
|
|
||||||
set_pwm
|
|
||||||
}
|
|
||||||
|
|
||||||
turn_off() {
|
|
||||||
set_gpio $SATA0 $LOW clean
|
|
||||||
set_gpio $SATA1 $LOW clean
|
|
||||||
set_gpio $CPU_FAN $LOW clean
|
|
||||||
set_pwm clean
|
|
||||||
}
|
|
||||||
|
|
||||||
trap turn_off INT
|
|
||||||
|
|
||||||
if [ "$1" = "on" ]; then
|
|
||||||
turn_on
|
|
||||||
else
|
|
||||||
turn_off
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
66
scripts/install.sh
Executable file
66
scripts/install.sh
Executable file
@@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
partition_disk() {
|
||||||
|
parted "$DISK" -- mklabel gpt
|
||||||
|
parted "$DISK" -- mkpart ESP fat32 1MiB 1025MiB
|
||||||
|
parted "$DISK" -- mkpart linux-swap 1025MiB 17409MiB
|
||||||
|
parted "$DISK" -- mkpart primary 17409MiB 100%
|
||||||
|
parted "$DISK" -- set 1 boot on
|
||||||
|
mkfs.fat -F32 -n BOOT "$DISK"p1
|
||||||
|
mkswap "$DISK"p2
|
||||||
|
swapon "$DISK"p2
|
||||||
|
}
|
||||||
|
|
||||||
|
zfs_setup() {
|
||||||
|
zpool import -f vault
|
||||||
|
zpool create -f -o ashift=12 -o autotrim=on -O acltype=posixacl -O relatime=on \
|
||||||
|
-O xattr=sa -O dnodesize=legacy -O normalization=formD -O mountpoint=none \
|
||||||
|
-O canmount=off -O devices=off -R /mnt -O compression=zstd "$POOL_NAME" "$DISK"p3
|
||||||
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false "$POOL_NAME"/ephemeral
|
||||||
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false "$POOL_NAME"/ephemeral/nix
|
||||||
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false -o sync=disabled -o setuid=off "$POOL_NAME"/ephemeral/tmp
|
||||||
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false "$POOL_NAME"/stateful
|
||||||
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=true "$POOL_NAME"/stateful/home
|
||||||
|
zfs create -o mountpoint=legacy -o com.sun:auto-snapshot=false "$POOL_NAME"/stateful/root
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_datasets() {
|
||||||
|
mount -t zfs sysion/stateful/root /mnt
|
||||||
|
mkdir -p /mnt/boot
|
||||||
|
mount "$DISK"p1 /mnt/boot
|
||||||
|
mkdir -p /mnt/home/coolneng
|
||||||
|
mount -t zfs sysion/stateful/home /mnt/home/coolneng
|
||||||
|
mkdir -p /mnt/nix
|
||||||
|
mount -t zfs sysion/ephemeral/nix /mnt/nix
|
||||||
|
mkdir -p /mnt/tmp
|
||||||
|
mount -t zfs sysion/ephemeral/tmp /mnt/tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
install_system() {
|
||||||
|
nixos-generate-config --root /mnt
|
||||||
|
mv /mnt/etc/nixos/hardware-configuration.nix modules/hardware-configuration.nix
|
||||||
|
nix-shell -p git --command "nixos-install --root /mnt --flake .#zion"
|
||||||
|
}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "Usage: install.sh <disk>"
|
||||||
|
echo "disk: full path to the disk (e.g. /dev/sda)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# != 1 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
DISK="$1"
|
||||||
|
POOL_NAME="sysion"
|
||||||
|
|
||||||
|
echo "Let's start by partitioning the disk"
|
||||||
|
partition_disk
|
||||||
|
echo "Starting up the ZFS machinery"
|
||||||
|
zfs_setup
|
||||||
|
echo "Mounting the horse"
|
||||||
|
mount_datasets
|
||||||
|
echo "Lift off to the NixOS planet"
|
||||||
|
install_system
|
||||||
|
echo "All ready, time to rejoice"
|
||||||
@@ -20,28 +20,31 @@ echo "============================================================
|
|||||||
- System uptime.......: $upDays days $upHours hours $upMins minutes $upSecs seconds
|
- System uptime.......: $upDays days $upHours hours $upMins minutes $upSecs seconds
|
||||||
============================================================"
|
============================================================"
|
||||||
services=(
|
services=(
|
||||||
"syncthing.service"
|
"syncthing.service"
|
||||||
"radicale.service"
|
"radicale.service"
|
||||||
"miniflux.service"
|
"miniflux.service"
|
||||||
"phpfpm-wallabag.service"
|
"gitea.service"
|
||||||
"gitea.service"
|
"dendrite.service"
|
||||||
"matrix-synapse.service"
|
"nginx.service"
|
||||||
"mautrix-telegram.service"
|
"dnsmasq.service"
|
||||||
"nginx.service"
|
"dnscrypt-proxy.service"
|
||||||
"dnsmasq.service"
|
"podman-openbooks.service"
|
||||||
"podman-openbooks.service"
|
"mosquitto.service"
|
||||||
|
"podman-mqtt2prometheus.service"
|
||||||
|
"prometheus.service"
|
||||||
|
"grafana.service"
|
||||||
)
|
)
|
||||||
|
|
||||||
for var in "${services[@]}"; do
|
for var in "${services[@]}"; do
|
||||||
if [[ -z $var ]]; then
|
if [[ -z $var ]]; then
|
||||||
printf "\n"
|
printf "\n"
|
||||||
else
|
else
|
||||||
if systemctl -q is-active "${var}"; then
|
if systemctl -q is-active "${var}"; then
|
||||||
printf "%-40s [\e[32mOK\e[39m]\n" "$var"
|
printf "%-40s [\e[32mOK\e[39m]\n" "$var"
|
||||||
else
|
else
|
||||||
printf "%-40s [\e[31mFAIL\e[39m]\n" "$var"
|
printf "%-40s [\e[31mFAIL\e[39m]\n" "$var"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "============================================================"
|
echo "============================================================"
|
||||||
|
|||||||
BIN
secrets/acme-duckdns.age
Normal file
BIN
secrets/acme-duckdns.age
Normal file
Binary file not shown.
5
secrets/acme-porkbun.age
Normal file
5
secrets/acme-porkbun.age
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 iUaRGg 7JImhL2Wo/eJEwUGP+NhEf36yq5gHO9q1GYhY2HaMAY
|
||||||
|
eAMhD0sqHQS+aayBpOsY8+081i72QAhJCFbBe0//uwU
|
||||||
|
--- 4K8cXsDuWZrmWNJ+rz166ej9o/gLFc7CfJuzAsG0BxA
|
||||||
|
|.<2E><><EFBFBD> f<><66>f<EFBFBD>=<1D>-<2D>X$P<>:
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
age-encryption.org/v1
|
|
||||||
-> ssh-ed25519 iUaRGg mRkPNMBvRfbwb3GjcWWJ42RiJn4wxMdczvL2OJFagkY
|
|
||||||
jCqCSE2MMx74ZvXabmyHfI4jC6lwhtgrTSqjAflUksw
|
|
||||||
-> vH/-grease []_Tx" cZfV JHS /x/
|
|
||||||
SK1DATphyeQv8pjoNXTlQrRKQwn8oItd6xrhSic7fmxzmuKTQiPE
|
|
||||||
--- ObilbWkclfLnmjVql03OamXitnFgYnzfoZ04oq3XO1k
|
|
||||||
<EFBFBD>iy<13>1k{<7B><>OJ3<1F>H<EFBFBD>N<><4E><11><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%y<><1D><><0C><>JA<4A>8<EFBFBD><38>
|
|
||||||
'<27>N<EFBFBD><4E>%<25><><EFBFBD><EFBFBD><EFBFBD>L@<12>6 &<26><>
|
|
||||||
BIN
secrets/dendrite-postgres.age
Normal file
BIN
secrets/dendrite-postgres.age
Normal file
Binary file not shown.
BIN
secrets/dendrite.age
Normal file
BIN
secrets/dendrite.age
Normal file
Binary file not shown.
BIN
secrets/facebook.age
Normal file
BIN
secrets/facebook.age
Normal file
Binary file not shown.
6
secrets/inadyn-duckdns.age
Normal file
6
secrets/inadyn-duckdns.age
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 iUaRGg XMrsd1RQcDq/SpFtqpB4Gj1keCvJsMB+VA58qZirYA4
|
||||||
|
tf8NQzoEYJXlKBjtX4ZplaPQv51RCW9yHulvKZB8c8g
|
||||||
|
--- 5wZntAZCQ4pGYrgDFd63w6Y+Taaatcw5z0tDSvShi30
|
||||||
|
<EFBFBD><EFBFBD>4<EFBFBD><EFBFBD><EFBFBD>Ɖq3<EFBFBD>&
|
||||||
|
><0E>4<EFBFBD><34>J<EFBFBD>?<3F><0F><>QW<51>jZ<:'<<16>x(<28>Y<16>i<EFBFBD>ZDO#<23>w<7F><77>R<EFBFBD><52><EFBFBD>O@2<>cAj (f<><66><EFBFBD><EFBFBD>M<EFBFBD><4D><EFBFBD>
|
||||||
5
secrets/inadyn-porkbun-secret.age
Normal file
5
secrets/inadyn-porkbun-secret.age
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 iUaRGg paS5BxWWicriSLAZyCBKd2xylLAp4/LcHmogO7me8yQ
|
||||||
|
MWW/Pkvn+4G4YeYXY9ZPXC92TbcFXQMyHJ2ltFzXpZs
|
||||||
|
--- ZdFfQ7tHfEo+u/0MmigCNh6OIxkd2bimRN30rMUs1ks
|
||||||
|
<EFBFBD>9<EFBFBD>7Y<EFBFBD>$B<>sX<0E>ʽb<CABD>O'J<><4A>S'<27>5!<21><>UMʯ-v<>m<EFBFBD><6D><EFBFBD><EFBFBD><EFBFBD>8%|R,<2C>~I<><14><>G<EFBFBD><47>VQE<0E>0D<30>:Qv<<1E><>)<29><0B><>%fc<66><63>XZչ 7+yB
|
||||||
BIN
secrets/inadyn-porkbun.age
Normal file
BIN
secrets/inadyn-porkbun.age
Normal file
Binary file not shown.
BIN
secrets/microbin.age
Normal file
BIN
secrets/microbin.age
Normal file
Binary file not shown.
8
secrets/mqtt-receiver.age
Normal file
8
secrets/mqtt-receiver.age
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 iUaRGg JT+as1Cl66qOy5yY3WJNs0bh51DWaCe/+XZLR8m1L0A
|
||||||
|
/6CyRX6Ks7Wr/ySlJhdfkabcy4N5rQ0VzGtlbxL8RCs
|
||||||
|
-> L$l;-grease uU_g`a
|
||||||
|
N00Z5C8AKzdnGZuFUHqY6uZBiMryyT3IXkdNlYW2fVJLOSfkfFdXssIK9hcMObyi
|
||||||
|
sQENGphUf1Sk16Vo9p4emOL5mtzU
|
||||||
|
--- flb9q0/Q608TJ6K9fsGULVwi2Pk860Cz750d5DBSfMM
|
||||||
|
1<EFBFBD>%<25><>=<3D>Lڮ<4C><DAAE>s<EFBFBD>c/<2F>Iy<49><79>oT!<21>ڏ<EFBFBD>&X<0F><><EFBFBD>WՒZ̋<5A><CC8B><0E>8Z<38><5A><EFBFBD><EFBFBD><EFBFBD>æ<19><><EFBFBD><EFBFBD><06> <09><0B>tw<74>'<27><> i<>e<65>_<EFBFBD>}-<2D>V<EFBFBD>$<24>S<EFBFBD><53><EFBFBD><EFBFBD><EFBFBD>خA<D8AE><41><EFBFBD>h<EFBFBD><68><EFBFBD><04><>!<21><>9Z<39><5A><05><>hqіIa<49><61>,
|
||||||
BIN
secrets/mqtt-sender.age
Normal file
BIN
secrets/mqtt-sender.age
Normal file
Binary file not shown.
BIN
secrets/readeck.age
Normal file
BIN
secrets/readeck.age
Normal file
Binary file not shown.
@@ -1,12 +1,25 @@
|
|||||||
let
|
let
|
||||||
zion =
|
zion = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW";
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRqINHR7/zc+c3/PuR+NeSsBHXXzBiEtFWSK6QaxQTW";
|
in
|
||||||
in {
|
{
|
||||||
"wireguard.age".publicKeys = [ zion ];
|
"wireguard.age".publicKeys = [ zion ];
|
||||||
"syncthing.age".publicKeys = [ zion ];
|
"syncthing.age".publicKeys = [ zion ];
|
||||||
"msmtp.age".publicKeys = [ zion ];
|
"msmtp.age".publicKeys = [ zion ];
|
||||||
"gitea.age".publicKeys = [ zion ];
|
"gitea.age".publicKeys = [ zion ];
|
||||||
"ddclient.age".publicKeys = [ zion ];
|
|
||||||
"miniflux.age".publicKeys = [ zion ];
|
"miniflux.age".publicKeys = [ zion ];
|
||||||
"git.age".publicKeys = [ zion ];
|
"git.age".publicKeys = [ zion ];
|
||||||
|
"dendrite.age".publicKeys = [ zion ];
|
||||||
|
"dendrite-postgres.age".publicKeys = [ zion ];
|
||||||
|
"telegram.age".publicKeys = [ zion ];
|
||||||
|
"mqtt-sender.age".publicKeys = [ zion ];
|
||||||
|
"mqtt-receiver.age".publicKeys = [ zion ];
|
||||||
|
"facebook.age".publicKeys = [ zion ];
|
||||||
|
"signal.age".publicKeys = [ zion ];
|
||||||
|
"inadyn-duckdns.age".publicKeys = [ zion ];
|
||||||
|
"inadyn-porkbun.age".publicKeys = [ zion ];
|
||||||
|
"inadyn-porkbun-secret.age".publicKeys = [ zion ];
|
||||||
|
"acme-duckdns.age".publicKeys = [ zion ];
|
||||||
|
"acme-porkbun.age".publicKeys = [ zion ];
|
||||||
|
"microbin.age".publicKeys = [ zion ];
|
||||||
|
"readeck.age".publicKeys = [ zion ];
|
||||||
}
|
}
|
||||||
|
|||||||
8
secrets/signal.age
Normal file
8
secrets/signal.age
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 iUaRGg J/gZDBtDsIzjCzO1y2vXgxl8YuvWJgcpk+8KMOp63kg
|
||||||
|
1XF9JFAIscHWFJMTctZOxVIBYhYliUFays5gwjZt6hs
|
||||||
|
-> vM4\2y\'-grease
|
||||||
|
bj9VKIuH0l1v5X8N2v4p+u3VySDKjj3WAyVZ7f+wmy16wncrNyMtiUZ+ELBWfqXd
|
||||||
|
XOyeGZoKBHwd8lOgkZ+va0BEkBJs9piX
|
||||||
|
--- K2uN9JxuqPQpAxjQ+6dgsqhsq50nTkLsw8QGJprE5hQ
|
||||||
|
H<EFBFBD><EFBFBD><EFBFBD>S<>:<3A>eJ4}'<27><><EFBFBD>T<EFBFBD><54>˦<0B><>[<5B>'<27>M<EFBFBD><4D><EFBFBD>9<><07><>E6_<36><12><><EFBFBD><1D><><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>yPM8''<27>'<15>F<><46><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Rڡ"<22>ݏ<EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>;<3B><>4<EFBFBD>J/>k<1C>5<EFBFBD><<15><>:<3A>M<EFBFBD>lK$<24>ӟq<D39F>S<EFBFBD><53><EFBFBD><EFBFBD>#<23>Ō<04>j<EFBFBD>X)<29><>v<EFBFBD><76><EFBFBD><EFBFBD>Ou<4F><75>J<>P<EFBFBD><12><>~
|
||||||
BIN
secrets/telegram.age
Normal file
BIN
secrets/telegram.age
Normal file
Binary file not shown.
5
secrets/wallabag-postgres.age
Normal file
5
secrets/wallabag-postgres.age
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 iUaRGg zWm4+j3/IRqd3uZqGzXVcHvs+urNrvDMOceWKbpl018
|
||||||
|
HlIKCFYt7n3iKZav5i0YiB4awRMJML0XUowX8sKKH2c
|
||||||
|
--- ysvYVxgK1OeqCk8KdNF+uWsaQ9EzVRku7nw37aUAW3A
|
||||||
|
c<EFBFBD><EFBFBD>b<EFBFBD>W|bU<62>B"<22><04>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><03><>U<EFBFBD>
|
||||||
BIN
secrets/wallabag.age
Normal file
BIN
secrets/wallabag.age
Normal file
Binary file not shown.
5
well-known/matrix/client
Normal file
5
well-known/matrix/client
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"m.homeserver": {
|
||||||
|
"base_url": "https://matrix.psydnd.org"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
well-known/matrix/server
Normal file
1
well-known/matrix/server
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{ "m.server": "matrix.psydnd.org:443" }
|
||||||
Reference in New Issue
Block a user