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 {
|
||||
confinement.enable = mkIf cfg.confine (mkDefault true);
|
||||
bindsTo = map (dir: mkIf (dir.mountPoint != null)
|
||||
"${utils.escapeSystemdPath dir.mountPoint}"
|
||||
"${utils.escapeSystemdPath dir.mountPoint}.mount"
|
||||
) cfg.mediaDirectories;
|
||||
unitConfig.RequiresMountsFor = mkMerge (
|
||||
map (dir: dir.paths) cfg.mediaDirectories
|
||||
|
|
@ -56,7 +56,7 @@ in {
|
|||
serviceConfig = {
|
||||
RestartSec = mkDefault 15;
|
||||
StateDirectory = mkDefault cfg.package.pname;
|
||||
BindReadOnlyPaths = mkIf cfg.config (mkMerge (
|
||||
BindReadOnlyPaths = mkIf cfg.confine (mkMerge (
|
||||
map (dir: dir.paths) cfg.mediaDirectories
|
||||
));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -37,23 +37,24 @@ in {
|
|||
};
|
||||
|
||||
services.mediatomb.mediaDirectories = let
|
||||
parent = builtins.dirOf cfg.config.download_location;
|
||||
hasCompletedSubdir = cfg.config.move_completed && hasPrefix parent cfg.config.move_completed_path;
|
||||
downloadLocation = cfg.config.download_location or (cfg.dataDir + "/Downloads");
|
||||
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;
|
||||
downloadDir = if hasCompletedSubdir then {
|
||||
path = parent;
|
||||
subdirectories = [
|
||||
(builtins.baseNameOf cfg.config.download_location)
|
||||
(builtins.baseNameOf downloadLocation)
|
||||
completedSubdir
|
||||
];
|
||||
} else {
|
||||
path = cfg.config.download_location;
|
||||
path = downloadLocation;
|
||||
};
|
||||
completedDir = {
|
||||
path = cfg.config.move_completed_path;
|
||||
};
|
||||
in mkIf cfg.enable (mkAfter [
|
||||
downloadDir
|
||||
(mkIf (cfg.config.move_completed && !hasCompletedSubdir) completedDir)
|
||||
(mkIf (cfg.config.move_completed or false && !hasCompletedSubdir) completedDir)
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
nixos.tautulli
|
||||
nixos.ombi
|
||||
nixos.deluge
|
||||
nixos.mediatomb
|
||||
|
||||
# yarr harr fiddle dee dee >w<
|
||||
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 = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [ mesa.drivers vaapiVdpau libvdpau-va-gl ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue