diff options
author | jeschli <jeschli@gmail.com> | 2018-03-20 15:37:44 +0100 |
---|---|---|
committer | jeschli <jeschli@gmail.com> | 2018-03-20 15:37:44 +0100 |
commit | 01358d3947b46c2d9cceb7f6c53855cb536d6efe (patch) | |
tree | 194c3c5e346327774603f8948a0fa301a082be90 /makefu/2configs/deployment/google-muell.nix | |
parent | 390375cd8a0c745eb6b4df93f3f6f3e5f2985c90 (diff) | |
parent | 6267aa42509a4f56dc95dfc2db7773c33ca12522 (diff) |
Merge branch 'staging/jeschli' of prism.r:stockholm into staging/jeschli
Diffstat (limited to 'makefu/2configs/deployment/google-muell.nix')
-rw-r--r-- | makefu/2configs/deployment/google-muell.nix | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/makefu/2configs/deployment/google-muell.nix b/makefu/2configs/deployment/google-muell.nix new file mode 100644 index 000000000..f23789ee5 --- /dev/null +++ b/makefu/2configs/deployment/google-muell.nix @@ -0,0 +1,34 @@ +{ config, lib, pkgs, buildPythonPackage, ... }: +with import <stockholm/lib>; +let + pkg = pkgs.ampel; + home = "/var/lib/ampel"; + sec = "${toString <secrets>}/google-muell.json"; + ampelsec = "${home}/google-muell.json"; + esp = "192.168.1.23"; + sleepval = "1800"; +in { + users.users.ampel = { + uid = genid "ampel"; + createHome = true; + isSystemUser = true; + inherit home; + }; + systemd.services.google-muell-ampel = { + description = "Send led change to rgb cubes"; + after = [ "network-online.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "ampel"; + ExecStartPre = pkgs.writeDash "copy-ampel-secrets" '' + cp ${sec} ${ampelsec} + chown ampel ${ampelsec} + ''; + ExecStart = "${pkg}/bin/google-muell --esp=${esp} --client-secrets=${ampelsec} --credential-path=${home}/google-muell-creds.json --sleepval=${sleepval}"; + PermissionsStartOnly = true; + Restart = "always"; + RestartSec = 10; + PrivateTmp = true; + }; + }; +} |