mirror of
https://github.com/elwrcl/copnix.git
synced 2026-10-31 22:28:03 +03:00
Refactors OpenCore configuration and activation
This commit is contained in:
1 parent
b9140228e7
commit
dafe3fbe1a
1 file changed
+25
-42
+25
-42
@@ -2,18 +2,17 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
ocPath = "/boot/EFI/OC";
|
ocPath = "/boot/EFI/OC";
|
||||||
liminePath = "/boot/EFI/limine";
|
|
||||||
|
|
||||||
ocResources = pkgs.fetchzip {
|
|
||||||
url = "https://github.com/acidanthera/OcBinaryData/archive/refs/heads/master.zip";
|
|
||||||
sha256 = "sha256-B5CABp0Y2dAVuw7185suaUuryl3iII4QNBVBttivQ7Y=";
|
|
||||||
};
|
|
||||||
|
|
||||||
oceanixPkgs = import pkgs.path {
|
oceanixPkgs = import pkgs.path {
|
||||||
inherit (pkgs) system config;
|
inherit (pkgs) system config;
|
||||||
overlays = [ inputs.oceanix.overlays.default ];
|
overlays = [ inputs.oceanix.overlays.default ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ocResources = pkgs.fetchzip {
|
||||||
|
url = "https://github.com/acidanthera/OcBinaryData/archive/refs/heads/master.zip";
|
||||||
|
sha256 = "sha256-B5CABp0Y2dAVuw7185suaUuryl3iII4QNBVBttivQ7Y=";
|
||||||
|
};
|
||||||
|
|
||||||
ocConfig = inputs.oceanix.lib.OpenCoreConfig {
|
ocConfig = inputs.oceanix.lib.OpenCoreConfig {
|
||||||
pkgs = oceanixPkgs;
|
pkgs = oceanixPkgs;
|
||||||
modules = [
|
modules = [
|
||||||
@@ -26,7 +25,8 @@ let
|
|||||||
Misc.Boot.PickerMode = "External";
|
Misc.Boot.PickerMode = "External";
|
||||||
Misc.Boot.PickerVariant = "Acidanthera\\Syrah";
|
Misc.Boot.PickerVariant = "Acidanthera\\Syrah";
|
||||||
Misc.Boot.PickerAttributes = 17;
|
Misc.Boot.PickerAttributes = 17;
|
||||||
Misc.Boot.Timeout = 10;
|
Misc.Boot.Timeout = 5;
|
||||||
|
Misc.Boot.HideAuxiliary = true;
|
||||||
|
|
||||||
Misc.Security.SecureBootModel = "Disabled";
|
Misc.Security.SecureBootModel = "Disabled";
|
||||||
Misc.Security.ScanPolicy = 0;
|
Misc.Security.ScanPolicy = 0;
|
||||||
@@ -35,61 +35,44 @@ let
|
|||||||
UEFI.Quirks.ReleaseUsbOwnership = true;
|
UEFI.Quirks.ReleaseUsbOwnership = true;
|
||||||
|
|
||||||
PlatformInfo.Automatic = true;
|
PlatformInfo.Automatic = true;
|
||||||
PlatformInfo.Generic.SystemProductName = "MacBookPro16,1";
|
PlatformInfo.Generic = {
|
||||||
PlatformInfo.Generic.SystemSerialNumber = "C02DF0Y0MD6N";
|
SystemProductName = "MacBookPro9,2";
|
||||||
PlatformInfo.Generic.SystemUUID = "5445524E-A59B-4D8B-9B2F-9876543210AB";
|
SystemSerialNumber = "C02J19YCDTY3";
|
||||||
|
SystemUUID = "8FF32D62-EC2E-46D1-A6D3-D1A5748F5F7B";
|
||||||
Misc.Entries = [
|
MLB = "C02227802QXF1YJ1M";
|
||||||
{
|
};
|
||||||
Name = "Limine";
|
|
||||||
Enabled = true;
|
|
||||||
Path = "PciRoot(0x0)/Pci(0x1f,0x2)/Sata(2,0,0)/HD(1,GPT,73ae5e9a-c31d-4787-9792-ee1843de3e9d,0x800,0x200000)/\\EFI\\limine\\BOOTX64.EFI";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
UEFI.Drivers = {
|
UEFI.Drivers = {
|
||||||
"OpenRuntime.efi" = { Enabled = true; };
|
"OpenRuntime.efi" = { Enabled = true; };
|
||||||
"OpenCanopy.efi" = { Enabled = true; };
|
"OpenCanopy.efi" = { Enabled = true; };
|
||||||
"OpenLinuxBoot.efi" = { Enabled = true; };
|
|
||||||
"OpenUsbKbDxe.efi" = { Enabled = true; };
|
"OpenUsbKbDxe.efi" = { Enabled = true; };
|
||||||
|
"OpenLinuxBoot.efi" = { Enabled = true; };
|
||||||
};
|
};
|
||||||
|
Misc.Entries = [ ];
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
limineConf = pkgs.writeText "limine.conf" ''
|
|
||||||
TIMEOUT=5
|
|
||||||
GRAPHICS=yes
|
|
||||||
INTERFACE_RESOLUTION=1366x768
|
|
||||||
|
|
||||||
:NixOS (Systemd-Boot)
|
|
||||||
PROTOCOL=chainload
|
|
||||||
PATH=boot:///EFI/systemd/systemd-bootx64.efi
|
|
||||||
'';
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
system.activationScripts.opencoreConfig = {
|
system.activationScripts.opencoreConfig = {
|
||||||
text = ''
|
text = ''
|
||||||
echo "--- Kopurando In1t ---"
|
echo "--- Kopurando In1t ---"
|
||||||
|
|
||||||
mkdir -p ${liminePath}
|
if [ ! -d "${ocPath}" ] || ! ${pkgs.diffutils}/bin/diff -r "${ocConfig.efiPackage}/EFI/OC" "${ocPath}" >/dev/null 2>&1; then
|
||||||
|
echo "diffs are dedected writing EFI files..."
|
||||||
|
|
||||||
rm -rf ${ocPath}
|
rm -rf ${ocPath}
|
||||||
mkdir -p ${ocPath}
|
mkdir -p ${ocPath}
|
||||||
|
cp -rf ${ocConfig.efiPackage}/EFI/OC/* ${ocPath}/
|
||||||
|
|
||||||
cp -rf ${ocConfig.efiPackage}/EFI/OC/* ${ocPath}/
|
mkdir -p ${ocPath}/Resources
|
||||||
|
cp -rf ${ocResources}/Resources/* ${ocPath}/Resources/
|
||||||
mkdir -p ${ocPath}/Resources
|
else
|
||||||
cp -rf ${ocResources}/Resources/* ${ocPath}/Resources/
|
echo "EFI is already up to date."
|
||||||
|
|
||||||
if [ -f ${pkgs.limine}/share/limine/BOOTX64.EFI ]; then
|
|
||||||
cp -f ${pkgs.limine}/share/limine/BOOTX64.EFI ${liminePath}/BOOTX64.EFI
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -f ${limineConf} ${liminePath}/limine.conf
|
|
||||||
|
|
||||||
if ! ${pkgs.efibootmgr}/bin/efibootmgr | grep -q "OpenCore_Copland"; then
|
if ! ${pkgs.efibootmgr}/bin/efibootmgr | grep -q "OpenCore_Copland"; then
|
||||||
${pkgs.efibootmgr}/bin/efibootmgr -c -d /dev/sda -p 1 -L "OpenCore_Copland" -l "\EFI\OC\OpenCore.efi"
|
${pkgs.efibootmgr}/bin/efibootmgr -c -d /dev/sda -p 1 -L "OpenCore_Copland" -l "\EFI\OC\OpenCore.efi"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user