forked from greenkeytech/zero-pod-autoscaler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
36 lines (25 loc) · 1 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ nixpkgs ? (fetchTarball https://releases.nixos.org/nixpkgs/nixpkgs-20.03pre212770.cc1ae9f21b9/nixexprs.tar.xz)
}:
with import nixpkgs {};
let
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
in stdenv.mkDerivation {
name = "shell-env";
buildInputs = [
git
go
golangci-lint
gotools # guru
]
# needed for building with cgo (default `go build`, `go run`, etc.)
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Security ];
shellHook = ''
unset GOPATH
export GO111MODULE=on
PATH=$HOME/go/bin:$PATH
'' + (if stdenv.isDarwin then ''
# https://stackoverflow.com/questions/51161225/how-can-i-make-macos-frameworks-available-to-clang-in-a-nix-environment
export CGO_CFLAGS="-iframework ${CoreFoundation}/Library/Frameworks -iframework ${Security}/Library/Frameworks"
export CGO_LDFLAGS="-F ${CoreFoundation}/Library/Frameworks -F ${Security}/Library/Frameworks -framework CoreFoundation -framework Security"
'' else "");
}