Compare commits

...

3 Commits

Author SHA1 Message Date
888fbc3649 proper mountpoint testing 2025-07-10 01:31:52 -07:00
265d5ff5fb disable hdd array (broken) 2025-07-10 00:11:01 -07:00
255a9e3781 update 2025-07-09 18:43:42 -07:00
11 changed files with 46 additions and 32 deletions

View File

@@ -22,7 +22,7 @@
./services/minecraft.nix
./services/wg.nix
./services/qbittorrent.nix
# ./services/qbittorrent.nix
./services/bitmagnet.nix
# ./services/matrix.nix

18
flake.lock generated
View File

@@ -238,11 +238,11 @@
]
},
"locked": {
"lastModified": 1751797776,
"narHash": "sha256-ZAiy7aGC4Q1nstnzEDDfBlAb1AiEHmpKClHuVQUB9II=",
"lastModified": 1752095368,
"narHash": "sha256-U2YJO3uAUkXlOxXPum/3I1XM68/ISozGxAoLvk8YIf8=",
"owner": "ggml-org",
"repo": "llama.cpp",
"rev": "6491d6e4f1caf0ad2221865b4249ae6938a6308c",
"rev": "cb9178f885d1986cc0b12feb26ff426bc8a3556c",
"type": "github"
},
"original": {
@@ -275,11 +275,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1751432711,
"narHash": "sha256-136MeWtckSHTN9Z2WRNRdZ8oRP3vyx3L8UxeBYE+J9w=",
"lastModified": 1752048960,
"narHash": "sha256-gATnkOe37eeVwKKYCsL+OnS2gU4MmLuZFzzWCtaKLI8=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "497ae1357f1ac97f1aea31a4cb74ad0d534ef41f",
"rev": "7ced9122cff2163c6a0212b8d1ec8c33a1660806",
"type": "github"
},
"original": {
@@ -291,11 +291,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1751741127,
"narHash": "sha256-t75Shs76NgxjZSgvvZZ9qOmz5zuBE8buUaYD28BMTxg=",
"lastModified": 1751943650,
"narHash": "sha256-7orTnNqkGGru8Je6Un6mq1T8YVVU/O5kyW4+f9C1mZQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "29e290002bfff26af1db6f64d070698019460302",
"rev": "88983d4b665fb491861005137ce2b11a9f89f203",
"type": "github"
},
"original": {

View File

@@ -135,9 +135,22 @@
};
};
serviceMountDeps = serviceName: dirs: {
serviceMountDeps = serviceName: dirs: pkgs: {
systemd.services."${serviceName}_mounts" = {
unitConfig.Wants = "zfs.target";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart =
let
lib = nixpkgs.lib;
in
"${lib.getExe pkgs.bash} -c \"${lib.getExe pkgs.zfs} get mounted | ${lib.getExe pkgs.gnugrep} yes | ${lib.getExe pkgs.gawk} '{print $1}' | while read i; do ${lib.getExe pkgs.zfs} get mountpoint \$i | ${lib.getExe pkgs.gawk} 'FNR==2 {print \$3}'; done | ${lib.getExe pkgs.gnugrep} '${lib.strings.concatStringsSep "\|" dirs}' | ${pkgs.coreutils}/bin/wc -l | ${lib.getExe pkgs.gnugrep} -q ${toString (lib.length dirs)}\"";
};
};
systemd.services.${serviceName} = {
unitConfig.RequiresMountsFor = dirs;
wants = [ "${serviceName}_mounts.service" ];
};
};
in

View File

@@ -1,4 +1,5 @@
{
pkgs,
config,
service_configs,
username,
@@ -7,7 +8,7 @@
}:
{
imports = [
(serviceMountDeps "gitea" [ config.services.gitea.stateDir ])
(serviceMountDeps "gitea" [ config.services.gitea.stateDir ] pkgs)
];
services.gitea = {

View File

@@ -8,8 +8,8 @@
}:
{
imports = [
(serviceMountDeps "immich-server" [ config.services.immich.mediaLocation ])
(serviceMountDeps "immich-machine-learning" [ config.services.immich.mediaLocation ])
(serviceMountDeps "immich-server" [ config.services.immich.mediaLocation ] pkgs)
(serviceMountDeps "immich-machine-learning" [ config.services.immich.mediaLocation ] pkgs)
];
services.immich = {

View File

@@ -12,7 +12,7 @@
(serviceMountDeps "jellyfin" [
config.services.jellyfin.dataDir
config.services.jellyfin.cacheDir
])
] pkgs)
];
services.jellyfin = {

View File

@@ -11,7 +11,7 @@
imports = [
(serviceMountDeps "minecraft-server-${service_configs.minecraft.server_name}" [
"${service_configs.minecraft.parent_dir}/${service_configs.minecraft.server_name}"
])
] pkgs)
];
environment.systemPackages = [

View File

@@ -8,7 +8,7 @@
}:
{
imports = [
(serviceMountDeps "postgresql" [ config.services.postgresql.dataDir ])
(serviceMountDeps "postgresql" [ config.services.postgresql.dataDir ] pkgs)
];
services.postgresql = {

View File

@@ -13,7 +13,7 @@
service_configs.torrents_path
config.services.qbittorrent.serverConfig.Preferences.Downloads.TempPath
"/var/lib/qBittorrent/qBittorrent"
])
] pkgs)
];
# network namespace that is proxied through mullvad

View File

@@ -14,9 +14,9 @@ in
imports = [
(serviceMountDeps "slskd" [
service_configs.slskd.base
service_configs.slskd.downloads
service_configs.slskd.incomplete
])
# service_configs.slskd.downloads
# service_configs.slskd.incomplete
] pkgs)
];
users.groups."music" = { };

20
zfs.nix
View File

@@ -31,7 +31,7 @@ in
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.extraPools = [
service_configs.zpool_ssds
service_configs.zpool_hdds
# service_configs.zpool_hdds
];
services.sanoid = {
@@ -66,15 +66,15 @@ in
yearly = 0;
};
datasets."${service_configs.zpool_hdds}" = {
recursive = true;
autoprune = true;
autosnap = true;
hourly = 0;
daily = 0;
monthly = 0;
yearly = 0;
};
# datasets."${service_configs.zpool_hdds}" = {
# recursive = true;
# autoprune = true;
# autosnap = true;
# hourly = 0;
# daily = 0;
# monthly = 0;
# yearly = 0;
# };
};
services.zfs = {