diff --git a/modules/services/hedgedoc/default.nix b/modules/services/hedgedoc/default.nix new file mode 100644 index 0000000..2f271de --- /dev/null +++ b/modules/services/hedgedoc/default.nix @@ -0,0 +1,69 @@ +# 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; { + enable = mkEnableOption "Navidrome Music Server"; + + settings = mkOption { + type = (pkgs.formats.json { }).type; + default = { }; + example = { + "LastFM.ApiKey" = "MYKEY"; + "LastFM.Secret" = "MYSECRET"; + "Spotify.ID" = "MYKEY"; + "Spotify.Secret" = "MYSECRET"; + }; + description = '' + Additional settings. + ''; + }; + + configuration = mkOption { + type = types.attrs; + default = { }; + description = "additional configurations"; + }; + + port = mkOption { + type = types.port; + default = 3000; + example = 8080; + description = "Internal port for webui"; + }; + }; + + config = lib.mkIf cfg.enable { + services.hedgedoc = { + enable = true; + + configuration = { + domain = "notes.${domain}"; + protocolUseSSL = true; + db = { + dialect = "sqlite"; + storage = "/var/lib/hedgedoc/db.hedgedoc.sqlite"; + }; + } // cfg.configuration; + }; + + my.services.nginx.virtualHosts = [ + { + subdomain = "notes"; + inherit (cfg) port; + } + ]; + + webapps.apps.hedgedoc = { + dashboard = { + name = "Notes"; + category = "app"; + icon = "edit"; + link = "https://notes.${domain}"; + }; + }; + }; +} diff --git a/nixos/modules/webapps/hedgedoc.nix b/nixos/modules/webapps/hedgedoc.nix deleted file mode 100644 index 315020e..0000000 --- a/nixos/modules/webapps/hedgedoc.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, pkgs, ... }: -{ - services.hedgedoc = { - enable = true; - configuration = { - domain = "notes.buehler.rocks"; - protocolUseSSL = true; - db = { - dialect = "sqlite"; - storage = "/var/lib/hedgedoc/db.hedgedoc.sqlite"; - }; - }; - }; - webapps.apps.hedgedoc = { - dashboard = { - name = "Hedgedoc"; - category = "app"; - icon = "edit"; - link = "https://notes.buehler.rocks"; - }; - }; -}