overlays.withUnpacked

This commit is contained in:
2025-04-24 20:07:46 +02:00
parent cf228eda6e
commit 1316943a0a

View File

@@ -92,6 +92,55 @@ let
}
);
# https://github.com/NixOS/nixpkgs/pull/392938
# usage: nix-build ./dev.nix -A <package>.src.unpacked
overlays.withUnpacked = final: prev: {
fetchurl = (lib.mirrorFunctionArgs prev.fetchurl) (
args:
let
fetched = prev.fetchurl args;
in
fetched.overrideAttrs (old: {
passthru = {
unpacked =
if old.outputHashMode == "recursive" then
fetched
else
prev.srcOnly {
name = "${fetched.name}-unpacked";
src = fetched;
stdenv = prev.stdenvNoCC;
inherit (old) preferLocalBuild;
};
} // old.passthru or { };
})
);
fetchgit = (lib.mirrorFunctionArgs prev.fetchgit) (
args:
(prev.fetchgit args).overrideAttrs (old: {
passthru = {
unpacked = prev.fetchgit args;
} // old.passthru or { };
})
);
fetchhg = (lib.mirrorFunctionArgs prev.fetchhg) (
args:
(prev.fetchhg args).overrideAttrs (old: {
passthru = {
unpacked = prev.fetchhg args;
} // old.passthru or { };
})
);
fetchsvn = (lib.mirrorFunctionArgs prev.fetchsvn) (
args:
(prev.fetchsvn args).overrideAttrs (old: {
passthru = {
unpacked = prev.fetchsvn args;
} // old.passthru or { };
})
);
};
# usage: nix-build ./dev.nix -A <package>.shellcheck
overlays.withShellCheck = mkDerivationOverlay (
final: prev: prevStdenv: finalAttrs: prevAttrs:
@@ -361,7 +410,7 @@ let
mkPkgs =
{
config ? { },
# overlays ? [ ],
# overlays ? [ ],
}:
import prev.path {
# if we don't specify overlays then impure.nix will do its thing
@@ -385,6 +434,7 @@ in
overlays.withShellCheck
overlays.withDebug
overlays.withInvalidateFetcherByDrvHash
overlays.withUnpacked
overlays.withTwostagePythonBuildPassthru
overlays.withPytestCheckHooks
overlays.toplevelCudaRocmPkgs