Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ fetchFromGitHub, fetchgit, fetchHex, rebar3WithPlugins, rebar3-nix, rebar3Relx
2, buildRebar3, writeScript, lib }:
3
4let
5 owner = "inaka";
6 repo = "elvis";
7in rebar3Relx rec {
8 releaseType = "escript";
9 # The package name "elvis" is already taken
10 pname = "elvis-erlang";
11 version = "1.1.0";
12 src = fetchFromGitHub {
13 inherit owner repo;
14 sha256 = "6vNxr3AYpFuXaIVH9bWw7K5KiF1swfI+CSI43RoMQEA=";
15 rev = version;
16 };
17 beamDeps = builtins.attrValues (import ./rebar-deps.nix {
18 inherit fetchHex fetchgit fetchFromGitHub;
19 builder = buildRebar3;
20 });
21 passthru.updateScript = writeScript "update.sh" ''
22 #!/usr/bin/env nix-shell
23 #!nix-shell -i bash -p bash common-updater-scripts git nix-prefetch-git gnutar gzip "rebar3WithPlugins {globalPlugins = [beamPackages.rebar3-nix];}"
24
25 set -euo pipefail
26
27 latest=$(list-git-tags | sort -V | tail -1)
28 if [ "$latest" != "${version}" ]; then
29 nixpkgs="$(git rev-parse --show-toplevel)"
30 nix_path="$nixpkgs/pkgs/development/beam-modules/elvis-erlang"
31 update-source-version elvis-erlang "$latest" --version-key=version --print-changes --file="$nix_path/default.nix"
32 tmpdir=$(mktemp -d)
33 cp -R $(nix-build $nixpkgs --no-out-link -A elvis-erlang.src)/* "$tmpdir"
34 (cd "$tmpdir" && HOME=. rebar3 nix lock -o "$nix_path/rebar-deps.nix")
35 else
36 echo "${repo} is already up-to-date"
37 fi
38 '';
39 meta = with lib; {
40 homepage = "https://github.com/inaka/elvis";
41 description = "Erlang Style Reviewer";
42 platforms = platforms.unix;
43 license = licenses.asl20;
44 maintainers = with lib.maintainers; [ dlesl ];
45 mainProgram = "elvis";
46 };
47}