~toastal/easy-purescript-nix

1ee19df5b0ce0892d07e60279c239ff29f56d1e8 — toastal 2 years ago 0cd6f26 purescript-0.15.3
Add but warn aarch64-darwin support
1 files changed, 21 insertions(+), 13 deletions(-)

M purs/0.15.3.nix
M purs/0.15.3.nix => purs/0.15.3.nix +21 -13
@@ 1,22 1,30 @@
{ pkgs ? import <nixpkgs> { } }:
{ pkgs ? import <nixpkgs> { }, system ? pkgs.stdenv.hostPlatform.system }:

let
  version = "v0.15.3";

  urls = {
    "x86_64-linux" = {
      url = "https://github.com/purescript/purescript/releases/download/${version}/linux64.tar.gz";
      sha256 = "083pd5l0q2dj4ky9r4sgnfiinlch73qcvl3l26jf3nfs48y8hffv";
    };
    "x86_64-darwin" = {
      url = "https://github.com/purescript/purescript/releases/download/${version}/macos.tar.gz";
      sha256 = "01ka3j1aakcabw6kmkfbk4c2cl2prihk6g8zvc995l83snj4n403";
    };
  };

  src =
    if pkgs.stdenv.hostPlatform.system == "x86_64-linux" then
      (pkgs.fetchurl {
        url = "https://github.com/purescript/purescript/releases/download/${version}/linux64.tar.gz";
        sha256 = "083pd5l0q2dj4ky9r4sgnfiinlch73qcvl3l26jf3nfs48y8hffv";
      })
    else if pkgs.stdenv.hostPlatform.system == "x86_64-darwin" then
      (pkgs.fetchurl {
        url = "https://github.com/purescript/purescript/releases/download/${version}/macos.tar.gz";
        sha256 = "01ka3j1aakcabw6kmkfbk4c2cl2prihk6g8zvc995l83snj4n403";
      })
    if builtins.hasAttr system urls then
      (pkgs.fetchurl urls.${system})
    else if system == "aarch64-darwin" then
      let
        useArch = "x86_64-darwin";
        msg = "Using the non-native ${useArch} binary. While this binary may run under Rosetta 2 translation, no guarantees can be made about stability or performance.";
      in
      pkgs.stdenv.warn msg (pkgs.fetchurl urls.${useArch})
    else
      throw "Architecture not supported";

      throw "Architecture not supported: ${system}";
in
import ./mkPursDerivation.nix {
  inherit pkgs version src;