From 4e9dc134d4323856f29cdcda4979ce3682753d72 Mon Sep 17 00:00:00 2001 From: sefidel Date: Sun, 12 Nov 2023 19:57:01 +0900 Subject: feat(overlays/matrix-signal-module): support setting package --- overlays/mautrix-signal-module.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/overlays/mautrix-signal-module.nix b/overlays/mautrix-signal-module.nix index 22abbb5..27c1a36 100644 --- a/overlays/mautrix-signal-module.nix +++ b/overlays/mautrix-signal-module.nix @@ -16,6 +16,8 @@ in services.mautrix-signal = { enable = mkEnableOption (lib.mdDoc "Mautrix-Signal, a Matrix-Signal puppeting bridge."); + package = mkOption { type = types.package; default = pkgs.mautrix-signal; }; + settings = mkOption rec { apply = recursiveUpdate default; inherit (settingsFormat) type; @@ -155,15 +157,15 @@ in preStart = '' # generate the appservice's registration file if absent if [ ! -f '${registrationFile}' ]; then - ${pkgs.mautrix-signal}/bin/mautrix-signal \ + ${cfg.package}/bin/mautrix-signal \ --generate-registration \ - --base-config='${pkgs.mautrix-signal}/${pkgs.mautrix-signal.pythonModule.sitePackages}/mautrix_signal/example-config.yaml' \ + --base-config='${cfg.package}/${cfg.package.pythonModule.sitePackages}/mautrix_signal/example-config.yaml' \ --config='${settingsFile}' \ --registration='${registrationFile}' fi - '' + lib.optionalString (pkgs.mautrix-signal ? alembic) '' + '' + lib.optionalString (cfg.package ? alembic) '' # run automatic database init and migration scripts - ${pkgs.mautrix-signal.alembic}/bin/alembic -x config='${settingsFile}' upgrade head + ${cfg.package.alembic}/bin/alembic -x config='${settingsFile}' upgrade head ''; serviceConfig = { @@ -179,13 +181,13 @@ in DynamicUser = true; SupplementaryGroups = [ "signald" ]; PrivateTmp = true; - WorkingDirectory = pkgs.mautrix-signal; # necessary for the database migration scripts to be found + WorkingDirectory = cfg.package; # necessary for the database migration scripts to be found StateDirectory = baseNameOf dataDir; UMask = "0027"; EnvironmentFile = cfg.environmentFile; ExecStart = '' - ${pkgs.mautrix-signal}/bin/mautrix-signal \ + ${cfg.package}/bin/mautrix-signal \ --config='${settingsFile}' ''; }; -- cgit 1.4.1