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