Skip to content

Commit

Permalink
nixos/calibre-web: customize data directory (#350617)
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas authored Jan 13, 2025
1 parent c023b2d commit e85ca75
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions nixos/modules/services/web-apps/calibre-web.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
'';
};

Expand Down Expand Up @@ -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 ", " (
Expand All @@ -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}
Expand Down

0 comments on commit e85ca75

Please sign in to comment.