nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 81 lines 2.1 kB view raw
1{ 2 lib, 3 buildPackages, 4 pkgsCross, 5 rustPlatform, 6 stdenv, 7 glibcLocales, 8 fetchFromGitHub, 9 installShellFiles, 10 versionCheckHook, 11 nix-update-script, 12}: 13 14let 15 canExecuteHost = stdenv.buildPlatform.canExecute stdenv.hostPlatform; 16in 17rustPlatform.buildRustPackage (finalAttrs: { 18 pname = "argc"; 19 version = "1.23.0"; 20 21 src = fetchFromGitHub { 22 owner = "sigoden"; 23 repo = "argc"; 24 tag = "v${finalAttrs.version}"; 25 hash = "sha256-in2ymxiSZbs3wZwo/aKfu11x8SLx4OHOoa/tVxr3FyM="; 26 }; 27 28 cargoHash = "sha256-2UmI9CMa130T7ML9iVNQ8Zh/stiFg05eBtF1sprmwk8="; 29 30 nativeBuildInputs = [ installShellFiles ] ++ lib.optional (!canExecuteHost) buildPackages.argc; 31 32 postInstall = '' 33 ARGC=${if canExecuteHost then "\${!outputBin}/bin/argc" else "argc"} 34 35 installShellCompletion --cmd argc \ 36 --bash <("$ARGC" --argc-completions bash) \ 37 --fish <("$ARGC" --argc-completions fish) \ 38 --zsh <("$ARGC" --argc-completions zsh) 39 ''; 40 41 disallowedReferences = lib.optional (!canExecuteHost) buildPackages.argc; 42 43 env = { 44 LANG = "C.UTF-8"; 45 } 46 // lib.optionalAttrs (glibcLocales != null) { 47 LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; 48 }; 49 50 doInstallCheck = true; 51 nativeInstallCheckInputs = [ versionCheckHook ]; 52 versionCheckProgramArg = "--argc-version"; 53 54 passthru = { 55 updateScript = nix-update-script { }; 56 tests = { 57 cross = 58 ( 59 if stdenv.hostPlatform.isDarwin then 60 if stdenv.hostPlatform.isAarch64 then pkgsCross.x86_64-darwin else pkgsCross.aarch64-darwin 61 else if stdenv.hostPlatform.isAarch64 then 62 pkgsCross.gnu64 63 else 64 pkgsCross.aarch64-multiplatform 65 ).argc; 66 }; 67 }; 68 69 meta = { 70 description = "Command-line options, arguments and sub-commands parser for bash"; 71 mainProgram = "argc"; 72 homepage = "https://github.com/sigoden/argc"; 73 changelog = "https://github.com/sigoden/argc/releases/tag/v${finalAttrs.version}"; 74 license = with lib.licenses; [ 75 mit 76 # or 77 asl20 78 ]; 79 maintainers = [ lib.maintainers.progrm_jarvis ]; 80 }; 81})