Add flake, module
This commit is contained in:
parent
680d7fcd05
commit
f04d073e6b
4 changed files with 886 additions and 9 deletions
79
module.nix
Normal file
79
module.nix
Normal file
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
utils,
|
||||
...
|
||||
}: let
|
||||
cfg = config.services.matrixoidc;
|
||||
in {
|
||||
meta.maintainers = with lib.maintainers; [quadradical];
|
||||
options.services.matrixoidc = {
|
||||
enable = lib.mkEnableOption "the matrixoidc server";
|
||||
package = lib.mkPackageOption pkgs "matrixoidc" {};
|
||||
|
||||
group = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
};
|
||||
|
||||
jwtSecretFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
};
|
||||
|
||||
args = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.matrixoidc = {
|
||||
description = "matrixoidc server";
|
||||
documentation = ["https://git.federated.nexus/Henry-Hiles/matrixoidc"];
|
||||
wantedBy = ["multi-user.target"];
|
||||
wants = ["network-online.target"];
|
||||
after = ["network-online.target"];
|
||||
|
||||
serviceConfig = {
|
||||
LoadCredential = ["matrixoidc-secrets:${cfg.jwtSecretFile}"];
|
||||
ExecStart = utils.escapeSystemdExecArgs [
|
||||
(lib.getExe cfg.package)
|
||||
cfg.args
|
||||
"--jwtSecretFile=/run/credentials/matrixoidc.service/matrixoidc-secrets"
|
||||
];
|
||||
DynamicUser = true;
|
||||
LockPersonality = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
ProtectClock = true;
|
||||
ProtectControlGroups = true;
|
||||
ProtectHostname = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
PrivateDevices = true;
|
||||
PrivateMounts = true;
|
||||
PrivateUsers = true;
|
||||
RestrictAddressFamilies = [
|
||||
"AF_INET"
|
||||
"AF_INET6"
|
||||
"AF_NETLINK"
|
||||
];
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
ProtectHome = true;
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = [
|
||||
"@system-service"
|
||||
"~@privileged"
|
||||
"~@resources"
|
||||
];
|
||||
Restart = "on-failure";
|
||||
RestartSec = 5;
|
||||
UMask = "077";
|
||||
|
||||
RuntimeDirectory = "matrixoidc";
|
||||
RuntimeDirectoryMode = 0770;
|
||||
Group = cfg.group;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue