2020-04-29 02:50:17 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
2020-12-12 14:44:01 +01:00
|
|
|
# ZFS automatic snapshots
|
|
|
|
services.zfs.autoSnapshot = {
|
2020-04-29 02:50:17 +02:00
|
|
|
enable = true;
|
2020-12-28 19:34:09 +01:00
|
|
|
frequent = 4;
|
2020-12-12 14:44:01 +01:00
|
|
|
hourly = 24;
|
|
|
|
daily = 7;
|
|
|
|
weekly = 4;
|
|
|
|
monthly = 12;
|
2020-04-29 02:50:17 +02:00
|
|
|
};
|
2020-04-30 03:02:54 +02:00
|
|
|
|
|
|
|
# Syncthing configuration
|
|
|
|
services.syncthing = {
|
|
|
|
enable = true;
|
2020-05-09 18:53:22 +02:00
|
|
|
user = "coolneng";
|
2020-04-30 03:02:54 +02:00
|
|
|
dataDir = "/home/coolneng";
|
2021-08-13 11:00:13 +02:00
|
|
|
key = config.age.secrets.syncthing.path;
|
2021-08-04 16:49:51 +02:00
|
|
|
devices.zion = {
|
|
|
|
id = "FLI2RS7-GNI5PDM-SQRNF7P-YJIOXJ7-46FRPEI-NRLQGBC-HXRWG7O-RKOVLAF";
|
2022-01-05 15:03:56 +01:00
|
|
|
addresses = [ "tcp://192.168.1.2:22000" ];
|
2021-08-04 16:49:51 +02:00
|
|
|
};
|
|
|
|
folders = {
|
|
|
|
Documents = {
|
|
|
|
id = "wusdj-bfjkr";
|
|
|
|
path = "/home/coolneng/Documents";
|
|
|
|
devices = [ "zion" ];
|
|
|
|
versioning = {
|
|
|
|
type = "simple";
|
|
|
|
params.keep = "5";
|
2020-06-01 19:39:12 +02:00
|
|
|
};
|
2020-04-30 03:02:54 +02:00
|
|
|
};
|
|
|
|
|
2021-08-04 16:49:51 +02:00
|
|
|
Notes = {
|
|
|
|
id = "kafhz-bfmzm";
|
|
|
|
path = "/home/coolneng/Notes";
|
|
|
|
devices = [ "zion" ];
|
|
|
|
versioning = {
|
|
|
|
type = "simple";
|
|
|
|
params.keep = "5";
|
2020-04-30 03:02:54 +02:00
|
|
|
};
|
2021-08-04 16:49:51 +02:00
|
|
|
};
|
2020-04-30 03:02:54 +02:00
|
|
|
|
2021-08-04 16:49:51 +02:00
|
|
|
Music = {
|
|
|
|
id = "2aqt7-vpprc";
|
|
|
|
path = "/home/coolneng/Music";
|
|
|
|
devices = [ "zion" ];
|
|
|
|
};
|
2020-04-30 03:02:54 +02:00
|
|
|
|
2021-08-04 16:49:51 +02:00
|
|
|
Photos = {
|
|
|
|
id = "mjibc-ustcg";
|
|
|
|
path = "/home/coolneng/Photos";
|
|
|
|
devices = [ "zion" ];
|
|
|
|
};
|
2020-04-30 03:02:54 +02:00
|
|
|
|
2021-08-04 16:49:51 +02:00
|
|
|
Projects = {
|
|
|
|
id = "cjhmu-avy9v";
|
|
|
|
path = "/home/coolneng/Projects";
|
|
|
|
devices = [ "zion" ];
|
|
|
|
};
|
2020-12-22 03:44:56 +01:00
|
|
|
|
2021-08-04 16:49:51 +02:00
|
|
|
Phone = {
|
2021-11-02 21:24:30 +01:00
|
|
|
id = "m2007j20cg_vc7r-photos";
|
2021-08-04 16:49:51 +02:00
|
|
|
type = "receiveonly";
|
|
|
|
path = "/home/coolneng/Photos/Phone";
|
|
|
|
devices = [ "zion" ];
|
|
|
|
};
|
2020-12-22 03:44:56 +01:00
|
|
|
|
2021-08-04 16:49:51 +02:00
|
|
|
Files = {
|
|
|
|
id = "tsk52-u6rbk";
|
|
|
|
path = "/home/coolneng/Files";
|
|
|
|
devices = [ "zion" ];
|
2020-04-30 03:02:54 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-01-27 00:29:15 +01:00
|
|
|
|
2022-02-21 19:05:18 +01:00
|
|
|
# Automount external storage
|
|
|
|
systemd.mounts = [
|
|
|
|
# USB
|
|
|
|
{
|
|
|
|
what = "/dev/sda1";
|
|
|
|
where = "/usb";
|
|
|
|
mountConfig = { TimeoutSec = "5"; };
|
|
|
|
}
|
|
|
|
# SD card
|
|
|
|
{
|
|
|
|
what = "/dev/mmcblk0p1";
|
|
|
|
where = "/sdcard";
|
|
|
|
mountConfig = { TimeoutSec = "5"; };
|
|
|
|
}
|
2022-02-24 12:20:14 +01:00
|
|
|
# UGent Samba
|
|
|
|
{
|
|
|
|
what = "//files.ugent.be/akasroua/home";
|
|
|
|
type = "cifs";
|
|
|
|
where = "/ugent";
|
|
|
|
options =
|
|
|
|
"credentials=${config.age.secrets.samba-ugent.path},noperm,vers=3.0,sec=ntlmv2i";
|
|
|
|
mountConfig = { TimeoutSec = "5"; };
|
|
|
|
}
|
2022-02-21 19:05:18 +01:00
|
|
|
];
|
|
|
|
systemd.automounts = [
|
|
|
|
# USB
|
|
|
|
{
|
|
|
|
where = "/usb";
|
|
|
|
automountConfig = { TimeoutIdleSec = "5"; };
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
}
|
|
|
|
# SD card
|
|
|
|
{
|
|
|
|
where = "/sdcard";
|
|
|
|
automountConfig = { TimeoutIdleSec = "5"; };
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
}
|
2022-02-24 12:20:14 +01:00
|
|
|
# UGent Samba
|
|
|
|
{
|
|
|
|
where = "/ugent";
|
|
|
|
automountConfig = { TimeoutIdleSec = "5"; };
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
}
|
2022-02-21 19:05:18 +01:00
|
|
|
];
|
2022-01-27 00:29:15 +01:00
|
|
|
|
2022-02-24 12:20:14 +01:00
|
|
|
# HACK Workaround to change the configuration of keyutils in order to get CIFS working
|
|
|
|
environment.etc."request-key.conf" = {
|
|
|
|
text = let
|
|
|
|
upcall = "${pkgs.cifs-utils}/bin/cifs.upcall";
|
|
|
|
keyctl = "${pkgs.keyutils}/bin/keyctl";
|
|
|
|
in ''
|
|
|
|
#OP TYPE DESCRIPTION CALLOUT_INFO PROGRAM
|
|
|
|
# -t is required for DFS share servers...
|
|
|
|
create cifs.spnego * * ${upcall} -t %k
|
|
|
|
create dns_resolver * * ${upcall} %k
|
|
|
|
# Everything below this point is essentially the default configuration,
|
|
|
|
# modified minimally to work under NixOS. Notably, it provides debug
|
|
|
|
# logging.
|
|
|
|
create user debug:* negate ${keyctl} negate %k 30 %S
|
|
|
|
create user debug:* rejected ${keyctl} reject %k 30 %c %S
|
|
|
|
create user debug:* expired ${keyctl} reject %k 30 %c %S
|
|
|
|
create user debug:* revoked ${keyctl} reject %k 30 %c %S
|
|
|
|
create user debug:loop:* * |${pkgs.coreutils}/bin/cat
|
|
|
|
create user debug:* * ${pkgs.keyutils}/share/keyutils/request-key-debug.sh %k %d %c %S
|
|
|
|
negate * * * ${keyctl} negate %k 30 %S
|
|
|
|
'';
|
2022-01-27 00:29:15 +01:00
|
|
|
};
|
|
|
|
|
2020-04-29 02:50:17 +02:00
|
|
|
}
|