gnomeExtensions: improve override mechanism

The reduced reduncancy should help us avoid making some copy-paste errors,
as happened previously. Also, increased ergonomics.
This commit is contained in:
piegames 2021-11-22 01:51:52 +01:00
parent 4a82bca530
commit bc1f025afb

View File

@ -3,31 +3,36 @@
, gjs
, xprop
}:
let
# Helper method to reduce redundancy
patchExtension = name: override: super: (super // {
${name} = super.${name}.overrideAttrs override;
});
in
# A set of overrides for automatically packaged extensions that require some small fixes.
# The input must be an attribute set with the extensions' UUIDs as keys and the extension
# derivations as values. Output is the same, but with patches applied.
#
# Note that all source patches refer to the built extension as published on extensions.gnome.org, and not
# the upstream repository's sources.
super: super // {
"caffeine@patapon.info" = super."caffeine@patapon.info".overrideAttrs (old: {
super: lib.trivial.pipe super [
(patchExtension "caffeine@patapon.info" (old: {
meta.maintainers = with lib.maintainers; [ eperuffo ];
});
}))
"dash-to-dock@micxgx.gmail.com" = super."dash-to-dock@micxgx.gmail.com".overrideAttrs (old: {
(patchExtension "dash-to-dock@micxgx.gmail.com" (old: {
meta.maintainers = with lib.maintainers; [ eperuffo jtojnar rhoriguchi ];
});
}))
"display-brightness-ddcutil@themightydeity.github.com" = super."display-brightness-ddcutil@themightydeity.github.com".overrideAttrs (old: {
(patchExtension "display-brightness-ddcutil@themightydeity.github.com" (old: {
# Has a hard-coded path to a run-time dependency
# https://github.com/NixOS/nixpkgs/issues/136111
postPatch = ''
substituteInPlace "extension.js" --replace "/usr/bin/ddcutil" "${ddcutil}/bin/ddcutil"
'';
});
}))
"gnome-shell-screenshot@ttll.de" = super."gnome-shell-screenshot@ttll.de".overrideAttrs (old: {
(patchExtension "gnome-shell-screenshot@ttll.de" (old: {
# Requires gjs
# https://github.com/NixOS/nixpkgs/issues/136112
postPatch = ''
@ -35,12 +40,11 @@ super: super // {
substituteInPlace $file --replace "gjs" "${gjs}/bin/gjs"
done
'';
});
}))
"unite@hardpixel.eu" = super."unite@hardpixel.eu".overrideAttrs (old: {
(patchExtension "unite@hardpixel.eu" (old: {
buildInputs = [ xprop ];
meta.maintainers = with lib.maintainers; [ rhoriguchi ];
});
}
}))
]