mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 20:09:07 +01:00
karakeep: Init module
This commit is contained in:
parent
29117dcbb6
commit
9c4b668a49
1 changed files with 62 additions and 0 deletions
62
modules/system/web-services/karakeep.nix
Normal file
62
modules/system/web-services/karakeep.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.custom.web-services.karakeep;
|
||||
in
|
||||
{
|
||||
options.custom.web-services.karakeep = {
|
||||
enable = lib.mkEnableOption "";
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = "";
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 18195;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops = {
|
||||
secrets."karakeep/openai-api-key" = { };
|
||||
templates."karakeep.env" = {
|
||||
content = "OPENAI_API_KEY=${config.sops.placeholder."karakeep/openai-api-key"}";
|
||||
owner = config.users.users.karakeep.name;
|
||||
restartUnits = [ "karakeep-web.service" ];
|
||||
};
|
||||
};
|
||||
|
||||
services.karakeep = {
|
||||
enable = true;
|
||||
environmentFile = config.sops.templates."karakeep.env".path;
|
||||
extraEnvironment = {
|
||||
PORT = toString cfg.port;
|
||||
DISABLE_NEW_RELEASE_CHECK = "true";
|
||||
OCR_LANGS = "eng,deu";
|
||||
};
|
||||
};
|
||||
|
||||
users = {
|
||||
users.meilisearch = {
|
||||
isSystemUser = true;
|
||||
group = config.users.groups.meilisearch.name;
|
||||
};
|
||||
groups.meilisearch = { };
|
||||
};
|
||||
|
||||
systemd.services.meilisearch.serviceConfig = {
|
||||
DynamicUser = lib.mkForce false;
|
||||
User = config.users.users.meilisearch.name;
|
||||
Group = config.users.groups.meilisearch.name;
|
||||
ReadWritePaths = lib.mkForce [ ];
|
||||
};
|
||||
|
||||
custom = {
|
||||
services.caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||
|
||||
persistence.directories = [
|
||||
"/var/lib/karakeep"
|
||||
"/var/lib/meilisearch"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue