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=";
|
||||
};
|
||||
|
||||
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:
|
||||
package.overrideAttrs (new: old: {
|
||||
preConfigurePhases = old.preConfigurePhases or [ ] ++ [ "postPatchPhase" ];
|
||||
|
@ -18,7 +24,7 @@ let
|
|||
|
||||
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";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Redecorating";
|
||||
|
@ -51,15 +57,12 @@ in
|
|||
|
||||
config = {
|
||||
# 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" ];
|
||||
|
||||
# For audio
|
||||
boot.kernelParams = [ "pcie_ports=compat" "intel_iommu=on" "iommu=pt" ];
|
||||
services.udev.extraRules = builtins.readFile (pkgs.substitute {
|
||||
src = "${audioFiles}/files/91-audio-custom.rules";
|
||||
replacements = [ "--replace" "/usr/bin/sed" "${pkgs.gnused}/bin/sed" ];
|
||||
});
|
||||
services.udev.packages = [ audioFilesUdevRules ];
|
||||
|
||||
hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, buildLinux, fetchFromGitHub, fetchurl, ... } @ args:
|
||||
{ lib, buildLinux, fetchFromGitHub, fetchzip, runCommand
|
||||
, ... } @ args:
|
||||
|
||||
let
|
||||
patchRepo = fetchFromGitHub {
|
||||
|
@ -18,10 +19,18 @@ buildLinux (args // {
|
|||
# Snippet from nixpkgs
|
||||
modDirVersion = with lib; "${concatStringsSep "." (take 3 (splitVersion "${version}.0"))}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://kernel/linux/kernel/v${majorVersion}.x/linux-${version}.tar.xz";
|
||||
hash = "sha256-eldLvCCALqdrUsp/rwcmf3IEXoYbGJFcUnKpjCer+IQ=";
|
||||
};
|
||||
src = runCommand "patched-source" {} ''
|
||||
cp -r ${fetchzip {
|
||||
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; {
|
||||
APPLE_BCE = module;
|
||||
|
@ -40,7 +49,5 @@ buildLinux (args // {
|
|||
STAGING = yes;
|
||||
};
|
||||
|
||||
kernelPatches = lib.attrsets.mapAttrsToList (file: type: { name = file; patch = "${patchRepo}/${file}"; })
|
||||
(lib.attrsets.filterAttrs (file: type: type == "regular" && lib.strings.hasSuffix ".patch" file)
|
||||
(builtins.readDir patchRepo));
|
||||
kernelPatches = [];
|
||||
} // (args.argsOverride or {}))
|
||||
|
|
Loading…
Reference in a new issue