diff options
author | makefu <github@syntax-fehler.de> | 2019-07-11 09:35:36 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2019-07-11 09:35:36 +0200 |
commit | bb0bd75d7854b4612b9843729ab93a2c90cd69f5 (patch) | |
tree | 60468366df1d58cc1d400eed41f587ac0744a9ac /krebs | |
parent | 4ce32d170826360f577624323d94a4c5432764f7 (diff) |
shack/muellshack: init
Diffstat (limited to 'krebs')
-rw-r--r-- | krebs/2configs/shack/muellshack.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/krebs/2configs/shack/muellshack.nix b/krebs/2configs/shack/muellshack.nix new file mode 100644 index 000000000..3a8d1cd88 --- /dev/null +++ b/krebs/2configs/shack/muellshack.nix @@ -0,0 +1,42 @@ +{ 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}"; + }; + 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} + ''; + WorkingDirectory = home; + ExecStart = "${pkg}/bin/muellshack"; + Restart = "always"; + PrivateTmp = true; + }; + }; +} |