2022-10-15 16:40:38 +02:00
|
|
|
# HedgeDoc is an open-source, web-based, self-hosted, collaborative markdown editor.
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.my.services.hedgedoc;
|
|
|
|
domain = config.networking.domain;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.services.hedgedoc = with lib; {
|
2023-03-15 22:38:22 +01:00
|
|
|
enable = mkEnableOption "Hedgedoc Music Server";
|
2022-10-15 16:40:38 +02:00
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = (pkgs.formats.json { }).type;
|
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
"LastFM.ApiKey" = "MYKEY";
|
|
|
|
"LastFM.Secret" = "MYSECRET";
|
|
|
|
"Spotify.ID" = "MYKEY";
|
|
|
|
"Spotify.Secret" = "MYSECRET";
|
|
|
|
};
|
|
|
|
description = ''
|
|
|
|
Additional settings.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = types.port;
|
2022-12-25 12:15:01 +01:00
|
|
|
default = 3080;
|
2022-10-15 16:40:38 +02:00
|
|
|
example = 8080;
|
|
|
|
description = "Internal port for webui";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
services.hedgedoc = {
|
|
|
|
enable = true;
|
|
|
|
|
2022-12-25 12:15:01 +01:00
|
|
|
settings = {
|
2022-10-15 16:40:38 +02:00
|
|
|
domain = "notes.${domain}";
|
2022-12-25 12:15:01 +01:00
|
|
|
inherit (cfg) port;
|
|
|
|
host = "127.0.0.1";
|
2022-10-15 16:40:38 +02:00
|
|
|
protocolUseSSL = true;
|
|
|
|
db = {
|
|
|
|
dialect = "sqlite";
|
2022-12-25 12:15:01 +01:00
|
|
|
storage = "/var/lib/hedgedoc/hedgedoc.sqlite";
|
2022-10-15 16:40:38 +02:00
|
|
|
};
|
2022-12-25 12:15:01 +01:00
|
|
|
} // cfg.settings;
|
2022-10-15 16:40:38 +02:00
|
|
|
};
|
|
|
|
|
2022-12-25 12:15:01 +01:00
|
|
|
# temporary fix for: https://github.com/NixOS/nixpkgs/issues/198250
|
|
|
|
#systemd.services.hedgedoc.serviceConfig.StateDirectory = lib.mkForce "/var/lib/hedgedoc";
|
|
|
|
systemd.services.hedgedoc.serviceConfig.StateDirectory = lib.mkForce "hedgedoc";
|
|
|
|
|
2022-10-15 16:40:38 +02:00
|
|
|
my.services.nginx.virtualHosts = [
|
|
|
|
{
|
|
|
|
subdomain = "notes";
|
|
|
|
inherit (cfg) port;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
webapps.apps.hedgedoc = {
|
|
|
|
dashboard = {
|
|
|
|
name = "Notes";
|
|
|
|
category = "app";
|
|
|
|
icon = "edit";
|
|
|
|
link = "https://notes.${domain}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|