@@ 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;