From 3c7f1a8c2c46271ca889a523734cb32e6bcc4cd7 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sun, 3 Aug 2025 20:20:49 +0300 Subject: Replaced state dir with runtime dir, hopefully fixes issues --- service.nix | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'service.nix') 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; -- cgit v1.3.1