mailcap: add update script
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
{ lib, stdenv, fetchurl }:
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
|
||||
# updater
|
||||
, git
|
||||
, coreutils
|
||||
, gawk
|
||||
, gnused
|
||||
, writeScript
|
||||
, nix-update
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "mailcap";
|
||||
@@ -22,6 +33,17 @@ stdenv.mkDerivation rec {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateScript = writeScript "update-mailcap" ''
|
||||
export PATH=${lib.makeBinPath [ git coreutils gawk gnused nix-update ]}:$PATH
|
||||
VERSION="$(git ls-remote --tags --sort="v:refname" https://pagure.io/mailcap.git | \
|
||||
awk '{ print $2 }' | \
|
||||
grep "refs/tags/r" | \
|
||||
sed -E -e "s,refs/tags/r(.*)$,\1," -e "s/-/./g" | \
|
||||
sort --version-sort --reverse | \
|
||||
head -n1)"
|
||||
exec nix-update --version "$VERSION" "$@"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Helper application and MIME type associations for file types";
|
||||
homepage = "https://pagure.io/mailcap";
|
||||
|
||||
Reference in New Issue
Block a user