diff options
author | Jakub Kozłowski <kubukoz@gmail.com> | 2021-10-25 14:08:24 +0200 |
---|---|---|
committer | Jakub Kozłowski <kubukoz@gmail.com> | 2021-11-04 15:16:30 +0100 |
commit | 49193f4ad3b5b0d25109848045ebd6c215ec7d5e (patch) | |
tree | 5435d30b0870db83caf7d357cd47c5885f35287e | |
parent | 6f7bf9bb0707f7b2bff0e6696dee0997d1229a57 (diff) |
scala-cli: init at 0.0.7
-rw-r--r-- | pkgs/development/tools/build-managers/scala-cli/default.nix | 65 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
2 files changed, 67 insertions, 0 deletions
diff --git a/pkgs/development/tools/build-managers/scala-cli/default.nix b/pkgs/development/tools/build-managers/scala-cli/default.nix new file mode 100644 index 0000000000000..74b1caa2c0e67 --- /dev/null +++ b/pkgs/development/tools/build-managers/scala-cli/default.nix @@ -0,0 +1,65 @@ +{ stdenv, coreutils, lib, installShellFiles, zlib, autoPatchelfHook, fetchurl }: + +let + version = "0.0.7"; + assets = { + x86_64-darwin = { + asset = "scala-cli-x86_64-apple-darwin.gz"; + sha256 = "0v6vlmw1zrzvbpa59y4cfv74mx56lyx109vk9cb942pyiv0ia6gf"; + }; + x86_64-linux = { + asset = "scala-cli-x86_64-pc-linux.gz"; + sha256 = "1xdkvjfw550lpjw5fsrv7mbnx5i8ix8lrxcd31yipm8p9g4vjcdn"; + }; + }; +in +stdenv.mkDerivation { + pname = "scala-cli"; + inherit version; + nativeBuildInputs = [ autoPatchelfHook installShellFiles ]; + buildInputs = [ coreutils zlib stdenv.cc.cc ]; + src = + let + asset = assets."${stdenv.hostPlatform.system}" or (throw "Unsupported platform ${stdenv.hostPlatform.system}"); + in + fetchurl { + url = "https://github.com/Virtuslab/scala-cli/releases/download/v${version}/${asset.asset}"; + sha256 = asset.sha256; + }; + + unpackPhase = '' + runHook preUnpack + gzip -d < $src > scala-cli + runHook postUnpack + ''; + + installPhase = '' + runHook preInstall + install -Dm755 scala-cli $out/bin/scala-cli + runHook postInstall + ''; + + # We need to call autopatchelf before generating completions + dontAutoPatchelf = true; + + postFixup = '' + autoPatchelf $out + + # hack to ensure the completion function looks right + # as $0 is used to generate the compdef directive + PATH="$out/bin:$PATH" + + installShellCompletion --cmd scala-cli \ + --bash <(scala-cli completions bash) \ + --zsh <(scala-cli completions zsh) + ''; + + meta = with lib; { + homepage = "https://scala-cli.virtuslab.org"; + downloadPage = "https://github.com/VirtusLab/scala-cli/releases/v${version}"; + license = licenses.asl20; + description = "Command-line tool to interact with the Scala language"; + maintainers = [ maintainers.kubukoz ]; + platforms = builtins.attrNames assets; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 761d1b8e3177c..2f546e13c93af 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15097,6 +15097,8 @@ with pkgs; sbt-extras = callPackage ../development/tools/build-managers/sbt-extras { }; + scala-cli = callPackage ../development/tools/build-managers/scala-cli {}; + scc = callPackage ../development/tools/misc/scc { }; scss-lint = callPackage ../development/tools/scss-lint { }; |