From 58947b75714d9471595d6f062d5180b8bd23904e Mon Sep 17 00:00:00 2001 From: Xe Date: Sat, 19 Feb 2022 14:19:28 -0500 Subject: [PATCH] flakify better Signed-off-by: Xe --- flake.nix | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 95563c8..a2e7fa5 100644 --- a/flake.nix +++ b/flake.nix @@ -43,6 +43,28 @@ RUST_SRC_PATH = rustPlatform.rustLibSrc; }; - }); + nixosModule = { config, lib }: { + options.xeserv.mara-bot.enable = lib.mkEnableOption "enable Mara bot"; + config = lib.mkIf config.xeserv.mara-bot.enable { + users.users.mara-bot = { + createHome = true; + isSystemUser = true; + home = "/var/lib/mara-bot"; + }; + + systemd.services.mara-bot = { + wantedBy = [ "multi-user.target" ]; + environment.RUST_LOG = "tower_http=debug,info"; + serviceConfig = { + User = "mara-bot"; + Group = "mara-bot"; + Restart = "always"; + ConditionPathExists = "/var/lib/mara-bot/config.yaml"; + WorkingDirectory = "/var/lib/mara-bot"; + }; + }; + }; + }; + }); }