update mac
This commit is contained in:
4
hosts/mac-nixos/apple-silicon-support/default.nix
Executable file → Normal file
4
hosts/mac-nixos/apple-silicon-support/default.nix
Executable file → Normal file
@@ -1,5 +1,7 @@
|
|||||||
{ ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ./modules/default.nix ];
|
imports = [
|
||||||
|
./modules/default.nix
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
21
hosts/mac-nixos/apple-silicon-support/modules/boot-m1n1/default.nix
Executable file → Normal file
21
hosts/mac-nixos/apple-silicon-support/modules/boot-m1n1/default.nix
Executable file → Normal file
@@ -1,9 +1,4 @@
|
|||||||
{
|
{ config, pkgs, lib, ... }:
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
let
|
||||||
pkgs' = config.hardware.asahi.pkgs;
|
pkgs' = config.hardware.asahi.pkgs;
|
||||||
|
|
||||||
@@ -13,10 +8,12 @@ let
|
|||||||
customLogo = config.boot.m1n1CustomLogo;
|
customLogo = config.boot.m1n1CustomLogo;
|
||||||
};
|
};
|
||||||
|
|
||||||
bootUBoot = pkgs'.uboot-asahi.override { m1n1 = bootM1n1; };
|
bootUBoot = pkgs'.uboot-asahi.override {
|
||||||
|
m1n1 = bootM1n1;
|
||||||
|
};
|
||||||
|
|
||||||
bootFiles = {
|
bootFiles = {
|
||||||
"m1n1/boot.bin" = pkgs.runCommand "boot.bin" { } ''
|
"m1n1/boot.bin" = pkgs.runCommand "boot.bin" {} ''
|
||||||
cat ${bootM1n1}/build/m1n1.bin > $out
|
cat ${bootM1n1}/build/m1n1.bin > $out
|
||||||
cat ${config.boot.kernelPackages.kernel}/dtbs/apple/*.dtb >> $out
|
cat ${config.boot.kernelPackages.kernel}/dtbs/apple/*.dtb >> $out
|
||||||
cat ${bootUBoot}/u-boot-nodtb.bin.gz >> $out
|
cat ${bootUBoot}/u-boot-nodtb.bin.gz >> $out
|
||||||
@@ -25,18 +22,14 @@ let
|
|||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
config = lib.mkIf config.hardware.asahi.enable {
|
config = lib.mkIf config.hardware.asahi.enable {
|
||||||
# install m1n1 with the boot loader
|
# install m1n1 with the boot loader
|
||||||
boot.loader.grub.extraFiles = bootFiles;
|
boot.loader.grub.extraFiles = bootFiles;
|
||||||
boot.loader.systemd-boot.extraFiles = bootFiles;
|
boot.loader.systemd-boot.extraFiles = bootFiles;
|
||||||
|
|
||||||
# ensure the installer has m1n1 in the image
|
# ensure the installer has m1n1 in the image
|
||||||
system.extraDependencies = lib.mkForce [
|
system.extraDependencies = lib.mkForce [ bootM1n1 bootUBoot ];
|
||||||
bootM1n1
|
|
||||||
bootUBoot
|
|
||||||
];
|
|
||||||
system.build.m1n1 = bootFiles."m1n1/boot.bin";
|
system.build.m1n1 = bootFiles."m1n1/boot.bin";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
42
hosts/mac-nixos/apple-silicon-support/modules/default.nix
Executable file → Normal file
42
hosts/mac-nixos/apple-silicon-support/modules/default.nix
Executable file → Normal file
@@ -1,9 +1,4 @@
|
|||||||
{
|
{ config, pkgs, lib, ... }:
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./kernel
|
./kernel
|
||||||
@@ -13,22 +8,43 @@
|
|||||||
./sound
|
./sound
|
||||||
];
|
];
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
|
||||||
cfg = config.hardware.asahi;
|
cfg = config.hardware.asahi;
|
||||||
in
|
in lib.mkIf cfg.enable {
|
||||||
lib.mkIf cfg.enable {
|
|
||||||
nixpkgs.overlays = lib.mkBefore [ cfg.overlay ];
|
nixpkgs.overlays = lib.mkBefore [ cfg.overlay ];
|
||||||
|
|
||||||
|
# patch systemd-boot to boot in Apple Silicon UEFI environment.
|
||||||
|
# This regression only appeared in systemd 256.7.
|
||||||
|
# see https://github.com/NixOS/nixpkgs/pull/355290
|
||||||
|
# and https://github.com/systemd/systemd/issues/35026
|
||||||
|
systemd.package = let
|
||||||
|
systemdBroken = (pkgs.systemd.version == "256.7");
|
||||||
|
|
||||||
|
systemdPatched = pkgs.systemd.overrideAttrs (old: {
|
||||||
|
patches = let
|
||||||
|
oldPatches = (old.patches or []);
|
||||||
|
# not sure why there are non-paths in there but oh well
|
||||||
|
patchNames = (builtins.map (p: if ((builtins.typeOf p) == "path") then builtins.baseNameOf p else "") oldPatches);
|
||||||
|
fixName = "0019-Revert-boot-Make-initrd_prepare-semantically-equival.patch";
|
||||||
|
alreadyPatched = builtins.elem fixName patchNames;
|
||||||
|
in oldPatches ++ lib.optionals (!alreadyPatched) [
|
||||||
|
(pkgs.fetchpatch {
|
||||||
|
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/125e99477b0ac0a54b7cddc6c5a704821a3074c7/pkgs/os-specific/linux/systemd/${fixName}";
|
||||||
|
hash = "sha256-UW3DZiaykQUUNcGA5UFxN+/wgNSW3ufxDDCZ7emD16o=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
});
|
||||||
|
in if systemdBroken then systemdPatched else pkgs.systemd;
|
||||||
|
|
||||||
hardware.asahi.pkgs =
|
hardware.asahi.pkgs =
|
||||||
if cfg.pkgsSystem != "aarch64-linux" then
|
if cfg.pkgsSystem != "aarch64-linux"
|
||||||
|
then
|
||||||
import (pkgs.path) {
|
import (pkgs.path) {
|
||||||
crossSystem.system = "aarch64-linux";
|
crossSystem.system = "aarch64-linux";
|
||||||
localSystem.system = cfg.pkgsSystem;
|
localSystem.system = cfg.pkgsSystem;
|
||||||
overlays = [ cfg.overlay ];
|
overlays = [ cfg.overlay ];
|
||||||
}
|
}
|
||||||
else
|
else pkgs;
|
||||||
pkgs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
options.hardware.asahi = {
|
options.hardware.asahi = {
|
||||||
|
|||||||
24
hosts/mac-nixos/apple-silicon-support/modules/kernel/default.nix
Executable file → Normal file
24
hosts/mac-nixos/apple-silicon-support/modules/kernel/default.nix
Executable file → Normal file
@@ -1,17 +1,11 @@
|
|||||||
# the Asahi Linux kernel and options that must go along with it
|
# the Asahi Linux kernel and options that must go along with it
|
||||||
|
|
||||||
{
|
{ config, pkgs, lib, ... }:
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
{
|
||||||
config = lib.mkIf config.hardware.asahi.enable {
|
config = lib.mkIf config.hardware.asahi.enable {
|
||||||
boot.kernelPackages =
|
boot.kernelPackages = let
|
||||||
let
|
pkgs' = config.hardware.asahi.pkgs;
|
||||||
pkgs' = config.hardware.asahi.pkgs;
|
in
|
||||||
in
|
|
||||||
pkgs'.linux-asahi.override {
|
pkgs'.linux-asahi.override {
|
||||||
_kernelPatches = config.boot.kernelPatches;
|
_kernelPatches = config.boot.kernelPatches;
|
||||||
withRust = config.hardware.asahi.withRust;
|
withRust = config.hardware.asahi.withRust;
|
||||||
@@ -31,7 +25,7 @@
|
|||||||
"pinctrl-apple-gpio"
|
"pinctrl-apple-gpio"
|
||||||
"macsmc"
|
"macsmc"
|
||||||
"macsmc-rtkit"
|
"macsmc-rtkit"
|
||||||
"i2c-apple"
|
"i2c-pasemi-platform"
|
||||||
"tps6598x"
|
"tps6598x"
|
||||||
"apple-dart"
|
"apple-dart"
|
||||||
"dwc3"
|
"dwc3"
|
||||||
@@ -62,7 +56,6 @@
|
|||||||
|
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
"earlycon"
|
"earlycon"
|
||||||
"console=ttySAC0,115200n8"
|
|
||||||
"console=tty0"
|
"console=tty0"
|
||||||
"boot.shell_on_fail"
|
"boot.shell_on_fail"
|
||||||
# Apple's SSDs are slow (~dozens of ms) at processing flush requests which
|
# Apple's SSDs are slow (~dozens of ms) at processing flush requests which
|
||||||
@@ -99,11 +92,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
(lib.mkRemovedOptionModule [
|
(lib.mkRemovedOptionModule [ "hardware" "asahi" "addEdgeKernelConfig" ]
|
||||||
"hardware"
|
"All edge kernel config options are now the default.")
|
||||||
"asahi"
|
|
||||||
"addEdgeKernelConfig"
|
|
||||||
] "All edge kernel config options are now the default.")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
options.hardware.asahi.withRust = lib.mkOption {
|
options.hardware.asahi.withRust = lib.mkOption {
|
||||||
|
|||||||
83
hosts/mac-nixos/apple-silicon-support/modules/mesa/default.nix
Executable file → Normal file
83
hosts/mac-nixos/apple-silicon-support/modules/mesa/default.nix
Executable file → Normal file
@@ -1,57 +1,27 @@
|
|||||||
|
{ options, config, pkgs, lib, ... }:
|
||||||
{
|
{
|
||||||
config,
|
config = let
|
||||||
pkgs,
|
isMode = mode: (config.hardware.asahi.useExperimentalGPUDriver
|
||||||
lib,
|
&& config.hardware.asahi.experimentalGPUInstallMode == mode);
|
||||||
...
|
in lib.mkIf config.hardware.asahi.enable (lib.mkMerge [
|
||||||
}:
|
{
|
||||||
{
|
# required for proper DRM setup even without GPU driver
|
||||||
config =
|
services.xserver.config = ''
|
||||||
let
|
Section "OutputClass"
|
||||||
isMode =
|
Identifier "appledrm"
|
||||||
mode:
|
MatchDriver "apple"
|
||||||
(
|
Driver "modesetting"
|
||||||
config.hardware.asahi.useExperimentalGPUDriver
|
Option "PrimaryGPU" "true"
|
||||||
&& config.hardware.asahi.experimentalGPUInstallMode == mode
|
EndSection
|
||||||
);
|
'';
|
||||||
in
|
}
|
||||||
lib.mkIf config.hardware.asahi.enable (
|
(lib.mkIf config.hardware.asahi.useExperimentalGPUDriver {
|
||||||
lib.mkMerge [
|
# install the Asahi Mesa version
|
||||||
{
|
hardware.graphics.package = config.hardware.asahi.pkgs.mesa-asahi-edge;
|
||||||
# required for proper DRM setup even without GPU driver
|
# required for in-kernel GPU driver
|
||||||
services.xserver.config = ''
|
hardware.asahi.withRust = true;
|
||||||
Section "OutputClass"
|
})
|
||||||
Identifier "appledrm"
|
]);
|
||||||
MatchDriver "apple"
|
|
||||||
Driver "modesetting"
|
|
||||||
Option "PrimaryGPU" "true"
|
|
||||||
EndSection
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
(lib.mkIf config.hardware.asahi.useExperimentalGPUDriver {
|
|
||||||
# install the drivers
|
|
||||||
hardware.opengl.package = config.hardware.asahi.pkgs.mesa-asahi-edge.drivers;
|
|
||||||
|
|
||||||
# required for in-kernel GPU driver
|
|
||||||
hardware.asahi.withRust = true;
|
|
||||||
})
|
|
||||||
(lib.mkIf (isMode "replace") {
|
|
||||||
# replace the Mesa linked into system packages with the Asahi version
|
|
||||||
# without rebuilding them to avoid rebuilding the world.
|
|
||||||
system.replaceRuntimeDependencies = [
|
|
||||||
{
|
|
||||||
original = pkgs.mesa;
|
|
||||||
replacement = config.hardware.asahi.pkgs.mesa-asahi-edge;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
})
|
|
||||||
(lib.mkIf (isMode "overlay") {
|
|
||||||
# replace the Mesa used in Nixpkgs with the Asahi version using an overlay,
|
|
||||||
# which requires rebuilding the world but ensures it is done faithfully
|
|
||||||
# (and in a way compatible with pure evaluation)
|
|
||||||
nixpkgs.overlays = [ (final: prev: { mesa = final.mesa-asahi-edge; }) ];
|
|
||||||
})
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
options.hardware.asahi.useExperimentalGPUDriver = lib.mkOption {
|
options.hardware.asahi.useExperimentalGPUDriver = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
@@ -63,12 +33,9 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# hopefully no longer used, should be deprecated eventually
|
||||||
options.hardware.asahi.experimentalGPUInstallMode = lib.mkOption {
|
options.hardware.asahi.experimentalGPUInstallMode = lib.mkOption {
|
||||||
type = lib.types.enum [
|
type = lib.types.enum [ "driver" "replace" "overlay" ];
|
||||||
"driver"
|
|
||||||
"replace"
|
|
||||||
"overlay"
|
|
||||||
];
|
|
||||||
default = "replace";
|
default = "replace";
|
||||||
description = ''
|
description = ''
|
||||||
Mode to use to install the experimental GPU driver into the system.
|
Mode to use to install the experimental GPU driver into the system.
|
||||||
|
|||||||
65
hosts/mac-nixos/apple-silicon-support/modules/peripheral-firmware/default.nix
Executable file → Normal file
65
hosts/mac-nixos/apple-silicon-support/modules/peripheral-firmware/default.nix
Executable file → Normal file
@@ -1,14 +1,8 @@
|
|||||||
{
|
{ config, pkgs, lib, ... }:
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
{
|
||||||
config = lib.mkIf config.hardware.asahi.enable {
|
config = lib.mkIf config.hardware.asahi.enable {
|
||||||
assertions = lib.mkIf config.hardware.asahi.extractPeripheralFirmware [
|
assertions = lib.mkIf config.hardware.asahi.extractPeripheralFirmware [
|
||||||
{
|
{ assertion = config.hardware.asahi.peripheralFirmwareDirectory != null;
|
||||||
assertion = config.hardware.asahi.peripheralFirmwareDirectory != null;
|
|
||||||
message = ''
|
message = ''
|
||||||
Asahi peripheral firmware extraction is enabled but the firmware
|
Asahi peripheral firmware extraction is enabled but the firmware
|
||||||
location appears incorrect.
|
location appears incorrect.
|
||||||
@@ -16,34 +10,26 @@
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
hardware.firmware =
|
hardware.firmware = let
|
||||||
let
|
pkgs' = config.hardware.asahi.pkgs;
|
||||||
pkgs' = config.hardware.asahi.pkgs;
|
in
|
||||||
in
|
lib.mkIf ((config.hardware.asahi.peripheralFirmwareDirectory != null)
|
||||||
lib.mkIf
|
&& config.hardware.asahi.extractPeripheralFirmware) [
|
||||||
(
|
(pkgs.stdenv.mkDerivation {
|
||||||
(config.hardware.asahi.peripheralFirmwareDirectory != null)
|
name = "asahi-peripheral-firmware";
|
||||||
&& config.hardware.asahi.extractPeripheralFirmware
|
|
||||||
)
|
|
||||||
[
|
|
||||||
(pkgs.stdenv.mkDerivation {
|
|
||||||
name = "asahi-peripheral-firmware";
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [ pkgs'.asahi-fwextract pkgs.cpio ];
|
||||||
pkgs'.asahi-fwextract
|
|
||||||
pkgs.cpio
|
|
||||||
];
|
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir extracted
|
mkdir extracted
|
||||||
asahi-fwextract ${config.hardware.asahi.peripheralFirmwareDirectory} extracted
|
asahi-fwextract ${config.hardware.asahi.peripheralFirmwareDirectory} extracted
|
||||||
|
|
||||||
mkdir -p $out/lib/firmware
|
mkdir -p $out/lib/firmware
|
||||||
cat extracted/firmware.cpio | cpio -id --quiet --no-absolute-filenames
|
cat extracted/firmware.cpio | cpio -id --quiet --no-absolute-filenames
|
||||||
mv vendorfw/* $out/lib/firmware
|
mv vendorfw/* $out/lib/firmware
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
options.hardware.asahi = {
|
options.hardware.asahi = {
|
||||||
@@ -59,12 +45,13 @@
|
|||||||
peripheralFirmwareDirectory = lib.mkOption {
|
peripheralFirmwareDirectory = lib.mkOption {
|
||||||
type = lib.types.nullOr lib.types.path;
|
type = lib.types.nullOr lib.types.path;
|
||||||
|
|
||||||
default = lib.findFirst (path: builtins.pathExists (path + "/all_firmware.tar.gz")) null [
|
default = lib.findFirst (path: builtins.pathExists (path + "/all_firmware.tar.gz")) null
|
||||||
# path when the system is operating normally
|
[
|
||||||
/boot/asahi
|
# path when the system is operating normally
|
||||||
# path when the system is mounted in the installer
|
/boot/asahi
|
||||||
/mnt/boot/asahi
|
# path when the system is mounted in the installer
|
||||||
];
|
/mnt/boot/asahi
|
||||||
|
];
|
||||||
|
|
||||||
description = ''
|
description = ''
|
||||||
Path to the directory containing the non-free non-redistributable
|
Path to the directory containing the non-free non-redistributable
|
||||||
|
|||||||
133
hosts/mac-nixos/apple-silicon-support/modules/sound/default.nix
Executable file → Normal file
133
hosts/mac-nixos/apple-silicon-support/modules/sound/default.nix
Executable file → Normal file
@@ -1,23 +1,10 @@
|
|||||||
{
|
{ config, options, pkgs, lib, ... }:
|
||||||
config,
|
|
||||||
options,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
|
||||||
# disable pulseaudio as the Asahi sound infrastructure can't use it.
|
|
||||||
# if we disable it only if setupAsahiSound is enabled, then infinite
|
|
||||||
# recursion results as pulseaudio enables config.sound by default.
|
|
||||||
{ config.hardware.pulseaudio.enable = (!config.hardware.asahi.enable); }
|
|
||||||
];
|
|
||||||
|
|
||||||
options.hardware.asahi = {
|
options.hardware.asahi = {
|
||||||
setupAsahiSound = lib.mkOption {
|
setupAsahiSound = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = config.sound.enable && config.hardware.asahi.enable;
|
default = config.hardware.asahi.enable;
|
||||||
description = ''
|
description = ''
|
||||||
Set up the Asahi DSP components so that the speakers and headphone jack
|
Set up the Asahi DSP components so that the speakers and headphone jack
|
||||||
work properly and safely.
|
work properly and safely.
|
||||||
@@ -25,96 +12,38 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let
|
||||||
let
|
cfg = config.hardware.asahi;
|
||||||
cfg = config.hardware.asahi;
|
in lib.mkIf (cfg.setupAsahiSound && cfg.enable) (lib.mkMerge [
|
||||||
|
{
|
||||||
|
# can't be used by Asahi sound infrastructure
|
||||||
|
services.pulseaudio.enable = false;
|
||||||
|
# enable pipewire to run real-time and avoid audible glitches
|
||||||
|
security.rtkit.enable = true;
|
||||||
|
# set up pipewire with the supported capabilities (instead of pulseaudio)
|
||||||
|
# and asahi-audio configs and plugins
|
||||||
|
services.pipewire = {
|
||||||
|
enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
|
||||||
asahi-audio = pkgs.asahi-audio; # the asahi-audio we use
|
configPackages = [ pkgs.asahi-audio ];
|
||||||
|
|
||||||
lsp-plugins = pkgs.lsp-plugins; # the lsp-plugins we use
|
wireplumber = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
lsp-plugins-is-patched =
|
configPackages = [ pkgs.asahi-audio ];
|
||||||
(lsp-plugins.overrideAttrs (old: {
|
};
|
||||||
passthru = (old.passthru or { }) // {
|
};
|
||||||
lsp-plugins-is-patched = builtins.elem "58c3f985f009c84347fa91236f164a9e47aafa93.patch" (
|
|
||||||
builtins.map (p: p.name) (old.patches or [ ])
|
|
||||||
);
|
|
||||||
};
|
|
||||||
})).lsp-plugins-is-patched;
|
|
||||||
|
|
||||||
lsp-plugins-is-safe =
|
# set up enivronment so that UCM configs are used as well
|
||||||
(pkgs.lib.versionAtLeast lsp-plugins.version "1.2.14") || lsp-plugins-is-patched;
|
environment.variables.ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-asahi}/share/alsa/ucm2";
|
||||||
|
systemd.user.services.pipewire.environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2;
|
||||||
|
systemd.user.services.wireplumber.environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2;
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/pull/282377
|
# enable speakersafetyd to protect speakers
|
||||||
# options is the set of all module option declarations, rather than their
|
systemd.packages = [ pkgs.speakersafetyd ];
|
||||||
# values, to prevent infinite recursion
|
services.udev.packages = [ pkgs.speakersafetyd ];
|
||||||
newHotness = builtins.hasAttr "configPackages" options.services.pipewire;
|
}
|
||||||
|
]);
|
||||||
lv2Path = lib.makeSearchPath "lib/lv2" [
|
|
||||||
lsp-plugins
|
|
||||||
pkgs.bankstown-lv2
|
|
||||||
];
|
|
||||||
in
|
|
||||||
lib.mkIf (cfg.setupAsahiSound && cfg.enable) (
|
|
||||||
lib.mkMerge [
|
|
||||||
{
|
|
||||||
# enable pipewire to run real-time and avoid audible glitches
|
|
||||||
security.rtkit.enable = true;
|
|
||||||
# set up pipewire with the supported capabilities (instead of pulseaudio)
|
|
||||||
# and asahi-audio configs and plugins
|
|
||||||
services.pipewire = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
alsa.enable = true;
|
|
||||||
pulse.enable = true;
|
|
||||||
wireplumber.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# set up enivronment so that UCM configs are used as well
|
|
||||||
environment.variables.ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-asahi}/share/alsa/ucm2";
|
|
||||||
systemd.user.services.pipewire.environment.ALSA_CONFIG_UCM2 =
|
|
||||||
config.environment.variables.ALSA_CONFIG_UCM2;
|
|
||||||
systemd.user.services.wireplumber.environment.ALSA_CONFIG_UCM2 =
|
|
||||||
config.environment.variables.ALSA_CONFIG_UCM2;
|
|
||||||
|
|
||||||
# enable speakersafetyd to protect speakers
|
|
||||||
systemd.packages =
|
|
||||||
lib.mkAssert lsp-plugins-is-safe
|
|
||||||
"lsp-plugins is unpatched/outdated and speakers cannot be safely enabled"
|
|
||||||
[ pkgs.speakersafetyd ];
|
|
||||||
services.udev.packages = [ pkgs.speakersafetyd ];
|
|
||||||
}
|
|
||||||
(lib.optionalAttrs newHotness {
|
|
||||||
# use configPackages and friends to install asahi-audio and plugins
|
|
||||||
services.pipewire = {
|
|
||||||
configPackages = [ asahi-audio ];
|
|
||||||
extraLv2Packages = [
|
|
||||||
lsp-plugins
|
|
||||||
pkgs.bankstown-lv2
|
|
||||||
];
|
|
||||||
wireplumber = {
|
|
||||||
configPackages = [ asahi-audio ];
|
|
||||||
extraLv2Packages = [
|
|
||||||
lsp-plugins
|
|
||||||
pkgs.bankstown-lv2
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
|
||||||
(lib.optionalAttrs (!newHotness) {
|
|
||||||
# use environment.etc and environment variables to install asahi-audio and plugins
|
|
||||||
environment.etc = builtins.listToAttrs (
|
|
||||||
builtins.map (f: {
|
|
||||||
name = f;
|
|
||||||
value = {
|
|
||||||
source = "${asahi-audio}/share/${f}";
|
|
||||||
};
|
|
||||||
}) asahi-audio.providedConfigFiles
|
|
||||||
);
|
|
||||||
|
|
||||||
systemd.user.services.pipewire.environment.LV2_PATH = lv2Path;
|
|
||||||
systemd.user.services.wireplumber.environment.LV2_PATH = lv2Path;
|
|
||||||
})
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
27
hosts/mac-nixos/apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix
Executable file → Normal file
27
hosts/mac-nixos/apple-silicon-support/packages/alsa-ucm-conf-asahi/default.nix
Executable file → Normal file
@@ -1,23 +1,22 @@
|
|||||||
{
|
{ lib
|
||||||
lib,
|
, fetchFromGitHub
|
||||||
fetchFromGitHub,
|
, alsa-ucm-conf
|
||||||
alsa-ucm-conf,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
(alsa-ucm-conf.overrideAttrs (oldAttrs: rec {
|
(alsa-ucm-conf.overrideAttrs (oldAttrs: let
|
||||||
version = "5";
|
versionAsahi = "8";
|
||||||
|
|
||||||
src_asahi = fetchFromGitHub {
|
srcAsahi = fetchFromGitHub {
|
||||||
# tracking: https://src.fedoraproject.org/rpms/alsa-ucm-asahi
|
# tracking: https://src.fedoraproject.org/rpms/alsa-ucm-asahi
|
||||||
owner = "AsahiLinux";
|
owner = "AsahiLinux";
|
||||||
repo = "alsa-ucm-conf-asahi";
|
repo = "alsa-ucm-conf-asahi";
|
||||||
rev = "v${version}";
|
rev = "v${versionAsahi}";
|
||||||
hash = "sha256-daUNz5oUrPfSMO0Tqq/WbtiLHMOtPeQQlI+juGrhTxw=";
|
hash = "sha256-FPrAzscc1ICSCQSqULaGLqG4UCq8GZU9XLV7TUSBBRM=";
|
||||||
};
|
};
|
||||||
|
in {
|
||||||
|
name = "${oldAttrs.pname}-${oldAttrs.version}-asahi-${versionAsahi}";
|
||||||
|
|
||||||
postInstall =
|
postInstall = oldAttrs.postInstall or "" + ''
|
||||||
oldAttrs.postInstall or ""
|
cp -r ${srcAsahi}/ucm2 $out/share/alsa
|
||||||
+ ''
|
'';
|
||||||
cp -r ${src_asahi}/ucm2 $out/share/alsa
|
|
||||||
'';
|
|
||||||
}))
|
}))
|
||||||
|
|||||||
30
hosts/mac-nixos/apple-silicon-support/packages/asahi-audio/default.nix
Executable file → Normal file
30
hosts/mac-nixos/apple-silicon-support/packages/asahi-audio/default.nix
Executable file → Normal file
@@ -1,20 +1,21 @@
|
|||||||
{
|
{ stdenv
|
||||||
stdenv,
|
, lib
|
||||||
lib,
|
, fetchFromGitHub
|
||||||
fetchFromGitHub,
|
, lsp-plugins
|
||||||
|
, bankstown-lv2
|
||||||
|
, triforce-lv2
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "asahi-audio";
|
pname = "asahi-audio";
|
||||||
# tracking: https://src.fedoraproject.org/rpms/asahi-audio
|
# tracking: https://src.fedoraproject.org/rpms/asahi-audio
|
||||||
# note: ensure that the providedConfigFiles list below is current!
|
version = "3.3";
|
||||||
version = "1.6";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "AsahiLinux";
|
owner = "AsahiLinux";
|
||||||
repo = "asahi-audio";
|
repo = "asahi-audio";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = "sha256-NxTQD742U2FUZNmw7RHuOruMuTRLtAh1HDlMV9EzQkg=";
|
hash = "sha256-p0M1pPxov+wSLT2F4G6y5NZpCXzbjZkzle+75zQ4xxU=";
|
||||||
};
|
};
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
@@ -37,16 +38,9 @@ stdenv.mkDerivation rec {
|
|||||||
mv $out/share/asahi-audio $out
|
mv $out/share/asahi-audio $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# list of config files installed in $out/share/ and destined for
|
passthru.requiredLv2Packages = [
|
||||||
# /etc/, from the `install -pm0644 conf/` lines in the Makefile. note
|
lsp-plugins
|
||||||
# that the contents of asahi-audio/ stay in $out/ and the config files
|
bankstown-lv2
|
||||||
# are modified to point to them.
|
triforce-lv2
|
||||||
passthru.providedConfigFiles = [
|
|
||||||
"wireplumber/wireplumber.conf.d/99-asahi.conf"
|
|
||||||
"wireplumber/policy.lua.d/85-asahi-policy.lua"
|
|
||||||
"wireplumber/main.lua.d/85-asahi.lua"
|
|
||||||
"wireplumber/scripts/policy-asahi.lua"
|
|
||||||
"pipewire/pipewire.conf.d/99-asahi.conf"
|
|
||||||
"pipewire/pipewire-pulse.conf.d/99-asahi.conf"
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
{
|
{ lib
|
||||||
lib,
|
, python3
|
||||||
python3,
|
, fetchFromGitHub
|
||||||
fetchFromGitHub,
|
, gzip
|
||||||
gzip,
|
, gnutar
|
||||||
gnutar,
|
, lzfse
|
||||||
lzfse,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
python3.pkgs.buildPythonApplication rec {
|
python3.pkgs.buildPythonApplication rec {
|
||||||
pname = "asahi-fwextract";
|
pname = "asahi-fwextract";
|
||||||
version = "0.6.9";
|
version = "0.7.8";
|
||||||
|
|
||||||
# tracking version: https://github.com/AsahiLinux/PKGBUILDs/blob/main/asahi-fwextract/PKGBUILD
|
# tracking version: https://packages.fedoraproject.org/pkgs/asahi-installer/python3-asahi_firmware/
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "AsahiLinux";
|
owner = "AsahiLinux";
|
||||||
repo = "asahi-installer";
|
repo = "asahi-installer";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = "sha256-MkNi4EBgT4gfev/yWqYyw5HZxewj6XTfb8na+eI2iVo=";
|
hash = "sha256-UmgHWKIRbcg9PK44YPPM4tyuEDC0+ANKO3Mzc4N9RHo=";
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
lib,
|
|
||||||
lv2,
|
|
||||||
pkg-config,
|
|
||||||
rustPlatform,
|
|
||||||
fetchFromGitHub,
|
|
||||||
fetchpatch,
|
|
||||||
}:
|
|
||||||
|
|
||||||
rustPlatform.buildRustPackage rec {
|
|
||||||
pname = "bankstown-lv2";
|
|
||||||
# tracking: https://src.fedoraproject.org/rpms/rust-bankstown-lv2
|
|
||||||
version = "1.1.0";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "chadmed";
|
|
||||||
repo = "bankstown";
|
|
||||||
rev = version;
|
|
||||||
hash = "sha256-IThXEY+mvT2MCw0PSWU/182xbUafd6dtm6hNjieLlKg=";
|
|
||||||
};
|
|
||||||
|
|
||||||
cargoSha256 = "sha256-yRzM4tcYc6mweTpLnnlCeKgP00L2wRgHamtUzK9Kstc=";
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
export LIBDIR=$out/lib
|
|
||||||
mkdir -p $LIBDIR
|
|
||||||
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config ];
|
|
||||||
|
|
||||||
buildInputs = [ lv2 ];
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,40 +0,0 @@
|
|||||||
From 0fcdbacd8b06c24f5761a0cf9cb0c43cad05c19b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Thomas Watson <twatson52@icloud.com>
|
|
||||||
Date: Mon, 26 Feb 2024 19:51:12 -0600
|
|
||||||
Subject: [PATCH] fs/fcntl: accept more values as F_DUPFD_CLOEXEC args
|
|
||||||
|
|
||||||
libwebrtc doesn't pass anything as the arg to this function so the
|
|
||||||
minimum fd ends up as random garbage. If it's bigger than the maximum
|
|
||||||
fd, which is likely, then the duplication fails, and libwebrtc breaks.
|
|
||||||
|
|
||||||
The previous patch (081abc5fa701738699705a6c0a41c824df77cb37) rejects
|
|
||||||
args >= 1024 (the default soft max fd) and instead subtitutes a minimum
|
|
||||||
fd of 0 to allow such requests to succeed.
|
|
||||||
|
|
||||||
However, gnulib's test suite can pass the following values and expects
|
|
||||||
them to fail; this patch prevents those from succeeding:
|
|
||||||
* -1 (hard-coded)
|
|
||||||
* 1024 (`ulimit -n` value by default)
|
|
||||||
* 1048576 (`ulimit -n` value in Nix build sandbox)
|
|
||||||
|
|
||||||
Hopefully the garbage values libwebrtc passes do not match very often.
|
|
||||||
---
|
|
||||||
fs/fcntl.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/fs/fcntl.c b/fs/fcntl.c
|
|
||||||
index f18f87419445..65a6861476ec 100644
|
|
||||||
--- a/fs/fcntl.c
|
|
||||||
+++ b/fs/fcntl.c
|
|
||||||
@@ -326,7 +326,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
|
|
||||||
err = f_dupfd(argi, filp, 0);
|
|
||||||
break;
|
|
||||||
case F_DUPFD_CLOEXEC:
|
|
||||||
- if (arg >= 1024)
|
|
||||||
+ if ((arg > 1024) && (argi != 1048576) && (argi != -1))
|
|
||||||
argi = 0; /* Lol libwebrtc */
|
|
||||||
err = f_dupfd(argi, filp, O_CLOEXEC);
|
|
||||||
break;
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
66
hosts/mac-nixos/apple-silicon-support/packages/linux-asahi/config
Executable file → Normal file
66
hosts/mac-nixos/apple-silicon-support/packages/linux-asahi/config
Executable file → Normal file
@@ -516,7 +516,7 @@ CONFIG_DMI=y
|
|||||||
#
|
#
|
||||||
# Power management options
|
# Power management options
|
||||||
#
|
#
|
||||||
# CONFIG_SUSPEND is not set
|
CONFIG_SUSPEND=y
|
||||||
# CONFIG_HIBERNATION is not set
|
# CONFIG_HIBERNATION is not set
|
||||||
CONFIG_PM=y
|
CONFIG_PM=y
|
||||||
CONFIG_PM_DEBUG=y
|
CONFIG_PM_DEBUG=y
|
||||||
@@ -742,6 +742,8 @@ CONFIG_MODULE_UNLOAD=y
|
|||||||
# CONFIG_MODULE_COMPRESS_NONE is not set
|
# CONFIG_MODULE_COMPRESS_NONE is not set
|
||||||
# CONFIG_MODULE_COMPRESS_GZIP is not set
|
# CONFIG_MODULE_COMPRESS_GZIP is not set
|
||||||
# CONFIG_MODULE_COMPRESS_XZ is not set
|
# CONFIG_MODULE_COMPRESS_XZ is not set
|
||||||
|
CONFIG_MODULE_COMPRESS=y
|
||||||
|
CONFIG_MODULE_COMPRESS_ALL=y
|
||||||
CONFIG_MODULE_COMPRESS_ZSTD=y
|
CONFIG_MODULE_COMPRESS_ZSTD=y
|
||||||
# CONFIG_MODULE_DECOMPRESS is not set
|
# CONFIG_MODULE_DECOMPRESS is not set
|
||||||
# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set
|
# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set
|
||||||
@@ -7782,52 +7784,55 @@ CONFIG_ACPI=y
|
|||||||
CONFIG_TCG_TPM=y
|
CONFIG_TCG_TPM=y
|
||||||
CONFIG_TCG_TIS=m
|
CONFIG_TCG_TIS=m
|
||||||
CONFIG_TCG_CRB=m
|
CONFIG_TCG_CRB=m
|
||||||
|
# needed for mounting the installer squashfs
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/6295433b2b0079b063d78761ae52c4f385180cae/nixos/modules/installer/cd-dvd/iso-image.nix#L725
|
||||||
|
CONFIG_SQUASHFS_CHOICE_DECOMP_BY_MOUNT=y
|
||||||
|
|
||||||
# for better efficiency with sound
|
# for better efficiency with sound
|
||||||
CONFIG_UCLAMP_TASK=y
|
CONFIG_UCLAMP_TASK=y
|
||||||
CONFIG_UCLAMP_TASK_GROUP=y
|
CONFIG_UCLAMP_TASK_GROUP=y
|
||||||
CONFIG_UCLAMP_BUCKETS_COUNT=5
|
CONFIG_UCLAMP_BUCKETS_COUNT=5
|
||||||
|
|
||||||
|
CONFIG_RUST_OVERFLOW_CHECKS=y
|
||||||
|
CONFIG_RUST_PHYLIB_ABSTRACTIONS=y
|
||||||
|
|
||||||
|
# "upstreamed" flags
|
||||||
|
CONFIG_SPI_APPLE=m
|
||||||
|
|
||||||
# Fedora Asahi Remix-specific options
|
# Fedora Asahi Remix-specific options
|
||||||
# generated with something like
|
# generated with something like
|
||||||
# git diff --name-only fedora-6.6 fedora-asahi-6.6 redhat/configs/ | xargs cat >> config
|
# git diff --name-only fedora-6.9 fedora-asahi-6.9 redhat/configs/ | grep -v x86 | grep -v s390x | xargs cat | sort >> config
|
||||||
# in a checkout of https://gitlab.com/fedora-asahi/kernel-asahi/-/tree/fedora-asahi-6.6
|
# in a checkout of https://gitlab.com/fedora-asahi/kernel-asahi/-/tree/fedora-asahi-6.9
|
||||||
|
|
||||||
CONFIG_SUSPEND=y
|
CONFIG_APPLE_AOP=m
|
||||||
# CONFIG_APPLE_PLATFORMS is not set
|
|
||||||
# CONFIG_DRM_SIMPLEDRM_BACKLIGHT is not set
|
|
||||||
CONFIG_RUST=y
|
|
||||||
# CONFIG_RUST_BUILD_ASSERT_ALLOW is not set
|
|
||||||
# CONFIG_RUST_DEBUG_ASSERTIONS is not set
|
|
||||||
# CONFIG_RUST_EXTRA_LOCKDEP is not set
|
|
||||||
CONFIG_RUST_OVERFLOW_CHECKS=y
|
|
||||||
# CONFIG_SPI_HID_APPLE_OF is not set
|
|
||||||
# CONFIG_USB_XHCI_PCI_ASMEDIA is not set
|
|
||||||
# CONFIG_APPLE_MAILBOX is not set
|
|
||||||
# CONFIG_APPLE_PMGR_MISC is not set
|
|
||||||
CONFIG_ARM64_MEMORY_MODEL_CONTROL=y
|
|
||||||
# CONFIG_ARM_APPLE_CPUIDLE is not set
|
|
||||||
# CONFIG_SND_SOC_CS42L84 is not set
|
|
||||||
CONFIG_DRM_GEM_SHMEM_HELPER=y
|
|
||||||
CONFIG_USB_XHCI_PCI_ASMEDIA=y
|
|
||||||
CONFIG_SND_SOC_CS42L84=m
|
|
||||||
CONFIG_TOUCHSCREEN_APPLE_Z2=m
|
|
||||||
CONFIG_APPLE_DOCKCHANNEL=m
|
CONFIG_APPLE_DOCKCHANNEL=m
|
||||||
CONFIG_APPLE_MBOX=y
|
CONFIG_APPLE_MAILBOX=y
|
||||||
|
# CONFIG_APPLE_PLATFORMS is not set
|
||||||
CONFIG_APPLE_PLATFORMS=y
|
CONFIG_APPLE_PLATFORMS=y
|
||||||
|
# CONFIG_APPLE_PMGR_MISC is not set
|
||||||
CONFIG_APPLE_PMGR_MISC=y
|
CONFIG_APPLE_PMGR_MISC=y
|
||||||
CONFIG_APPLE_RTKIT=y
|
|
||||||
CONFIG_APPLE_RTKIT_HELPER=m
|
CONFIG_APPLE_RTKIT_HELPER=m
|
||||||
|
CONFIG_APPLE_RTKIT=y
|
||||||
|
CONFIG_APPLE_SEP=m
|
||||||
|
CONFIG_APPLE_SIO=m
|
||||||
CONFIG_APPLE_SMC=m
|
CONFIG_APPLE_SMC=m
|
||||||
CONFIG_APPLE_SMC_RTKIT=m
|
CONFIG_APPLE_SMC_RTKIT=m
|
||||||
|
CONFIG_ARM64_MEMORY_MODEL_CONTROL=y
|
||||||
|
# CONFIG_ARM_APPLE_CPUIDLE is not set
|
||||||
CONFIG_ARM_APPLE_CPUIDLE=y
|
CONFIG_ARM_APPLE_CPUIDLE=y
|
||||||
CONFIG_CHARGER_MACSMC=m
|
CONFIG_CHARGER_MACSMC=m
|
||||||
CONFIG_DRM_ADP=m
|
CONFIG_DRM_ADP=m
|
||||||
|
CONFIG_DRM_APPLE_AUDIO=y
|
||||||
|
# CONFIG_DRM_APPLE_DEBUG is not set
|
||||||
CONFIG_DRM_APPLE=m
|
CONFIG_DRM_APPLE=m
|
||||||
CONFIG_DRM_ASAHI=m
|
|
||||||
# CONFIG_DRM_ASAHI_DEBUG_ALLOCATOR is not set
|
# CONFIG_DRM_ASAHI_DEBUG_ALLOCATOR is not set
|
||||||
|
CONFIG_DRM_ASAHI=m
|
||||||
|
# CONFIG_DRM_PANEL_SUMMIT is not set
|
||||||
|
CONFIG_DRM_PANEL_SUMMIT=m
|
||||||
CONFIG_GPIO_MACSMC=m
|
CONFIG_GPIO_MACSMC=m
|
||||||
CONFIG_HID_DOCKCHANNEL=m
|
CONFIG_HID_DOCKCHANNEL=m
|
||||||
|
CONFIG_IIO_AOP_SENSOR_ALS=m
|
||||||
|
CONFIG_IIO_AOP_SENSOR_LAS=m
|
||||||
CONFIG_INPUT_MACSMC_HID=m
|
CONFIG_INPUT_MACSMC_HID=m
|
||||||
CONFIG_MFD_APPLE_SPMI_PMU=m
|
CONFIG_MFD_APPLE_SPMI_PMU=m
|
||||||
CONFIG_MUX_APPLE_DPXBAR=m
|
CONFIG_MUX_APPLE_DPXBAR=m
|
||||||
@@ -7836,10 +7841,15 @@ CONFIG_PHY_APPLE_ATC=m
|
|||||||
CONFIG_PHY_APPLE_DPTX=m
|
CONFIG_PHY_APPLE_DPTX=m
|
||||||
CONFIG_POWER_RESET_MACSMC=m
|
CONFIG_POWER_RESET_MACSMC=m
|
||||||
CONFIG_RTC_DRV_MACSMC=m
|
CONFIG_RTC_DRV_MACSMC=m
|
||||||
|
CONFIG_SENSORS_MACSMC=m
|
||||||
|
CONFIG_SND_SOC_APPLE_AOP_AUDIO=m
|
||||||
CONFIG_SND_SOC_APPLE_MACAUDIO=m
|
CONFIG_SND_SOC_APPLE_MACAUDIO=m
|
||||||
CONFIG_SND_SOC_APPLE_SILICON=m
|
CONFIG_SND_SOC_CS42L84=m
|
||||||
CONFIG_SPI_APPLE=m
|
# CONFIG_SPI_HID_APPLE_OF is not set
|
||||||
CONFIG_SPI_HID_APPLE_OF=m
|
CONFIG_SPI_HID_APPLE_OF=m
|
||||||
CONFIG_SPMI_APPLE=m
|
CONFIG_SPMI_APPLE=m
|
||||||
|
# CONFIG_TOUCHSCREEN_APPLE_Z2 is not set
|
||||||
|
CONFIG_TOUCHSCREEN_APPLE_Z2=m
|
||||||
|
# CONFIG_USB_XHCI_PCI_ASMEDIA is not set
|
||||||
|
CONFIG_USB_XHCI_PCI_ASMEDIA=y
|
||||||
CONFIG_VIDEO_APPLE_ISP=m
|
CONFIG_VIDEO_APPLE_ISP=m
|
||||||
CONFIG_SND_SOC_CS42L84=m
|
|
||||||
|
|||||||
236
hosts/mac-nixos/apple-silicon-support/packages/linux-asahi/default.nix
Executable file → Normal file
236
hosts/mac-nixos/apple-silicon-support/packages/linux-asahi/default.nix
Executable file → Normal file
@@ -1,13 +1,9 @@
|
|||||||
{
|
{ lib
|
||||||
lib,
|
, callPackage
|
||||||
pkgs,
|
, writeText
|
||||||
callPackage,
|
, linuxPackagesFor
|
||||||
writeShellScriptBin,
|
, withRust ? true
|
||||||
writeText,
|
, _kernelPatches ? [ ]
|
||||||
removeReferencesTo,
|
|
||||||
linuxPackagesFor,
|
|
||||||
withRust ? false,
|
|
||||||
_kernelPatches ? [ ],
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@@ -15,204 +11,94 @@ let
|
|||||||
|
|
||||||
# parse <OPT> [ymn]|foo style configuration as found in a patch's extraConfig
|
# parse <OPT> [ymn]|foo style configuration as found in a patch's extraConfig
|
||||||
# into a list of k, v tuples
|
# into a list of k, v tuples
|
||||||
parseExtraConfig =
|
parseExtraConfig = config:
|
||||||
config:
|
|
||||||
let
|
let
|
||||||
lines = builtins.filter (s: s != "") (lib.strings.splitString "\n" config);
|
lines =
|
||||||
parseLine =
|
builtins.filter (s: s != "") (lib.strings.splitString "\n" config);
|
||||||
line:
|
parseLine = line: let
|
||||||
let
|
t = lib.strings.splitString " " line;
|
||||||
t = lib.strings.splitString " " line;
|
join = l: builtins.foldl' (a: b: "${a} ${b}")
|
||||||
join = l: builtins.foldl' (a: b: "${a} ${b}") (builtins.head l) (builtins.tail l);
|
(builtins.head l) (builtins.tail l);
|
||||||
v = if (builtins.length t) > 2 then join (builtins.tail t) else (i t 1);
|
v = if (builtins.length t) > 2 then join (builtins.tail t) else (i t 1);
|
||||||
in
|
in [ "CONFIG_${i t 0}" v ];
|
||||||
[
|
in map parseLine lines;
|
||||||
"CONFIG_${i t 0}"
|
|
||||||
v
|
|
||||||
];
|
|
||||||
in
|
|
||||||
map parseLine lines;
|
|
||||||
|
|
||||||
# parse <OPT>=lib.kernel.(yes|module|no)|lib.kernel.freeform "foo"
|
# parse <OPT>=lib.kernel.(yes|module|no)|lib.kernel.freeform "foo"
|
||||||
# style configuration as found in a patch's extraStructuredConfig into
|
# style configuration as found in a patch's extraStructuredConfig into
|
||||||
# a list of k, v tuples
|
# a list of k, v tuples
|
||||||
parseExtraStructuredConfig =
|
parseExtraStructuredConfig = config: lib.attrsets.mapAttrsToList
|
||||||
config:
|
(k: v: [ "CONFIG_${k}" (v.tristate or v.freeform) ] ) config;
|
||||||
lib.attrsets.mapAttrsToList (k: v: [
|
|
||||||
"CONFIG_${k}"
|
|
||||||
(v.tristate or v.freeform)
|
|
||||||
]) config;
|
|
||||||
|
|
||||||
parsePatchConfig =
|
parsePatchConfig = { extraConfig ? "", extraStructuredConfig ? {}, ... }:
|
||||||
{
|
(parseExtraConfig extraConfig) ++
|
||||||
extraConfig ? "",
|
(parseExtraStructuredConfig extraStructuredConfig);
|
||||||
extraStructuredConfig ? { },
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
(parseExtraConfig extraConfig) ++ (parseExtraStructuredConfig extraStructuredConfig);
|
|
||||||
|
|
||||||
# parse CONFIG_<OPT>=[ymn]|"foo" style configuration as found in a config file
|
# parse CONFIG_<OPT>=[ymn]|"foo" style configuration as found in a config file
|
||||||
# into a list of k, v tuples
|
# into a list of k, v tuples
|
||||||
parseConfig =
|
parseConfig = config:
|
||||||
config:
|
|
||||||
let
|
let
|
||||||
parseLine = builtins.match ''(CONFIG_[[:upper:][:digit:]_]+)=(([ymn])|"([^"]*)")'';
|
parseLine = builtins.match ''(CONFIG_[[:upper:][:digit:]_]+)=(([ymn])|"([^"]*)")'';
|
||||||
# get either the [ymn] option or the "foo" option; whichever matched
|
# get either the [ymn] option or the "foo" option; whichever matched
|
||||||
t =
|
t = l: let v = (i l 2); in [ (i l 0) (if v != null then v else (i l 3)) ];
|
||||||
l:
|
|
||||||
let
|
|
||||||
v = (i l 2);
|
|
||||||
in
|
|
||||||
[
|
|
||||||
(i l 0)
|
|
||||||
(if v != null then v else (i l 3))
|
|
||||||
];
|
|
||||||
lines = lib.strings.splitString "\n" config;
|
lines = lib.strings.splitString "\n" config;
|
||||||
in
|
in map t (builtins.filter (l: l != null) (map parseLine lines));
|
||||||
map t (builtins.filter (l: l != null) (map parseLine lines));
|
|
||||||
|
|
||||||
origConfigfile = ./config;
|
origConfigfile = ./config;
|
||||||
|
|
||||||
linux-asahi-pkg =
|
linux-asahi-pkg = { stdenv, lib, fetchFromGitHub, fetchpatch, linuxKernel,
|
||||||
{
|
rustc, rust-bindgen, ... } @ args:
|
||||||
stdenv,
|
|
||||||
lib,
|
|
||||||
fetchFromGitHub,
|
|
||||||
fetchpatch,
|
|
||||||
linuxKernel,
|
|
||||||
rustPlatform,
|
|
||||||
rustc,
|
|
||||||
rustfmt,
|
|
||||||
rust-bindgen,
|
|
||||||
...
|
|
||||||
}@args:
|
|
||||||
let
|
let
|
||||||
origConfigText = builtins.readFile origConfigfile;
|
origConfigText = builtins.readFile origConfigfile;
|
||||||
|
|
||||||
# extraConfig from all patches in order
|
# extraConfig from all patches in order
|
||||||
extraConfig = lib.fold (patch: ex: ex ++ (parsePatchConfig patch)) [ ] _kernelPatches;
|
extraConfig =
|
||||||
|
lib.fold (patch: ex: ex ++ (parsePatchConfig patch)) [] _kernelPatches
|
||||||
|
++ (lib.optional withRust [ "CONFIG_RUST" "y" ]);
|
||||||
# config file text for above
|
# config file text for above
|
||||||
extraConfigText =
|
extraConfigText = let
|
||||||
let
|
text = k: v: if (v == "y") || (v == "m") || (v == "n")
|
||||||
text = k: v: if (v == "y") || (v == "m") || (v == "n") then "${k}=${v}" else ''${k}="${v}"'';
|
then "${k}=${v}" else ''${k}="${v}"'';
|
||||||
in
|
in (map (t: text (i t 0) (i t 1)) extraConfig);
|
||||||
(map (t: text (i t 0) (i t 1)) extraConfig);
|
|
||||||
|
|
||||||
# final config as a text file path
|
# final config as a text file path
|
||||||
configfile =
|
configfile = if extraConfig == [] then origConfigfile else
|
||||||
if extraConfig == [ ] then
|
writeText "config" ''
|
||||||
origConfigfile
|
${origConfigText}
|
||||||
else
|
|
||||||
writeText "config" ''
|
|
||||||
${origConfigText}
|
|
||||||
|
|
||||||
# Patches
|
# Patches
|
||||||
${lib.strings.concatStringsSep "\n" extraConfigText}
|
${lib.strings.concatStringsSep "\n" extraConfigText}
|
||||||
'';
|
'';
|
||||||
# final config as an attrset
|
# final config as an attrset
|
||||||
configAttrs =
|
configAttrs = let
|
||||||
let
|
makePair = t: lib.nameValuePair (i t 0) (i t 1);
|
||||||
makePair = t: lib.nameValuePair (i t 0) (i t 1);
|
configList = (parseConfig origConfigText) ++ extraConfig;
|
||||||
configList = (parseConfig origConfigText) ++ extraConfig;
|
in builtins.listToAttrs (map makePair (lib.lists.reverseList configList));
|
||||||
in
|
|
||||||
builtins.listToAttrs (map makePair (lib.lists.reverseList configList));
|
|
||||||
|
|
||||||
# used to (ostensibly) keep compatibility for those running stable versions of nixos
|
|
||||||
rustOlder = version: withRust && (lib.versionOlder rustc.version version);
|
|
||||||
bindgenOlder = version: withRust && (lib.versionOlder rust-bindgen.unwrapped.version version);
|
|
||||||
|
|
||||||
# used to fix issues when nixpkgs gets ahead of the kernel
|
# used to fix issues when nixpkgs gets ahead of the kernel
|
||||||
rustAtLeast = version: withRust && (lib.versionAtLeast rustc.version version);
|
rustAtLeast = version: withRust && (lib.versionAtLeast rustc.version version);
|
||||||
bindgenAtLeast = version: withRust && (lib.versionAtLeast rust-bindgen.unwrapped.version version);
|
bindgenAtLeast = version: withRust && (lib.versionAtLeast rust-bindgen.unwrapped.version version);
|
||||||
in
|
in
|
||||||
(
|
linuxKernel.manualConfig rec {
|
||||||
linuxKernel.manualConfig rec {
|
inherit stdenv lib;
|
||||||
inherit stdenv lib;
|
|
||||||
|
|
||||||
version = "6.6.0-asahi";
|
version = "6.14.8-asahi";
|
||||||
modDirVersion = version;
|
modDirVersion = version;
|
||||||
extraMeta.branch = "6.6";
|
extraMeta.branch = "6.14";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
# tracking: https://github.com/AsahiLinux/linux/tree/asahi-wip (w/ fedora verification)
|
# tracking: https://github.com/AsahiLinux/linux/tree/asahi-wip (w/ fedora verification)
|
||||||
owner = "AsahiLinux";
|
owner = "AsahiLinux";
|
||||||
repo = "linux";
|
repo = "linux";
|
||||||
rev = "asahi-6.6-15";
|
rev = "asahi-6.14.8-1";
|
||||||
hash = "sha256-Jm7wTKWuwd/6ZN0g5F4CNNETiOyGQL31hfSyTDYH85k=";
|
hash = "sha256-JrWVw1FiF9LYMiOPm0QI0bg/CrZAMSSVcs4AWNDIH3Q=";
|
||||||
};
|
};
|
||||||
|
|
||||||
kernelPatches =
|
kernelPatches = [
|
||||||
[
|
] ++ _kernelPatches;
|
||||||
{
|
|
||||||
name = "coreutils-fix";
|
|
||||||
patch = ./0001-fs-fcntl-accept-more-values-as-F_DUPFD_CLOEXEC-args.patch;
|
|
||||||
}
|
|
||||||
# speaker enablement; we assert on the relevant lsp-plugins patch
|
|
||||||
# before installing speakersafetyd to let the speakers work
|
|
||||||
{
|
|
||||||
name = "speakers-1";
|
|
||||||
patch = fetchpatch {
|
|
||||||
url = "https://github.com/AsahiLinux/linux/commit/385ea7b5023486aba7919cec8b6b3f6a843a1013.patch";
|
|
||||||
hash = "sha256-u7IzhJbUgBPfhJXAcpHw1I6OPzPHc1UKYjH91Ep3QHQ=";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "speakers-2";
|
|
||||||
patch = fetchpatch {
|
|
||||||
url = "https://github.com/AsahiLinux/linux/commit/6a24102c06c95951ab992e2d41336cc6d4bfdf23.patch";
|
|
||||||
hash = "sha256-wn5x2hN42/kCp/XHBvLWeNLfwlOBB+T6UeeMt2tSg3o=";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]
|
|
||||||
++ lib.optionals (rustAtLeast "1.75.0") [
|
|
||||||
{
|
|
||||||
name = "rustc-1.75.0";
|
|
||||||
patch = ./0001-check-in-new-alloc-for-1.75.0.patch;
|
|
||||||
}
|
|
||||||
]
|
|
||||||
++ lib.optionals (rustAtLeast "1.76.0") [
|
|
||||||
{
|
|
||||||
name = "rustc-1.76.0";
|
|
||||||
patch = ./rust_1_76_0.patch;
|
|
||||||
}
|
|
||||||
]
|
|
||||||
++ _kernelPatches;
|
|
||||||
|
|
||||||
inherit configfile;
|
inherit configfile;
|
||||||
# hide Rust support from the nixpkgs infra to avoid it re-adding the rust packages.
|
config = configAttrs;
|
||||||
# we can't use it until it's in stable and until we've evaluated the cross-compilation impact.
|
};
|
||||||
config = configAttrs // {
|
|
||||||
"CONFIG_RUST" = "n";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// (args.argsOverride or { })
|
|
||||||
).overrideAttrs
|
|
||||||
(
|
|
||||||
old:
|
|
||||||
if withRust then
|
|
||||||
{
|
|
||||||
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
|
|
||||||
rust-bindgen
|
|
||||||
rustfmt
|
|
||||||
rustc
|
|
||||||
removeReferencesTo
|
|
||||||
];
|
|
||||||
# HACK: references shouldn't have been there in the first place
|
|
||||||
# TODO: remove once 23.05 is obsolete
|
|
||||||
postFixup =
|
|
||||||
(old.postFixup or "")
|
|
||||||
+ ''
|
|
||||||
if [ -f $dev/lib/modules/${old.version}/build/vmlinux ]; then
|
|
||||||
remove-references-to -t $out $dev/lib/modules/${old.version}/build/vmlinux
|
|
||||||
fi
|
|
||||||
remove-references-to -t $dev $out/Image
|
|
||||||
'';
|
|
||||||
RUST_LIB_SRC = rustPlatform.rustLibSrc;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ }
|
|
||||||
);
|
|
||||||
|
|
||||||
linux-asahi = (callPackage linux-asahi-pkg { });
|
linux-asahi = (callPackage linux-asahi-pkg { });
|
||||||
in
|
in lib.recurseIntoAttrs (linuxPackagesFor linux-asahi)
|
||||||
lib.recurseIntoAttrs (linuxPackagesFor linux-asahi)
|
|
||||||
|
|||||||
@@ -1,426 +0,0 @@
|
|||||||
diff --git a/rust/alloc/alloc.rs b/rust/alloc/alloc.rs
|
|
||||||
index 08eafb3de807..7cf4edb8b786 100644
|
|
||||||
--- a/rust/alloc/alloc.rs
|
|
||||||
+++ b/rust/alloc/alloc.rs
|
|
||||||
@@ -426,12 +426,14 @@ pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+#[cfg(not(no_global_oom_handling))]
|
|
||||||
/// Specialize clones into pre-allocated, uninitialized memory.
|
|
||||||
/// Used by `Box::clone` and `Rc`/`Arc::make_mut`.
|
|
||||||
pub(crate) trait WriteCloneIntoRaw: Sized {
|
|
||||||
unsafe fn write_clone_into_raw(&self, target: *mut Self);
|
|
||||||
}
|
|
||||||
|
|
||||||
+#[cfg(not(no_global_oom_handling))]
|
|
||||||
impl<T: Clone> WriteCloneIntoRaw for T {
|
|
||||||
#[inline]
|
|
||||||
default unsafe fn write_clone_into_raw(&self, target: *mut Self) {
|
|
||||||
@@ -441,6 +443,7 @@ impl<T: Clone> WriteCloneIntoRaw for T {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+#[cfg(not(no_global_oom_handling))]
|
|
||||||
impl<T: Copy> WriteCloneIntoRaw for T {
|
|
||||||
#[inline]
|
|
||||||
unsafe fn write_clone_into_raw(&self, target: *mut Self) {
|
|
||||||
diff --git a/rust/alloc/boxed.rs b/rust/alloc/boxed.rs
|
|
||||||
index ed7e2f666178..359b8bcdb7a2 100644
|
|
||||||
--- a/rust/alloc/boxed.rs
|
|
||||||
+++ b/rust/alloc/boxed.rs
|
|
||||||
@@ -1030,10 +1030,18 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
|
|
||||||
/// use std::ptr;
|
|
||||||
///
|
|
||||||
/// let x = Box::new(String::from("Hello"));
|
|
||||||
- /// let p = Box::into_raw(x);
|
|
||||||
+ /// let ptr = Box::into_raw(x);
|
|
||||||
+ /// unsafe {
|
|
||||||
+ /// ptr::drop_in_place(ptr);
|
|
||||||
+ /// dealloc(ptr as *mut u8, Layout::new::<String>());
|
|
||||||
+ /// }
|
|
||||||
+ /// ```
|
|
||||||
+ /// Note: This is equivalent to the following:
|
|
||||||
+ /// ```
|
|
||||||
+ /// let x = Box::new(String::from("Hello"));
|
|
||||||
+ /// let ptr = Box::into_raw(x);
|
|
||||||
/// unsafe {
|
|
||||||
- /// ptr::drop_in_place(p);
|
|
||||||
- /// dealloc(p as *mut u8, Layout::new::<String>());
|
|
||||||
+ /// drop(Box::from_raw(ptr));
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
diff --git a/rust/alloc/collections/mod.rs b/rust/alloc/collections/mod.rs
|
|
||||||
index 2506065d158a..00ffb3b97365 100644
|
|
||||||
--- a/rust/alloc/collections/mod.rs
|
|
||||||
+++ b/rust/alloc/collections/mod.rs
|
|
||||||
@@ -150,6 +150,7 @@ fn fmt(
|
|
||||||
|
|
||||||
/// An intermediate trait for specialization of `Extend`.
|
|
||||||
#[doc(hidden)]
|
|
||||||
+#[cfg(not(no_global_oom_handling))]
|
|
||||||
trait SpecExtend<I: IntoIterator> {
|
|
||||||
/// Extends `self` with the contents of the given iterator.
|
|
||||||
fn spec_extend(&mut self, iter: I);
|
|
||||||
diff --git a/rust/alloc/lib.rs b/rust/alloc/lib.rs
|
|
||||||
index 65b7a02d0956..6cddaf298118 100644
|
|
||||||
--- a/rust/alloc/lib.rs
|
|
||||||
+++ b/rust/alloc/lib.rs
|
|
||||||
@@ -157,6 +157,7 @@
|
|
||||||
#![feature(std_internals)]
|
|
||||||
#![feature(str_internals)]
|
|
||||||
#![feature(strict_provenance)]
|
|
||||||
+#![feature(trusted_fused)]
|
|
||||||
#![feature(trusted_len)]
|
|
||||||
#![feature(trusted_random_access)]
|
|
||||||
#![feature(try_trait_v2)]
|
|
||||||
@@ -276,7 +277,7 @@ pub(crate) mod test_helpers {
|
|
||||||
/// seed not being the same for every RNG invocation too.
|
|
||||||
pub(crate) fn test_rng() -> rand_xorshift::XorShiftRng {
|
|
||||||
use std::hash::{BuildHasher, Hash, Hasher};
|
|
||||||
- let mut hasher = std::collections::hash_map::RandomState::new().build_hasher();
|
|
||||||
+ let mut hasher = std::hash::RandomState::new().build_hasher();
|
|
||||||
std::panic::Location::caller().hash(&mut hasher);
|
|
||||||
let hc64 = hasher.finish();
|
|
||||||
let seed_vec =
|
|
||||||
diff --git a/rust/alloc/raw_vec.rs b/rust/alloc/raw_vec.rs
|
|
||||||
index 65d5ce15828e..3fb1ee104cff 100644
|
|
||||||
--- a/rust/alloc/raw_vec.rs
|
|
||||||
+++ b/rust/alloc/raw_vec.rs
|
|
||||||
@@ -27,6 +27,16 @@ enum AllocInit {
|
|
||||||
Zeroed,
|
|
||||||
}
|
|
||||||
|
|
||||||
+#[repr(transparent)]
|
|
||||||
+#[cfg_attr(target_pointer_width = "16", rustc_layout_scalar_valid_range_end(0x7fff))]
|
|
||||||
+#[cfg_attr(target_pointer_width = "32", rustc_layout_scalar_valid_range_end(0x7fff_ffff))]
|
|
||||||
+#[cfg_attr(target_pointer_width = "64", rustc_layout_scalar_valid_range_end(0x7fff_ffff_ffff_ffff))]
|
|
||||||
+struct Cap(usize);
|
|
||||||
+
|
|
||||||
+impl Cap {
|
|
||||||
+ const ZERO: Cap = unsafe { Cap(0) };
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating
|
|
||||||
/// a buffer of memory on the heap without having to worry about all the corner cases
|
|
||||||
/// involved. This type is excellent for building your own data structures like Vec and VecDeque.
|
|
||||||
@@ -52,7 +62,12 @@ enum AllocInit {
|
|
||||||
#[allow(missing_debug_implementations)]
|
|
||||||
pub(crate) struct RawVec<T, A: Allocator = Global> {
|
|
||||||
ptr: Unique<T>,
|
|
||||||
- cap: usize,
|
|
||||||
+ /// Never used for ZSTs; it's `capacity()`'s responsibility to return usize::MAX in that case.
|
|
||||||
+ ///
|
|
||||||
+ /// # Safety
|
|
||||||
+ ///
|
|
||||||
+ /// `cap` must be in the `0..=isize::MAX` range.
|
|
||||||
+ cap: Cap,
|
|
||||||
alloc: A,
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -121,7 +136,7 @@ impl<T, A: Allocator> RawVec<T, A> {
|
|
||||||
/// the returned `RawVec`.
|
|
||||||
pub const fn new_in(alloc: A) -> Self {
|
|
||||||
// `cap: 0` means "unallocated". zero-sized types are ignored.
|
|
||||||
- Self { ptr: Unique::dangling(), cap: 0, alloc }
|
|
||||||
+ Self { ptr: Unique::dangling(), cap: Cap::ZERO, alloc }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Like `with_capacity`, but parameterized over the choice of
|
|
||||||
@@ -203,7 +218,7 @@ fn allocate_in(capacity: usize, init: AllocInit, alloc: A) -> Self {
|
|
||||||
// here should change to `ptr.len() / mem::size_of::<T>()`.
|
|
||||||
Self {
|
|
||||||
ptr: unsafe { Unique::new_unchecked(ptr.cast().as_ptr()) },
|
|
||||||
- cap: capacity,
|
|
||||||
+ cap: unsafe { Cap(capacity) },
|
|
||||||
alloc,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -228,7 +243,7 @@ fn try_allocate_in(capacity: usize, init: AllocInit, alloc: A) -> Result<Self, T
|
|
||||||
// here should change to `ptr.len() / mem::size_of::<T>()`.
|
|
||||||
Ok(Self {
|
|
||||||
ptr: unsafe { Unique::new_unchecked(ptr.cast().as_ptr()) },
|
|
||||||
- cap: capacity,
|
|
||||||
+ cap: unsafe { Cap(capacity) },
|
|
||||||
alloc,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -240,12 +255,13 @@ fn try_allocate_in(capacity: usize, init: AllocInit, alloc: A) -> Result<Self, T
|
|
||||||
/// The `ptr` must be allocated (via the given allocator `alloc`), and with the given
|
|
||||||
/// `capacity`.
|
|
||||||
/// The `capacity` cannot exceed `isize::MAX` for sized types. (only a concern on 32-bit
|
|
||||||
- /// systems). ZST vectors may have a capacity up to `usize::MAX`.
|
|
||||||
+ /// systems). For ZSTs capacity is ignored.
|
|
||||||
/// If the `ptr` and `capacity` come from a `RawVec` created via `alloc`, then this is
|
|
||||||
/// guaranteed.
|
|
||||||
#[inline]
|
|
||||||
pub unsafe fn from_raw_parts_in(ptr: *mut T, capacity: usize, alloc: A) -> Self {
|
|
||||||
- Self { ptr: unsafe { Unique::new_unchecked(ptr) }, cap: capacity, alloc }
|
|
||||||
+ let cap = if T::IS_ZST { Cap::ZERO } else { unsafe { Cap(capacity) } };
|
|
||||||
+ Self { ptr: unsafe { Unique::new_unchecked(ptr) }, cap, alloc }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Gets a raw pointer to the start of the allocation. Note that this is
|
|
||||||
@@ -261,7 +277,7 @@ pub fn ptr(&self) -> *mut T {
|
|
||||||
/// This will always be `usize::MAX` if `T` is zero-sized.
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn capacity(&self) -> usize {
|
|
||||||
- if T::IS_ZST { usize::MAX } else { self.cap }
|
|
||||||
+ if T::IS_ZST { usize::MAX } else { self.cap.0 }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns a shared reference to the allocator backing this `RawVec`.
|
|
||||||
@@ -270,7 +286,7 @@ pub fn allocator(&self) -> &A {
|
|
||||||
}
|
|
||||||
|
|
||||||
fn current_memory(&self) -> Option<(NonNull<u8>, Layout)> {
|
|
||||||
- if T::IS_ZST || self.cap == 0 {
|
|
||||||
+ if T::IS_ZST || self.cap.0 == 0 {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
// We could use Layout::array here which ensures the absence of isize and usize overflows
|
|
||||||
@@ -280,7 +296,7 @@ fn current_memory(&self) -> Option<(NonNull<u8>, Layout)> {
|
|
||||||
let _: () = const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
|
|
||||||
unsafe {
|
|
||||||
let align = mem::align_of::<T>();
|
|
||||||
- let size = mem::size_of::<T>().unchecked_mul(self.cap);
|
|
||||||
+ let size = mem::size_of::<T>().unchecked_mul(self.cap.0);
|
|
||||||
let layout = Layout::from_size_align_unchecked(size, align);
|
|
||||||
Some((self.ptr.cast().into(), layout))
|
|
||||||
}
|
|
||||||
@@ -404,12 +420,15 @@ fn needs_to_grow(&self, len: usize, additional: usize) -> bool {
|
|
||||||
additional > self.capacity().wrapping_sub(len)
|
|
||||||
}
|
|
||||||
|
|
||||||
- fn set_ptr_and_cap(&mut self, ptr: NonNull<[u8]>, cap: usize) {
|
|
||||||
+ /// # Safety:
|
|
||||||
+ ///
|
|
||||||
+ /// `cap` must not exceed `isize::MAX`.
|
|
||||||
+ unsafe fn set_ptr_and_cap(&mut self, ptr: NonNull<[u8]>, cap: usize) {
|
|
||||||
// Allocators currently return a `NonNull<[u8]>` whose length matches
|
|
||||||
// the size requested. If that ever changes, the capacity here should
|
|
||||||
// change to `ptr.len() / mem::size_of::<T>()`.
|
|
||||||
self.ptr = unsafe { Unique::new_unchecked(ptr.cast().as_ptr()) };
|
|
||||||
- self.cap = cap;
|
|
||||||
+ self.cap = unsafe { Cap(cap) };
|
|
||||||
}
|
|
||||||
|
|
||||||
// This method is usually instantiated many times. So we want it to be as
|
|
||||||
@@ -434,14 +453,15 @@ fn grow_amortized(&mut self, len: usize, additional: usize) -> Result<(), TryRes
|
|
||||||
|
|
||||||
// This guarantees exponential growth. The doubling cannot overflow
|
|
||||||
// because `cap <= isize::MAX` and the type of `cap` is `usize`.
|
|
||||||
- let cap = cmp::max(self.cap * 2, required_cap);
|
|
||||||
+ let cap = cmp::max(self.cap.0 * 2, required_cap);
|
|
||||||
let cap = cmp::max(Self::MIN_NON_ZERO_CAP, cap);
|
|
||||||
|
|
||||||
let new_layout = Layout::array::<T>(cap);
|
|
||||||
|
|
||||||
// `finish_grow` is non-generic over `T`.
|
|
||||||
let ptr = finish_grow(new_layout, self.current_memory(), &mut self.alloc)?;
|
|
||||||
- self.set_ptr_and_cap(ptr, cap);
|
|
||||||
+ // SAFETY: finish_grow would have resulted in a capacity overflow if we tried to allocate more than isize::MAX items
|
|
||||||
+ unsafe { self.set_ptr_and_cap(ptr, cap) };
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -460,7 +480,10 @@ fn grow_exact(&mut self, len: usize, additional: usize) -> Result<(), TryReserve
|
|
||||||
|
|
||||||
// `finish_grow` is non-generic over `T`.
|
|
||||||
let ptr = finish_grow(new_layout, self.current_memory(), &mut self.alloc)?;
|
|
||||||
- self.set_ptr_and_cap(ptr, cap);
|
|
||||||
+ // SAFETY: finish_grow would have resulted in a capacity overflow if we tried to allocate more than isize::MAX items
|
|
||||||
+ unsafe {
|
|
||||||
+ self.set_ptr_and_cap(ptr, cap);
|
|
||||||
+ }
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/rust/alloc/vec/into_iter.rs b/rust/alloc/vec/into_iter.rs
|
|
||||||
index aac0ec16aef1..136bfe94af6c 100644
|
|
||||||
--- a/rust/alloc/vec/into_iter.rs
|
|
||||||
+++ b/rust/alloc/vec/into_iter.rs
|
|
||||||
@@ -9,7 +9,8 @@
|
|
||||||
use core::array;
|
|
||||||
use core::fmt;
|
|
||||||
use core::iter::{
|
|
||||||
- FusedIterator, InPlaceIterable, SourceIter, TrustedLen, TrustedRandomAccessNoCoerce,
|
|
||||||
+ FusedIterator, InPlaceIterable, SourceIter, TrustedFused, TrustedLen,
|
|
||||||
+ TrustedRandomAccessNoCoerce,
|
|
||||||
};
|
|
||||||
use core::marker::PhantomData;
|
|
||||||
use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties};
|
|
||||||
@@ -287,9 +288,7 @@ unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> Self::Item
|
|
||||||
// Also note the implementation of `Self: TrustedRandomAccess` requires
|
|
||||||
// that `T: Copy` so reading elements from the buffer doesn't invalidate
|
|
||||||
// them for `Drop`.
|
|
||||||
- unsafe {
|
|
||||||
- if T::IS_ZST { mem::zeroed() } else { ptr::read(self.ptr.add(i)) }
|
|
||||||
- }
|
|
||||||
+ unsafe { if T::IS_ZST { mem::zeroed() } else { ptr::read(self.ptr.add(i)) } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -341,6 +340,10 @@ fn is_empty(&self) -> bool {
|
|
||||||
#[stable(feature = "fused", since = "1.26.0")]
|
|
||||||
impl<T, A: Allocator> FusedIterator for IntoIter<T, A> {}
|
|
||||||
|
|
||||||
+#[doc(hidden)]
|
|
||||||
+#[unstable(issue = "none", feature = "trusted_fused")]
|
|
||||||
+unsafe impl<T, A: Allocator> TrustedFused for IntoIter<T, A> {}
|
|
||||||
+
|
|
||||||
#[unstable(feature = "trusted_len", issue = "37572")]
|
|
||||||
unsafe impl<T, A: Allocator> TrustedLen for IntoIter<T, A> {}
|
|
||||||
|
|
||||||
@@ -425,7 +428,10 @@ fn drop(&mut self) {
|
|
||||||
// also refer to the vec::in_place_collect module documentation to get an overview
|
|
||||||
#[unstable(issue = "none", feature = "inplace_iteration")]
|
|
||||||
#[doc(hidden)]
|
|
||||||
-unsafe impl<T, A: Allocator> InPlaceIterable for IntoIter<T, A> {}
|
|
||||||
+unsafe impl<T, A: Allocator> InPlaceIterable for IntoIter<T, A> {
|
|
||||||
+ const EXPAND_BY: Option<NonZeroUsize> = NonZeroUsize::new(1);
|
|
||||||
+ const MERGE_BY: Option<NonZeroUsize> = NonZeroUsize::new(1);
|
|
||||||
+}
|
|
||||||
|
|
||||||
#[unstable(issue = "none", feature = "inplace_iteration")]
|
|
||||||
#[doc(hidden)]
|
|
||||||
diff --git a/rust/alloc/vec/mod.rs b/rust/alloc/vec/mod.rs
|
|
||||||
index 05c70de0227e..2534ec65500e 100644
|
|
||||||
--- a/rust/alloc/vec/mod.rs
|
|
||||||
+++ b/rust/alloc/vec/mod.rs
|
|
||||||
@@ -105,6 +105,7 @@
|
|
||||||
#[cfg(not(no_global_oom_handling))]
|
|
||||||
use self::is_zero::IsZero;
|
|
||||||
|
|
||||||
+#[cfg(not(no_global_oom_handling))]
|
|
||||||
mod is_zero;
|
|
||||||
|
|
||||||
#[cfg(not(no_global_oom_handling))]
|
|
||||||
@@ -123,7 +124,7 @@
|
|
||||||
mod set_len_on_drop;
|
|
||||||
|
|
||||||
#[cfg(not(no_global_oom_handling))]
|
|
||||||
-use self::in_place_drop::{InPlaceDrop, InPlaceDstBufDrop};
|
|
||||||
+use self::in_place_drop::{InPlaceDrop, InPlaceDstDataSrcBufDrop};
|
|
||||||
|
|
||||||
#[cfg(not(no_global_oom_handling))]
|
|
||||||
mod in_place_drop;
|
|
||||||
@@ -1837,7 +1838,32 @@ pub fn dedup_by<F>(&mut self, mut same_bucket: F)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* INVARIANT: vec.len() > read >= write > write-1 >= 0 */
|
|
||||||
+ // Check if we ever want to remove anything.
|
|
||||||
+ // This allows to use copy_non_overlapping in next cycle.
|
|
||||||
+ // And avoids any memory writes if we don't need to remove anything.
|
|
||||||
+ let mut first_duplicate_idx: usize = 1;
|
|
||||||
+ let start = self.as_mut_ptr();
|
|
||||||
+ while first_duplicate_idx != len {
|
|
||||||
+ let found_duplicate = unsafe {
|
|
||||||
+ // SAFETY: first_duplicate always in range [1..len)
|
|
||||||
+ // Note that we start iteration from 1 so we never overflow.
|
|
||||||
+ let prev = start.add(first_duplicate_idx.wrapping_sub(1));
|
|
||||||
+ let current = start.add(first_duplicate_idx);
|
|
||||||
+ // We explicitly say in docs that references are reversed.
|
|
||||||
+ same_bucket(&mut *current, &mut *prev)
|
|
||||||
+ };
|
|
||||||
+ if found_duplicate {
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ first_duplicate_idx += 1;
|
|
||||||
+ }
|
|
||||||
+ // Don't need to remove anything.
|
|
||||||
+ // We cannot get bigger than len.
|
|
||||||
+ if first_duplicate_idx == len {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* INVARIANT: vec.len() > read > write > write-1 >= 0 */
|
|
||||||
struct FillGapOnDrop<'a, T, A: core::alloc::Allocator> {
|
|
||||||
/* Offset of the element we want to check if it is duplicate */
|
|
||||||
read: usize,
|
|
||||||
@@ -1883,31 +1909,39 @@ fn drop(&mut self) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- let mut gap = FillGapOnDrop { read: 1, write: 1, vec: self };
|
|
||||||
- let ptr = gap.vec.as_mut_ptr();
|
|
||||||
-
|
|
||||||
/* Drop items while going through Vec, it should be more efficient than
|
|
||||||
* doing slice partition_dedup + truncate */
|
|
||||||
|
|
||||||
+ // Construct gap first and then drop item to avoid memory corruption if `T::drop` panics.
|
|
||||||
+ let mut gap =
|
|
||||||
+ FillGapOnDrop { read: first_duplicate_idx + 1, write: first_duplicate_idx, vec: self };
|
|
||||||
+ unsafe {
|
|
||||||
+ // SAFETY: we checked that first_duplicate_idx in bounds before.
|
|
||||||
+ // If drop panics, `gap` would remove this item without drop.
|
|
||||||
+ ptr::drop_in_place(start.add(first_duplicate_idx));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/* SAFETY: Because of the invariant, read_ptr, prev_ptr and write_ptr
|
|
||||||
* are always in-bounds and read_ptr never aliases prev_ptr */
|
|
||||||
unsafe {
|
|
||||||
while gap.read < len {
|
|
||||||
- let read_ptr = ptr.add(gap.read);
|
|
||||||
- let prev_ptr = ptr.add(gap.write.wrapping_sub(1));
|
|
||||||
+ let read_ptr = start.add(gap.read);
|
|
||||||
+ let prev_ptr = start.add(gap.write.wrapping_sub(1));
|
|
||||||
|
|
||||||
- if same_bucket(&mut *read_ptr, &mut *prev_ptr) {
|
|
||||||
+ // We explicitly say in docs that references are reversed.
|
|
||||||
+ let found_duplicate = same_bucket(&mut *read_ptr, &mut *prev_ptr);
|
|
||||||
+ if found_duplicate {
|
|
||||||
// Increase `gap.read` now since the drop may panic.
|
|
||||||
gap.read += 1;
|
|
||||||
/* We have found duplicate, drop it in-place */
|
|
||||||
ptr::drop_in_place(read_ptr);
|
|
||||||
} else {
|
|
||||||
- let write_ptr = ptr.add(gap.write);
|
|
||||||
+ let write_ptr = start.add(gap.write);
|
|
||||||
|
|
||||||
- /* Because `read_ptr` can be equal to `write_ptr`, we either
|
|
||||||
- * have to use `copy` or conditional `copy_nonoverlapping`.
|
|
||||||
- * Looks like the first option is faster. */
|
|
||||||
- ptr::copy(read_ptr, write_ptr, 1);
|
|
||||||
+ /* read_ptr cannot be equal to write_ptr because at this point
|
|
||||||
+ * we guaranteed to skip at least one element (before loop starts).
|
|
||||||
+ */
|
|
||||||
+ ptr::copy_nonoverlapping(read_ptr, write_ptr, 1);
|
|
||||||
|
|
||||||
/* We have filled that place, so go further */
|
|
||||||
gap.write += 1;
|
|
||||||
@@ -2802,6 +2836,7 @@ pub fn from_elem_in<T: Clone, A: Allocator>(elem: T, n: usize, alloc: A) -> Vec<
|
|
||||||
<T as SpecFromElem>::from_elem(elem, n, alloc)
|
|
||||||
}
|
|
||||||
|
|
||||||
+#[cfg(not(no_global_oom_handling))]
|
|
||||||
trait ExtendFromWithinSpec {
|
|
||||||
/// # Safety
|
|
||||||
///
|
|
||||||
@@ -2810,6 +2845,7 @@ trait ExtendFromWithinSpec {
|
|
||||||
unsafe fn spec_extend_from_within(&mut self, src: Range<usize>);
|
|
||||||
}
|
|
||||||
|
|
||||||
+#[cfg(not(no_global_oom_handling))]
|
|
||||||
impl<T: Clone, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
|
|
||||||
default unsafe fn spec_extend_from_within(&mut self, src: Range<usize>) {
|
|
||||||
// SAFETY:
|
|
||||||
@@ -2829,6 +2865,7 @@ impl<T: Clone, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+#[cfg(not(no_global_oom_handling))]
|
|
||||||
impl<T: Copy, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
|
|
||||||
unsafe fn spec_extend_from_within(&mut self, src: Range<usize>) {
|
|
||||||
let count = src.len();
|
|
||||||
@@ -2909,7 +2946,7 @@ fn clone_from(&mut self, other: &Self) {
|
|
||||||
/// ```
|
|
||||||
/// use std::hash::BuildHasher;
|
|
||||||
///
|
|
||||||
-/// let b = std::collections::hash_map::RandomState::new();
|
|
||||||
+/// let b = std::hash::RandomState::new();
|
|
||||||
/// let v: Vec<u8> = vec![0xa8, 0x3c, 0x09];
|
|
||||||
/// let s: &[u8] = &[0xa8, 0x3c, 0x09];
|
|
||||||
/// assert_eq!(b.hash_one(v), b.hash_one(s));
|
|
||||||
129
hosts/mac-nixos/apple-silicon-support/packages/m1n1/default.nix
Executable file → Normal file
129
hosts/mac-nixos/apple-silicon-support/packages/m1n1/default.nix
Executable file → Normal file
@@ -1,53 +1,59 @@
|
|||||||
{
|
{ stdenv
|
||||||
stdenv,
|
, buildPackages
|
||||||
buildPackages,
|
, lib
|
||||||
lib,
|
, fetchFromGitHub
|
||||||
fetchFromGitHub,
|
, python3
|
||||||
python3,
|
, dtc
|
||||||
dtc,
|
, imagemagick
|
||||||
imagemagick,
|
, isRelease ? false
|
||||||
isRelease ? false,
|
, withTools ? true
|
||||||
withTools ? true,
|
, withChainloading ? false
|
||||||
withChainloading ? false,
|
, customLogo ? null
|
||||||
rust-bin ? null,
|
|
||||||
customLogo ? null,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert withChainloading -> rust-bin != null;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
pyenv = python3.withPackages (
|
pyenv = python3.withPackages (p: with p; [
|
||||||
p: with p; [
|
construct
|
||||||
construct
|
pyserial
|
||||||
pyserial
|
]);
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
rustenv = rust-bin.selectLatestNightlyWith (
|
stdenvOpts = {
|
||||||
toolchain: toolchain.minimal.override { targets = [ "aarch64-unknown-none-softfloat" ]; }
|
targetPlatform.system = "aarch64-none-elf";
|
||||||
);
|
targetPlatform.rust.rustcTarget = "${stdenv.hostPlatform.parsed.cpu.name}-unknown-none-softfloat";
|
||||||
in
|
targetPlatform.rust.rustcTargetSpec = "${stdenv.hostPlatform.parsed.cpu.name}-unknown-none-softfloat";
|
||||||
stdenv.mkDerivation rec {
|
};
|
||||||
|
rust = buildPackages.rust.override {
|
||||||
|
stdenv = lib.recursiveUpdate buildPackages.stdenv stdenvOpts;
|
||||||
|
};
|
||||||
|
rustPackages = rust.packages.stable.overrideScope (f: p: {
|
||||||
|
rustc-unwrapped = p.rustc-unwrapped.override {
|
||||||
|
stdenv = lib.recursiveUpdate p.rustc-unwrapped.stdenv stdenvOpts;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
rustPlatform = buildPackages.makeRustPlatform rustPackages;
|
||||||
|
|
||||||
|
in stdenv.mkDerivation rec {
|
||||||
pname = "m1n1";
|
pname = "m1n1";
|
||||||
version = "1.4.11";
|
version = "1.4.21";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
# tracking: https://src.fedoraproject.org/rpms/m1n1
|
# tracking: https://src.fedoraproject.org/rpms/m1n1
|
||||||
owner = "AsahiLinux";
|
owner = "AsahiLinux";
|
||||||
repo = "m1n1";
|
repo = "m1n1";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = "sha256-1lWI9tcOxgrcfaPfdSF+xRE9qofhNR3SQiA4h86VVeE=";
|
hash = "sha256-PEjTaSwcsV8PzM9a3rDWMYXGX9FlrM0oeElrP5HYRPg=";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
|
cargoVendorDir = ".";
|
||||||
|
|
||||||
makeFlags = [
|
makeFlags = [ "ARCH=${stdenv.cc.targetPrefix}" ]
|
||||||
"ARCH=${stdenv.cc.targetPrefix}"
|
++ lib.optional isRelease "RELEASE=1"
|
||||||
] ++ lib.optional isRelease "RELEASE=1" ++ lib.optional withChainloading "CHAINLOADING=1";
|
++ lib.optional withChainloading "CHAINLOADING=1";
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
dtc
|
dtc
|
||||||
buildPackages.gcc
|
] ++ lib.optionals withChainloading [rustPackages.rustc rustPackages.cargo rustPlatform.cargoSetupHook]
|
||||||
] ++ lib.optional withChainloading rustenv ++ lib.optional (customLogo != null) imagemagick;
|
++ lib.optional (customLogo != null) imagemagick;
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace proxyclient/m1n1/asm.py \
|
substituteInPlace proxyclient/m1n1/asm.py \
|
||||||
@@ -70,38 +76,35 @@ stdenv.mkDerivation rec {
|
|||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase =
|
installPhase = ''
|
||||||
''
|
runHook preInstall
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
mkdir -p $out/build
|
mkdir -p $out/build
|
||||||
cp build/m1n1.bin $out/build
|
cp build/m1n1.bin $out/build
|
||||||
''
|
'' + (lib.optionalString withTools ''
|
||||||
+ (lib.optionalString withTools ''
|
mkdir -p $out/{bin,script,toolchain-bin}
|
||||||
mkdir -p $out/{bin,script,toolchain-bin}
|
cp -r proxyclient $out/script
|
||||||
cp -r proxyclient $out/script
|
cp -r tools $out/script
|
||||||
cp -r tools $out/script
|
|
||||||
|
|
||||||
for toolpath in $out/script/proxyclient/tools/*.py; do
|
for toolpath in $out/script/proxyclient/tools/*.py; do
|
||||||
tool=$(basename $toolpath .py)
|
tool=$(basename $toolpath .py)
|
||||||
script=$out/bin/m1n1-$tool
|
script=$out/bin/m1n1-$tool
|
||||||
cat > $script <<EOF
|
cat > $script <<EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
${pyenv}/bin/python $toolpath "\$@"
|
${pyenv}/bin/python $toolpath "\$@"
|
||||||
EOF
|
EOF
|
||||||
chmod +x $script
|
chmod +x $script
|
||||||
done
|
done
|
||||||
|
|
||||||
GCC=${buildPackages.gcc}
|
GCC=${buildPackages.gcc}
|
||||||
BINUTILS=${buildPackages.binutils-unwrapped}
|
BINUTILS=${buildPackages.binutils-unwrapped}
|
||||||
|
|
||||||
ln -s $GCC/bin/${stdenv.cc.targetPrefix}gcc $out/toolchain-bin/
|
ln -s $GCC/bin/${stdenv.cc.targetPrefix}gcc $out/toolchain-bin/
|
||||||
ln -s $GCC/bin/${stdenv.cc.targetPrefix}ld $out/toolchain-bin/
|
ln -s $GCC/bin/${stdenv.cc.targetPrefix}ld $out/toolchain-bin/
|
||||||
ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objcopy $out/toolchain-bin/
|
ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objcopy $out/toolchain-bin/
|
||||||
ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objdump $out/toolchain-bin/
|
ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objdump $out/toolchain-bin/
|
||||||
ln -s $GCC/bin/${stdenv.cc.targetPrefix}nm $out/toolchain-bin/
|
ln -s $GCC/bin/${stdenv.cc.targetPrefix}nm $out/toolchain-bin/
|
||||||
'')
|
'') + ''
|
||||||
+ ''
|
runHook postInstall
|
||||||
runHook postInstall
|
'';
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|||||||
94
hosts/mac-nixos/apple-silicon-support/packages/mesa-asahi-edge/default.nix
Executable file → Normal file
94
hosts/mac-nixos/apple-silicon-support/packages/mesa-asahi-edge/default.nix
Executable file → Normal file
@@ -1,56 +1,48 @@
|
|||||||
{
|
{ lib
|
||||||
lib,
|
, fetchFromGitLab
|
||||||
fetchFromGitLab,
|
, mesa
|
||||||
mesa,
|
|
||||||
meson,
|
|
||||||
llvmPackages,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
(mesa.override {
|
(mesa.override {
|
||||||
galliumDrivers = [
|
galliumDrivers = [ "softpipe" "llvmpipe" "asahi" ];
|
||||||
"swrast"
|
vulkanDrivers = [ "swrast" "asahi" ];
|
||||||
"asahi"
|
}).overrideAttrs (oldAttrs: {
|
||||||
];
|
version = "25.1.0-asahi";
|
||||||
vulkanDrivers = [ "swrast" ];
|
src = fetchFromGitLab {
|
||||||
enableGalliumNine = false;
|
# tracking: https://pagure.io/fedora-asahi/mesa/commits/asahi
|
||||||
# libclc and other OpenCL components are needed for geometry shader support on Apple Silicon
|
domain = "gitlab.freedesktop.org";
|
||||||
enableOpenCL = true;
|
owner = "asahi";
|
||||||
}).overrideAttrs
|
repo = "mesa";
|
||||||
(oldAttrs: {
|
tag = "asahi-20250425";
|
||||||
# version must be the same length (i.e. no unstable or date)
|
hash = "sha256-3c3uewzKv5wL9BRwaVL4E3FnyA04veQwAPxfHiL7wII=";
|
||||||
# so that system.replaceRuntimeDependencies can work
|
};
|
||||||
version = "24.1.0";
|
|
||||||
src = fetchFromGitLab {
|
|
||||||
# tracking: https://pagure.io/fedora-asahi/mesa/commits/asahi
|
|
||||||
domain = "gitlab.freedesktop.org";
|
|
||||||
owner = "asahi";
|
|
||||||
repo = "mesa";
|
|
||||||
rev = "asahi-20240228";
|
|
||||||
hash = "sha256-wOFJyYfoN6yxE9HaHXLP/0MhjyRvmlb+jPPUke0sbbE=";
|
|
||||||
};
|
|
||||||
|
|
||||||
mesonFlags =
|
mesonFlags =
|
||||||
# remove flag to configure xvmc functionality as having it
|
let
|
||||||
# breaks the build because that no longer exists in Mesa 23
|
badFlags = [
|
||||||
(lib.filter (x: !(lib.hasPrefix "-Dxvmc-libs-path=" x)) oldAttrs.mesonFlags)
|
"-Dinstall-mesa-clc"
|
||||||
++ [
|
"-Dgallium-nine"
|
||||||
# we do not build any graphics drivers these features can be enabled for
|
"-Dtools"
|
||||||
"-Dgallium-va=disabled"
|
];
|
||||||
"-Dgallium-vdpau=disabled"
|
isBadFlagList = f: builtins.map (b: lib.hasPrefix b f) badFlags;
|
||||||
"-Dgallium-xa=disabled"
|
isGoodFlag = f: !(builtins.foldl' (x: y: x || y) false (isBadFlagList f));
|
||||||
# does not make any sense
|
in
|
||||||
"-Dandroid-libbacktrace=disabled"
|
(builtins.filter isGoodFlag oldAttrs.mesonFlags) ++ [
|
||||||
# do not want to add the dependencies
|
# we do not build any graphics drivers these features can be enabled for
|
||||||
"-Dlibunwind=disabled"
|
"-Dgallium-va=disabled"
|
||||||
"-Dlmsensors=disabled"
|
"-Dgallium-vdpau=disabled"
|
||||||
]
|
"-Dgallium-xa=disabled"
|
||||||
++
|
"-Dtools=asahi"
|
||||||
# does not compile on nixpkgs stable, doesn't seem mandatory
|
|
||||||
(lib.optional (lib.versionOlder meson.version "1.3.1") "-Dgallium-rusticl=false");
|
|
||||||
|
|
||||||
# replace patches with ones tweaked slightly to apply to this version
|
|
||||||
patches = [
|
|
||||||
./disk_cache-include-dri-driver-path-in-cache-key.patch
|
|
||||||
./opencl.patch
|
|
||||||
];
|
];
|
||||||
})
|
|
||||||
|
# replace patches with ones tweaked slightly to apply to this version
|
||||||
|
patches = [
|
||||||
|
./opencl.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
postInstall = (oldAttrs.postInstall or "") + ''
|
||||||
|
# we don't build anything to go in this output but it needs to exist
|
||||||
|
touch $spirv2dxil
|
||||||
|
touch $cross_tools
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
Author: David McFarland <corngood@gmail.com>
|
|
||||||
Date: Mon Aug 6 15:52:11 2018 -0300
|
|
||||||
|
|
||||||
[PATCH] disk_cache: include dri driver path in cache key
|
|
||||||
|
|
||||||
This fixes invalid cache hits on NixOS where all shared library
|
|
||||||
timestamps in /nix/store are zero.
|
|
||||||
|
|
||||||
diff --git a/meson_options.txt b/meson_options.txt
|
|
||||||
index 512e05d..93001da 100644
|
|
||||||
--- a/meson_options.txt
|
|
||||||
+++ b/meson_options.txt
|
|
||||||
@@ -513,6 +513,13 @@ option(
|
|
||||||
description : 'Enable direct rendering in GLX and EGL for DRI',
|
|
||||||
)
|
|
||||||
|
|
||||||
+option(
|
|
||||||
+ 'disk-cache-key',
|
|
||||||
+ type : 'string',
|
|
||||||
+ value : '',
|
|
||||||
+ description : 'Mesa cache key.'
|
|
||||||
+)
|
|
||||||
+
|
|
||||||
option('egl-lib-suffix',
|
|
||||||
type : 'string',
|
|
||||||
value : '',
|
|
||||||
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
|
|
||||||
index 8298f9d..e622133 100644
|
|
||||||
--- a/src/util/disk_cache.c
|
|
||||||
+++ b/src/util/disk_cache.c
|
|
||||||
@@ -226,8 +226,10 @@ disk_cache_type_create(const char *gpu_name,
|
|
||||||
|
|
||||||
/* Create driver id keys */
|
|
||||||
size_t id_size = strlen(driver_id) + 1;
|
|
||||||
+ size_t key_size = strlen(DISK_CACHE_KEY) + 1;
|
|
||||||
size_t gpu_name_size = strlen(gpu_name) + 1;
|
|
||||||
cache->driver_keys_blob_size += id_size;
|
|
||||||
+ cache->driver_keys_blob_size += key_size;
|
|
||||||
cache->driver_keys_blob_size += gpu_name_size;
|
|
||||||
|
|
||||||
/* We sometimes store entire structs that contains a pointers in the cache,
|
|
||||||
@@ -248,6 +250,7 @@ disk_cache_type_create(const char *gpu_name,
|
|
||||||
uint8_t *drv_key_blob = cache->driver_keys_blob;
|
|
||||||
DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size)
|
|
||||||
DRV_KEY_CPY(drv_key_blob, driver_id, id_size)
|
|
||||||
+ DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size)
|
|
||||||
DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size)
|
|
||||||
DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size)
|
|
||||||
DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size)
|
|
||||||
diff --git a/src/util/meson.build b/src/util/meson.build
|
|
||||||
index c0c1b9d..442163c 100644
|
|
||||||
--- a/src/util/meson.build
|
|
||||||
+++ b/src/util/meson.build
|
|
||||||
@@ -268,7 +268,12 @@ _libmesa_util = static_library(
|
|
||||||
include_directories : [inc_util, include_directories('format')],
|
|
||||||
dependencies : deps_for_libmesa_util,
|
|
||||||
link_with: [libmesa_util_sse41],
|
|
||||||
- c_args : [c_msvc_compat_args],
|
|
||||||
+ c_args : [
|
|
||||||
+ c_msvc_compat_args,
|
|
||||||
+ '-DDISK_CACHE_KEY="@0@"'.format(
|
|
||||||
+ get_option('disk-cache-key')
|
|
||||||
+ ),
|
|
||||||
+ ],
|
|
||||||
gnu_symbol_visibility : 'hidden',
|
|
||||||
build_by_default : false
|
|
||||||
)
|
|
||||||
66
hosts/mac-nixos/apple-silicon-support/packages/mesa-asahi-edge/opencl.patch
Executable file → Normal file
66
hosts/mac-nixos/apple-silicon-support/packages/mesa-asahi-edge/opencl.patch
Executable file → Normal file
@@ -1,84 +1,54 @@
|
|||||||
From bbd0f154183e4d26a14bb005f6afc636629c201e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Thomas Watson <twatson52@icloud.com>
|
|
||||||
Date: Sat, 16 Dec 2023 20:46:51 -0600
|
|
||||||
Subject: [PATCH] opencl.patch from nixpkgs
|
|
||||||
f416128e90ac75bec060e8b9435fe9c38423c036
|
|
||||||
|
|
||||||
---
|
|
||||||
meson.build | 2 +-
|
|
||||||
meson_options.txt | 6 ++++++
|
|
||||||
src/gallium/targets/opencl/meson.build | 6 +++---
|
|
||||||
src/gallium/targets/rusticl/meson.build | 3 +--
|
|
||||||
4 files changed, 11 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/meson.build b/meson.build
|
diff --git a/meson.build b/meson.build
|
||||||
index 552ff196aa8..9e10156b875 100644
|
index 07991a6..4c875b9 100644
|
||||||
--- a/meson.build
|
--- a/meson.build
|
||||||
+++ b/meson.build
|
+++ b/meson.build
|
||||||
@@ -1829,7 +1829,7 @@ endif
|
@@ -1900,7 +1900,7 @@ endif
|
||||||
|
|
||||||
dep_clang = null_dep
|
dep_clang = null_dep
|
||||||
if with_clc
|
if with_clc or with_gallium_clover
|
||||||
- llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
|
- llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
|
||||||
+ llvm_libdir = get_option('clang-libdir')
|
+ llvm_libdir = get_option('clang-libdir')
|
||||||
|
|
||||||
dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
|
dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
|
||||||
|
|
||||||
diff --git a/meson_options.txt b/meson_options.txt
|
diff --git a/meson.options b/meson.options
|
||||||
index c76fa6d3382..d2021f55634 100644
|
index 84e0f20..38ea92c 100644
|
||||||
--- a/meson_options.txt
|
--- a/meson.options
|
||||||
+++ b/meson_options.txt
|
+++ b/meson.options
|
||||||
@@ -1,6 +1,12 @@
|
@@ -795,3 +795,10 @@ option(
|
||||||
# Copyright © 2017-2019 Intel Corporation
|
value : false,
|
||||||
# SPDX-License-Identifier: MIT
|
description : 'Install the drivers internal shader compilers (if needed for cross builds).'
|
||||||
|
)
|
||||||
|
+
|
||||||
+option(
|
+option(
|
||||||
+ 'clang-libdir',
|
+ 'clang-libdir',
|
||||||
+ type : 'string',
|
+ type : 'string',
|
||||||
+ value : '',
|
+ value : '',
|
||||||
+ description : 'Locations to search for clang libraries.'
|
+ description : 'Locations to search for clang libraries.'
|
||||||
+)
|
+)
|
||||||
option(
|
|
||||||
'platforms',
|
|
||||||
type : 'array',
|
|
||||||
diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
|
diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
|
||||||
index 7c14135898e..cbcd67cc443 100644
|
index ab2c835..a59e88e 100644
|
||||||
--- a/src/gallium/targets/opencl/meson.build
|
--- a/src/gallium/targets/opencl/meson.build
|
||||||
+++ b/src/gallium/targets/opencl/meson.build
|
+++ b/src/gallium/targets/opencl/meson.build
|
||||||
@@ -39,7 +39,8 @@ if dep_llvm.version().version_compare('>=10.0.0')
|
@@ -56,7 +56,7 @@ if with_opencl_icd
|
||||||
polly_isl_dep = cpp.find_library('PollyISL', dirs : llvm_libdir, required : false)
|
|
||||||
endif
|
|
||||||
|
|
||||||
-dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
|
|
||||||
+clang_libdir = get_option('clang-libdir')
|
|
||||||
+dep_clang = cpp.find_library('clang-cpp', dirs : clang_libdir, required : false)
|
|
||||||
|
|
||||||
# meson will return clang-cpp from system dirs if it's not found in llvm_libdir
|
|
||||||
linker_rpath_arg = '-Wl,--rpath=@0@'.format(llvm_libdir)
|
|
||||||
@@ -123,8 +124,7 @@ if with_opencl_icd
|
|
||||||
configuration : _config,
|
configuration : _config,
|
||||||
input : 'mesa.icd.in',
|
input : 'mesa.icd.in',
|
||||||
output : 'mesa.icd',
|
output : 'mesa.icd',
|
||||||
- install : true,
|
- install : true,
|
||||||
- install_tag : 'runtime',
|
|
||||||
+ install : false,
|
+ install : false,
|
||||||
|
install_tag : 'runtime',
|
||||||
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
|
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
|
||||||
)
|
)
|
||||||
|
|
||||||
diff --git a/src/gallium/targets/rusticl/meson.build b/src/gallium/targets/rusticl/meson.build
|
diff --git a/src/gallium/targets/rusticl/meson.build b/src/gallium/targets/rusticl/meson.build
|
||||||
index b2963fe6dfa..2f784bdccd4 100644
|
index 2b214ad..7f91939 100644
|
||||||
--- a/src/gallium/targets/rusticl/meson.build
|
--- a/src/gallium/targets/rusticl/meson.build
|
||||||
+++ b/src/gallium/targets/rusticl/meson.build
|
+++ b/src/gallium/targets/rusticl/meson.build
|
||||||
@@ -76,8 +76,7 @@ configure_file(
|
@@ -64,7 +64,7 @@ configure_file(
|
||||||
configuration : _config,
|
configuration : _config,
|
||||||
input : 'rusticl.icd.in',
|
input : 'rusticl.icd.in',
|
||||||
output : 'rusticl.icd',
|
output : 'rusticl.icd',
|
||||||
- install : true,
|
- install : true,
|
||||||
- install_tag : 'runtime',
|
|
||||||
+ install : false,
|
+ install : false,
|
||||||
|
install_tag : 'runtime',
|
||||||
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
|
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
|
||||||
)
|
)
|
||||||
|
|
||||||
--
|
|
||||||
2.40.1
|
|
||||||
|
|
||||||
|
|||||||
4
hosts/mac-nixos/apple-silicon-support/packages/overlay.nix
Executable file → Normal file
4
hosts/mac-nixos/apple-silicon-support/packages/overlay.nix
Executable file → Normal file
@@ -3,9 +3,7 @@ final: prev: {
|
|||||||
m1n1 = final.callPackage ./m1n1 { };
|
m1n1 = final.callPackage ./m1n1 { };
|
||||||
uboot-asahi = final.callPackage ./uboot-asahi { };
|
uboot-asahi = final.callPackage ./uboot-asahi { };
|
||||||
asahi-fwextract = final.callPackage ./asahi-fwextract { };
|
asahi-fwextract = final.callPackage ./asahi-fwextract { };
|
||||||
mesa-asahi-edge = final.callPackage ./mesa-asahi-edge { inherit (prev) mesa; };
|
mesa-asahi-edge = final.callPackage ./mesa-asahi-edge { };
|
||||||
alsa-ucm-conf-asahi = final.callPackage ./alsa-ucm-conf-asahi { inherit (prev) alsa-ucm-conf; };
|
alsa-ucm-conf-asahi = final.callPackage ./alsa-ucm-conf-asahi { inherit (prev) alsa-ucm-conf; };
|
||||||
speakersafetyd = final.callPackage ./speakersafetyd { };
|
|
||||||
bankstown-lv2 = final.callPackage ./bankstown-lv2 { };
|
|
||||||
asahi-audio = final.callPackage ./asahi-audio { };
|
asahi-audio = final.callPackage ./asahi-audio { };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
rustPlatform,
|
|
||||||
stdenv,
|
|
||||||
rust,
|
|
||||||
fetchCrate,
|
|
||||||
pkg-config,
|
|
||||||
alsa-lib,
|
|
||||||
}:
|
|
||||||
|
|
||||||
rustPlatform.buildRustPackage rec {
|
|
||||||
pname = "speakersafetyd";
|
|
||||||
# tracking: https://src.fedoraproject.org/rpms/rust-speakersafetyd
|
|
||||||
version = "0.1.9";
|
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config ];
|
|
||||||
buildInputs = [ alsa-lib ];
|
|
||||||
|
|
||||||
src = fetchCrate {
|
|
||||||
inherit pname version;
|
|
||||||
hash = "sha256-I1fL1U4vqKxPS1t6vujMTdi/JAAOCcPkvUqv6FqkId4=";
|
|
||||||
};
|
|
||||||
cargoHash = "sha256-Adwct+qFhUsOIao8XqNK2zcn13DBlQNA+X4aRFeIAXM=";
|
|
||||||
|
|
||||||
postPatch = ''
|
|
||||||
substituteInPlace speakersafetyd.service --replace "/usr" "$out"
|
|
||||||
substituteInPlace Makefile --replace "target/release" "target/${rust.lib.toRustTargetSpec stdenv.hostPlatform}/$cargoBuildType"
|
|
||||||
'';
|
|
||||||
|
|
||||||
installFlags = [
|
|
||||||
"DESTDIR=${placeholder "out"}"
|
|
||||||
"BINDIR=/bin"
|
|
||||||
"SHAREDIR=/share"
|
|
||||||
"TMPFILESDIR=/lib/tmpfiles.d"
|
|
||||||
];
|
|
||||||
|
|
||||||
dontCargoInstall = true;
|
|
||||||
}
|
|
||||||
40
hosts/mac-nixos/apple-silicon-support/packages/uboot-asahi/default.nix
Executable file → Normal file
40
hosts/mac-nixos/apple-silicon-support/packages/uboot-asahi/default.nix
Executable file → Normal file
@@ -1,8 +1,7 @@
|
|||||||
{
|
{ lib
|
||||||
lib,
|
, fetchFromGitHub
|
||||||
fetchFromGitHub,
|
, buildUBoot
|
||||||
buildUBoot,
|
, m1n1
|
||||||
m1n1,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
(buildUBoot rec {
|
(buildUBoot rec {
|
||||||
@@ -10,10 +9,10 @@
|
|||||||
# tracking: https://pagure.io/fedora-asahi/uboot-tools/commits/main
|
# tracking: https://pagure.io/fedora-asahi/uboot-tools/commits/main
|
||||||
owner = "AsahiLinux";
|
owner = "AsahiLinux";
|
||||||
repo = "u-boot";
|
repo = "u-boot";
|
||||||
rev = "asahi-v2023.07.02-4";
|
rev = "asahi-v2025.04-1";
|
||||||
hash = "sha256-M4qkEyNgwV2AKSr5VzPGfhHo1kGy8Tw8TfyP36cgYjc=";
|
hash = "sha256-/z37qj26AqsyEBsFT6UEN3GjG6KVsoJOoUB4s9BRDbE=";
|
||||||
};
|
};
|
||||||
version = "2023.07.02.asahi4-1";
|
version = "2025.04-1-asahi";
|
||||||
|
|
||||||
defconfig = "apple_m1_defconfig";
|
defconfig = "apple_m1_defconfig";
|
||||||
extraMeta.platforms = [ "aarch64-linux" ];
|
extraMeta.platforms = [ "aarch64-linux" ];
|
||||||
@@ -27,18 +26,19 @@
|
|||||||
CONFIG_VIDEO_FONT_8X16=n
|
CONFIG_VIDEO_FONT_8X16=n
|
||||||
CONFIG_VIDEO_FONT_SUN12X22=n
|
CONFIG_VIDEO_FONT_SUN12X22=n
|
||||||
CONFIG_VIDEO_FONT_16X32=y
|
CONFIG_VIDEO_FONT_16X32=y
|
||||||
|
CONFIG_CMD_BOOTMENU=y
|
||||||
'';
|
'';
|
||||||
}).overrideAttrs
|
}).overrideAttrs (o: {
|
||||||
(o: {
|
# nixos's downstream patches are not applicable
|
||||||
# nixos's downstream patches are not applicable
|
patches = [
|
||||||
patches = [ ];
|
];
|
||||||
|
|
||||||
# DTC= flag somehow breaks DTC compilation so we remove it
|
# DTC= flag somehow breaks DTC compilation so we remove it
|
||||||
makeFlags = builtins.filter (s: (!(lib.strings.hasPrefix "DTC=" s))) o.makeFlags;
|
makeFlags = builtins.filter (s: (!(lib.strings.hasPrefix "DTC=" s))) o.makeFlags;
|
||||||
|
|
||||||
preInstall = ''
|
preInstall = ''
|
||||||
# compress so that m1n1 knows U-Boot's size and can find things after it
|
# compress so that m1n1 knows U-Boot's size and can find things after it
|
||||||
gzip -n u-boot-nodtb.bin
|
gzip -n u-boot-nodtb.bin
|
||||||
cat ${m1n1}/build/m1n1.bin arch/arm/dts/t[68]*.dtb u-boot-nodtb.bin.gz > m1n1-u-boot.bin
|
cat ${m1n1}/build/m1n1.bin arch/arm/dts/t[68]*.dtb u-boot-nodtb.bin.gz > m1n1-u-boot.bin
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|||||||
86
hosts/mac-nixos/hardware-configuration.nix
Executable file → Normal file
86
hosts/mac-nixos/hardware-configuration.nix
Executable file → Normal file
@@ -1,60 +1,64 @@
|
|||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{ lib, modulesPath, ... }:
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
imports =
|
||||||
|
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "sdhci_pci" ];
|
boot.initrd.availableKernelModules = [ "uas" "sdhci_pci" ];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ ];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" = {
|
fileSystems."/" =
|
||||||
device = "none";
|
{ device = "none";
|
||||||
fsType = "tmpfs";
|
fsType = "tmpfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/etc" = {
|
fileSystems."/root" =
|
||||||
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
|
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = [ "subvol=etc" ];
|
options = [ "subvol=root" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/nix" = {
|
fileSystems."/etc" =
|
||||||
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
|
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = [ "subvol=nix" ];
|
options = [ "subvol=etc" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/var/log" = {
|
fileSystems."/tmp" =
|
||||||
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
|
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = [ "subvol=log" ];
|
options = [ "subvol=tmp" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/home" = {
|
fileSystems."/nix" =
|
||||||
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
|
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = [ "subvol=home" ];
|
options = [ "subvol=nix" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/root" = {
|
fileSystems."/var/log" =
|
||||||
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
|
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = [ "subvol=root" ];
|
options = [ "subvol=log" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
fileSystems."/home" =
|
||||||
device = "/dev/disk/by-uuid/F4A1-C77F";
|
{ device = "/dev/disk/by-uuid/69fa608d-1dd2-408a-9907-7d0881db5b4a";
|
||||||
fsType = "vfat";
|
fsType = "btrfs";
|
||||||
};
|
options = [ "subvol=home" ];
|
||||||
|
};
|
||||||
|
|
||||||
# fileSystems."/boot" =
|
fileSystems."/boot" =
|
||||||
# { device = "/dev/disk/by-uuid/3aaa1d0e-057d-4b7d-b2fe-ef02db373e9f";
|
{ device = "/dev/disk/by-uuid/23FA-AD3E";
|
||||||
# fsType = "ext4";
|
fsType = "vfat";
|
||||||
# };
|
options = [ "fmask=0022" "dmask=0022" ];
|
||||||
|
};
|
||||||
|
|
||||||
swapDevices = [ ];
|
swapDevices = [ ];
|
||||||
|
|
||||||
@@ -63,7 +67,7 @@
|
|||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
# still possible to use this option, but it's recommended to use it in conjunction
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||||
networking.useDHCP = lib.mkDefault true;
|
networking.useDHCP = lib.mkDefault true;
|
||||||
# networking.interfaces.wlp1s0f0.useDHCP = lib.mkDefault true;
|
# networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
|
||||||
}
|
}
|
||||||
|
|||||||
69
hosts/mac-nixos/hardware-configuration.nix.ori
Executable file
69
hosts/mac-nixos/hardware-configuration.nix.ori
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
|
# and may be overwritten by future invocations. Please make changes
|
||||||
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ lib, modulesPath, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "sdhci_pci" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "none";
|
||||||
|
fsType = "tmpfs";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/etc" = {
|
||||||
|
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=etc" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/nix" = {
|
||||||
|
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=nix" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/var/log" = {
|
||||||
|
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=log" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/home" = {
|
||||||
|
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=home" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/root" = {
|
||||||
|
device = "/dev/disk/by-uuid/19b99a76-0285-443a-a83c-a00a5fab54f5";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=root" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-uuid/F4A1-C77F";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
|
||||||
|
# fileSystems."/boot" =
|
||||||
|
# { device = "/dev/disk/by-uuid/3aaa1d0e-057d-4b7d-b2fe-ef02db373e9f";
|
||||||
|
# fsType = "ext4";
|
||||||
|
# };
|
||||||
|
|
||||||
|
swapDevices = [ ];
|
||||||
|
|
||||||
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
# still possible to use this option, but it's recommended to use it in conjunction
|
||||||
|
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.wlp1s0f0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user