From 9291a221b75723d6447f9644202f32aeacabb3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20P=C3=A4ssler?= Date: Wed, 19 Feb 2020 23:15:44 +0100 Subject: [PATCH] add hydra ci --- default.nix | 31 +++++++++++++++++++++++++++++++ release.nix | 20 ++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 default.nix create mode 100644 release.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..2b89edd --- /dev/null +++ b/default.nix @@ -0,0 +1,31 @@ +{ + pkgs ? import {} +, 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 new file mode 100644 index 0000000..b792833 --- /dev/null +++ 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