Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
2.0 kB · 87 lines
Nix
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788{ # general lib, resholve, bash, doCheck ? true, doInstallCheck ? true, # variant-specific variant, version, branch, src, fake ? false, keep,}:let # extracting this so that it's trivial to test in other shells installCheck = shell: '' echo "testing bashup.events in ${shell}" ${shell} <<'EOF' source $out/bin/bashup.events neat(){ echo $0: Hi from event \'test event\'. I can have both $1 and $2 arguments. exit 0 } event on "test event" @2 neat curried echo event registered event emit "test event" runtime exit 1 # fail if emitting event didn't exit clean EOF '';
inresholve.mkDerivation { # bashup.events doesn't version yet but it has two variants with # differing features/performance characteristics: # - branch master: a variant for bash 3.2+ # - branch bash44: a variant for bash 4.4+ pname = "bashup-events${variant}-unstable"; # should be YYYY-MM-DD inherit version; inherit src;
installPhase = '' runHook preInstall install -Dt $out/bin bashup.events runHook postInstall '';
inherit doCheck; nativeCheckInputs = [ bash ];
checkPhase = '' runHook preCheck ${bash}/bin/bash -n ./bashup.events ${bash}/bin/bash ./bashup.events runHook postCheck '';
solutions = { events = { inputs = [ ]; interpreter = "none"; scripts = [ "bin/bashup.events" ]; inherit keep; } // lib.optionalAttrs (lib.isAttrs fake) { inherit fake; }; };
inherit doInstallCheck; nativeInstallCheckInputs = [ bash ]; installCheckPhase = '' runHook preInstallCheck ${installCheck "${bash}/bin/bash"} runHook postInstallCheck '';
meta = with lib; { inherit branch; description = "Event listener/callback API for creating extensible bash programs"; mainProgram = "bashup.events"; homepage = "https://github.com/bashup/events"; license = licenses.cc0; maintainers = with maintainers; [ abathur ]; platforms = platforms.all; };}