Unverified Commit 2e68224e authored by Dmitry Kalinkin's avatar Dmitry Kalinkin Committed by GitHub
Browse files

mill: 1.0.6 -> 1.1.1 (#487954)

parents e99a3306 1ec0247b
Loading
Loading
Loading
Loading
+64 −12
Original line number Diff line number Diff line
@@ -4,22 +4,40 @@
  jre,
  lib,
  makeWrapper,
  sourcesJSON ? ./sources.json,
  stdenvNoCC,
  zlib,
  writeScript,
  stdenv,
  curl,
  libxml2,
  common-updater-scripts,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "mill";
  version = "1.0.6";

  src =
let
      source = (lib.importJSON sourcesJSON)."${stdenvNoCC.hostPlatform.system}";
  suffixMap = {
    aarch64-darwin = "native-mac-aarch64";
    x86_64-darwin = "native-mac-amd64";
    aarch64-linux = "native-linux-aarch64";
    x86_64-linux = "native-linux-amd64";
  };
  suffix =
    suffixMap.${stdenv.hostPlatform.system}
      or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
in
    fetchurl {
      url = "https://repo1.maven.org/maven2/com/lihaoyi/mill-dist-${source.artifact-suffix}/${finalAttrs.version}/mill-dist-${source.artifact-suffix}-${finalAttrs.version}.exe";
      inherit (source) hash;
stdenvNoCC.mkDerivation rec {
  pname = "mill";
  version = "1.1.1";

  src = fetchurl {
    url = "https://repo1.maven.org/maven2/com/lihaoyi/mill-dist-${suffix}/${version}/mill-dist-${suffix}-${version}.exe";
    sha256 =
      {
        aarch64-darwin = "sha256-ItoUsQ2Hu6aCrVS9GGf/m6DrQyCwJqtvWT8cTJSnZw4=";
        x86_64-darwin = "sha256-9NLsUK3H3L27a+OO2kAyApezQpkHAJqvgYgQEXT6y9U=";
        aarch64-linux = "sha256-VaBjRHMBKB83dHACQor9R0Gk/7tCpw1ITkxqWJb9+KI=";
        x86_64-linux = "sha256-BMc7sGPlTzcED5RjrTNlrBWyr89cNiKfnh3plJ24dZ4=";
      }
      .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
  };

  buildInputs = [ zlib ];
@@ -47,6 +65,40 @@ stdenvNoCC.mkDerivation (finalAttrs: {
    runHook postInstall
  '';

  passthru.updateScript = writeScript "${pname}-updater" ''
    #!${stdenv.shell}
    set -eu -o pipefail
    PATH=${
      lib.makeBinPath [
        curl
        libxml2 # xmllint
        common-updater-scripts
      ]
    }:$PATH
    metadataUrl="https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/maven-metadata.xml"
    latestVersion="$(curl -sS $metadataUrl | xmllint --xpath '/metadata/versioning/release/text()' -)"

    ${lib.strings.concatStrings (
      builtins.map (
        platform:
        let
          suffix = suffixMap.${platform} or (throw "Platform not in suffixMap: ${platform}");
        in
        ''
          {
            dlUrl="https://repo1.maven.org/maven2/com/lihaoyi/mill-dist-${suffix}/$latestVersion/mill-dist-${suffix}-$latestVersion.exe"

            prefetch="$(nix-prefetch-url $dlUrl)"
            hash=$(nix --extra-experimental-features nix-command hash convert --hash-algo sha256 --to sri $prefetch)


            update-source-version mill "$latestVersion" "$hash" --system=${platform} --ignore-same-version
          }
        ''
      ) meta.platforms
    )}
  '';

  meta = {
    homepage = "https://com-lihaoyi.github.io/mill/";
    license = lib.licenses.mit;
@@ -70,4 +122,4 @@ stdenvNoCC.mkDerivation (finalAttrs: {
    ];
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
  };
})
}

pkgs/by-name/mi/mill/sources.json

deleted100644 → 0
+0 −18
Original line number Diff line number Diff line
{
  "aarch64-darwin": {
    "artifact-suffix": "native-mac-aarch64",
    "hash": "sha256-KMlBQfSytFddA1eNJAx0yiuusgkVe1xkRoHw+03Q9rg="
  },
  "x86_64-darwin": {
    "artifact-suffix": "native-mac-amd64",
    "hash": "sha256-8CkXOfhJv/71vTgJqoEQ0TMW+r8kvdH1ff7l/Pbz0ZU="
  },
  "aarch64-linux": {
    "artifact-suffix": "native-linux-aarch64",
    "hash": "sha256-d/dSBStPdz4D/Jwe8UuqQRt6FZILwHrKXsSVyO6Ky4c="
  },
  "x86_64-linux": {
    "artifact-suffix": "native-linux-amd64",
    "hash": "sha256-iP7KHx+RA+2EQC5tRoBybe7MHXkEbxg00mDqE7IiCoY="
  }
}