1 { lib, stdenv, fetchurl, fetchFromGitHub, ncurses, texinfo, writeScript
2 , common-updater-scripts, git, nix, nixfmt-classic, coreutils, gnused
3 , callPackage, file ? null, gettext ? null, enableNls ? true, enableTiny ? false
6 assert enableNls -> (gettext != null);
9 nixSyntaxHighlight = fetchFromGitHub {
12 rev = "bf8d898efaa10dce3f7972ff765b58c353b4b4ab";
13 hash = "sha256-1tJV7F+iwMPRV6FgnbTw+5m7vMhgaeXftYkr9GPR4xw=";
16 in stdenv.mkDerivation rec {
21 url = "mirror://gnu/nano/${pname}-${version}.tar.xz";
22 hash = "sha256-1a0H3YYvrK4DBRxUxlNeVMftdAcxh4P8rRrS1wdv/+s=";
25 nativeBuildInputs = [ texinfo ] ++ lib.optional enableNls gettext;
26 buildInputs = [ ncurses ] ++ lib.optional (!enableTiny) file;
28 outputs = [ "out" "info" ];
32 (lib.enableFeature enableNls "nls")
33 (lib.enableFeature enableTiny "tiny")
36 postInstall = if enableTiny then
39 cp ${nixSyntaxHighlight}/nix.nanorc $out/share/nano/
42 enableParallelBuilding = true;
45 tests = { expect = callPackage ./test-with-expect.nix { }; };
47 updateScript = writeScript "update.sh" ''
52 common-updater-scripts
61 oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
62 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')"
64 if [ ! "$oldVersion" = "$latestTag" ]; then
65 update-source-version ${pname} "$latestTag" --version-key=version --print-changes
66 nixpkgs="$(git rev-parse --show-toplevel)"
67 default_nix="$nixpkgs/pkgs/applications/editors/nano/default.nix"
70 echo "${pname} is already up-to-date"
76 homepage = "https://www.nano-editor.org/";
77 description = "Small, user-friendly console text editor";
78 license = licenses.gpl3Plus;
79 maintainers = with maintainers; [ joachifm nequissimus ];
80 platforms = platforms.all;