Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions crates/l2/tee/quote-gen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ NIXPKGS_URL = https://github.com/NixOS/nixpkgs/archive/3fcbdcfc707e0aa42c541b774
GIT_REV := $(shell git rev-parse --short=7 HEAD)
NIX_BUILD_ARGS = --no-out-link -I nixpkgs=$(NIXPKGS_URL) --argstr gitRev "$(GIT_REV)"

# crates.io returns HTTP 403 for any User-Agent containing "curl/", which is what
# Nix's fetchurl sends by default (`curl/<ver> Nixpkgs/<ver>`). That breaks every
# crate download during the image build. fetchurl appends $NIX_CURL_FLAGS to its
# curl invocation (last --user-agent wins) and passes it into the fixed-output
# derivation sandbox via impureEnvVars, so we override the User-Agent with one
# crates.io accepts. Set inline on the nix-build command rather than via `export`
# because GNU Make's $(shell ...) does not inherit exported variables.
NIX_ENV = NIX_CURL_FLAGS="--user-agent ethrex-ci+https://github.com/lambdaclass/ethrex"

image.raw:
$(eval IMAGE := $(shell nix-build image.nix ${NIX_BUILD_ARGS})/${IMAGE_NAME})
$(eval IMAGE := $(shell $(NIX_ENV) nix-build image.nix ${NIX_BUILD_ARGS})/${IMAGE_NAME})
cp $(IMAGE) image.raw
chmod u+rw image.raw

run: image.raw
$(eval RUN_QEMU := $(shell nix-build hypervisor.nix ${NIX_BUILD_ARGS})/bin/run-qemu)
$(eval RUN_QEMU := $(shell $(NIX_ENV) nix-build hypervisor.nix ${NIX_BUILD_ARGS})/bin/run-qemu)
$(RUN_QEMU) image.raw

clean:
Expand Down
Loading