Skip to content

Commit

Permalink
chore: fix crosscompiling (#832)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop authored Feb 14, 2024
1 parent 8cb5541 commit 9b11915
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ifeq ($(shell uname -m),x86_64)
HOST_ARCH?=x86_64
GOARCH?=amd64
ARCH?=amd64
else ifeq ($(shell uname -m),arm64)
HOST_ARCH?=aarch64
GOARCH?=arm64
ARCH?=arm64
endif

ifeq ($(shell uname -o),Darwin)
Expand All @@ -24,14 +24,14 @@ check: ## Run nix flake check
.PHONY: build
build: ## Build application and places the binary under ./result/bin
nix build $(docker-build-options) \
.\#cli-$(GOARCH)-$(OS) \
.\#cli-$(ARCH)-$(OS) \
--print-build-logs


.PHONY: build-docker-image
build-docker-image: ## Build docker image
nix build $(docker-build-options) \
.\#packages.$(HOST_ARCH)-linux.docker-image-$(GOARCH) \
.\#packages.$(HOST_ARCH)-linux.docker-image-$(ARCH) \
--print-build-logs
docker load < result

Expand Down
10 changes: 5 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -100,31 +100,31 @@
cli = nixops-lib.go.package {
inherit name submodule description src version ldflags buildInputs nativeBuildInputs;

cgoEnabled = false;
cgoEnabled = 0;
};

cli-arm64-darwin = (nixops-lib.go.package {
inherit name submodule description src version ldflags buildInputs nativeBuildInputs;

cgoEnabled = false;
cgoEnabled = 0;
}).overrideAttrs (old: old // { GOOS = "darwin"; GOARCH = "arm64"; });

cli-amd64-darwin = (nixops-lib.go.package {
inherit name submodule description src version ldflags buildInputs nativeBuildInputs;

cgoEnabled = false;
cgoEnabled = 0;
}).overrideAttrs (old: old // { GOOS = "darwin"; GOARCH = "amd64"; });

cli-arm64-linux = (nixops-lib.go.package {
inherit name submodule description src version ldflags buildInputs nativeBuildInputs;

cgoEnabled = false;
cgoEnabled = 0;
}).overrideAttrs (old: old // { GOOS = "linux"; GOARCH = "arm64"; });

cli-amd64-linux = (nixops-lib.go.package {
inherit name submodule description src version ldflags buildInputs nativeBuildInputs;

cgoEnabled = false;
cgoEnabled = 0;
}).overrideAttrs (old: old // { GOOS = "linux"; GOARCH = "amd64"; });

docker-image-arm64 = nixops-lib.go.docker-image {
Expand Down

0 comments on commit 9b11915

Please sign in to comment.