stockholm/krebs/2configs/shack/s3-power.nix

34 lines
919 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
let
pkg = pkgs.callPackage (
pkgs.fetchgit {
url = "https://git.shackspace.de/rz/s3-power";
2019-07-16 22:53:56 +00:00
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 = {
2019-07-16 17:47:49 +00:00
startAt = "daily";
description = "s3-power";
environment.CONFIG = "${home}/s3-power.json";
serviceConfig = {
2019-07-16 17:47:49 +00:00
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;
};
};
}