Skip to content

Commit

Permalink
Update Nix apple sdk usage (#12758)
Browse files Browse the repository at this point in the history
- the previous usage is a pattern that is being deprecated in nix
- no longer need to add CGO_ENABLED=0 with this method
- bumps flake.lock to get golang 1.21.9 in nix shells
  • Loading branch information
tateexon authored Apr 9, 2024
1 parent e364955 commit a21c5f4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ ]; };
# 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
rec {
devShell = callPackage ./shell.nix {
devShell = pkgs.callPackage ./shell.nix {
inherit pkgs;
};
formatter = pkgs.nixpkgs-fmt;
Expand Down
8 changes: 6 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ let
postgresql = postgresql_14;
nodejs = nodejs-18_x;
nodePackages = pkgs.nodePackages.override { inherit nodejs; };

mkShell' = mkShell.override {
# The current nix default sdk for macOS fails to compile go projects, so we use a newer one for now.
stdenv = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv;
};
in
mkShell {
mkShell' {
nativeBuildInputs = [
go
goreleaser
Expand Down Expand Up @@ -46,7 +51,6 @@ mkShell {
];
LD_LIBRARY_PATH = "${stdenv.cc.cc.lib}/lib64:$LD_LIBRARY_PATH";
GOROOT = "${go}/share/go";
CGO_ENABLED = 0;

PGDATA = "db";
CL_DATABASE_URL = "postgresql://chainlink:chainlink@localhost:5432/chainlink_test?sslmode=disable";
Expand Down

0 comments on commit a21c5f4

Please sign in to comment.