Add shell and build environment for NixOS

This commit is contained in:
Vincent Berthier 2025-02-18 22:23:42 +00:00 committed by Jeremy Soller
parent b91d42a541
commit 4573edcc16
4 changed files with 284 additions and 0 deletions

View file

@ -3,10 +3,15 @@
# Don't check for Rust/Cargo if you will be using Podman
ifneq ($(PODMAN_BUILD),1)
# dont check for Rust and Cargo if building on a Nix system
ifneq ($(NIX_SHELL_BUILD),1)
ifeq ($(shell which rustup),)
$(error rustup not found, install from "https://rustup.rs/")
endif
endif
ifeq ($(shell which cbindgen),)
$(error cbindgen not found, install from crates.io or from your package manager)
endif
@ -19,9 +24,11 @@ ifeq ($(shell which just),)
$(error 'just' not found, install from crates.io or from your package manager)
endif
ifneq ($(NIX_SHELL_BUILD),1)
CARGO_CONFIG_VERSION=0.1.1
ifeq ($(shell env -u RUSTUP_TOOLCHAIN cargo install --list | grep '^cargo-config v$(CARGO_CONFIG_VERSION):$$'),)
$(error cargo-config $(CARGO_CONFIG_VERSION) not found, run "cargo install --force --version $(CARGO_CONFIG_VERSION) cargo-config")
endif
endif
endif

View file

@ -16,6 +16,9 @@ else
touch $@
endif
$(INSTALLER): CC =
$(INSTALLER): TARGET = $(HOST_TARGET)
$(INSTALLER): RUSTUP_TOOLCHAIN =
$(INSTALLER): installer
$(HOST_CARGO) build --bin redox_installer --manifest-path installer/Cargo.toml --release