Files
nixpkgs/pkgs/by-name/ar/argc/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

75 lines
1.8 KiB
Nix

{
lib,
buildPackages,
pkgsCross,
rustPlatform,
stdenv,
glibcLocales,
fetchFromGitHub,
installShellFiles,
}:
let
canExecuteHost = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
in
rustPlatform.buildRustPackage rec {
pname = "argc";
version = "1.23.0";
src = fetchFromGitHub {
owner = "sigoden";
repo = "argc";
rev = "v${version}";
hash = "sha256-in2ymxiSZbs3wZwo/aKfu11x8SLx4OHOoa/tVxr3FyM=";
};
cargoHash = "sha256-2UmI9CMa130T7ML9iVNQ8Zh/stiFg05eBtF1sprmwk8=";
nativeBuildInputs = [ installShellFiles ] ++ lib.optional (!canExecuteHost) buildPackages.argc;
postInstall = ''
ARGC=${if canExecuteHost then ''''${!outputBin}/bin/argc'' else "argc"}
installShellCompletion --cmd argc \
--bash <("$ARGC" --argc-completions bash) \
--fish <("$ARGC" --argc-completions fish) \
--zsh <("$ARGC" --argc-completions zsh)
'';
disallowedReferences = lib.optional (!canExecuteHost) buildPackages.argc;
env = {
LANG = "C.UTF-8";
}
// lib.optionalAttrs (glibcLocales != null) {
LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive";
};
passthru = {
tests = {
cross =
(
if stdenv.hostPlatform.isDarwin then
if stdenv.hostPlatform.isAarch64 then pkgsCross.x86_64-darwin else pkgsCross.aarch64-darwin
else if stdenv.hostPlatform.isAarch64 then
pkgsCross.gnu64
else
pkgsCross.aarch64-multiplatform
).argc;
};
};
meta = {
description = "Command-line options, arguments and sub-commands parser for bash";
mainProgram = "argc";
homepage = "https://github.com/sigoden/argc";
changelog = "https://github.com/sigoden/argc/releases/tag/v${version}";
license = with lib.licenses; [
mit
# or
asl20
];
maintainers = with lib.maintainers; [ figsoda ];
};
}