try systemd mount that I found on a blog instead of this way from reddit

This commit is contained in:
Lillian Violet 2024-12-05 14:16:40 +01:00
parent c124fc819a
commit 816a34770c

View file

@ -6,11 +6,7 @@
config, config,
modulesPath, modulesPath,
... ...
}: let }: {
davfsconf = pkgs.writeText "davfs.conf" ''
secrets ${config.sops.secrets."webdav-secret".path}
'';
in {
imports = [ imports = [
# inputs.nixos-hardware.nixosModules.raspberry-pi-4 # inputs.nixos-hardware.nixosModules.raspberry-pi-4
(modulesPath + "/installer/sd-card/sd-image-aarch64.nix") (modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
@ -76,21 +72,27 @@ in {
prowlarr.enable = true; prowlarr.enable = true;
}; };
sops.secrets."webdav-secret".mode = "0600"; sops.secrets."webdav-secret" = {
sops.secrets."webdav-secret".owner = config.users.users.root.name; mode = "0600";
owner = config.users.users.root.name;
services.davfs2.enable = true; path = "/etc/davfs2/secrets";
services.autofs = {
enable = true;
autoMaster = let
mapConf = pkgs.writeText "auto" ''
nextcloud -fstype=davfs,conf=${davfsconf},uid=jellyfinmediaplayer,gid=jellyfinmediaplayer :https\:nextcloud.gladtherescake.eu/remote.php/dav/files/GLaDTheresCake
'';
in ''
/home/jellyfinmediaplayer/ file:${mapConf}
'';
}; };
systemd.mounts = [
{
enable = true;
description = "Webdav mount point";
after = ["network-online.target"];
wants = ["network-online.target"];
what = "https://gladtherescake.eu/remote.php/dav/files/GLaDTheresCake";
where = "/home/jellyfinmediaplayer/nextcloud";
options = "uid=1003,gid=1003,file_mode=0664,dir_mode=2775";
type = "davfs";
mountConfig.TimeoutSec = 15;
}
];
#uses port 8096 #uses port 8096
services.jellyfin.enable = true; services.jellyfin.enable = true;
users.groups.jellyfinmediaplayer = {}; users.groups.jellyfinmediaplayer = {};