-
-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add installer for apple-set-os-loader-installer
- Loading branch information
Showing
2 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ config, pkgs, ... }: | ||
let | ||
apple-set-os-loader-installer = pkgs.stdenv.mkDerivation rec { | ||
name = "apple-set-os-loader-installer-1.0"; | ||
src = pkgs.fetchFromGitHub { | ||
owner = "Redecorating"; | ||
repo = "apple_set_os-loader"; | ||
rev = "r33.9856dc4"; | ||
sha256 = "hvwqfoF989PfDRrwU0BMi69nFjPeOmSaD6vR6jIRK2Y="; | ||
}; | ||
buildInputs = [ pkgs.gnu-efi ]; | ||
buildPhase = '' | ||
substituteInPlace Makefile --replace "/usr" '$(GNU_EFI)' | ||
export GNU_EFI=${pkgs.gnu-efi} | ||
make | ||
''; | ||
installPhase = '' | ||
install -D bootx64_silent.efi $out/bootx64.efi | ||
''; | ||
}; | ||
in | ||
{ | ||
system.activationScripts.hybrid-graphics = { | ||
text = '' | ||
if [[ -e /boot/efi/EFI/BOOT/bootx64_original.efi ]]; then | ||
# We interpret this as apple-set-os-loader being already installed | ||
exit 0 | ||
elif [[ -e /boot/efi/EFI/BOOT/BOOTX64.EFI ]] then | ||
mv /boot/efi/EFI/BOOT/BOOTX64.EFI /boot/efi/EFI/BOOT/bootx64_original.efi | ||
cp ${apple-set-os-loader-installer}/bootx64.efi /boot/efi/EFI/BOOT/bootx64.efi | ||
else | ||
echo "Error: /boot/efi/EFI/BOOT/BOOTX64.EFI is missing" | ||
fi | ||
''; | ||
}; | ||
environment.etc."modprobe.d/apple-gmux.conf".text = '' | ||
# Enable the iGPU by default if present | ||
options apple-gmux force_igd=y | ||
''; | ||
environment.systemPackages = with pkgs; [ apple-set-os-loader-installer ]; | ||
} |