Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, cmake }: 2 3stdenv.mkDerivation rec { 4 pname = "hotpatch"; 5 version = "0.2"; 6 7 src = fetchFromGitHub { 8 owner = "vikasnkumar"; 9 repo = "hotpatch"; 10 rev = "4b65e3f275739ea5aa798d4ad083c4cb10e29149"; 11 sha256 = "169vdh55wsbn6fl58lpzqx64v6ifzh7krykav33x1d9hsk98qjqh"; 12 }; 13 14 doCheck = true; 15 16 nativeBuildInputs = [ cmake ]; 17 18 preConfigure = '' 19 substituteInPlace test/loader.c \ 20 --replace \"/lib64/ld-linux-x86-64.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)" \ 21 --replace \"/lib/ld-linux-x86-64.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)" \ 22 --replace \"/lib/ld-linux.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)" \ 23 --replace \"/lib32/ld-linux.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)" 24 ''; 25 26 checkPhase = '' 27 LD_LIBRARY_PATH=$(pwd)/src make test 28 ''; 29 30 patches = [ ./no-loader-test.patch ]; 31 32 meta = with lib; { 33 description = "Hot patching executables on Linux using .so file injection"; 34 homepage = src.meta.homepage; 35 license = licenses.bsd3; 36 maintainers = [ ]; 37 platforms = ["i686-linux" "x86_64-linux"]; 38 }; 39}