pantalaimon: add module (#2056)

This commit is contained in:
Johannes Schleifenbaum 2021-06-07 23:38:42 +02:00 committed by GitHub
parent f74dc9c70b
commit 06a98ba0fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 122 additions and 0 deletions

3
.github/CODEOWNERS vendored
View file

@ -246,6 +246,9 @@
/modules/services/network-manager-applet.nix @rycee
/modules/services/pantalaimon.nix @jojosch
/tests/modules/services/pantalaimon @jojosch
/modules/services/parcellite.nix @gleber
/modules/services/pass-secret-service.nix @cab404

View file

@ -2069,6 +2069,14 @@ in
A new module is available: 'services.xidlehook'.
'';
}
{
time = "2021-06-07T20:44:00+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.pantalaimon'.
'';
}
];
};
}

View file

@ -185,6 +185,7 @@ let
(loadModule ./services/network-manager-applet.nix { })
(loadModule ./services/nextcloud-client.nix { })
(loadModule ./services/owncloud-client.nix { })
(loadModule ./services/pantalaimon.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/parcellite.nix { })
(loadModule ./services/pass-secret-service.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/password-store-sync.nix { condition = hostPlatform.isLinux; })

View file

@ -0,0 +1,79 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.pantalaimon;
iniFmt = pkgs.formats.ini { };
in {
meta.maintainers = [ maintainers.jojosch ];
options = {
services.pantalaimon = {
enable = mkEnableOption
"Pantalaimon, an E2EE aware proxy daemon for matrix clients";
package = mkOption {
type = types.package;
default = pkgs.pantalaimon;
defaultText = literalExample "pkgs.pantalaimon";
description =
"Package providing the <command>pantalaimon</command> executable to use.";
};
settings = mkOption {
type = iniFmt.type;
default = { };
defaultText = literalExample "{ }";
example = literalExample ''
{
Default = {
LogLevel = "Debug";
SSL = true;
};
local-matrix = {
Homeserver = "https://matrix.org";
ListenAddress = "127.0.0.1";
ListenPort = 8008;
};
}
'';
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/pantalaimon/pantalaimon.conf</filename>.
</para><para>
See <link xlink:href="https://github.com/matrix-org/pantalaimon/blob/master/docs/manpantalaimon.5.md" /> or
<citerefentry>
<refentrytitle>pantalaimon</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>
for options.
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
systemd.user.services = {
pantalaimon = {
Unit = {
Description =
"Pantalaimon - E2EE aware proxy daemon for matrix clients";
After = [ "network-online.target" ];
};
Service = {
ExecStart = "${cfg.package}/bin/pantalaimon -c ${
iniFmt.generate "pantalaimon.conf" cfg.settings
}";
Restart = "on-failure";
};
Install.WantedBy = [ "default.target" ];
};
};
};
}

View file

@ -113,6 +113,7 @@ import nmt {
./modules/services/fluidsynth
./modules/services/kanshi
./modules/services/lieer
./modules/services/pantalaimon
./modules/services/pbgopy
./modules/services/playerctld
./modules/services/polybar

View file

@ -0,0 +1,29 @@
{ config, pkgs, ... }:
{
config = {
services.pantalaimon = {
enable = true;
package = pkgs.writeScriptBin "dummy-pantalaimon" "" // {
outPath = "@pantalaimon@";
};
settings = {
Default = {
LogLevel = "Debug";
SSL = true;
};
local-matrix = {
Homeserver = "https://matrix.org";
ListenAddress = "127.0.0.1";
ListenPort = 8008;
};
};
};
nmt.script = ''
serviceFile=home-files/.config/systemd/user/pantalaimon.service
assertFileExists $serviceFile
assertFileRegex $serviceFile 'ExecStart=@pantalaimon@/bin/pantalaimon -c /nix/store/.*-pantalaimon.conf'
'';
};
}

View file

@ -0,0 +1 @@
{ pantalaimon-basic-configuration = ./basic-configuration.nix; }