summaryrefslogtreecommitdiff
path: root/modules/nixos/duksebot
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2024-02-20 19:00:53 +0100
committerLinnnus <[email protected]>2024-02-20 19:01:44 +0100
commit274e08f50faffe1b8e4a760811b0a12450eae719 (patch)
tree393449e81f21b6f6b1ea7a701cef0f740cc3b757 /modules/nixos/duksebot
parent1bbdd3f63a9d8c46b1772cbf2ad9fd83d7ef213b (diff)
Merge 'reorg' into 'main'
This patch moves in the reorganizational work done on the reorg branch, mainly: * Move host-specific modules into hosts/<host>/<module> * Break up HM config See the reorg branch for the individual commits.
Diffstat (limited to 'modules/nixos/duksebot')
-rw-r--r--modules/nixos/duksebot/default.nix72
1 files changed, 0 insertions, 72 deletions
diff --git a/modules/nixos/duksebot/default.nix b/modules/nixos/duksebot/default.nix
deleted file mode 100644
index 4c10cd8..0000000
--- a/modules/nixos/duksebot/default.nix
+++ /dev/null
@@ -1,72 +0,0 @@
-# This module defines an on-demand minecraft server service which turns off the
-# server when it's not being used.
-{
- config,
- lib,
- pkgs,
- modulesPath,
- ...
-}: let
- inherit (lib) mkIf mkOption mkEnableOption types;
-
- cfg = config.services.duksebot;
-in {
- options.services.duksebot = {
- enable = mkEnableOption "duksebot daily reminder";
-
- package = mkOption {
- description = "What package to use";
- default = pkgs.duksebot;
- type = types.package;
- };
- };
-
- config = mkIf cfg.enable {
- # Create a user to run the server under.
- users.users.duksebot = {
- description = "Runs daily dukse reminder";
- group = "duksebot";
- isSystemUser = true;
- home = "/srv/duksebot";
- createHome = true;
- };
- users.groups.duksebot = {};
-
- age.secrets.duksebot-env = {
- file = ../../../secrets/duksebot.env.age;
- owner = config.users.users.duksebot.name;
- group = config.users.users.duksebot.group;
- mode = "0440";
- };
-
- # Create a service which simply runs script. This will be invoked by our timer.
- systemd.services.duksebot = {
- serviceConfig = {
- # We only want to run this once every time the timer triggers it.
- Type = "oneshot";
- # Run as the user we created above.
- User = "duksebot";
- Group = "duksebot";
- WorkingDirectory = config.users.users.duksebot.home;
- };
- script = ''
- # Load the secret environment variables.
- export $(grep -v '^#' ${config.age.secrets.duksebot-env.path} | xargs)
- # Kick off.
- exec "${cfg.package}"/bin/duksebot
- '';
- };
-
- # Create a timer to activate our oneshot service.
- systemd.timers.duksebot = {
- wantedBy = ["timers.target"];
- partOf = ["duksebot.service"];
- after = ["network-online.target"];
- wants = ["network-online.target"];
- timerConfig = {
- OnCalendar = "*-*-* 7:00:00";
- Unit = "duksebot.service";
- };
- };
- };
-}