summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service.nix32
1 files changed, 28 insertions, 4 deletions
diff --git a/service.nix b/service.nix
index a0750ac..50473b2 100644
--- a/service.nix
+++ b/service.nix
@@ -55,6 +55,23 @@ in
type = lib.types.path;
};
+ user = lib.mkOption {
+ description = "Eko user";
+ default = "eko";
+ type = lib.types.str;
+ };
+
+ group = lib.mkOption {
+ description = "Eko group";
+ default = "eko";
+ type = lib.types.str;
+ };
+
+ permission = lib.mkOption {
+ description = "Permission to access dataDir";
+ default = "0750";
+ type = lib.types.str;
+ };
};
config = lib.mkIf cfg.enable {
@@ -71,6 +88,10 @@ in
group = "eko";
};
+ systemd.tmpfiles.rules = [
+ "d '${cfg.dataDir}' ${cfg.permission} ${cfg.user} ${cfg.group} - -"
+ ];
+
# Systemd service for eko
systemd.services.eko = {
description = "Eko - a secure terminal-native social media platform";
@@ -98,14 +119,17 @@ in
ExecReload = "${pkgs.coreutils}/bin/kill -SIGHUP $MAINPID";
ConfigurationDirectory = "eko";
- StateDirectory = "eko";
- StateDirectoryMode = "0700";
+ # StateDirectory = "eko";
+ # StateDirectoryMode = "0700";
+ # Runtime directory and mode
+ RuntimeDirectory = "eko";
+ RuntimeDirectoryMode = cfg.permission;
LogsDirectory = "eko";
WorkingDirectory = cfg.dataDir;
Type = "simple";
- User = "eko";
- Group = "eko";
+ User = cfg.user;
+ Group = cfg.group;
# Hardening
ProtectHome = true;