ctucx.git: oeffisearch

[nimlang] fast and simple tripplanner

commit 9291a221b75723d6447f9644202f32aeacabb3ed
parent b623e279a5369e49a0ec0daa5b96cda0b9b82d1f
Author: Milan Pässler <me@pbb.lc>
Date: Wed, 19 Feb 2020 23:15:44 +0100

add hydra ci
2 files changed, 51 insertions(+), 0 deletions(-)
A
default.nix
|
31
+++++++++++++++++++++++++++++++
A
release.nix
|
20
++++++++++++++++++++
diff --git a/default.nix b/default.nix
@@ -0,0 +1,31 @@
+{
+  pkgs ? import <nixpkgs> {}
+, src ? ./.
+}:
+
+with pkgs;
+
+stdenv.mkDerivation {
+  pname = "oeffisearch";
+  version = "0.1.0";
+  inherit src;
+  nativeBuildInputs = [ nim ];
+  buildInputs = [ openssl ];
+  buildPhase = ''
+    runHook preBuild
+    nim c -d:release --nimcache:$PWD src/oeffisearch.nim
+    runHook postBuild
+  '';
+  installPhase = ''
+    runHook preInstall
+    install -Dm755 src/oeffisearch $out/bin/oeffisearch
+    mkdir -p $out/share
+    cp -r client $out/share/client
+    runHook postInstall
+  '';
+  fixupPhase = ''
+    runHook preFixup
+    patchelf --set-rpath ${lib.makeLibraryPath [ openssl ]} $out/bin/oeffisearch
+    runHook postFixup
+  '';
+}
diff --git a/release.nix b/release.nix
@@ -0,0 +1,20 @@
+{ oeffisearchSrc ? { outPath = ./.; revCount = 1234; shortRev = "abcdef"; }
+, nixpkgs ? builtins.fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.09.tar.gz
+, officialRelease ? false
+}:
+
+let
+  pkgs = import nixpkgs { system = builtins.currentSystem or "x86_64-linux"; };
+
+  jobs = rec {
+    build.x86_64-linux = pkgs.releaseTools.nixBuild (
+      (import ./default.nix { inherit pkgs; })
+        .drvAttrs // {
+          postHook = ''
+            src=$origSrc
+          '';
+        }
+    );
+  };
+
+in jobs