hedgedoc: use lib.mkPackageOptionMD

This commit is contained in:
Pol Dellaiera 2023-08-01 15:51:33 +02:00
parent f310ee473d
commit a521506834

View File

@ -32,6 +32,7 @@ in
]; ];
options.services.hedgedoc = { options.services.hedgedoc = {
package = mkPackageOptionMD pkgs "hedgedoc" { };
enable = mkEnableOption (lib.mdDoc "the HedgeDoc Markdown Editor"); enable = mkEnableOption (lib.mdDoc "the HedgeDoc Markdown Editor");
groups = mkOption { groups = mkOption {
@ -1018,16 +1019,6 @@ in
`HedgeDoc` is running. `HedgeDoc` is running.
''; '';
}; };
package = mkOption {
type = types.package;
default = pkgs.hedgedoc;
defaultText = literalExpression "pkgs.hedgedoc";
description = lib.mdDoc ''
Package that provides HedgeDoc.
'';
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -1060,7 +1051,7 @@ in
serviceConfig = { serviceConfig = {
WorkingDirectory = cfg.workDir; WorkingDirectory = cfg.workDir;
StateDirectory = [ cfg.workDir cfg.settings.uploadsPath ]; StateDirectory = [ cfg.workDir cfg.settings.uploadsPath ];
ExecStart = "${cfg.package}/bin/hedgedoc"; ExecStart = "${lib.getExe cfg.package}";
EnvironmentFile = mkIf (cfg.environmentFile != null) [ cfg.environmentFile ]; EnvironmentFile = mkIf (cfg.environmentFile != null) [ cfg.environmentFile ];
Environment = [ Environment = [
"CMD_CONFIG_FILE=${cfg.workDir}/config.json" "CMD_CONFIG_FILE=${cfg.workDir}/config.json"