@@ -1,10 +1,6 @@
1−{ stdenv, fetchurl, fetchFromGitHub
2−, ncurses
3−, texinfo
4−, gettext ? null
5−, enableNls ? true
6−, enableTiny ? false
7−}:
1+{ stdenv, fetchurl, fetchFromGitHub, ncurses, texinfo, writeScript
2+, common-updater-scripts, git, nix, nixfmt, coreutils, gnused, nixosTests
3+, gettext ? null, enableNls ? true, enableTiny ? false }:
84
95assert enableNls -> (gettext != null);
106
@@ -44,13 +40,42 @@ in stdenv.mkDerivation rec {
4440
4541 enableParallelBuilding = true;
4642
43+ passthru = {
44+ tests = { inherit (nixosTests) nano; };
45+
46+ updateScript = writeScript "update.sh" ''
47+ #!${stdenv.shell}
48+ set -o errexit
49+ PATH=${
50+ stdenv.lib.makeBinPath [
51+ common-updater-scripts
52+ git
53+ nixfmt
54+ nix
55+ coreutils
56+ gnused
57+ ]
58+ }
59+
60+ oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
61+ 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')"
62+
63+ if [ ! "$oldVersion" = "$latestTag" ]; then
64+ update-source-version ${pname} "$latestTag" --version-key=version --print-changes
65+ nixpkgs="$(git rev-parse --show-toplevel)"
66+ default_nix="$nixpkgs/pkgs/applications/editors/nano/default.nix"
67+ nixfmt "$default_nix"
68+ else
69+ echo "${pname} is already up-to-date"
70+ fi
71+ '';
72+ };
73+
4774 meta = {
4875 homepage = "https://www.nano-editor.org/";
4976 description = "A small, user-friendly console text editor";
5077 license = licenses.gpl3Plus;
51− maintainers = with maintainers; [
52− joachifm
53− ];
78+ maintainers = with maintainers; [ joachifm nequissimus ];
5479 platforms = platforms.all;
5580 };
5681}