diff --git a/nixos/modules/services/web-apps/calibre-web.nix b/nixos/modules/services/web-apps/calibre-web.nix index 0ca9ed2fbcf3b..c0fdbaa234358 100644 --- a/nixos/modules/services/web-apps/calibre-web.nix +++ b/nixos/modules/services/web-apps/calibre-web.nix @@ -32,9 +32,9 @@ in dataDir = mkOption { type = types.str; - default = "calibre-web"; + default = "/var/lib/calibre-web"; description = '' - The directory below {file}`/var/lib` where Calibre-Web stores its data. + The directory where Calibre-Web stores its data. ''; }; @@ -107,9 +107,14 @@ in }; config = mkIf cfg.enable { + systemd.tmpfiles.settings."10-calibre-web".${cfg.dataDir}.d = { + inherit (cfg) user group; + mode = "0700"; + }; + systemd.services.calibre-web = let - appDb = "/var/lib/${cfg.dataDir}/app.db"; - gdriveDb = "/var/lib/${cfg.dataDir}/gdrive.db"; + appDb = "${cfg.dataDir}/app.db"; + gdriveDb = "${cfg.dataDir}/gdrive.db"; calibreWebCmd = "${cfg.package}/bin/calibre-web -p ${appDb} -g ${gdriveDb}"; settings = concatStringsSep ", " ( @@ -134,7 +139,6 @@ in User = cfg.user; Group = cfg.group; - StateDirectory = cfg.dataDir; ExecStartPre = pkgs.writeShellScript "calibre-web-pre-start" ( '' __RUN_MIGRATIONS_AND_EXIT=1 ${calibreWebCmd}