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/muellshack.nix | |
parent | 0699b41b05a1f9cd133c15c3aadf70c3a45170f6 (diff) | |
parent | 124b1d7639c404e5a58a9aef0f0bee1424f54a45 (diff) |
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'krebs/2configs/shack/muellshack.nix')
-rw-r--r-- | krebs/2configs/shack/muellshack.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/krebs/2configs/shack/muellshack.nix b/krebs/2configs/shack/muellshack.nix new file mode 100644 index 000000000..1e6843bdf --- /dev/null +++ b/krebs/2configs/shack/muellshack.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, ... }: + +let + pkg = pkgs.callPackage ( + pkgs.fetchgit { + url = "https://git.shackspace.de/rz/muellshack"; + rev = "d8a5e2d4c0a22804838675ac42b468299dcd9a76"; + sha256 = "0ff6q64dgdxmpszp94z100fdic175b1vvxn4crg8p0jcabzxsv0m"; + }) {}; + home = "/var/lib/muellshack"; + port = "8081"; +in { + users.users.muellshack = { + inherit home; + createHome = true; + }; + services.nginx.virtualHosts."muell.shack" = { + locations."/" = { + proxyPass = "http://localhost:${port}/muellshack/"; + }; + }; + services.nginx.virtualHosts."openhab.shack" = { + locations."/muellshack/".proxyPass = "http://localhost:${port}/muellshack/"; + }; + systemd.services.muellshack = { + description = "muellshack"; + wantedBy = [ "multi-user.target" ]; + environment.PORT = port; + serviceConfig = { + User = "muellshack"; + # do not override the current storage fil + ExecStartPre = pkgs.writeDash "call-muell-pre" '' + cp -vf ${pkg}/share/static_muelldata.json ${home} + cp -vn ${pkg}/share/storage.json ${home} + chmod 700 ${home}/storage.json + ''; + WorkingDirectory = home; + ExecStart = "${pkg}/bin/muellshack"; + Restart = "always"; + PrivateTmp = true; + }; + }; +} |