nixos-configuration/pkgs/by-name/ra/ranger-git/package.nix

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 = "b31db0f638118c103a35be5a57d1a0f3609838d6";
hash = "sha256-ksWlopkqD/98hwVspIRIEGCN/L/OuVlVyXftfza4LhI=";
};
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";
};
}];
};
};
})