signage: bring in from external repo

This is b28e6f07aa48f1e2f01eb37bffa180f97a7b03bd from
https://code.hackerspace.pl/q3k/love2d-signage/. We only keep code
commited by inf and q3k, and we're both now licensing this code under
the ISC license, as per COPYING in the root of hscloud.

Change-Id: Ibeee2e6923605e4b1a17a1d295867c056863ef59
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1335
Reviewed-by: informatic <informatic@hackerspace.pl>
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/hswaw/signage/default.nix b/hswaw/signage/default.nix
new file mode 100644
index 0000000..0ac8c66
--- /dev/null
+++ b/hswaw/signage/default.nix
@@ -0,0 +1,43 @@
+{ pkgs, ... }: let
+
+  signageForPkgs = pkgs: with { inherit (pkgs) love fetchFromGitHub stdenv curl; }; let
+    # Build LÖVE2D 12, currently still in development. This gives us https
+    # support.
+    love12 = (love.overrideAttrs (oa: {
+      version = "12.0-dev";
+      src = fetchFromGitHub {
+        owner = "love2d";
+        repo = "love";
+        rev = "d586d1847446f5212d5f7e9efb94e50fcfba7d77";
+        sha256 = "sha256-gTpVtyqXV6/GsezuCpooaY+x5tPfOF9p1b83v4kKR4E=";
+      };
+      makeFlags = [
+        "CPPFLAGS=-DHTTPS_BACKEND_CURL"
+      ];
+      buildInputs = oa.buildInputs ++ [ curl ];
+      NIX_LDFLAGS = "-lcurl";
+      enableParallelBuilding = true;
+    }));
+
+    signage = stdenv.mkDerivation {
+      name = "signage";
+      src = ./.;
+
+      installPhase = ''
+        mkdir -p $out/share/signage
+        cp -rv $src/* $out/share/signage/
+
+        mkdir -p $out/bin/
+        cat <<EOF >$out/bin/signage
+        #!/usr/bin/env bash
+        ${love12}/bin/love $out/share/signage
+        EOF
+        chmod +x $out/bin/signage
+      '';
+    };
+  in signage;
+
+in {
+  prod = signageForPkgs pkgs;
+  local = signageForPkgs (import <nixpkgs> {});
+}