mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
refactor(samba): kyuuto
This commit is contained in:
parent
602eda1012
commit
5dcd5a5be0
14 changed files with 379 additions and 125 deletions
|
|
@ -9,13 +9,12 @@
|
|||
inherit (lib.attrsets) mapAttrs mapAttrsToList;
|
||||
inherit (lib.strings) removePrefix;
|
||||
inherit (config.services) deluge plex tautulli ombi sonarr radarr bazarr lidarr readarr prowlarr cloudflared;
|
||||
kyuuto = "/mnt/kyuuto-media";
|
||||
kyuuto-library = kyuuto + "/library";
|
||||
inherit (config) kyuuto;
|
||||
plexLibrary = {
|
||||
"/mnt/Anime".hostPath = kyuuto-library + "/anime";
|
||||
"/mnt/Shows".hostPath = kyuuto-library + "/tv";
|
||||
"/mnt/Movies".hostPath = kyuuto-library + "/movies";
|
||||
"/mnt/Music".hostPath = kyuuto-library + "/music";
|
||||
"/mnt/Anime".hostPath = kyuuto.libraryDir + "/anime";
|
||||
"/mnt/Shows".hostPath = kyuuto.libraryDir + "/tv";
|
||||
"/mnt/Movies".hostPath = kyuuto.libraryDir + "/movies";
|
||||
"/mnt/Music".hostPath = kyuuto.libraryDir + "/music";
|
||||
};
|
||||
in {
|
||||
imports = let
|
||||
|
|
@ -29,6 +28,7 @@ in {
|
|||
./cloudflared.nix
|
||||
|
||||
# media
|
||||
nixos.kyuuto
|
||||
nixos.plex
|
||||
nixos.tautulli
|
||||
nixos.ombi
|
||||
|
|
@ -48,16 +48,16 @@ in {
|
|||
serverName = "tewi";
|
||||
mediaDirectories = let
|
||||
mkLibraryDir = dir: {
|
||||
path = kyuuto-library + "/${dir}";
|
||||
mountPoint = kyuuto-library;
|
||||
path = kyuuto.libraryDir + "/${dir}";
|
||||
mountPoint = kyuuto.libraryDir;
|
||||
};
|
||||
libraryDir = {
|
||||
path = kyuuto-library;
|
||||
mountPoint = kyuuto-library;
|
||||
path = kyuuto.libraryDir;
|
||||
mountPoint = kyuuto.libraryDir;
|
||||
subdirectories =
|
||||
mapAttrsToList (
|
||||
_: {hostPath, ...}:
|
||||
removePrefix "${kyuuto-library}/" hostPath
|
||||
removePrefix "${kyuuto.libraryDir}/" hostPath
|
||||
)
|
||||
plexLibrary
|
||||
++ ["tlmc" "music-raw"];
|
||||
|
|
@ -88,7 +88,7 @@ in {
|
|||
"${deluge.downloadDir}" = mkIf deluge.enable (mkMerge [
|
||||
bind
|
||||
{
|
||||
device = kyuuto + "/downloads/deluge/download";
|
||||
device = kyuuto.mountDir + "/downloads/deluge/download";
|
||||
}
|
||||
]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
kyuuto = "/mnt/kyuuto-media";
|
||||
kyuuto-transfer = kyuuto + "/transfer";
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
inherit (config.networking.access) cidrForNetwork;
|
||||
in {
|
||||
services.nfs.server.exports = let
|
||||
mapPerm = perm: map (addr: "${addr}(${perm})");
|
||||
toPerms = concatStringsSep " ";
|
||||
localAddrs = cidrForNetwork.loopback.all ++ cidrForNetwork.local.all;
|
||||
tailAddrs = optionals config.services.tailscale.enable cidrForNetwork.tail.all;
|
||||
allAddrs = localAddrs ++ tailAddrs;
|
||||
kyuutoPerms =
|
||||
mapPerm "ro" localAddrs
|
||||
++ mapPerm "rw" tailAddrs;
|
||||
transferPerms = mapPerm "rw" allAddrs;
|
||||
in ''
|
||||
${kyuuto} ${toPerms kyuutoPerms}
|
||||
${kyuuto-transfer} ${toPerms transferPerms}
|
||||
'';
|
||||
|
||||
services.samba.shares = {
|
||||
kyuuto-transfer = {
|
||||
path = kyuuto-transfer;
|
||||
writeable = "yes";
|
||||
browseable = "yes";
|
||||
public = "yes";
|
||||
"guest only" = "yes";
|
||||
comment = "Kyuuto Media Transfer Area";
|
||||
};
|
||||
kyuuto-access = {
|
||||
path = kyuuto;
|
||||
writeable = false;
|
||||
browseable = "yes";
|
||||
public = "yes";
|
||||
comment = "Kyuuto Media Access";
|
||||
};
|
||||
kyuuto-media = {
|
||||
path = kyuuto;
|
||||
writeable = "yes";
|
||||
browseable = "yes";
|
||||
public = "no";
|
||||
comment = "Kyuuto Media";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -8,12 +8,16 @@
|
|||
nixos.sops
|
||||
nixos.base
|
||||
nixos.reisen-ct
|
||||
nixos.kyuuto
|
||||
nixos.tailscale
|
||||
nixos.nfs
|
||||
nixos.samba
|
||||
./nfs.nix
|
||||
];
|
||||
|
||||
kyuuto.setup = true;
|
||||
|
||||
proxmoxLXC.privileged = true;
|
||||
|
||||
systemd.network.networks.eth0 = {
|
||||
name = "eth0";
|
||||
matchConfig = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue