updated opencore.nix

This commit is contained in:
elwrcl committed 2026-04-24 19:04:07 +03:00
1 parent e04b9efc7b
commit 8182474695
1 file changed
+115 -49
+115 -49
View File
@@ -1,11 +1,6 @@
{ pkgs, inputs, ... }: { pkgs, inputs, ... }:
let let
ocPath = "/boot/EFI/OC";
# for debugging
ocDebug = false;
oceanixPkgs = import pkgs.path { oceanixPkgs = import pkgs.path {
localSystem = pkgs.stdenv.hostPlatform; localSystem = pkgs.stdenv.hostPlatform;
inherit (pkgs) config; inherit (pkgs) config;
@@ -75,8 +70,9 @@ let
ocConfig = inputs.oceanix.lib.OpenCoreConfig { ocConfig = inputs.oceanix.lib.OpenCoreConfig {
pkgs = oceanixPkgs; pkgs = oceanixPkgs;
modules = [ modules = [
({ ... }: { (
{ ... }:
{
oceanix.opencore.resources.packages = [ oceanix.opencore.resources.packages = [
oceanixPkgs."lilu-latest-release" oceanixPkgs."lilu-latest-release"
oceanixPkgs."virtualsmc-latest-release" oceanixPkgs."virtualsmc-latest-release"
@@ -91,6 +87,7 @@ let
]; ];
oceanix.opencore.settings = { oceanix.opencore.settings = {
Kernel.Add."Lilu.kext".Enabled = true; Kernel.Add."Lilu.kext".Enabled = true;
Kernel.Add."VirtualSMC.kext".Enabled = true; Kernel.Add."VirtualSMC.kext".Enabled = true;
Kernel.Add."SMCBatteryManager.kext".Enabled = true; Kernel.Add."SMCBatteryManager.kext".Enabled = true;
@@ -104,60 +101,129 @@ let
Kernel.Add."CryptexFixup.kext".Enabled = true; Kernel.Add."CryptexFixup.kext".Enabled = true;
Kernel.Add."RestrictEvents.kext".Enabled = true; Kernel.Add."RestrictEvents.kext".Enabled = true;
# boot menu Kernel.Quirks = {
Misc.Boot.PickerMode = "Builtin"; AppleCpuPmCfgLock = true;
Misc.Boot.PickerVariant = "Auto"; AppleXcpmCfgLock = true;
Misc.Boot.PickerAttributes = 0; DisableIoMapper = true;
Misc.Boot.Timeout = 15; LapicKernelPanic = false;
Misc.Boot.HideAuxiliary = false; PanicNoKextDump = true;
PowerTimeoutKernelPanic = true;
XhciPortLimit = false;
};
Booter.Quirks = {
AvoidRuntimeDefrag = true;
EnableSafeModeSlide = true;
EnableWriteUnprotector = true;
ProvideCustomSlide = true;
RebuildAppleMemoryMap = true;
SetupVirtualMap = true;
SyncRuntimePermissions = true;
};
DeviceProperties.Add."PciRoot(0x0)/Pci(0x2,0x0)" = {
"AAPL,ig-platform-id" = "03006601";
"device-id" = "66010000";
};
NVRAM.Add."7C436110-AB2A-4BBB-A880-FE41995C9F82" = {
"boot-args" =
"ipc_control_port_options=0 amfi_get_out_of_my_way=0x1 -no-compat-check revpatch=sbvmm,f16c revblock=media";
"csr-active-config" = pkgs.lib.mkForce "AwgAAA==";
};
Misc.Boot.PickerMode = "External";
Misc.Boot.PickerVariant = "Acidanthera\\Syrah";
Misc.Boot.PickerAttributes = 144;
Misc.Boot.Timeout = 15;
Misc.Boot.HideAuxiliary = true;
Misc.Debug = {
AppleDebug = true;
ApplePanic = true;
DisableWatchDog = true;
DisplayLevel = 2147483650;
Target = 3;
};
PlatformInfo = {
Automatic = true;
UpdateSMBIOSMode = "Create";
Generic = {
SystemProductName = "MacBookPro10,2";
SystemSerialNumber = "C02J603FDR53";
MLB = "C02232403J9F16P1F";
SystemUUID = "2B8E7220-2B6A-4595-B254-930EE04E752A";
ROM = "F0B0E7AC067D";
};
};
Misc.Security.SecureBootModel = "Disabled";
Misc.Security.ScanPolicy = 0;
Misc.Security.Vault = "Optional";
Misc.Tools."OpenShell.efi".Enabled = true; Misc.Tools."OpenShell.efi".Enabled = true;
Misc.Tools."OpenShell.efi".Name = "OpenShell"; Misc.Tools."OpenShell.efi".Name = "OpenShell";
Misc.Tools."OpenShell.efi".Auxiliary = true; Misc.Tools."OpenShell.efi".Auxiliary = true;
Misc.Tools."CleanNvram.efi".Enabled = true; Misc.Tools."CleanNvram.efi".Enabled = true;
Misc.Tools."CleanNvram.efi".Name = "Reset NVRAM"; Misc.Tools."CleanNvram.efi".Name = "Reset NVRAM";
Misc.Tools."CleanNvram.efi".Auxiliary = true; Misc.Tools."CleanNvram.efi".Auxiliary = true;
UEFI.Output.ProvideConsoleGop = true;
UEFI.Output.Resolution = "1366x768";
UEFI.Output.TextRenderer = "BuiltinGraphics";
UEFI.AppleInput = {
AppleEvent = "Builtin";
CustomDelays = false;
GraphicsInputMirroring = true;
KeyInitialDelay = 50;
KeySubsequentDelay = 5;
PointerPollMask = -1;
PointerPollMin = 10;
PointerPollMax = 80;
PointerSpeedDiv = 1;
PointerSpeedMul = 1;
};
UEFI.Audio = {
AudioCodec = 0;
AudioDevice = "PciRoot(0x0)/Pci(0x1b,0x0)";
AudioOutMask = 1;
AudioSupport = true;
ResetTrafficClass = true;
DisconnectHda = false;
MaximumGain = -10;
MinimumAssistGain = -30;
MinimumAudibleGain = -128;
PlayChime = "Enabled";
SetupDelay = 0;
};
UEFI.Drivers."ResetNvramEntry.efi".Enabled = true; UEFI.Drivers."ResetNvramEntry.efi".Enabled = true;
}; UEFI.Drivers."OpenRuntime.efi".Enabled = true;
}) UEFI.Drivers."OpenCanopy.efi".Enabled = true;
]; UEFI.Drivers."OpenLinuxBoot.efi".Enabled = true;
}; UEFI.Drivers."AudioDxe.efi".Enabled = true;
in UEFI.Quirks.RequestBootVarRouting = true;
{ UEFI.Quirks.DisableSecurityPolicy = true;
system.activationScripts.opencoreConfig = { UEFI.Quirks.ReleaseUsbOwnership = true;
text = ''
set -euo pipefail
echo "--- Kopurando In1t ---"
if [ ! -d "${ocPath}" ] || ! ${pkgs.diffutils}/bin/diff -r "${ocConfig.efiPackage}/EFI/OC" "${ocPath}" >/dev/null 2>&1; then Misc.Entries = [ ];
echo "diffs are detected, writing EFI files..."
rm -rf "${ocPath}"
mkdir -p "${ocPath}"
cp -rf "${ocConfig.efiPackage}/EFI/OC/"* "${ocPath}/"
mkdir -p "${ocPath}/Resources"
cp -rf "${ocResources}/Resources/"* "${ocPath}/Resources/"
else
echo "EFI is already up to date."
fi
BOOT_DEV="$(${pkgs.util-linux}/bin/findmnt -n -o SOURCE /boot)"
if [ -n "$BOOT_DEV" ]; then
TARGET_DISK="$(echo "$BOOT_DEV" | ${pkgs.gnused}/bin/sed -E 's/p?[0-9]+$//')"
PART_NUM="$(echo "$BOOT_DEV" | ${pkgs.gnugrep}/bin/grep -oE '[0-9]+$')"
if ! ${pkgs.efibootmgr}/bin/efibootmgr | ${pkgs.gnugrep}/bin/grep -q "OpenCore_Copland"; then
echo "Registering OpenCore on $TARGET_DISK (partition $PART_NUM)..."
${pkgs.efibootmgr}/bin/efibootmgr -c -d "$TARGET_DISK" -p "$PART_NUM" -L "OpenCore_Copland" -l '\EFI\OC\OpenCore.efi'
fi
else
echo "Error: Could not find mount point for /boot!"
fi
'';
}; };
} }
)
];
};
in
{
# system.activationScripts.opencoreConfig = { ... }; usb test
environment.systemPackages = [
(pkgs.writeShellScriptBin "oc-paths" ''
echo "OC_EFI=${ocConfig.efiPackage}/EFI/OC"
echo "OC_RES=${ocResources}/Resources"
'')
];
}