summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorJakub Stachurski <j.stachurski@student.utwente.nl>2026-05-08 23:23:19 +0200
committerJakub Stachurski <j.stachurski@student.utwente.nl>2026-05-08 23:23:19 +0200
commitbb957032ffc5352229edbbdcdb56b9dba4408f37 (patch)
tree8d6c171a49aae83dfc191e2aad1ecf55330f0bb4 /services
parentad57da6bda1cb00ab11f78125c16daebbf0c221c (diff)
Tacitus hosts and locale
Diffstat (limited to 'services')
-rw-r--r--services/email.nix15
-rw-r--r--services/gomuks.nix67
2 files changed, 75 insertions, 7 deletions
diff --git a/services/email.nix b/services/email.nix
index c698c5c..c05840d 100644
--- a/services/email.nix
+++ b/services/email.nix
@@ -235,13 +235,14 @@ in
certificate = (
lib.mkIf (cfg.doACME) (
- lib.mapAttrs' (name: value: ( lib.nameValuePair ("nix_${(lib.replaceString "." "_" name)}") (value) )) (
- lib.genAttrs ([ cfg.domain ] ++ cfg.additionalDomains) (domain: {
- cert = toStalwartCred "tls_${domain}_cert.pem";
- private-key = toStalwartCred "tls_${domain}_key.pem";
- default = (domain == cfg.domain);
- })
- )
+ lib.mapAttrs' (name: value: (lib.nameValuePair ("nix_${(lib.replaceString "." "_" name)}") (value)))
+ (
+ lib.genAttrs ([ cfg.domain ] ++ cfg.additionalDomains) (domain: {
+ cert = toStalwartCred "tls_${domain}_cert.pem";
+ private-key = toStalwartCred "tls_${domain}_key.pem";
+ default = (domain == cfg.domain);
+ })
+ )
)
);
};
diff --git a/services/gomuks.nix b/services/gomuks.nix
new file mode 100644
index 0000000..be53daa
--- /dev/null
+++ b/services/gomuks.nix
@@ -0,0 +1,67 @@
+{
+ pkgs,
+ config,
+ lib,
+}:
+let
+ cfg = config.wilkuu.services.gomuks;
+ hostname = config.networking.hostName;
+in
+{
+ options.wilkuu.serivces.gomuks = with lib; {
+ enable = mkEnableOption "Enable gomuks";
+ # Hostname option is reused a lot, we might need to create a util for the options at this rate.
+ hostname = mkOption {
+ type = types.str;
+ default = "$matrix.{config.networking.hostName}.local";
+ description = "Hostname on which gomuks should be hosted.";
+ };
+ package = mkPackageOption pkgs "gomuks-web" { };
+ dataDir = mkOption {
+ type = types.path;
+ default = "/srv/gomuks/";
+ description = "Directory for where gomuks will store it's files.";
+ };
+
+ };
+ config = lib.mkIf cfg.enable (
+ let
+ yaml = pkgs.writers.writeYAML;
+ cfgDir = "${cfg.dataDir}/.config";
+ configFile = yaml.generate "config.yaml" {
+ password_file = config.sops.secrets."gomuks/password".path;
+ };
+ in
+ {
+ users.users.gomuks = {
+ isSystemUser = true;
+ group = "gomuks";
+ };
+ users.groups.gomuks = { };
+
+ sops.secrets."gomuks/password" = {
+ owner = "gomuks";
+ sopsFile = ./secrets/${hostname}/gomuks.yaml;
+ };
+
+ systemd.services.gomuks = {
+ name = "gomuks";
+ serviceConifg = {
+ User = "gomuks";
+ ExecStart = "${cfg.package}";
+ WorkingDirectory = "${cfg.dataDir}";
+ Restart = "always";
+ Environment = [
+ "XDG_CONFIG_HOME=${cfgDir}"
+ ];
+ };
+ };
+
+ systemd.tmpfiles.rules = [
+ "d ${cfgDir} 0700 ${cfg.user} ${cfg.user} -"
+ "L+ ${cfgDir}/config.yaml - - - - ${configFile}"
+ ];
+
+ }
+ );
+}