nano: Add update script
This commit is contained in:
parent
bb15fa7427
commit
701df1a3dc
@ -1,10 +1,6 @@
|
|||||||
{ stdenv, fetchurl, fetchFromGitHub
|
{ stdenv, fetchurl, fetchFromGitHub, ncurses, texinfo, writeScript
|
||||||
, ncurses
|
, common-updater-scripts, git, nix, nixfmt, coreutils, gnused, gettext ? null
|
||||||
, texinfo
|
, enableNls ? true, enableTiny ? false }:
|
||||||
, gettext ? null
|
|
||||||
, enableNls ? true
|
|
||||||
, enableTiny ? false
|
|
||||||
}:
|
|
||||||
|
|
||||||
assert enableNls -> (gettext != null);
|
assert enableNls -> (gettext != null);
|
||||||
|
|
||||||
@ -44,13 +40,40 @@ in stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
enableParallelBuilding = true;
|
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 = {
|
meta = {
|
||||||
homepage = "https://www.nano-editor.org/";
|
homepage = "https://www.nano-editor.org/";
|
||||||
description = "A small, user-friendly console text editor";
|
description = "A small, user-friendly console text editor";
|
||||||
license = licenses.gpl3Plus;
|
license = licenses.gpl3Plus;
|
||||||
maintainers = with maintainers; [
|
maintainers = with maintainers; [ joachifm ];
|
||||||
joachifm
|
|
||||||
];
|
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user