Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenvNoCC 2, lib 3, fetchFromGitHub 4, bash 5, gnused 6, gawk 7, coreutils 8}: 9 10stdenvNoCC.mkDerivation { 11 pname = "optparse-bash-unstable"; 12 version = "2021-06-13"; 13 14 src = fetchFromGitHub { 15 owner = "nk412"; 16 repo = "optparse"; 17 rev = "d86ec17d15368e5b54eb2d47b001b0b61d68bbd0"; 18 sha256 = "sha256-vs7Jo1+sV0tPse4Wu2xtzSX1IkahwLgO3e4Riz3uMmI="; 19 }; 20 21 postPatch = '' 22 substituteInPlace optparse.bash \ 23 --replace sed "${gnused}/bin/sed" \ 24 --replace awk "${gawk}/bin/awk" \ 25 --replace printf "${coreutils}/bin/printf" 26''; 27 28 dontBuild = true; 29 30 doCheck = true; 31 32 nativeCheckInputs = [ bash ]; 33 34 # `#!/usr/bin/env` isn't okay for OfBorg 35 # Need external bash to run 36 checkPhase = '' 37 runHook preCheck 38 bash ./sample_head.sh -v --file README.md 39 runHook postCheck 40 ''; 41 42 installPhase = '' 43 runHook preInstall 44 mkdir -p $out/bin 45 mv optparse.bash $out/bin/ 46 mkdir -p $out/share/doc/optparse-bash 47 mv README.md sample_head.sh $out/share/doc/optparse-bash/ 48 runHook postInstall 49 ''; 50 51 # As example code, 52 # sample_head.sh shows how users can use opt-parse in their script, 53 # and its shebang (`/usr/bin/env bash`) should not be patched. 54 dontPatchShebangs = true; 55 56 meta = with lib; { 57 description = "A BASH wrapper for getopts, for simple command-line argument parsing"; 58 homepage = "https://github.com/nk412/optparse"; 59 license = licenses.mit; 60 platforms = platforms.all; 61 maintainers = with maintainers; [ ShamrockLee ]; 62 }; 63}