gpodder-adaptive: 3.11.1+1 -> 3.11.2+1 and add an updateScript

This commit is contained in:
Colin 2023-09-24 08:16:19 +00:00
parent 07ee54af3a
commit 457197f85b
2 changed files with 39 additions and 18 deletions

View File

@ -4,6 +4,8 @@
# - this is marginally the case with schemes like `github:nixos/nixpkgs`.
# - given the *existing* `git+https://` scheme, i propose expressing github URLs similarly:
# - `github+https://github.com/nixos/nixpkgs/tree/nixos-22.11`
# - this would allow for the same optimizations as today's `github:nixos/nixpkgs`, but without obscuring the source.
# a code reader could view the source being referenced simply by clicking the https:// portion of that URI.
# - need some way to apply local patches to inputs.
#
#
@ -253,6 +255,19 @@
# let the user handle that edge case by re-running this whole command
nixos-rebuild --flake '.#${host}' ${action} --target-host colin@${addr} --use-remote-sudo $@
'';
mkUpdater = attrPath: {
type = "app";
program = let
pkg = pkgs.lib.getAttrFromPath attrPath pkgs;
strAttrPath = pkgs.lib.concatStringsSep "." attrPath;
in builtins.toString (pkgs.writeShellScript "update-${pkg.name}" ''
export UPDATE_NIX_NAME=${pkg.name}
export UPDATE_NIX_PNAME=${pkg.pname}
export UPDATE_NIX_OLD_VERSION=${pkg.version}
export UPDATE_NIX_ATTR_PATH=${strAttrPath}
${pkgs.lib.escapeShellArgs pkg.updateScript.command}
'');
};
in {
help = {
type = "app";
@ -276,20 +291,8 @@
program = "${pkgs.feeds.updateScript}";
};
update-bpc = {
# proof-of-concept updater like in nixpkgs
# TODO: extend this to update all my packages
type = "app";
program = let
pkg = pkgs.firefox-extensions.unwrapped.bypass-paywalls-clean;
in builtins.toString (pkgs.writeShellScript "update-bpc" ''
export UPDATE_NIX_NAME=${pkg.name}
export UPDATE_NIX_PNAME=${pkg.pname}
export UPDATE_NIX_OLD_VERSION=${pkg.version}
export UPDATE_NIX_ATTR_PATH=firefox-extensions.unwrapped.bypass-paywalls-clean
${pkgs.lib.escapeShellArgs pkg.updateScript.command}
'');
};
update-bpc = mkUpdater [ "firefox-extensions" "unwrapped" "bypass-paywalls-clean" ];
update-gpodder-adaptive = mkUpdater [ "gpodder-adaptive" ];
init-feed = {
type = "app";

View File

@ -1,15 +1,18 @@
{ gpodder
, fetchFromGitHub
, gitUpdater
, libhandy
}:
gpodder.overridePythonAttrs (upstream: rec {
let
self = gpodder.overridePythonAttrs (upstream: rec {
pname = "gpodder-adaptive";
version = "3.11.1+1";
version = "3.11.2+1";
src = fetchFromGitHub {
owner = "gpodder";
repo = "gpodder";
rev = "adaptive/${version}";
hash = "sha256-pn5sh8CLV2Civ26PL3rrkkUdoobu7SIHXmWKCZucBhw=";
hash = "sha256-DJ5/9PFRc0uVREy4JmFVweiSGtXZ8wyb+XaNmjI5/k4=";
};
# nixpkgs `gpodder` uses the `format = "other"` Makefile build flow.
@ -30,4 +33,19 @@ gpodder.overridePythonAttrs (upstream: rec {
buildInputs = upstream.buildInputs ++ [
libhandy
];
})
passthru.updateScript = gitUpdater {
rev-prefix = "adaptive/";
};
});
in self // {
meta = self.meta // {
# ensure nix thinks the canonical position of this derivation is inside my own repo,
# not upstream nixpkgs repo. this ensures that the updateScript can patch the version/hash
# of the right file. meta.position gets overwritten if set in overrideAttrs, hence this
# manual `//` hack
position = let
pos = builtins.unsafeGetAttrPos "updateScript" self.passthru;
in "${pos.file}:${builtins.toString pos.line}";
};
}