mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(mediabox): mediatomb
This commit is contained in:
parent
2dfb1d9a4a
commit
59808530ec
3 changed files with 27 additions and 7 deletions
|
|
@ -48,7 +48,7 @@ in {
|
||||||
config.systemd.services.mediatomb = mkIf cfg.enable {
|
config.systemd.services.mediatomb = mkIf cfg.enable {
|
||||||
confinement.enable = mkIf cfg.confine (mkDefault true);
|
confinement.enable = mkIf cfg.confine (mkDefault true);
|
||||||
bindsTo = map (dir: mkIf (dir.mountPoint != null)
|
bindsTo = map (dir: mkIf (dir.mountPoint != null)
|
||||||
"${utils.escapeSystemdPath dir.mountPoint}"
|
"${utils.escapeSystemdPath dir.mountPoint}.mount"
|
||||||
) cfg.mediaDirectories;
|
) cfg.mediaDirectories;
|
||||||
unitConfig.RequiresMountsFor = mkMerge (
|
unitConfig.RequiresMountsFor = mkMerge (
|
||||||
map (dir: dir.paths) cfg.mediaDirectories
|
map (dir: dir.paths) cfg.mediaDirectories
|
||||||
|
|
@ -56,7 +56,7 @@ in {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
RestartSec = mkDefault 15;
|
RestartSec = mkDefault 15;
|
||||||
StateDirectory = mkDefault cfg.package.pname;
|
StateDirectory = mkDefault cfg.package.pname;
|
||||||
BindReadOnlyPaths = mkIf cfg.config (mkMerge (
|
BindReadOnlyPaths = mkIf cfg.confine (mkMerge (
|
||||||
map (dir: dir.paths) cfg.mediaDirectories
|
map (dir: dir.paths) cfg.mediaDirectories
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -37,23 +37,24 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
services.mediatomb.mediaDirectories = let
|
services.mediatomb.mediaDirectories = let
|
||||||
parent = builtins.dirOf cfg.config.download_location;
|
downloadLocation = cfg.config.download_location or (cfg.dataDir + "/Downloads");
|
||||||
hasCompletedSubdir = cfg.config.move_completed && hasPrefix parent cfg.config.move_completed_path;
|
parent = builtins.dirOf downloadLocation;
|
||||||
|
hasCompletedSubdir = cfg.config.move_completed or false && hasPrefix parent cfg.config.move_completed_path;
|
||||||
completedSubdir = removePrefix parent cfg.config.move_completed_path;
|
completedSubdir = removePrefix parent cfg.config.move_completed_path;
|
||||||
downloadDir = if hasCompletedSubdir then {
|
downloadDir = if hasCompletedSubdir then {
|
||||||
path = parent;
|
path = parent;
|
||||||
subdirectories = [
|
subdirectories = [
|
||||||
(builtins.baseNameOf cfg.config.download_location)
|
(builtins.baseNameOf downloadLocation)
|
||||||
completedSubdir
|
completedSubdir
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
path = cfg.config.download_location;
|
path = downloadLocation;
|
||||||
};
|
};
|
||||||
completedDir = {
|
completedDir = {
|
||||||
path = cfg.config.move_completed_path;
|
path = cfg.config.move_completed_path;
|
||||||
};
|
};
|
||||||
in mkIf cfg.enable (mkAfter [
|
in mkIf cfg.enable (mkAfter [
|
||||||
downloadDir
|
downloadDir
|
||||||
(mkIf (cfg.config.move_completed && !hasCompletedSubdir) completedDir)
|
(mkIf (cfg.config.move_completed or false && !hasCompletedSubdir) completedDir)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
nixos.tautulli
|
nixos.tautulli
|
||||||
nixos.ombi
|
nixos.ombi
|
||||||
nixos.deluge
|
nixos.deluge
|
||||||
|
nixos.mediatomb
|
||||||
|
|
||||||
# yarr harr fiddle dee dee >w<
|
# yarr harr fiddle dee dee >w<
|
||||||
nixos.radarr
|
nixos.radarr
|
||||||
|
|
@ -47,6 +48,24 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.mediatomb = {
|
||||||
|
serverName = "tewi";
|
||||||
|
mediaDirectories = [
|
||||||
|
rec {
|
||||||
|
path = "/mnt/Anime";
|
||||||
|
mountPoint = path;
|
||||||
|
}
|
||||||
|
rec {
|
||||||
|
path = "/mnt/Shows";
|
||||||
|
mountPoint = path;
|
||||||
|
}
|
||||||
|
rec {
|
||||||
|
path = "/mnt/Movies";
|
||||||
|
mountPoint = path;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
hardware.opengl = {
|
hardware.opengl = {
|
||||||
enable = true;
|
enable = true;
|
||||||
extraPackages = with pkgs; [ mesa.drivers vaapiVdpau libvdpau-va-gl ];
|
extraPackages = with pkgs; [ mesa.drivers vaapiVdpau libvdpau-va-gl ];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue