mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-14 13:39:15 +03:00
nixos/kavita: init
This commit is contained in:
parent
76de0ec750
commit
e2854d332d
3 changed files with 88 additions and 0 deletions
|
@ -70,6 +70,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||||
|
|
||||||
- [opensearch](https://opensearch.org), a search server alternative to Elasticsearch. Available as [services.opensearch](options.html#opt-services.opensearch.enable).
|
- [opensearch](https://opensearch.org), a search server alternative to Elasticsearch. Available as [services.opensearch](options.html#opt-services.opensearch.enable).
|
||||||
|
|
||||||
|
- [kavita](https://kavitareader.com), a self-hosted digital library. Available as [services.kavita](options.html#opt-services.kavita.enable).
|
||||||
|
|
||||||
- [monica](https://www.monicahq.com), an open source personal CRM. Available as [services.monica](options.html#opt-services.monica.enable).
|
- [monica](https://www.monicahq.com), an open source personal CRM. Available as [services.monica](options.html#opt-services.monica.enable).
|
||||||
|
|
||||||
- [authelia](https://www.authelia.com/), is an open-source authentication and authorization server. Available under [services.authelia](options.html#opt-services.authelia.enable).
|
- [authelia](https://www.authelia.com/), is an open-source authentication and authorization server. Available under [services.authelia](options.html#opt-services.authelia.enable).
|
||||||
|
|
|
@ -1184,6 +1184,7 @@
|
||||||
./services/web-apps/jirafeau.nix
|
./services/web-apps/jirafeau.nix
|
||||||
./services/web-apps/jitsi-meet.nix
|
./services/web-apps/jitsi-meet.nix
|
||||||
./services/web-apps/kasmweb/default.nix
|
./services/web-apps/kasmweb/default.nix
|
||||||
|
./services/web-apps/kavita.nix
|
||||||
./services/web-apps/keycloak.nix
|
./services/web-apps/keycloak.nix
|
||||||
./services/web-apps/komga.nix
|
./services/web-apps/komga.nix
|
||||||
./services/web-apps/lemmy.nix
|
./services/web-apps/lemmy.nix
|
||||||
|
|
85
nixos/modules/services/web-apps/kavita.nix
Normal file
85
nixos/modules/services/web-apps/kavita.nix
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.kavita;
|
||||||
|
in {
|
||||||
|
options.services.kavita = {
|
||||||
|
enable = lib.mkEnableOption (lib.mdDoc "Kavita reading server");
|
||||||
|
|
||||||
|
user = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "kavita";
|
||||||
|
description = lib.mdDoc "User account under which Kavita runs.";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = lib.mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
default = pkgs.kavita;
|
||||||
|
defaultText = "pkgs.kavita";
|
||||||
|
description = lib.mdDoc "Kavita package to use.";
|
||||||
|
};
|
||||||
|
|
||||||
|
dataDir = lib.mkOption {
|
||||||
|
default = "/var/lib/kavita";
|
||||||
|
type = lib.types.str;
|
||||||
|
description = lib.mdDoc "The directory where Kavita stores its state.";
|
||||||
|
};
|
||||||
|
|
||||||
|
tokenKeyFile = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
description = lib.mdDoc ''
|
||||||
|
A file containing the TokenKey, a secret with at 128+ bits.
|
||||||
|
It can be generated with `head -c 32 /dev/urandom | base64`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
port = lib.mkOption {
|
||||||
|
default = 5000;
|
||||||
|
type = lib.types.port;
|
||||||
|
description = lib.mdDoc "Port to bind to.";
|
||||||
|
};
|
||||||
|
ipAdresses = lib.mkOption {
|
||||||
|
default = ["0.0.0.0" "::"];
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
description = lib.mdDoc "IP Adresses to bind to. The default is to bind to all IPv4
|
||||||
|
and IPv6 addresses.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.services.kavita = {
|
||||||
|
description = "Kavita";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network.target" ];
|
||||||
|
preStart = ''
|
||||||
|
mkdir -p "${cfg.dataDir}/config"
|
||||||
|
cat > "${cfg.dataDir}/config/appsettings.json" <<EOF
|
||||||
|
{
|
||||||
|
"TokenKey": "$(cat ${cfg.tokenKeyFile})",
|
||||||
|
"Port": ${toString cfg.port},
|
||||||
|
"IpAddresses": "${lib.concatStringsSep "," cfg.ipAdresses}"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
chmod 640 ${cfg.dataDir}/config/appsettings.json
|
||||||
|
'';
|
||||||
|
serviceConfig = {
|
||||||
|
WorkingDirectory = cfg.dataDir;
|
||||||
|
ExecStart = "${lib.getExe cfg.package}";
|
||||||
|
Restart = "always";
|
||||||
|
User = cfg.user;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
users = {
|
||||||
|
users.${cfg.user} = {
|
||||||
|
description = "kavita service user";
|
||||||
|
isSystemUser = true;
|
||||||
|
group = cfg.user;
|
||||||
|
home = cfg.dataDir;
|
||||||
|
createHome = true;
|
||||||
|
};
|
||||||
|
groups.${cfg.user} = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
meta.maintainers = with lib.maintainers; [ misterio77 ];
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue