add serviceMountDeps

This commit is contained in:
Simon Gardling 2025-03-22 20:46:55 -04:00
parent 9a45c808fd
commit f3fe629666
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
7 changed files with 46 additions and 0 deletions

View File

@ -112,6 +112,12 @@
data_dir = services_dir + "/owntracks";
};
};
serviceMountDeps = serviceName: dirs: {
systemd.services.${serviceName} = {
unitConfig.RequiresMountsFor = dirs;
};
};
in
{
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
@ -123,6 +129,7 @@
eth_interface
service_configs
inputs
serviceMountDeps
;
};
modules =

View File

@ -2,9 +2,14 @@
config,
service_configs,
username,
serviceMountDeps,
...
}:
{
imports = [
(serviceMountDeps "gitea" [ config.services.gitea.stateDir ])
];
services.gitea = {
enable = true;
appName = "Simon Gardling's Gitea instance";

View File

@ -3,9 +3,14 @@
pkgs,
config,
username,
serviceMountDeps,
...
}:
{
imports = [
(serviceMountDeps "immich" [ config.services.immich.mediaLocation ])
];
services.immich = {
enable = true;
mediaLocation = service_configs.immich.dir;

View File

@ -3,9 +3,17 @@
config,
service_configs,
username,
serviceMountDeps,
...
}:
{
imports = [
(serviceMountDeps "jellyfin" [
config.services.jellyfin.dataDir
config.services.jellyfin.cacheDir
])
];
environment.systemPackages = with pkgs; [
jellyfin
jellyfin-web
@ -37,6 +45,7 @@
"video"
"render"
service_configs.torrent_group
"media"
];
users.users.${username}.extraGroups = [

View File

@ -4,9 +4,16 @@
lib,
username,
config,
serviceMountDeps,
...
}:
{
imports = [
(serviceMountDeps "minecraft-server-${service_configs.minecraft.server_name}" [
"${service_configs.minecraft.parent_dir}/${service_configs.minecraft.server_name}"
])
];
environment.systemPackages = [
(pkgs.writeScriptBin "mc-console" ''
#!/bin/sh

View File

@ -3,9 +3,14 @@
config,
username,
service_configs,
serviceMountDeps,
...
}:
{
imports = [
(serviceMountDeps "postgresql" [ config.services.postgresql.dataDir ])
];
services.postgresql = {
enable = true;
package = pkgs.postgresql_16;

View File

@ -4,9 +4,17 @@
service_configs,
username,
lib,
serviceMountDeps,
...
}:
{
imports = [
(serviceMountDeps "qbittorrent" [
service_configs.torrent.SavePath
service_configs.torrent.TempPath
])
];
# network namespace that is proxied through mullvad
vpnNamespaces.wg = {
portMappings = [