Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Commit

Permalink
Add binary building helper
Browse files Browse the repository at this point in the history
  • Loading branch information
seqizz committed Nov 28, 2019
1 parent 4fa7813 commit d6597d6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build-binaries.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
with import <nixpkgs> {}; {
devEnv = stdenv.mkDerivation {
name = "dev";
buildInputs = [ stdenv go glibc.static ];
CFLAGS="-I${pkgs.glibc.dev}/include";
LDFLAGS="-L${pkgs.glibc}/lib";
shellHook = ''
env GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -linkmode external -extldflags -static" -o jb-linux-amd64 jb.go
env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 go build -o jb-windows-amd64.exe jb.go
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static" -o jb-darwin-amd64 jb.go
'';
};
}

0 comments on commit d6597d6

Please sign in to comment.