From 863f6089e5a97e5f4440c6ba1578c9725ef4cfc7 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Thu, 23 Jul 2020 21:21:43 +0200 Subject: [PATCH] add module for matrix-corporal --- modules/matrix-corporal.nix | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 modules/matrix-corporal.nix diff --git a/modules/matrix-corporal.nix b/modules/matrix-corporal.nix new file mode 100644 index 0000000..ffdca63 --- /dev/null +++ b/modules/matrix-corporal.nix @@ -0,0 +1,34 @@ +{ lib, pkgs, config, ... }: +let + cfg = config.services.matrix-corporal; +in +{ + options.services.matrix-corporal = { + enable = lib.mkEnableOption "Start matrix-corporal"; + + package = lib.mkOption { + type = lib.types.package; + default = pkgs.nur.repos.dandellion.matrix-corporal; + }; + + settings = lib.mkOption { + default = {}; + description = '' + Configuration for matrix-corporal, see + for supported values. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + systemd.services.pantalaimon = { + wantedBy = [ "default.target" ]; + after = [ "network-online.target" ]; + serviceConfig = { + Type = "simple"; + DynamicUser="yes"; + ExecStart = "${cfg.package}/bin/matrix-corporal -c ${pkgs.writeTextFile {name = "matrix-corporal-config.json"; text = lib.generators.toJSON {} cfg.settings;}}"; + }; + }; + }; +}