From 5fcd22a93a30f29ac553419d42b4d73a8fec2211 Mon Sep 17 00:00:00 2001 From: Yvan Sraka Date: Mon, 13 Mar 2023 11:57:56 +0100 Subject: [PATCH] @amesgen advices me a better way to write "if macOS" :) --- dynamic.nix | 4 ++-- flake.nix | 8 ++++---- static.nix | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dynamic.nix b/dynamic.nix index ee749163..534776c5 100644 --- a/dynamic.nix +++ b/dynamic.nix @@ -1,5 +1,5 @@ # define a development shell for dynamically linked applications (default) -{ system, pkgs, compiler, compiler-nix-name, withHLS ? true, withHlint ? true }: +{ pkgs, compiler, compiler-nix-name, withHLS ? true, withHlint ? true }: let tool-version-map = import ./tool-map.nix; tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name (tool-version-map compiler-nix-name tool-name); cabal-install = tool "cabal"; in @@ -24,7 +24,7 @@ pkgs.mkShell { ;; esac } - '' ++ (if system == "darwin-aarch64" || system == "darwin-x86_64" then '' + '' ++ (if pkgs.stdenv.targetPlatform.isMacOS then '' # this one is only needed on macOS right now, due to a bug in loading libcrypto. export DYLD_LIBRARY_PATH=$(pkg-config --libs-only-L libcrypto|cut -c 3-) '' else ""); diff --git a/flake.nix b/flake.nix index 6944c63a..8f5d7af9 100644 --- a/flake.nix +++ b/flake.nix @@ -107,19 +107,19 @@ else pkgs.pkgsCross.musl64 else pkgs; in (builtins.mapAttrs (compiler-nix-name: compiler: - import ./dynamic.nix { inherit system pkgs compiler compiler-nix-name; } + import ./dynamic.nix { inherit pkgs compiler compiler-nix-name; } ) (compilers pkgs) // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: pkgs.lib.nameValuePair "${compiler-nix-name}-minimal" ( - import ./dynamic.nix { inherit system pkgs compiler compiler-nix-name; withHLS = false; withHlint = false; } + import ./dynamic.nix { inherit pkgs compiler compiler-nix-name; withHLS = false; withHlint = false; } )) (compilers pkgs) // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: pkgs.lib.nameValuePair "${compiler-nix-name}-static" ( - import ./static.nix { pkgs = static-pkgs; inherit system compiler compiler-nix-name; } + import ./static.nix { pkgs = static-pkgs; inherit compiler compiler-nix-name; } )) (compilers static-pkgs.buildPackages) // pkgs.lib.mapAttrs' (compiler-nix-name: compiler: pkgs.lib.nameValuePair "${compiler-nix-name}-static-minimal" ( - import ./static.nix { pkgs = static-pkgs; inherit system compiler compiler-nix-name; withHLS = false; withHlint = false; } + import ./static.nix { pkgs = static-pkgs; inherit compiler compiler-nix-name; withHLS = false; withHlint = false; } )) (compilers static-pkgs.buildPackages) ); hydraJobs = devShells; diff --git a/static.nix b/static.nix index b9d5a50d..cb6f69c0 100644 --- a/static.nix +++ b/static.nix @@ -1,4 +1,4 @@ -{ system, pkgs, compiler, compiler-nix-name, withHLS ? true, withHlint ? true }: +{ pkgs, compiler, compiler-nix-name, withHLS ? true, withHlint ? true }: let tool-version-map = import ./tool-map.nix; tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name (tool-version-map compiler-nix-name tool-name); cabal-install = tool "cabal"; in @@ -75,7 +75,7 @@ pkgs.mkShell ({ done } - '' ++ (if system == "darwin-aarch64" || system == "darwin-x86_64" then '' + '' ++ (if pkgs.stdenv.targetPlatform.isMacOS then '' # this one is only needed on macOS right now, due to a bug in loading libcrypto. export DYLD_LIBRARY_PATH=$(pkg-config --libs-only-L libcrypto|cut -c 3-) '' else "");