2021-01-15 13:21:58 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, writeScript, nixosTests, common-updater-scripts
|
2020-11-06 01:38:18 +00:00
|
|
|
, coreutils, git, gnused, nix, nixfmt }:
|
2018-09-08 01:58:00 +01:00
|
|
|
|
2020-11-06 01:38:18 +00:00
|
|
|
let
|
|
|
|
owner = "scopatz";
|
|
|
|
repo = "nanorc";
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "nanorc";
|
2020-11-06 01:38:18 +00:00
|
|
|
version = "2020-10-10";
|
2018-09-08 01:58:00 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-11-06 01:38:18 +00:00
|
|
|
inherit owner repo;
|
|
|
|
rev = builtins.replaceStrings [ "-" ] [ "." ] version;
|
|
|
|
sha256 = "3B2nNFYkwYHCX6pQz/hMO/rnVqlCiw1BSNmGmJ6KCqE=";
|
2018-09-08 01:58:00 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/share
|
|
|
|
|
|
|
|
install *.nanorc $out/share/
|
|
|
|
'';
|
|
|
|
|
2020-11-06 01:38:18 +00:00
|
|
|
passthru.updateScript = writeScript "update.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
set -o errexit
|
|
|
|
PATH=${
|
2021-01-15 13:21:58 +00:00
|
|
|
lib.makeBinPath [
|
2020-11-06 01:38:18 +00:00
|
|
|
common-updater-scripts
|
|
|
|
coreutils
|
|
|
|
git
|
|
|
|
gnused
|
|
|
|
nix
|
|
|
|
nixfmt
|
|
|
|
]
|
|
|
|
}
|
|
|
|
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"' | sed 's|\\.|-|g')"
|
|
|
|
latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags git@github.com:${owner}/${repo} '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3)"
|
|
|
|
if [ "$oldVersion" != "$latestTag" ]; then
|
|
|
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
|
|
default_nix="$nixpkgs/pkgs/applications/editors/nano/nanorc/default.nix"
|
|
|
|
newTag=$(echo $latestTag | sed 's|\.|-|g')
|
|
|
|
update-source-version ${pname} "$newTag" --version-key=version --print-changes
|
|
|
|
nixfmt "$default_nix"
|
|
|
|
else
|
|
|
|
echo "${pname} is already up-to-date"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2018-09-08 01:58:00 +01:00
|
|
|
meta = {
|
|
|
|
description = "Improved Nano Syntax Highlighting Files";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/scopatz/nanorc";
|
2021-01-15 13:21:58 +00:00
|
|
|
license = lib.licenses.gpl3;
|
|
|
|
maintainers = with lib.maintainers; [ nequissimus ];
|
|
|
|
platforms = lib.platforms.all;
|
2018-09-08 01:58:00 +01:00
|
|
|
};
|
|
|
|
}
|