nano: Add update script
This commit is contained in:
parent
bb15fa7427
commit
701df1a3dc
@ -1,10 +1,6 @@
|
||||
{ stdenv, fetchurl, fetchFromGitHub
|
||||
, ncurses
|
||||
, texinfo
|
||||
, gettext ? null
|
||||
, enableNls ? true
|
||||
, enableTiny ? false
|
||||
}:
|
||||
{ stdenv, fetchurl, fetchFromGitHub, ncurses, texinfo, writeScript
|
||||
, common-updater-scripts, git, nix, nixfmt, coreutils, gnused, gettext ? null
|
||||
, enableNls ? true, enableTiny ? false }:
|
||||
|
||||
assert enableNls -> (gettext != null);
|
||||
|
||||
@ -44,13 +40,40 @@ in stdenv.mkDerivation rec {
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru = {
|
||||
updateScript = writeScript "update.sh" ''
|
||||
#!${stdenv.shell}
|
||||
set -o errexit
|
||||
PATH=${
|
||||
stdenv.lib.makeBinPath [
|
||||
common-updater-scripts
|
||||
git
|
||||
nixfmt
|
||||
nix
|
||||
coreutils
|
||||
gnused
|
||||
]
|
||||
}
|
||||
|
||||
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
|
||||
latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags git://git.savannah.gnu.org/nano.git '*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')"
|
||||
|
||||
if [ ! "$oldVersion" = "$latestTag" ]; then
|
||||
update-source-version ${pname} "$latestTag" --version-key=version --print-changes
|
||||
nixpkgs="$(git rev-parse --show-toplevel)"
|
||||
default_nix="$nixpkgs/pkgs/applications/editors/nano/default.nix"
|
||||
nixfmt "$default_nix"
|
||||
else
|
||||
echo "${pname} is already up-to-date"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://www.nano-editor.org/";
|
||||
description = "A small, user-friendly console text editor";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = with maintainers; [
|
||||
joachifm
|
||||
];
|
||||
maintainers = with maintainers; [ joachifm ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user