Compare commits
4 commits
d5f1d2b5c4
...
8d697ab71d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d697ab71d | ||
|
|
3d93bffc31 | ||
|
|
44d649c555 | ||
|
|
522ed5da99 |
11 changed files with 484 additions and 9 deletions
162
drives.nix
Normal file
162
drives.nix
Normal file
|
|
@ -0,0 +1,162 @@
|
||||||
|
{ ... }:
|
||||||
|
let
|
||||||
|
btrfsOpt = [ "compress-force=zstd" "nofail" "x-systemd.mount-timeout=10m" ];
|
||||||
|
btrfsNoComp = [ "nofail" "x-systemd.mount-timeout=10m" ];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
environment.etc.crypttab = {
|
||||||
|
text = ''
|
||||||
|
1EJZN6MZ UUID=da1abbcf-69ef-4bbf-847f-5df0c2a321f9 /var/lib/keyfiles/da1abbcf-69ef-4bbf-847f-5df0c2a321f9 nofail
|
||||||
|
1EKR513Z UUID=9dfd833d-b79f-478b-9c07-e6730f88b02f /var/lib/keyfiles/9dfd833d-b79f-478b-9c07-e6730f88b02f nofail
|
||||||
|
1EKVK21Z UUID=7d1b1146-a50e-405e-8d3e-df0d1fbc9451 /var/lib/keyfiles/7d1b1146-a50e-405e-8d3e-df0d1fbc9451 nofail
|
||||||
|
43P0A00AFJDH UUID=eff697b4-86bc-4a0e-833f-cc40e6aa001e /var/lib/keyfiles/eff697b4-86bc-4a0e-833f-cc40e6aa001e nofail
|
||||||
|
43P0A00FFJDH UUID=69dc9bb1-f180-43f1-9f98-48ca592278bf /var/lib/keyfiles/69dc9bb1-f180-43f1-9f98-48ca592278bf nofail
|
||||||
|
53F0A0SBFJDH UUID=d228e44f-fe1f-4eee-8415-289583ddec99 /var/lib/keyfiles/d228e44f-fe1f-4eee-8415-289583ddec99 nofail
|
||||||
|
53G0A2AXFJDH UUID=dd66940c-aa6e-460a-9e55-7dd08247a792 /var/lib/keyfiles/dd66940c-aa6e-460a-9e55-7dd08247a792 nofail
|
||||||
|
53J0A016FJDH UUID=95f84b21-d3d3-4241-8a9b-5ac46afea1e1 /var/lib/keyfiles/95f84b21-d3d3-4241-8a9b-5ac46afea1e1 nofail
|
||||||
|
92F0A079FJDH UUID=adf0a919-3ff2-4508-86af-9bc94573a484 /var/lib/keyfiles/adf0a919-3ff2-4508-86af-9bc94573a484 nofail
|
||||||
|
X2N0A0AXFJDH UUID=7b46d2e3-09da-4ef6-987f-6ffcabf79537 /var/lib/keyfiles/7b46d2e3-09da-4ef6-987f-6ffcabf79537 nofail
|
||||||
|
X2N0A0AZFJDH UUID=db05ac12-2a2b-4baf-8bf0-94a3e5c9ba9e /var/lib/keyfiles/db05ac12-2a2b-4baf-8bf0-94a3e5c9ba9e nofail
|
||||||
|
ZA1D9307 UUID=79f2d993-6862-4f9c-ba2d-88f49286e356 /var/lib/keyfiles/79f2d993-6862-4f9c-ba2d-88f49286e356 nofail
|
||||||
|
ZVV0688G UUID=8a14aa76-5138-4cd0-8f31-0aafe63e870b /var/lib/keyfiles/8a14aa76-5138-4cd0-8f31-0aafe63e870b nofail
|
||||||
|
ZVV072JR UUID=416f1016-b849-4bc8-a078-4b1426788c6c /var/lib/keyfiles/416f1016-b849-4bc8-a078-4b1426788c6c nofail
|
||||||
|
ZXA0FSKT UUID=4f1e92cc-1267-4671-b943-99481ea2a7b5 /var/lib/keyfiles/4f1e92cc-1267-4671-b943-99481ea2a7b5 nofail
|
||||||
|
ZXA0MNRB UUID=64161475-e328-4a59-98d5-117d724693cf /var/lib/keyfiles/64161475-e328-4a59-98d5-117d724693cf nofail
|
||||||
|
'';
|
||||||
|
#unused
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems = {
|
||||||
|
"/" = {
|
||||||
|
device = "/dev/disk/by-uuid/ad716602-9e0d-4c07-9fb5-e15cb6df3004";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
"/boot/efi" = {
|
||||||
|
device = "/dev/disk/by-uuid/2427-55B1";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [ "fmask=0022" "dmask=0022" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/1EJZN6MZ" = {
|
||||||
|
label = "1EJZN6MZ";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/1EKR513Z" = {
|
||||||
|
label = "1EKR513Z";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/1EKVK21Z" = {
|
||||||
|
label = "1EKVK21Z";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
#"/mnt/drives/53F0A0SBFJDH" = {
|
||||||
|
# label = "53F0A0SBFJDH";
|
||||||
|
# fsType = "btrfs";
|
||||||
|
# options = btrfsOpt;
|
||||||
|
#};
|
||||||
|
|
||||||
|
"/mnt/drives/53G0A2AXFJDH" = {
|
||||||
|
label = "53G0A2AXFJDH";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/53J0A016FJDH" = {
|
||||||
|
label = "53J0A016FJDH";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/92F0A079FJDH" = {
|
||||||
|
label = "92F0A079FJDH";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/43P0A00FFJDH" = {
|
||||||
|
label = "43P0A00FFJDH";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/43P0A00AFJDH" = {
|
||||||
|
label = "43P0A00AFJDH";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsNoComp;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/X2N0A0AXFJDH" = {
|
||||||
|
label = "X2N0A0AXFJDH";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/X2N0A0AZFJDH" = {
|
||||||
|
label = "X2N0A0AZFJDH";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/ZA1D9307" = {
|
||||||
|
label = "ZA1D9307";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/ZVV0688G" = {
|
||||||
|
label = "ZVV0688G";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/ZVV072JR" = {
|
||||||
|
label = "ZVV072JR";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/ZXA0FSKT" = {
|
||||||
|
label = "ZXA0FSKT-lv0";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsOpt;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/drives/ZXA0MNRB" = {
|
||||||
|
label = "ZXA0MNRB-lv0";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = btrfsNoComp;
|
||||||
|
};
|
||||||
|
|
||||||
|
"/mnt/mergerfs" = {
|
||||||
|
device = "/mnt/drives/ZVV0688G:/mnt/drives/ZVV072JR:/mnt/drives/ZXA0FSKT:/mnt/drives/X2N0A0AZFJDH:/mnt/drives/53G0A2AXFJDH:/mnt/drives/53J0A016FJDH:/mnt/drives/X2N0A0AXFJDH:/mnt/drives/43P0A00FFJDH:/mnt/drives/ZA1D9307:/mnt/drives/1EJZN6MZ:/mnt/drives/1EKR513Z:/mnt/drives/1EKVK21Z";
|
||||||
|
fsType = "fuse.mergerfs";
|
||||||
|
options = [ "cache.files=full,,dropcacheonclose=true,category.create=mfs" "nofail" ];
|
||||||
|
depends = [ "/mnt/drives/ZVV0688G" "/mnt/drives/ZVV072JR" "/mnt/drives/X2N0A0AZFJDH" "/mnt/drives/53G0A2AXFJDH" "/mnt/drives/53J0A016FJDH" "/mnt/drives/X2N0A0AXFJDH" "/mnt/drives/43P0A00FFJDH" "/mnt/drives/ZA1D9307" "/mnt/drives/1EJZN6MZ" "/mnt/drives/1EKR513Z" "/mnt/drives/1EKVK21Z" "/mnt/drives/ZXA0FSKT" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
#"/mnt/box" = {
|
||||||
|
# device = "seedbox:";
|
||||||
|
# fsType = "fuse.rclone";
|
||||||
|
# options = [ "user_id=1000" "group_id=100" ];
|
||||||
|
#};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nfs.server = {
|
||||||
|
enable = true;
|
||||||
|
exports = ''
|
||||||
|
/mnt/mergerfs 100.64.0.13(no_subtree_check,fsid=0)
|
||||||
|
/mnt/mergerfs 100.64.0.7(no_subtree_check,fsid=0)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
# vim: set et ts=2 sw=2 ai:
|
||||||
82
modules/arrstack/calibre.nix
Normal file
82
modules/arrstack/calibre.nix
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = import /etc/nixos/modules/vars.nix;
|
||||||
|
name = "calibre-web-automated";
|
||||||
|
#dbport = cfg.XXX.dbport;
|
||||||
|
#db_host = cfg.podman.hostIP;
|
||||||
|
port = cfg.calibre.port;
|
||||||
|
#domain = cfg.XXX.domain;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
#./podman.nix
|
||||||
|
#./podman-postgresql.nix # for the database
|
||||||
|
#./nginx.nix # for the webserver
|
||||||
|
];
|
||||||
|
|
||||||
|
#sops.secrets."${name}/db" = {};
|
||||||
|
sops.secrets."calibre/env" = {};
|
||||||
|
|
||||||
|
#services.podman-postgresql."${name}" = {
|
||||||
|
# enable = true;
|
||||||
|
# image = "docker.io/library/postgres:16-alpine";
|
||||||
|
# port = (lib.strings.toInt dbport);
|
||||||
|
# passwordFile = config.sops.secrets."${name}/db".path;
|
||||||
|
#};
|
||||||
|
|
||||||
|
virtualisation.oci-containers.containers."${name}" = {
|
||||||
|
image = "docker.io/crocodilestick/calibre-web-automated";
|
||||||
|
environment = {
|
||||||
|
TZ = "Europe/Berlin";
|
||||||
|
PUID = toString config.users.users.arr.uid;
|
||||||
|
PGID = toString config.users.groups.arr.gid;
|
||||||
|
};
|
||||||
|
#environmentFiles = [ config.sops.secrets."calibre/env".path ];
|
||||||
|
ports = [
|
||||||
|
"${port}:${port}"
|
||||||
|
];
|
||||||
|
volumes = [
|
||||||
|
"/var/lib/${name}:/config"
|
||||||
|
"/mnt/cache/calibre:/cwa-book-ingest"
|
||||||
|
"/mnt/mergerfs/media/calibre:/calibre-library"
|
||||||
|
];
|
||||||
|
extraOptions = cfg.podman.extraOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.oci-containers.containers.calibre-book-downloader = {
|
||||||
|
image = "ghcr.io/calibrain/calibre-web-automated-book-downloader";
|
||||||
|
environment = {
|
||||||
|
TZ = "Europe/Berlin";
|
||||||
|
UID = toString config.users.users.arr.uid;
|
||||||
|
GID = toString config.users.groups.arr.gid;
|
||||||
|
FLASK_PORT = "8084";
|
||||||
|
APP_ENV = "prod";
|
||||||
|
SUPPORTED_FORMATS = "pdf,epub,mobi,azw3,fb2,djvu,cbz,cbr";
|
||||||
|
};
|
||||||
|
#environmentFiles = [ config.sops.secrets."calibre/env".path ];
|
||||||
|
ports = [
|
||||||
|
"8084:8084"
|
||||||
|
];
|
||||||
|
volumes = [
|
||||||
|
#"/var/lib/${name}:/config"
|
||||||
|
"/mnt/cache/calibre:/cwa-book-ingest"
|
||||||
|
#"/mnt/mergerfs/media/calibre:/calibre-library"
|
||||||
|
];
|
||||||
|
extraOptions = cfg.podman.extraOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
#services.nginx.virtualHosts.${domain} = {
|
||||||
|
# forceSSL = true;
|
||||||
|
# enableACME = true;
|
||||||
|
# locations."/" = {
|
||||||
|
# proxyPass = "http://localhost:${port}";
|
||||||
|
# proxyWebsockets = true;
|
||||||
|
# };
|
||||||
|
# extraConfig = ''
|
||||||
|
# access_log /var/log/nginx/${domain}_access.log;
|
||||||
|
# error_log /var/log/nginx/${domain}_error.log;
|
||||||
|
# '';
|
||||||
|
#};
|
||||||
|
|
||||||
|
}
|
||||||
|
# vim: set et ts=2 sw=2 ai:
|
||||||
|
|
@ -64,9 +64,11 @@ in
|
||||||
/etc/nixos/modules/nginx.nix
|
/etc/nixos/modules/nginx.nix
|
||||||
./autobrr.nix
|
./autobrr.nix
|
||||||
./bazarr.nix
|
./bazarr.nix
|
||||||
|
./calibre.nix
|
||||||
./crossseed.nix
|
./crossseed.nix
|
||||||
./lidarr.nix
|
|
||||||
./jellyseerr.nix
|
./jellyseerr.nix
|
||||||
|
./lidarr.nix
|
||||||
|
./mediathekarr.nix
|
||||||
./prowlarr.nix
|
./prowlarr.nix
|
||||||
./qbittorrent.nix
|
./qbittorrent.nix
|
||||||
./radarr.nix
|
./radarr.nix
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ in
|
||||||
"/var/lib/lidarr-extended/custom-cont-init.d:/custom-cont-init.d"
|
"/var/lib/lidarr-extended/custom-cont-init.d:/custom-cont-init.d"
|
||||||
"/var/lib/lidarr-extended/custom-services.d:/custom-services.d"
|
"/var/lib/lidarr-extended/custom-services.d:/custom-services.d"
|
||||||
"/mnt/mergerfs/media:/data"
|
"/mnt/mergerfs/media:/data"
|
||||||
"/mnt/ultracc/downloads:/mnt/ultracc"
|
#"/mnt/ultracc/downloads:/mnt/ultracc"
|
||||||
];
|
];
|
||||||
extraOptions = cfg.podman.extraOptions;
|
extraOptions = cfg.podman.extraOptions;
|
||||||
autoStart = false;
|
autoStart = false;
|
||||||
|
|
|
||||||
50
modules/arrstack/mediathekarr.nix
Normal file
50
modules/arrstack/mediathekarr.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = import /etc/nixos/modules/vars.nix;
|
||||||
|
name = "mediathekarr";
|
||||||
|
port = "5007";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
#./podman.nix
|
||||||
|
#./podman-postgresql.nix # for the database
|
||||||
|
#./nginx.nix # for the webserver
|
||||||
|
];
|
||||||
|
|
||||||
|
#sops.secrets."${name}/db" = {};
|
||||||
|
#sops.secrets."${name}/env" = {};
|
||||||
|
|
||||||
|
virtualisation.oci-containers.containers.${name} = {
|
||||||
|
image = "docker.io/pcjones/mediathekarr:beta";
|
||||||
|
environment = {
|
||||||
|
PUID = toString config.users.users.arr.uid;
|
||||||
|
PGID = toString config.users.groups.arr.gid;
|
||||||
|
TZ = "Europe/Berlin";
|
||||||
|
};
|
||||||
|
#environmentFiles = [ config.sops.secrets."${name}/env".path ];
|
||||||
|
ports = [
|
||||||
|
"${port}:${port}"
|
||||||
|
];
|
||||||
|
volumes = [
|
||||||
|
"/var/lib/${name}:/app/config"
|
||||||
|
"/mnt/mergerfs/media/mediathek:/data/mediathek"
|
||||||
|
];
|
||||||
|
extraOptions = cfg.podman.extraOptions;
|
||||||
|
autoStart = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
#services.nginx.virtualHosts.${domain} = {
|
||||||
|
# forceSSL = true;
|
||||||
|
# enableACME = true;
|
||||||
|
# locations."/" = {
|
||||||
|
# proxyPass = "http://localhost:${port}";
|
||||||
|
# proxyWebsockets = true;
|
||||||
|
# };
|
||||||
|
# extraConfig = ''
|
||||||
|
# access_log /var/log/nginx/${domain}_access.log;
|
||||||
|
# error_log /var/log/nginx/${domain}_error.log;
|
||||||
|
# '';
|
||||||
|
#};
|
||||||
|
|
||||||
|
}
|
||||||
|
# vim: set et ts=2 sw=2 ai:
|
||||||
|
|
@ -7,8 +7,11 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
||||||
|
boot.kernelModules = [ "iptable_filter" ]; # needed for the container
|
||||||
|
|
||||||
virtualisation.oci-containers.containers.qbittorrent = {
|
virtualisation.oci-containers.containers.qbittorrent = {
|
||||||
image = "docker.io/binhex/arch-qbittorrentvpn";
|
#image = "docker.io/binhex/arch-qbittorrentvpn:5.1.1-1-01";
|
||||||
|
image = "docker.io/binhex/arch-qbittorrentvpn:latest";
|
||||||
environment = {
|
environment = {
|
||||||
TZ = "Europe/Berlin";
|
TZ = "Europe/Berlin";
|
||||||
PUID = toString config.users.users.arr.uid;
|
PUID = toString config.users.users.arr.uid;
|
||||||
|
|
@ -30,7 +33,7 @@ in
|
||||||
"/mnt/cache/qbittorrent:/cache"
|
"/mnt/cache/qbittorrent:/cache"
|
||||||
];
|
];
|
||||||
#extraOptions = cfg.podman.extraOptions ++ [ "--cap-add=NET_ADMIN,NET_RAW" "--device=/dev/net/tun" ];
|
#extraOptions = cfg.podman.extraOptions ++ [ "--cap-add=NET_ADMIN,NET_RAW" "--device=/dev/net/tun" ];
|
||||||
extraOptions = cfg.podman.extraOptions ++ [ ''--sysctl="net.ipv4.conf.all.src_valid_mark=1"'' "--privileged=true" "--ip=10.88.13.37" ];
|
extraOptions = cfg.podman.extraOptions ++ [ ''--sysctl="net.ipv4.conf.all.src_valid_mark=1"'' "--privileged=true" "--ip=10.88.13.37" "--cap-add=NET_ADMIN,NET_RAW" ];
|
||||||
autoStart = false;
|
autoStart = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ in
|
||||||
volumes = [
|
volumes = [
|
||||||
"/var/lib/radarr:/config"
|
"/var/lib/radarr:/config"
|
||||||
"/mnt/mergerfs/media:/data"
|
"/mnt/mergerfs/media:/data"
|
||||||
"/mnt/ultracc/downloads:/mnt/ultracc"
|
#"/mnt/ultracc/downloads:/mnt/ultracc"
|
||||||
];
|
];
|
||||||
extraOptions = cfg.podman.extraOptions;
|
extraOptions = cfg.podman.extraOptions;
|
||||||
autoStart = false;
|
autoStart = false;
|
||||||
|
|
@ -60,6 +60,11 @@ in
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
access_log /var/log/nginx/radarr.${domain}_access.log;
|
access_log /var/log/nginx/radarr.${domain}_access.log;
|
||||||
error_log /var/log/nginx/radarr.${domain}_error.log;
|
error_log /var/log/nginx/radarr.${domain}_error.log;
|
||||||
|
send_timeout 100m;
|
||||||
|
proxy_connect_timeout 600;
|
||||||
|
proxy_send_timeout 600;
|
||||||
|
proxy_read_timeout 30m;
|
||||||
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ in
|
||||||
volumes = [
|
volumes = [
|
||||||
"/var/lib/sonarr:/config"
|
"/var/lib/sonarr:/config"
|
||||||
"/mnt/mergerfs/media:/data"
|
"/mnt/mergerfs/media:/data"
|
||||||
"/mnt/ultracc/downloads:/mnt/ultracc"
|
#"/mnt/ultracc/downloads:/mnt/ultracc"
|
||||||
];
|
];
|
||||||
extraOptions = cfg.podman.extraOptions;
|
extraOptions = cfg.podman.extraOptions;
|
||||||
autoStart = false;
|
autoStart = false;
|
||||||
|
|
@ -57,6 +57,10 @@ in
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
access_log /var/log/nginx/sonarr.${domain}_access.log;
|
access_log /var/log/nginx/sonarr.${domain}_access.log;
|
||||||
error_log /var/log/nginx/sonarr.${domain}_error.log;
|
error_log /var/log/nginx/sonarr.${domain}_error.log;
|
||||||
|
send_timeout 100m;
|
||||||
|
proxy_connect_timeout 600;
|
||||||
|
proxy_send_timeout 600;
|
||||||
|
proxy_read_timeout 30m;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ in
|
||||||
volumes = [
|
volumes = [
|
||||||
"/var/lib/whisparr:/config"
|
"/var/lib/whisparr:/config"
|
||||||
"/mnt/mergerfs/media:/data"
|
"/mnt/mergerfs/media:/data"
|
||||||
"/mnt/ultracc/downloads:/mnt/ultracc"
|
#"/mnt/ultracc/downloads:/mnt/ultracc"
|
||||||
];
|
];
|
||||||
extraOptions = cfg.podman.extraOptions;
|
extraOptions = cfg.podman.extraOptions;
|
||||||
autoStart = false;
|
autoStart = false;
|
||||||
|
|
|
||||||
32
scripts/snapraid_snapshots.sh
Executable file
32
scripts/snapraid_snapshots.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
day="$(date -I)"
|
||||||
|
drivelist="$(grep -F "data d" /etc/snapraid.conf | grep -Po "(?<=/mnt/snapshot/)[[:alnum:]]*")"
|
||||||
|
param=$1
|
||||||
|
|
||||||
|
function create {
|
||||||
|
echo "$drivelist" | while IFS="" read -r serial; do
|
||||||
|
drive="/mnt/drives/${serial}"
|
||||||
|
if [[ ! -s "${drive}/snapraid?.parity" ]]; then
|
||||||
|
if [[ ! -d "${drive}/.snapshot/${day}" ]]; then
|
||||||
|
btrfs subvolume snapshot -r "$drive" "${drive}/.snapshot/${day}"
|
||||||
|
ln -nsfr "${drive}/.snapshot/${day}" "/mnt/snapshot/${serial}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete {
|
||||||
|
echo "$drivelist" | while IFS="" read -r serial; do
|
||||||
|
drive="/mnt/drives/${serial}"
|
||||||
|
snapshots="$(ls -1 -d "${drive}/.snapshot/"* | head -n -1)"
|
||||||
|
echo "$snapshots" | while IFS="" read -r snap; do
|
||||||
|
btrfs subvolume delete "$snap"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "$param" == "create" ]]; then
|
||||||
|
create
|
||||||
|
elif [[ "$param" == "delete" ]]; then
|
||||||
|
delete
|
||||||
|
fi
|
||||||
135
snapraid.nix
Normal file
135
snapraid.nix
Normal file
|
|
@ -0,0 +1,135 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
excludes = [
|
||||||
|
"/media/usenet/incomplete/"
|
||||||
|
"/.snapshot/"
|
||||||
|
];
|
||||||
|
snapshot-path = [
|
||||||
|
pkgs.bash
|
||||||
|
pkgs.btrfs-progs
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
#systemd.timers."snapraid-sync".enable = false; #temporarily
|
||||||
|
#systemd.timers."snapraid-scrub".enable = false; #temporarily
|
||||||
|
|
||||||
|
systemd.services."snapraid-sync" = {
|
||||||
|
serviceConfig = {
|
||||||
|
ReadWritePaths = [
|
||||||
|
"/mnt/snapshot/ZVV0688G/.snapshot/"
|
||||||
|
"/mnt/snapshot/ZVV072JR/.snapshot/"
|
||||||
|
"/mnt/snapshot/ZXA0FSKT/.snapshot/"
|
||||||
|
"/mnt/snapshot/X2N0A0AZFJDH/.snapshot/"
|
||||||
|
"/mnt/snapshot/53G0A2AXFJDH/.snapshot/"
|
||||||
|
"/mnt/snapshot/92F0A079FJDH/.snapshot/"
|
||||||
|
"/mnt/snapshot/X2N0A0AXFJDH/.snapshot/"
|
||||||
|
"/mnt/snapshot/43P0A00FFJDH/.snapshot/"
|
||||||
|
"/mnt/snapshot/ZA1D9307/.snapshot/"
|
||||||
|
"/mnt/snapshot/1EJZN6MZ/.snapshot/"
|
||||||
|
"/mnt/snapshot/1EKR513Z/.snapshot/"
|
||||||
|
"/mnt/snapshot/1EKVK21Z/.snapshot/"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
unitConfig.After = "snapraid-pre.service";
|
||||||
|
unitConfig.Before = "snapraid-post.service";
|
||||||
|
wants = [
|
||||||
|
"snapraid-pre.service"
|
||||||
|
"snapraid-post.service"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services = {
|
||||||
|
snapraid-pre = {
|
||||||
|
description = "Create btrfs snapshots for each disk in the array";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "/etc/nixos/scripts/snapraid_snapshots.sh create";
|
||||||
|
};
|
||||||
|
path = snapshot-path;
|
||||||
|
};
|
||||||
|
snapraid-post = {
|
||||||
|
description = "Delete btrfs snapshots for each disk in the array";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "/etc/nixos/scripts/snapraid_snapshots.sh delete";
|
||||||
|
};
|
||||||
|
path = snapshot-path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.snapraid = {
|
||||||
|
enable = true;
|
||||||
|
scrub.plan = 5;
|
||||||
|
touchBeforeSync = false; # doesn't work with snapshots
|
||||||
|
parityFiles = [
|
||||||
|
"/mnt/drives/43P0A00AFJDH/snapraid1.parity"
|
||||||
|
"/mnt/drives/ZXA0MNRB/snapraid2.parity"
|
||||||
|
];
|
||||||
|
dataDisks = {
|
||||||
|
d1 = "/mnt/snapshot/ZVV0688G/";
|
||||||
|
d2 = "/mnt/snapshot/ZVV072JR/";
|
||||||
|
d3 = "/mnt/snapshot/ZXA0FSKT/";
|
||||||
|
d4 = "/mnt/snapshot/X2N0A0AZFJDH/";
|
||||||
|
d5 = "/mnt/snapshot/53G0A2AXFJDH/";
|
||||||
|
d6 = "/mnt/snapshot/92F0A079FJDH/";
|
||||||
|
d7 = "/mnt/snapshot/X2N0A0AXFJDH/";
|
||||||
|
d8 = "/mnt/snapshot/43P0A00FFJDH/";
|
||||||
|
d9 = "/mnt/snapshot/ZA1D9307/";
|
||||||
|
d10 = "/mnt/snapshot/1EJZN6MZ/";
|
||||||
|
d11 = "/mnt/snapshot/1EKR513Z/";
|
||||||
|
d12 = "/mnt/snapshot/1EKVK21Z/";
|
||||||
|
};
|
||||||
|
contentFiles = [
|
||||||
|
"/mnt/snapraid1.content"
|
||||||
|
"/mnt/drives/43P0A00AFJDH/snapraid2.content"
|
||||||
|
"/mnt/drives/ZXA0MNRB/snapraid3.content"
|
||||||
|
];
|
||||||
|
exclude = excludes;
|
||||||
|
};
|
||||||
|
|
||||||
|
#imports = [ ./modules/snapraid.nix ];
|
||||||
|
|
||||||
|
#services.snapraidnew = {
|
||||||
|
# "8tb" = {
|
||||||
|
# arrayName = "8tb";
|
||||||
|
# enable = true;
|
||||||
|
# scrub.plan = 5;
|
||||||
|
# parityFiles = [
|
||||||
|
# "/mnt/drives/ZA1D9307/snapraid-8tb.parity"
|
||||||
|
# ];
|
||||||
|
# dataDisks = {
|
||||||
|
# d1 = "/mnt/drives/1EJZN6MZ";
|
||||||
|
# d2 = "/mnt/drives/1EKR513Z";
|
||||||
|
# d3 = "/mnt/drives/1EKVK21Z";
|
||||||
|
# };
|
||||||
|
# contentFiles = [
|
||||||
|
# "/mnt/snapraid-8tb1.content"
|
||||||
|
# "/mnt/drives/X2N0A0AZFJDH/snapraid-8tb2.content"
|
||||||
|
# ];
|
||||||
|
# exclude = excludes;
|
||||||
|
# };
|
||||||
|
# "18tb" = {
|
||||||
|
# enable = true;
|
||||||
|
# scrub.plan = 5;
|
||||||
|
# parityFiles = [
|
||||||
|
# "/mnt/drives/X2N0A0AZFJDH/snapraid.parity"
|
||||||
|
# ];
|
||||||
|
# dataDisks = {
|
||||||
|
# d1 = "/mnt/drives/43P0A00AFJDH";
|
||||||
|
# d2 = "/mnt/drives/43P0A00FFJDH";
|
||||||
|
# d3 = "/mnt/drives/92F0A079FJDH";
|
||||||
|
# d4 = "/mnt/drives/X2N0A0AXFJDH";
|
||||||
|
# d5 = "/mnt/drives/53J0A016FJDH";
|
||||||
|
# d6 = "/mnt/drives/ZVV072JR";
|
||||||
|
# d7 = "/mnt/drives/ZVV0688G";
|
||||||
|
# };
|
||||||
|
# contentFiles = [
|
||||||
|
# "/mnt/snapraid-18tb1.content"
|
||||||
|
# "/mnt/drives/ZA1D9307/snapraid-18tb2.content"
|
||||||
|
# ];
|
||||||
|
# exclude = excludes;
|
||||||
|
# };
|
||||||
|
#};
|
||||||
|
|
||||||
|
}
|
||||||
|
# vim: set et ts=2 sw=2 ai:
|
||||||
Loading…
Add table
Reference in a new issue