apple-t2: avoid import-from-derivation
This commit is contained in:
parent
65753f5d11
commit
a15b6e525f
|
@ -8,6 +8,12 @@ let
|
||||||
hash = "sha256-x7K0qa++P1e1vuCGxnsFxL1d9+nwMtZUJ6Kd9e27TFs=";
|
hash = "sha256-x7K0qa++P1e1vuCGxnsFxL1d9+nwMtZUJ6Kd9e27TFs=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
audioFilesUdevRules = pkgs.runCommand "audio-files-udev-rules" {} ''
|
||||||
|
mkdir -p $out/lib/udev/rules.d
|
||||||
|
cp ${audioFiles}/files/*.rules $out/lib/udev/rules.d
|
||||||
|
substituteInPlace $out/lib/udev/rules.d/*.rules --replace "/usr/bin/sed" "${pkgs.gnused}/bin/sed"
|
||||||
|
'';
|
||||||
|
|
||||||
overrideAudioFiles = package: pluginsPath:
|
overrideAudioFiles = package: pluginsPath:
|
||||||
package.overrideAttrs (new: old: {
|
package.overrideAttrs (new: old: {
|
||||||
preConfigurePhases = old.preConfigurePhases or [ ] ++ [ "postPatchPhase" ];
|
preConfigurePhases = old.preConfigurePhases or [ ] ++ [ "postPatchPhase" ];
|
||||||
|
@ -18,7 +24,7 @@ let
|
||||||
|
|
||||||
pipewirePackage = overrideAudioFiles pkgs.pipewire "spa/plugins/";
|
pipewirePackage = overrideAudioFiles pkgs.pipewire "spa/plugins/";
|
||||||
|
|
||||||
apple-set-os-loader-installer = pkgs.stdenv.mkDerivation rec {
|
apple-set-os-loader-installer = pkgs.stdenv.mkDerivation {
|
||||||
name = "apple-set-os-loader-installer-1.0";
|
name = "apple-set-os-loader-installer-1.0";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "Redecorating";
|
owner = "Redecorating";
|
||||||
|
@ -51,15 +57,12 @@ in
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
# For keyboard and touchbar
|
# For keyboard and touchbar
|
||||||
boot.kernelPackages = with pkgs; recurseIntoAttrs (linuxPackagesFor (callPackage ./pkgs/linux-t2.nix { }));
|
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./pkgs/linux-t2.nix { });
|
||||||
boot.initrd.kernelModules = [ "apple-bce" ];
|
boot.initrd.kernelModules = [ "apple-bce" ];
|
||||||
|
|
||||||
# For audio
|
# For audio
|
||||||
boot.kernelParams = [ "pcie_ports=compat" "intel_iommu=on" "iommu=pt" ];
|
boot.kernelParams = [ "pcie_ports=compat" "intel_iommu=on" "iommu=pt" ];
|
||||||
services.udev.extraRules = builtins.readFile (pkgs.substitute {
|
services.udev.packages = [ audioFilesUdevRules ];
|
||||||
src = "${audioFiles}/files/91-audio-custom.rules";
|
|
||||||
replacements = [ "--replace" "/usr/bin/sed" "${pkgs.gnused}/bin/sed" ];
|
|
||||||
});
|
|
||||||
|
|
||||||
hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
|
hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{ lib, buildLinux, fetchFromGitHub, fetchurl, ... } @ args:
|
{ lib, buildLinux, fetchFromGitHub, fetchzip, runCommand
|
||||||
|
, ... } @ args:
|
||||||
|
|
||||||
let
|
let
|
||||||
patchRepo = fetchFromGitHub {
|
patchRepo = fetchFromGitHub {
|
||||||
|
@ -18,10 +19,18 @@ buildLinux (args // {
|
||||||
# Snippet from nixpkgs
|
# Snippet from nixpkgs
|
||||||
modDirVersion = with lib; "${concatStringsSep "." (take 3 (splitVersion "${version}.0"))}";
|
modDirVersion = with lib; "${concatStringsSep "." (take 3 (splitVersion "${version}.0"))}";
|
||||||
|
|
||||||
src = fetchurl {
|
src = runCommand "patched-source" {} ''
|
||||||
url = "mirror://kernel/linux/kernel/v${majorVersion}.x/linux-${version}.tar.xz";
|
cp -r ${fetchzip {
|
||||||
hash = "sha256-eldLvCCALqdrUsp/rwcmf3IEXoYbGJFcUnKpjCer+IQ=";
|
url = "mirror://kernel/linux/kernel/v${majorVersion}.x/linux-${version}.tar.xz";
|
||||||
};
|
hash = "sha256-qJmVSju69WcvDIbgrbtMyCi+OXUNTzNX2G+/0zwsPR4=";
|
||||||
|
}} $out
|
||||||
|
chmod -R u+w $out
|
||||||
|
cd $out
|
||||||
|
while read -r patch; do
|
||||||
|
echo "Applying patch $patch";
|
||||||
|
patch -p1 < $patch;
|
||||||
|
done < <(find ${patchRepo} -type f -name "*.patch" | sort)
|
||||||
|
'';
|
||||||
|
|
||||||
structuredExtraConfig = with lib.kernel; {
|
structuredExtraConfig = with lib.kernel; {
|
||||||
APPLE_BCE = module;
|
APPLE_BCE = module;
|
||||||
|
@ -40,7 +49,5 @@ buildLinux (args // {
|
||||||
STAGING = yes;
|
STAGING = yes;
|
||||||
};
|
};
|
||||||
|
|
||||||
kernelPatches = lib.attrsets.mapAttrsToList (file: type: { name = file; patch = "${patchRepo}/${file}"; })
|
kernelPatches = [];
|
||||||
(lib.attrsets.filterAttrs (file: type: type == "regular" && lib.strings.hasSuffix ".patch" file)
|
|
||||||
(builtins.readDir patchRepo));
|
|
||||||
} // (args.argsOverride or {}))
|
} // (args.argsOverride or {}))
|
||||||
|
|
Loading…
Reference in a new issue