pkgs/ranger-git: add updater, update

This commit is contained in:
Wroclaw 2025-04-29 23:51:18 +02:00
parent 4e9be713ee
commit 09cd559534

View file

@ -1,18 +1,32 @@
{
ranger,
den-http-get-updater,
fetchFromGitHub,
fetchpatch,
lib,
python3Packages,
}:
ranger.overrideAttrs (selfAttrs: superAttrs: {
version = "git";
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 = "c7777d558d5b69843b21f986e9af1af311c83887";
hash = "sha256-DTVoEfc4dAaBTDLFujvWIYj5KHL89YknUiinIs9Rkeg=";
rev = "b31db0f638118c103a35be5a57d1a0f3609838d6";
hash = "sha256-ksWlopkqD/98hwVspIRIEGCN/L/OuVlVyXftfza4LhI=";
};
patches = superAttrs.patches or [] ++ [
(fetchpatch {
url = "https://github.com/ranger/ranger/commit/efb5d0410083ae218996eaa2447d828794229ecf.patch";
hash = "sha256-q/3pbnpnCoEoPY76v63OHtGrDQdFQBEZTFG6XNAeJ4w=";
})
];
propagatedBuildInputs = with python3Packages; [
# required for test suite, it's being ran during package build for some reason
flake8
@ -20,4 +34,22 @@ ranger.overrideAttrs (selfAttrs: superAttrs: {
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";
};
}];
};
};
})