Fixes for shell.nix

This commit is contained in:
River 2025-03-07 17:43:53 -05:00
parent 89f21f577d
commit d6cf762181
Signed by: shibedrill
GPG Key ID: 5FE0CB25945EFAA2
4 changed files with 21 additions and 17 deletions

View File

@ -1,4 +1,5 @@
{
"rust-analyzer.cargo.target": "x86_64-unknown-none",
"rust-analyzer.check.allTargets": false
"rust-analyzer.check.allTargets": false,
"makefile.configureOnOpen": false
}

View File

@ -2,7 +2,7 @@
# Default target is x86_64-unknown-none
TARGET ?= "x86_64-unknown-none"
# Limine BIOS file directory
LIMINE-DIR ?= "/usr/share/limine"
LIMINEDIR ?= "/usr/share/limine"
# QEMU system is set accordingly and automatically
qemu = "qemu-system-x86_64"
@ -28,8 +28,9 @@ all: gila iso run
checkenv:
$(info "Limine directory: $(LIMINEDIR)")
$(foreach file,$(limine-files),\
$(if $(shell test -f $(LIMINE-DIR)/$(file) | echo "it exists"),$(info "Found $(file)"),$(error "No $(file) in $(LIMINE-DIR)")))
$(if $(shell test -f $(LIMINEDIR)/$(file) | echo "it exists"),$(info "Found $(file)"),$(error "No $(file) in $(LIMINEDIR)")))
$(foreach exec,$(executables),\
$(if $(shell which $(exec)),$(info "Found $(exec)"),$(error "No $(exec) in PATH")))
@ -60,9 +61,9 @@ iso: build/iso/gila limine.conf
mkdir -p build/iso/EFI/BOOT
cp ./limine.conf build/iso/
cp $(LIMINE-DIR)/limine-bios.sys build/iso/limine/
cp $(LIMINE-DIR)/limine-bios-cd.bin build/iso/limine/
cp $(LIMINE-DIR)/limine-uefi-cd.bin build/iso/limine/
cp $(LIMINEDIR)/limine-bios.sys build/iso/limine/
cp $(LIMINEDIR)/limine-bios-cd.bin build/iso/limine/
cp $(LIMINEDIR)/limine-uefi-cd.bin build/iso/limine/
tree build/iso/
@ -74,4 +75,4 @@ iso: build/iso/gila limine.conf
clean:
rm -rf build
cargo clean
cargo clean

View File

@ -61,7 +61,7 @@ To build an ISO image that you can boot, there are several prerequisites:
- `limine` command installed
- `xorriso` command installed
- `make` command installed
- `qemu-system-(your target architecture)` command installed (for running)
- `qemu-system-{your target architecture}` command installed (for running)
Then run `make` to invoke the [Makefile](Makefile).
@ -72,12 +72,14 @@ Then run `make` to invoke the [Makefile](Makefile).
- `make iso`: Builds the bootable ISO with Limine installed.
- `make run`: Builds the ISO and boots it in QEMU.
By supplying `TARGET=(rustc target triple)` as an additional argument, you can change the architecture that gila will be compiled & run for. The default is `x86_64-unknown-none`.
To change the target gila will be compiled or run for, supply `TARGET={valid-rustc-targettriple}` either as an argument to `make` or as an environment variable. The default is `x86_64-unknown-none`.
The default limine BIOS file search directory is `/usr/share/limine`. You can change this by supplying a path (no trailing slash) like so: `LIMINE-DIR=/home/user/Downloads/limine`.
To change the search path for limine's binaries, supply `LIMINEDIR=/some/valid/path/no/trailing/slash` either as an argument to `make` or as an environment variable. The default is `/usr/share/limine`.
You can install all these dependencies automatically by using `nix-shell` and
supplying [shell.nix](shell.nix) as an argument.
If you use Nix, you can install all these dependencies automatically by running `nix-shell`. This will also automatically set the correct directory for the limine BIOS files.
> [!IMPORTANT]
> **I do not, and cannot, currently recommend using `nix` for dependency management.** `nixpkgs` ships an outdated version of Limine which is incompatible and contains none of the necessary files.
## Kernel Parameters

View File

@ -1,28 +1,28 @@
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05";
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/25.05-pre";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
pkgs.mkShell {
packages = with pkgs; [
bash
limine
limine.dev
xorriso
rustup
qemu
make
gnumake
];
shellHook = ''
rustup default nightly;
rustup target add x86_64-unknown-none
export LIMINEDIR="${pkgs.limine}/share/limine"
'';
}
}