summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/worlddomination.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2017-07-14 00:41:36 +0200
committerlassulus <lassulus@lassul.us>2017-07-14 00:41:36 +0200
commit8d128c769aec24d8989db8220d680ea6f4735193 (patch)
tree8c8a6132fda88ba989bbb7fc170b54b1ca242987 /krebs/2configs/shack/worlddomination.nix
parentc4627764062a42f8d952ff90557c1e0d8735485f (diff)
parent58380c82848c3db0bd6c3d74904153f3464c2098 (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'krebs/2configs/shack/worlddomination.nix')
-rw-r--r--krebs/2configs/shack/worlddomination.nix67
1 files changed, 67 insertions, 0 deletions
diff --git a/krebs/2configs/shack/worlddomination.nix b/krebs/2configs/shack/worlddomination.nix
new file mode 100644
index 000000000..d0f9f5fa6
--- /dev/null
+++ b/krebs/2configs/shack/worlddomination.nix
@@ -0,0 +1,67 @@
+{ config, lib, pkgs, ... }:
+
+with import <stockholm/lib>;
+let
+ pythonPackages = pkgs.python3Packages;
+ # https://github.com/chrysn/aiocoap
+ aiocoap = pythonPackages.buildPythonPackage {
+ name = "aiocoap-0.3";
+ src = pkgs.fetchurl { url = "https://pypi.python.org/packages/9c/f6/d839e4b14258d76e74a39810829c13f8dd31de2bfe0915579b2a609d1bbe/aiocoap-0.3.tar.gz"; sha256 = "402d4151db6d8d0b1d66af5b6e10e0de1521decbf12140637e5b8d2aa9c5aef6"; };
+ propagatedBuildInputs = [ ];
+ doCheck = false; # 2 errors, dunnolol
+ meta = with pkgs.stdenv.lib; {
+ homepage = "";
+ license = licenses.mit;
+ description = "Python CoAP library";
+ };
+ };
+ LinkHeader = pythonPackages.buildPythonPackage {
+ name = "LinkHeader-0.4.3";
+ src = pkgs.fetchurl { url = "https://pypi.python.org/packages/27/d4/eb1da743b2dc825e936ef1d9e04356b5701e3a9ea022c7aaffdf4f6b0594/LinkHeader-0.4.3.tar.gz"; sha256 = "7fbbc35c0ba3fbbc530571db7e1c886e7db3d718b29b345848ac9686f21b50c3"; };
+ propagatedBuildInputs = [ ];
+ meta = with pkgs.stdenv.lib; {
+ homepage = "";
+ license = licenses.bsdOriginal;
+ description = "Parse and format link headers according to RFC 5988 \"Web Linking\"";
+ };
+ };
+ pkg = pkgs.stdenv.mkDerivation {
+ name = "worlddomination-2017-06-10";
+ src = pkgs.fetchgit {
+ url = "https://github.com/shackspace/worlddomination/";
+ rev = "72fc9b5";
+ sha256 = "05h500rswzypcxy4i22qc1vkc8izbzfqa9m86xg289hjxh133xyf";
+ };
+ buildInputs = [
+ (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
+ docopt
+ LinkHeader
+ aiocoap
+ requests2
+ paramiko
+ python
+ ]))
+ ];
+ installPhase = ''
+ install -m755 -D backend/push_led.py $out/bin/push-led
+ install -m755 -D backend/loop_single.py $out/bin/loop-single
+ # copy the provided file to the package
+ install -m755 -D backend/wd.lst $out/${wdpath}
+ '';
+ };
+ wdpath = "/usr/worlddomination/wd.lst";
+ esphost = "10.42.24.7"; # esp8266
+ timeout = 10; # minutes
+in {
+ systemd.services.worlddomination = {
+ description = "run worlddomination";
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ User = "nobody"; # TODO separate user
+ ExecStart = "${pkg}/bin/push-led ${esphost} ${pkg}/${wdpath} loop ${toString timeout}";
+ Restart = "always";
+ PrivateTmp = true;
+ PermissionsStartOnly = true;
+ };
+ };
+}