Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 79 lines 2.7 kB view raw
1{ fetchFromGitHub, fetchgit, fetchHex, rebar3Relx, buildRebar3, rebar3-proper 2, stdenv, writeScript, lib, erlang }: 3let 4 version = "0.46.2"; 5 owner = "erlang-ls"; 6 repo = "erlang_ls"; 7 deps = import ./rebar-deps.nix { 8 inherit fetchHex fetchFromGitHub fetchgit; 9 builder = buildRebar3; 10 overrides = (self: super: { 11 proper = super.proper.overrideAttrs (_: { 12 configurePhase = "true"; 13 }); 14 redbug = super.redbug.overrideAttrs (_: { 15 patchPhase = '' 16 substituteInPlace rebar.config --replace ", warnings_as_errors" "" 17 ''; 18 }); 19 }); 20 }; 21in 22rebar3Relx { 23 pname = "erlang-ls"; 24 inherit version; 25 src = fetchFromGitHub { 26 inherit owner repo; 27 sha256 = "sha256-J0Qa8s8v/KT4/Jaj9JYsfvzviMUx8FnX0nMoeH8bkB8="; 28 rev = version; 29 }; 30 releaseType = "escript"; 31 beamDeps = builtins.attrValues deps; 32 33 # https://github.com/erlang-ls/erlang_ls/issues/1429 34 postPatch = '' 35 rm apps/els_lsp/test/els_diagnostics_SUITE.erl 36 ''; 37 38 buildPlugins = [ rebar3-proper ]; 39 buildPhase = "HOME=. make"; 40 # based on https://github.com/erlang-ls/erlang_ls/blob/main/.github/workflows/build.yml 41 # these tests are excessively long and we should probably skip them 42 checkPhase = '' 43 HOME=. epmd -daemon 44 HOME=. rebar3 ct 45 HOME=. rebar3 proper --constraint_tries 100 46 ''; 47 # tests seem to be a bit flaky on darwin, skip them for now 48 doCheck = !stdenv.isDarwin; 49 installPhase = '' 50 mkdir -p $out/bin 51 cp _build/default/bin/erlang_ls $out/bin/ 52 cp _build/dap/bin/els_dap $out/bin/ 53 ''; 54 meta = with lib; { 55 homepage = "https://github.com/erlang-ls/erlang_ls"; 56 description = "The Erlang Language Server"; 57 platforms = platforms.unix; 58 license = licenses.asl20; 59 mainProgram = "erlang_ls"; 60 }; 61 passthru.updateScript = writeScript "update.sh" '' 62 #!/usr/bin/env nix-shell 63 #! nix-shell -i bash -p common-updater-scripts coreutils git gnused gnutar gzip "rebar3WithPlugins { globalPlugins = [ beamPackages.rebar3-nix ]; }" 64 65 set -ox errexit 66 latest=$(list-git-tags | sed -n '/[\d\.]\+/p' | sort -V | tail -1) 67 if [[ "$latest" != "${version}" ]]; then 68 nixpkgs="$(git rev-parse --show-toplevel)" 69 nix_path="$nixpkgs/pkgs/development/beam-modules/erlang-ls" 70 update-source-version erlang-ls "$latest" --version-key=version --print-changes --file="$nix_path/default.nix" 71 tmpdir=$(mktemp -d) 72 cp -R $(nix-build $nixpkgs --no-out-link -A erlang-ls.src)/* "$tmpdir" 73 DEBUG=1 74 (cd "$tmpdir" && HOME=. rebar3 as test nix lock -o "$nix_path/rebar-deps.nix") 75 else 76 echo "erlang-ls is already up-to-date" 77 fi 78 ''; 79}