I need to compile GitHub - Redecorating/apple_set_os-loader: Tiny EFI program for unlocking the Intel IGD on the MacBook for Linux and Windows and replace the boot efi, I want to do it via flakes. I already installed pkgs.gnu-efi pkgs.gcc pkgs.gnumake
as environment.systemPackages
using nixos-rebuild switch --no-flake
, so now I would make a derivation for the repo and run nixos-rebuild switch
to get it going, but I get the error:
error: builder for '/nix/store/p4nisd0qb95nq4rcx3r2zgvxnkwsmmpc-apple_set_os-loader.drv' failed with exit code 2;
last 10 log lines:
> unpacking sources
> unpacking source archive /nix/store/092rna0fsssk6r56a5icnlzvqi0p2v08-source
> source root is source
> patching sources
> configuring
> no configure script, doing nothing
> building
> cc -I/usr/include/efi -I/usr/include/efi/x86_64 -DGNU_EFI_USE_MS_ABI -fPIC -fshort-wchar -ffreestanding -fno-stack-protector -maccumulate-outgoing-args -Wall -Dx86_64 -Werror -m64 -mno-red-zone -c -o lib/int_event.o lib/int_event.c
> make: cc: No such file or directory
> make: *** [<builtin>: lib/int_event.o] Error 127
For full logs, run 'nix log /nix/store/p4nisd0qb95nq4rcx3r2zgvxnkwsmmpc-apple_set_os-loader.drv'.
error: 1 dependencies of derivation '/nix/store/aqg62synzfxgydndp69ixrgp128zqy0c-system-path.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-linux-config-6.4.2.drv-2/linux-6.4.2': Directory not empty
error: 1 dependencies of derivation '/nix/store/1hkqs6g726b09vp3bhwiph2fcz8dkss7-nixos-system-mbp2019-23.05.20230715.af8279f.drv' failed to build
To clarify: cc
, gcc
, make
all those commands work already.
My module looks like this:
{ config, pkgs, lib, ... }@specialArgs: let
apple_set_os-loader = pkgs.stdenvNoCC.mkDerivation {
name = "apple_set_os-loader";
src = pkgs.fetchFromGitHub {
owner = "Redecorating";
repo = "apple_set_os-loader";
rev = "r33.9856dc4";
sha256 = "hvwqfoF989PfDRrwU0BMi69nFjPeOmSaD6vR6jIRK2Y=";
};
builder = ./apple_set_os-loader.builder.sh;
};
in {
environment.etc."modprobe.d/apple-gmux.conf".text = ''
# Enable the iGPU by default if present
options apple-gmux force_igd=y
'';
environment.systemPackages = [
apple_set_os-loader
];
}
The apple_set_os-loader.builder.sh contains:
source $stdenv/setup
buildPhase() {
make -f Makefile
}
installPhase() {
dir="$out/boot/EFI/boot"
if [ ! -f "$dir/bootx64_original.efi" ]; then
cp "$dir/bootx64.efi" "$dir/bootx64_original.efi"
fi
cp bootx64_silent.efi "$dir"
}
genericBuild
For test purposes I tried to compile it right in the store:
[mbx@mbp2019:/nix/store/092rna0fsssk6r56a5icnlzvqi0p2v08-source]$ make
cc -I/usr/include/efi -I/usr/include/efi/x86_64 -DGNU_EFI_USE_MS_ABI -fPIC -fshort-wchar -ffreestanding -fno-stack-protector -maccumulate-outgoing-args -Wall -Dx86_64 -Werror -m64 -mno-red-zone -c -o lib/int_event.o lib/int_event.c
In file included from lib/int_event.c:1:
lib/../include/int_event.h:3:10: fatal error: efi.h: No such file or directory
3 | #include <efi.h>
| ^~~~~~~
compilation terminated.
make: *** [<builtin>: lib/int_event.o] Error 1
Yes sure, it can’t work, because those dependencies are not linked to the system, since cd: /usr/include/efi: No such file or directory
. I think now I am experiencing “the bad” about NixOS I was reading about: The inability to simply compile something as I wish, right? I have read a lot “good” as well, just saying
My question is how to fix this issue, so my derivation will work, so that the package will be compiled and installed properly.
Thank you.