diff options
author | lassulus <lassulus@lassul.us> | 2019-08-13 18:55:08 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2019-08-13 18:55:08 +0200 |
commit | 3047fea88d2379011685be4e57a5b379778423c7 (patch) | |
tree | 23ad61badb3794cabf4a9cc9de89c3465cfec737 /krebs/2configs/shack/s3-power.nix | |
parent | 0699b41b05a1f9cd133c15c3aadf70c3a45170f6 (diff) | |
parent | 124b1d7639c404e5a58a9aef0f0bee1424f54a45 (diff) |
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'krebs/2configs/shack/s3-power.nix')
-rw-r--r-- | krebs/2configs/shack/s3-power.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/krebs/2configs/shack/s3-power.nix b/krebs/2configs/shack/s3-power.nix new file mode 100644 index 000000000..40c42260f --- /dev/null +++ b/krebs/2configs/shack/s3-power.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +let + pkg = pkgs.callPackage ( + pkgs.fetchgit { + url = "https://git.shackspace.de/rz/s3-power"; + rev = "b2b87b56bb40d714dbbecd1285566870b256aec4"; + sha256 = "sha256:02wikwf3rgkkggwbwqisdvhlwd38w5pw011xhwvhnj114s3rynan"; + }) {}; + home = "/var/lib/s3-power"; + cfg = toString <secrets/shack/s3-power.json>; +in { + users.users.s3_power = { + inherit home; + createHome = true; + }; + systemd.services.s3-power = { + startAt = "daily"; + description = "s3-power"; + environment.CONFIG = "${home}/s3-power.json"; + serviceConfig = { + Type = "oneshot"; + User = "s3_power"; + ExecStartPre = pkgs.writeDash "s3-power-pre" '' + install -D -os3_power -m700 ${cfg} ${home}/s3-power.json + ''; + WorkingDirectory = home; + PermissionsStartOnly = true; + ExecStart = "${pkg}/bin/s3-power"; + PrivateTmp = true; + }; + }; +} |