Files
nixpkgs/pkgs/tools/misc/bat-extras/buildBatExtrasPkg.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

78 lines
1.3 KiB
Nix

{
lib,
stdenv,
core,
bash,
bat,
fish,
getconf,
makeWrapper,
zsh,
}:
let
cleanArgs = lib.flip removeAttrs [
"dependencies"
"meta"
];
in
{
name,
dependencies,
meta ? { },
...
}@args:
stdenv.mkDerivation (
finalAttrs:
cleanArgs args
// {
inherit (core) version;
src = core;
nativeBuildInputs = [ makeWrapper ];
# Make the dependencies available to the tests.
buildInputs = dependencies;
# Patch shebangs now because our tests rely on them
postPatch = ''
patchShebangs --host bin/${name}
'';
dontConfigure = true;
dontBuild = true; # we've already built
doCheck = true;
nativeCheckInputs = [
bat
bash
fish
zsh
]
++ (lib.optionals stdenv.hostPlatform.isDarwin [ getconf ]);
checkPhase = ''
runHook preCheck
bash ./test.sh --compiled --suite ${name}
runHook postCheck
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -p bin/${name} $out/bin/${name}
''
+ lib.optionalString (dependencies != [ ]) ''
wrapProgram $out/bin/${name} \
--prefix PATH : ${lib.makeBinPath dependencies}
''
+ ''
runHook postInstall
'';
# We already patched
dontPatchShebangs = true;
meta = core.meta // { mainProgram = name; } // meta;
}
)