emacs: Add custom elpa fetcher

Elpa only serves the latest version of a given package uncompressed.
Once that release is no longer the latest & greatest it gets archived and compressed
meaning that both the URL and the hash changes.

To work around this issue we fall back to the URL with the .lz suffix and if that's the
one we downloaded we uncompress the file to ensure the hash matches regardless of compression.
This commit is contained in:
adisbladis 2021-08-06 16:25:38 -05:00 committed by Rasmus Précenth
parent d5aadbefd6
commit 66966119f3
No known key found for this signature in database
GPG Key ID: E0D6F12345AD5641

View File

@ -0,0 +1,21 @@
# Elpa only serves the latest version of a given package uncompressed.
# Once that release is no longer the latest & greatest it gets archived and compressed
# meaning that both the URL and the hash changes.
#
# To work around this issue we fall back to the URL with the .lz suffix and if that's the
# one we downloaded we uncompress the file to ensure the hash matches regardless of compression.
{ fetchurl, lzip }:
{ url, ... }@args: fetchurl ((removeAttrs args [ "url" ]) // {
urls = [
url
(url + ".lz")
];
postFetch = ''
if [[ $url == *.lz ]]; then
${lzip}/bin/lzip -c -d $out > uncompressed
mv uncompressed $out
fi
'';
})