diff options
| author | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 18:43:51 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 18:43:51 +0300 |
| commit | b85e90fc3480da0e6a48da73201a0b22488cc650 (patch) | |
| tree | 42b2e083e7d268747b01a03c0bedb48a9394585e /meta/nix/nixos/meta.nix | |
| parent | 5c7048091e3a191e8a34f26852a8976b254e339b (diff) | |
| parent | f88d1f18953f9619444d56756702c7eb54580ab1 (diff) | |
| download | Project-Tick-b85e90fc3480da0e6a48da73201a0b22488cc650.tar.gz Project-Tick-b85e90fc3480da0e6a48da73201a0b22488cc650.zip | |
Add 'meta/' from commit 'f88d1f18953f9619444d56756702c7eb54580ab1'
git-subtree-dir: meta
git-subtree-mainline: 5c7048091e3a191e8a34f26852a8976b254e339b
git-subtree-split: f88d1f18953f9619444d56756702c7eb54580ab1
Diffstat (limited to 'meta/nix/nixos/meta.nix')
| -rw-r--r-- | meta/nix/nixos/meta.nix | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/meta/nix/nixos/meta.nix b/meta/nix/nixos/meta.nix new file mode 100644 index 0000000000..c03d4e6e01 --- /dev/null +++ b/meta/nix/nixos/meta.nix @@ -0,0 +1,70 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib) getExe getExe' mkEnableOption mkIf mkOption mkPackageOption types; + + settingsFormat = pkgs.formats.keyValue {}; + + cfg = config.services.blockgame-meta; +in { + options.services.blockgame-meta = { + enable = mkEnableOption "blockgame-meta service"; + + package = mkPackageOption pkgs "blockgame-meta" {}; + + settings = mkOption { + type = types.submodule { + freeformType = settingsFormat.type; + options = { + DEPLOY_TO_S3 = mkOption { + type = types.str; + default = "false"; + }; + DEPLOY_TO_FOLDER = mkOption { + type = types.str; + default = "false"; + }; + DEPLOY_TO_GIT = mkOption { + type = types.str; + default = "false"; + }; + }; + }; + }; + }; + config = mkIf cfg.enable { + users.users."blockgame-meta" = { + isSystemUser = true; + group = "blockgame-meta"; + }; + + users.groups."blockgame-meta" = {}; + + systemd = { + services."blockgame-meta" = { + description = "blockgame metadata generator"; + after = ["network-online.target"]; + wants = ["network-online.target"]; + serviceConfig = { + EnvironmentFile = [(settingsFormat.generate "blockgame-meta.env" cfg.settings)]; + ExecStartPre = getExe' cfg.package "init"; + ExecStart = getExe cfg.package; + StateDirectory = "blockgame-meta"; + CacheDirectory = "blockgame-meta"; + User = "blockgame-meta"; + }; + }; + + timers."blockgame-meta" = { + timerConfig = { + OnCalendar = "hourly"; + RandomizedDelaySec = "5m"; + }; + wantedBy = ["timers.target"]; + }; + }; + }; +} |
