Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, rustPlatform 3, fetchFromGitHub 4, installShellFiles 5, fetchpatch 6}: 7 8rustPlatform.buildRustPackage rec { 9 pname = "argc"; 10 version = "1.2.0"; 11 12 src = fetchFromGitHub { 13 owner = "sigoden"; 14 repo = pname; 15 rev = "v${version}"; 16 hash = "sha256-sJINgB1cGtqLPl2RmwgChwnSrJL5TWu5AU6hfLhvmE4="; 17 }; 18 19 cargoHash = "sha256-HrmqARhEKlAjrW6QieVEEKkfda6R69oLcG/6fd3rvWM="; 20 21 patches = [ 22 # tests make the assumption that the compiled binary is in target/debug, 23 # which fails since `cargoBuildHook` uses `--release` and `--target` 24 (fetchpatch { 25 name = "fix-tests-with-release-or-target"; 26 url = "https://github.com/sigoden/argc/commit/a4f2db46e27cad14d3251ef0b25b6f2ea9e70f0e.patch"; 27 hash = "sha256-bsHSo11/RVstyzdg0BKFhjuWUTLdKO4qsWIOjTTi+HQ="; 28 }) 29 ]; 30 31 nativeBuildInputs = [ installShellFiles ]; 32 33 postInstall = '' 34 installShellCompletion --cmd argc \ 35 --bash <($out/bin/argc --argc-completions bash) \ 36 --fish <($out/bin/argc --argc-completions fish) \ 37 --zsh <($out/bin/argc --argc-completions zsh) 38 ''; 39 40 meta = with lib; { 41 description = "A command-line options, arguments and sub-commands parser for bash"; 42 homepage = "https://github.com/sigoden/argc"; 43 changelog = "https://github.com/sigoden/argc/releases/tag/v${version}"; 44 license = with licenses; [ mit /* or */ asl20 ]; 45 maintainers = with maintainers; [ figsoda ]; 46 }; 47}