2021-01-15 14:21:58 +01:00
|
|
|
{ lib, stdenv, fetchurl, fetchFromGitHub, ncurses, texinfo, writeScript
|
2020-11-16 19:59:36 +01:00
|
|
|
, common-updater-scripts, git, nix, nixfmt, coreutils, gnused, nixosTests
|
|
|
|
, gettext ? null, enableNls ? true, enableTiny ? false }:
|
2015-03-25 23:21:44 +01:00
|
|
|
|
|
|
|
assert enableNls -> (gettext != null);
|
|
|
|
|
2021-01-15 14:21:58 +01:00
|
|
|
with lib;
|
2010-07-28 13:55:54 +02:00
|
|
|
|
2017-01-18 12:05:30 +01:00
|
|
|
let
|
|
|
|
nixSyntaxHighlight = fetchFromGitHub {
|
|
|
|
owner = "seitz";
|
|
|
|
repo = "nanonix";
|
2018-09-09 23:16:07 +02:00
|
|
|
rev = "bf8d898efaa10dce3f7972ff765b58c353b4b4ab";
|
|
|
|
sha256 = "0773s5iz8aw9npgyasb0r2ybp6gvy2s9sq51az8w7h52bzn5blnn";
|
2017-01-18 12:05:30 +01:00
|
|
|
};
|
2017-03-19 22:36:48 +01:00
|
|
|
|
2017-01-18 12:05:30 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "nano";
|
2021-10-07 04:32:41 +02:00
|
|
|
version = "5.9";
|
2017-04-05 03:04:39 +02:00
|
|
|
|
2004-10-06 15:17:06 +02:00
|
|
|
src = fetchurl {
|
2019-08-15 14:41:18 +02:00
|
|
|
url = "mirror://gnu/nano/${pname}-${version}.tar.xz";
|
2021-10-07 04:32:41 +02:00
|
|
|
sha256 = "dX24zaS7KHNZnkd4OvRj47VHpiewyrsw6nv3H7TCSTc=";
|
2004-10-06 15:17:06 +02:00
|
|
|
};
|
2017-03-19 22:36:48 +01:00
|
|
|
|
2016-03-07 19:34:44 +01:00
|
|
|
nativeBuildInputs = [ texinfo ] ++ optional enableNls gettext;
|
|
|
|
buildInputs = [ ncurses ];
|
2017-04-05 03:04:39 +02:00
|
|
|
|
2016-02-28 03:01:34 +01:00
|
|
|
outputs = [ "out" "info" ];
|
2017-04-05 03:04:39 +02:00
|
|
|
|
2018-07-25 23:44:21 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--sysconfdir=/etc"
|
2021-01-15 14:21:58 +01:00
|
|
|
(lib.enableFeature enableNls "nls")
|
|
|
|
(lib.enableFeature enableTiny "tiny")
|
2018-07-25 23:44:21 +02:00
|
|
|
];
|
2015-03-27 20:05:19 +01:00
|
|
|
|
2017-01-18 12:05:30 +01:00
|
|
|
postInstall = ''
|
|
|
|
cp ${nixSyntaxHighlight}/nix.nanorc $out/share/nano/
|
|
|
|
'';
|
|
|
|
|
2017-11-29 02:22:42 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-11-16 18:56:38 +01:00
|
|
|
passthru = {
|
2020-11-16 19:59:36 +01:00
|
|
|
tests = { inherit (nixosTests) nano; };
|
|
|
|
|
2020-11-16 18:56:38 +01:00
|
|
|
updateScript = writeScript "update.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
set -o errexit
|
|
|
|
PATH=${
|
2021-01-15 14:21:58 +01:00
|
|
|
lib.makeBinPath [
|
2020-11-16 18:56:38 +01:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2015-03-25 23:21:44 +01:00
|
|
|
meta = {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.nano-editor.org/";
|
2008-02-18 15:59:48 +01:00
|
|
|
description = "A small, user-friendly console text editor";
|
2015-03-25 23:17:51 +01:00
|
|
|
license = licenses.gpl3Plus;
|
2020-11-16 19:59:36 +01:00
|
|
|
maintainers = with maintainers; [ joachifm nequissimus ];
|
2015-03-25 23:17:51 +01:00
|
|
|
platforms = platforms.all;
|
2008-01-30 20:49:42 +01:00
|
|
|
};
|
2015-03-25 23:17:51 +01:00
|
|
|
}
|