From e309889b0bbe3a7358343151a4d05b71614c2a4b Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 9 Oct 2022 03:51:25 +0000 Subject: [PATCH] replace activationscripts with systemd --- modules/services/jellyfin.nix | 19 ++++++++++++------- modules/services/nextcloud.nix | 3 ++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/services/jellyfin.nix b/modules/services/jellyfin.nix index 33828d9..0f69c85 100644 --- a/modules/services/jellyfin.nix +++ b/modules/services/jellyfin.nix @@ -20,13 +20,18 @@ }]; # Create videos directory, allow anyone in Jellyfin group to manage it - system.activationScripts.jellyfin = let videosDirectory = "/var/videos"; - in { - text = '' - if [ ! -d "${videosDirectory}" ]; then - $DRY_RUN_CMD mkdir --parents $VERBOSE_ARG ${videosDirectory} - $DRY_RUN_CMD chmod 775 $VERBOSE_ARG ${videosDirectory} - fi + systemd.services.videos-library = { + wantedBy = [ "jellyfin.service" ]; + requiredBy = [ "jellyfin.service" ]; + before = [ "jellyfin.service" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + script = let videosDirectory = "/var/videos"; + in '' + mkdir --parents --mode 0755 ${videosDirectory} + chown jellyfin:jellyfin ${videosDirectory} ''; }; diff --git a/modules/services/nextcloud.nix b/modules/services/nextcloud.nix index c9ffa1e..7c8e270 100644 --- a/modules/services/nextcloud.nix +++ b/modules/services/nextcloud.nix @@ -1,6 +1,7 @@ { config, pkgs, lib, ... }: let + adminpassFile = "/var/lib/nextcloud/creds"; backupS3File = "/var/lib/nextcloud/backup-creds"; @@ -147,7 +148,7 @@ in { before = [ "litestream.service" ]; serviceConfig = { Type = "oneshot"; - User = "root"; + RemainAfterExit = true; }; script = '' echo \