2019-07-15 07:58:20 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
pkg = pkgs.callPackage (
|
2021-09-05 17:51:31 +00:00
|
|
|
pkgs.fetchFromGitHub {
|
|
|
|
owner = "shackspace";
|
|
|
|
repo = "s3-power";
|
2019-10-31 14:17:18 +00:00
|
|
|
rev = "0687ab64";
|
|
|
|
sha256 = "1m8h4bwykv24bbgr5v51mam4wsbp5424xcrawhs4izv563jjf130";
|
|
|
|
}) { mkYarnPackage = pkgs.yarn2nix-moretea.mkYarnPackage; };
|
|
|
|
|
2019-07-15 07:58:20 +00:00
|
|
|
home = "/var/lib/s3-power";
|
|
|
|
cfg = toString <secrets/shack/s3-power.json>;
|
|
|
|
in {
|
|
|
|
users.users.s3_power = {
|
|
|
|
inherit home;
|
|
|
|
createHome = true;
|
2021-06-05 17:13:25 +00:00
|
|
|
isSystemUser = true;
|
2021-12-04 19:04:25 +00:00
|
|
|
group = "s3_power";
|
2019-07-15 07:58:20 +00:00
|
|
|
};
|
2021-12-04 19:04:25 +00:00
|
|
|
users.groups.shackDNS = {};
|
2019-07-15 07:58:20 +00:00
|
|
|
systemd.services.s3-power = {
|
2019-07-16 17:47:49 +00:00
|
|
|
startAt = "daily";
|
2019-07-15 07:58:20 +00:00
|
|
|
description = "s3-power";
|
|
|
|
environment.CONFIG = "${home}/s3-power.json";
|
|
|
|
serviceConfig = {
|
2019-07-16 17:47:49 +00:00
|
|
|
Type = "oneshot";
|
2019-07-15 07:58:20 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|