From f6cddc0ed865bf4352ae7e49a4ce1aa29df2ee2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 13 Sep 2023 08:07:32 +0200 Subject: [PATCH] update the reason why we have to use a newer sdk for macOS --- flake.nix | 4 ++-- overlay.nix | 4 ++-- templates/app/flake.nix | 10 +++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index aa052e5..e80aef0 100644 --- a/flake.nix +++ b/flake.nix @@ -23,8 +23,8 @@ let pkgs = nixpkgs.legacyPackages.${system}; - # The newer Darwin SDK does not exist in current (nixos-22.05) stable - # branches, so just fallback to the default callPackage. + # The current default sdk for macOS fails to compile go projects, so we use a newer one for now. + # This has no effect on other platforms. callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage; inherit (callPackage ./builder { diff --git a/overlay.nix b/overlay.nix index 9010386..5154028 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,7 +1,7 @@ final: prev: let - # The newer Darwin SDK does not exist in current (nixos-22.05) stable - # branches, so just fallback to the default callPackage. + # The current default sdk for macOS fails to compile go projects, so we use a newer one for now. + # This has no effect on other platforms. callPackage = final.darwin.apple_sdk_11_0.callPackage or final.callPackage; in { diff --git a/templates/app/flake.nix b/templates/app/flake.nix index 1238c4e..8d12bbc 100644 --- a/templates/app/flake.nix +++ b/templates/app/flake.nix @@ -10,12 +10,16 @@ (system: let pkgs = nixpkgs.legacyPackages.${system}; + + # The current default sdk for macOS fails to compile go projects, so we use a newer one for now. + # This has no effect on other platforms. + callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage; in { - packages.default = pkgs.callPackage ./. { - inherit (gomod2nix.legacyPackages.${system}) buildGoApplication; + packages.default = callPackage ./. { + inherit (gomod2nix.legacyPackages.${system}) buildGoApplication; }; - devShells.default = pkgs.callPackage ./shell.nix { + devShells.default = callPackage ./shell.nix { inherit (gomod2nix.legacyPackages.${system}) buildGoApplication mkGoEnv gomod2nix; }; })