nixos-configuration/pkgs/by-name/ra/ranger-git/package.nix
2025-05-22 02:55:52 +02:00

55 lines
1.5 KiB
Nix

{
ranger,
den-http-get-updater,
fetchFromGitHub,
fetchpatch,
lib,
python3Packages,
}:
ranger.overrideAttrs (selfAttrs: superAttrs: {
pname = "ranger";
version = "0-unsatble-git-${lib.substring 0 7 selfAttrs.src.rev}";
name = "${selfAttrs.pname}-${selfAttrs.version}";
src = fetchFromGitHub {
owner = "ranger";
repo = "ranger";
rev = "fa812718c586cfc12c1a4b6237877c79f8b4a521";
hash = "sha256-husMv1RxyvvU1X6C6BQn8Lly63Z40Gwr/k7NZX8DNIw=";
};
patches = superAttrs.patches or [] ++ [
(fetchpatch {
url = "https://github.com/ranger/ranger/commit/c6bd9e051e8429fb8dcf16acf6ae9d34f14ecb24.patch";
hash = "sha256-NOGL51Ctv0Rmo+lbUY8awimo/9K007mPfRUnYBihRNQ=";
})
];
propagatedBuildInputs = with python3Packages; [
# required for test suite, it's being ran during package build for some reason
flake8
pylint
pytest
setuptools
] ++ superAttrs.propagatedBuildInputs;
passthru = superAttrs.passthru // {
updateScript = den-http-get-updater {
fileLocation = builtins.toString ./package.nix;
previousVersion = selfAttrs.src.rev;
versionUrl = "https://api.github.com/repos/ranger/ranger/commits";
contentParser = "jq -rc '.[0].sha' <<< \"$newVersion\"";
prefetchList = [{
unpack = true;
previousHash = selfAttrs.src.outputHash;
prefetchUrlLocation = {
# FIXME: this is ugly
file = ../../../../outputs.nix;
attrpath = "updateList.packages/ranger-git.src.url";
};
}];
};
};
})