summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2020-09-29 12:57:52 +0200
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2020-09-29 13:00:07 +0200
commitebc96a025146dc67ee335c52cdd2d06575d5cc1c (patch)
treec25c0aa7c9e6395badbad04064a6ae804d15cdd5
parentd30bc05ce5e28d44222ef0cf01ecd545b590ed76 (diff)
feat(default.nix): add package for anzeigetafel
-rw-r--r--README.adoc1
-rw-r--r--default.nix38
2 files changed, 27 insertions, 12 deletions
diff --git a/README.adoc b/README.adoc
index 2defc5c..8b517de 100644
--- a/README.adoc
+++ b/README.adoc
@@ -266,6 +266,7 @@ ready to be installed:
   using gcc and musl (used for the systemd service so we
   can restrict file system access)
 * `bahnhofshalle`
+* `anzeigetafel`
 
 The warteraum attributes can be overriden to set the following
 values:
diff --git a/default.nix b/default.nix
index 5191cac..a2eec33 100644
--- a/default.nix
+++ b/default.nix
@@ -149,18 +149,32 @@ rec {
       dontStrip = true;
     };
 
-  pythonShell =
+  anzeigetafel =
     let
-      pythonEnv = python3.withPackages (p: with p; [
-        flask
-        pillow
-        requests
-        sqlite
-      ]);
-    in mkShell {
-      name = "python-env";
-
-      buildInputs = [ pythonEnv sqlite ];
-    };
+      pythonEnv = python3.withPackages (p: with p; [ pillow requests ]);
+      libPath = "$out/lib/${pythonEnv.libPrefix}/site-lib";
+    in stdenv.mkDerivation {
+      pname = "anzeigetafel";
+      inherit version;
+
+      inherit src;
+      sourceRoot = sourceName + "/anzeigetafel";
+
+      buildInputs = [ pythonEnv makeWrapper ];
+
+      patchPhase = ''
+        sed -i 's|FONT =.*$|FONT = "${unifont}/share/fonts/truetype/unifont.ttf"|' anzeigetafel.py
+      '';
 
+      installPhase = ''
+        install -Dm755 anzeigetafel.py $out/bin/anzeigetafel
+        mkdir -p ${libPath}/flipdots
+        cp -r ../third_party/flipdots/scripts ${libPath}/flipdots/scripts
+      '';
+
+      postFixup = ''
+        wrapProgram $out/bin/anzeigetafel \
+          --prefix PYTHONPATH : "${libPath}"
+      '';
+    };
 }