Compare commits

..

2 commits

Author SHA1 Message Date
chayleaf 910055176f
matrix-appservice-discord: +1 patch 2024-06-11 22:48:54 +07:00
chayleaf 04ffe78439
update inputs 2024-06-11 22:48:50 +07:00
6 changed files with 40 additions and 51 deletions

View file

@ -189,12 +189,10 @@
inherit (args) system; inherit (args) system;
# allow modules to access nixpkgs directly, use customized lib, # allow modules to access nixpkgs directly, use customized lib,
# and pass nixos-harware to let hardware modules import parts of nixos-hardware # and pass nixos-harware to let hardware modules import parts of nixos-hardware
specialArgs = { specialArgs = { inherit inputs lib; } // args.specialArgs or { };
inherit inputs lib;
hardware = inputs.nixos-hardware.nixosModules;
} // args.specialArgs or { };
modules = [ modules = [
{ _module.args = { { _module.args = {
hardware = inputs.nixos-hardware.nixosModules;
pkgs-kernel = import inputs.nixpkgs-kernel { inherit (args) system; overlays = all-overlays; }; pkgs-kernel = import inputs.nixpkgs-kernel { inherit (args) system; overlays = all-overlays; };
}; } }; }
(getPrivSys hostname) (getPrivSys hostname)

View file

@ -93,9 +93,7 @@ in
qemu = pkgs'.qemu_7_ccache; qemu = pkgs'.qemu_7_ccache;
stdenv = pkgs'.ccacheStdenv; stdenv = pkgs'.ccacheStdenv;
}; };
ccachePkgs = import ./ccache.nix { inherit pkgs pkgs' lib sources; };
# hardware stuff
hw.bpi-r3 = import ../system/hardware/bpi-r3/pkgs.nix { inherit pkgs pkgs' lib sources; };
hw.oneplus-enchilada = import ../system/hardware/oneplus-enchilada/pkgs.nix { inherit inputs pkgs pkgs' lib sources; };
} }
// import ./ccache.nix { inherit pkgs pkgs' lib sources; }
// import ../system/hardware/bpi-r3/pkgs.nix { inherit pkgs pkgs' lib sources; }
// import ../system/hardware/oneplus-enchilada/pkgs.nix { inherit inputs pkgs pkgs' lib sources; }

View file

@ -9,7 +9,7 @@
generic-extlinux-compatible.enable = true; generic-extlinux-compatible.enable = true;
}; };
boot.kernelPackages = pkgs-kernel.linuxPackagesFor (pkgs-kernel.ccachePkgs.buildLinuxWithCcache pkgs-kernel.hw.bpi-r3.linux); boot.kernelPackages = pkgs-kernel.linuxPackagesFor (pkgs-kernel.buildLinuxWithCcache pkgs-kernel.linux_bpiR3);
hardware.deviceTree.enable = true; hardware.deviceTree.enable = true;
hardware.deviceTree.filter = "mt7986a-bananapi-bpi-r3.dtb"; hardware.deviceTree.filter = "mt7986a-bananapi-bpi-r3.dtb";

View file

@ -4,7 +4,7 @@
, ... }: , ... }:
let let
mkArmTrustedFirmwareBpiR3 = { bootDevice, uboot ? null }: pkgs.buildArmTrustedFirmware rec { armTrustedFirmwareBpiR3 = { bootDevice, uboot ? null }: pkgs.buildArmTrustedFirmware rec {
inherit (sources.atf-bpir3) src; inherit (sources.atf-bpir3) src;
patches = [ ./bpi-r3-atf-backport-mkimage-support.patch ]; patches = [ ./bpi-r3-atf-backport-mkimage-support.patch ];
extraMakeFlags = assert builtins.elem bootDevice [ extraMakeFlags = assert builtins.elem bootDevice [
@ -36,7 +36,7 @@ let
# CONFIG_DISTRO_DEFAULTS - surely this won't hurt, it adds autocomplete and stuff and doesn't weight much in the large scale of things # CONFIG_DISTRO_DEFAULTS - surely this won't hurt, it adds autocomplete and stuff and doesn't weight much in the large scale of things
# CONFIG_SYS_BOOTM_LEN - increase max initrd? size # CONFIG_SYS_BOOTM_LEN - increase max initrd? size
# CONFIG_ZSTD - allow zstd initrd # CONFIG_ZSTD - allow zstd initrd
mkUbootConfig = storage: '' ubootConfig = storage: ''
CONFIG_AUTOBOOT=y CONFIG_AUTOBOOT=y
CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] '' CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] ''
setenv boot_prefixes /@boot/ /@/ /boot/ / setenv boot_prefixes /@boot/ /@/ /boot/ /
@ -61,9 +61,9 @@ let
}; };
in rec { in rec {
sd.uboot = pkgs.buildUBoot { ubootBpiR3Sd = pkgs.buildUBoot {
defconfig = "mt7986a_bpir3_sd_defconfig"; defconfig = "mt7986a_bpir3_sd_defconfig";
extraConfig = mkUbootConfig "sd"; extraConfig = ubootConfig "sd";
src = ubootSrc; src = ubootSrc;
version = ubootVersion; version = ubootVersion;
extraMeta.platforms = [ "aarch64-linux" ]; extraMeta.platforms = [ "aarch64-linux" ];
@ -71,52 +71,52 @@ in rec {
patches = [ ./mt7986-default-bootcmd.patch ]; patches = [ ./mt7986-default-bootcmd.patch ];
filesToInstall = [ "u-boot.bin" ]; filesToInstall = [ "u-boot.bin" ];
}; };
emmc.uboot = pkgs.buildUBoot { ubootBpiR3Emmc = pkgs.buildUBoot {
defconfig = "mt7986a_bpir3_emmc_defconfig"; defconfig = "mt7986a_bpir3_emmc_defconfig";
extraConfig = mkUbootConfig "emmc"; extraConfig = ubootConfig "emmc";
src = ubootSrc; src = ubootSrc;
version = ubootVersion; version = ubootVersion;
extraMeta.platforms = [ "aarch64-linux" ]; extraMeta.platforms = [ "aarch64-linux" ];
patches = [ ./mt7986-default-bootcmd.patch ]; patches = [ ./mt7986-default-bootcmd.patch ];
filesToInstall = [ "u-boot.bin" ]; filesToInstall = [ "u-boot.bin" ];
}; };
sd.armTrustedFirmware = mkArmTrustedFirmwareBpiR3 { inherit (sd) uboot; bootDevice = "sdmmc"; }; armTrustedFirmwareBpiR3Sd = armTrustedFirmwareBpiR3 { uboot = ubootBpiR3Sd; bootDevice = "sdmmc"; };
emmc.armTrustedFirmware = mkArmTrustedFirmwareBpiR3 { inherit (emmc) uboot; bootDevice = "emmc"; }; armTrustedFirmwareBpiR3Emmc = armTrustedFirmwareBpiR3 { uboot = ubootBpiR3Emmc; bootDevice = "emmc"; };
combinedStuff = pkgs.stdenvNoCC.mkDerivation { bpiR3StuffCombined = pkgs.stdenvNoCC.mkDerivation {
name = "bpi-r3-stuff"; name = "bpi-r3-stuff";
unpackPhase = "true"; unpackPhase = "true";
buildPhase = "true"; buildPhase = "true";
installPhase = '' installPhase = ''
mkdir -p $out/sd mkdir -p $out/sd
mkdir -p $out/emmc mkdir -p $out/emmc
cp ${emmc.stuff}/* $out/emmc cp ${bpiR3StuffEmmc}/* $out/emmc
cp ${sd.stuff}/* $out/sd cp ${bpiR3StuffSd}/* $out/sd
''; '';
fixupPhase = "true"; fixupPhase = "true";
}; };
emmc.stuff = pkgs.stdenvNoCC.mkDerivation { bpiR3StuffEmmc = pkgs.stdenvNoCC.mkDerivation {
name = "bpi-r3-stuff-emmc"; name = "bpi-r3-stuff-emmc";
unpackPhase = "true"; unpackPhase = "true";
buildPhase = "true"; buildPhase = "true";
installPhase = '' installPhase = ''
mkdir -p $out mkdir -p $out
cp ${emmc.uboot}/*.* $out cp ${ubootBpiR3Emmc}/*.* $out
cp ${emmc.armTrustedFirmware}/*.* $out cp ${armTrustedFirmwareBpiR3Emmc}/*.* $out
''; '';
fixupPhase = "true"; fixupPhase = "true";
}; };
sd.stuff = pkgs.stdenvNoCC.mkDerivation { bpiR3StuffSd = pkgs.stdenvNoCC.mkDerivation {
name = "bpi-r3-stuff-sd"; name = "bpi-r3-stuff-sd";
unpackPhase = "true"; unpackPhase = "true";
buildPhase = "true"; buildPhase = "true";
installPhase = '' installPhase = ''
mkdir -p $out mkdir -p $out
cp ${sd.uboot}/*.* $out cp ${ubootBpiR3Sd}/*.* $out
cp ${sd.armTrustedFirmware}/*.* $out cp ${armTrustedFirmwareBpiR3Sd}/*.* $out
''; '';
fixupPhase = "true"; fixupPhase = "true";
}; };
linux = pkgs.linux_latest.override { linux_bpiR3 = pkgs.linux_latest.override {
ignoreConfigErrors = false; ignoreConfigErrors = false;
# there's probably more enabled-by-default configs that are better left disabled, but whatever # there's probably more enabled-by-default configs that are better left disabled, but whatever
structuredExtraConfig = with lib.kernel; { structuredExtraConfig = with lib.kernel; {
@ -351,5 +351,5 @@ in rec {
XEN_PVHVM.tristate = lib.mkForce null; XEN_SAVE_RESTORE.tristate = lib.mkForce null; XEN_SYS_HYPERVISOR.tristate = lib.mkForce null; XEN_PVHVM.tristate = lib.mkForce null; XEN_SAVE_RESTORE.tristate = lib.mkForce null; XEN_SYS_HYPERVISOR.tristate = lib.mkForce null;
}; };
}; };
linuxPackages = pkgs.linuxPackagesFor linux; linuxPackages_bpiR3 = pkgs.linuxPackagesFor linux_bpiR3;
} }

View file

@ -8,8 +8,6 @@
let let
cfg = config.phone; cfg = config.phone;
hw = pkgs.hw.oneplus-enchilada;
hw-kernel = pkgs-kernel.hw.oneplus-enchilada;
in in
{ {
imports = [ imports = [
@ -30,21 +28,16 @@ in
config = lib.mkMerge [ config = lib.mkMerge [
{ {
nixpkgs.overlays = [
(self: super: {
inherit (self.hw.oneplus-enchilada) pd-mapper qrtr rmtfs tqftpserv;
})
];
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
mobile.quirks.qualcomm.sdm845-modem.enable = true; mobile.quirks.qualcomm.sdm845-modem.enable = true;
mobile.quirks.audio.alsa-ucm-meld = true; mobile.quirks.audio.alsa-ucm-meld = true;
environment.systemPackages = [ hw.alsa-ucm-conf ]; environment.systemPackages = [ pkgs.alsa-ucm-conf-enchilada ];
systemd.services.q6voiced = { systemd.services.q6voiced = {
description = "QDSP6 driver daemon"; description = "QDSP6 driver daemon";
after = [ "ModemManager.service" "dbus.socket" ]; after = [ "ModemManager.service" "dbus.socket" ];
wantedBy = [ "ModemManager.service" ]; wantedBy = [ "ModemManager.service" ];
requires = [ "dbus.socket" ]; requires = [ "dbus.socket" ];
serviceConfig.ExecStart = "${hw.q6voiced}/bin/q6voiced hw:0,6"; serviceConfig.ExecStart = "${pkgs.q6voiced}/bin/q6voiced hw:0,6";
}; };
# TODO when testing PipeWire instead of PulseAudio, the following is needed: # TODO when testing PipeWire instead of PulseAudio, the following is needed:
# https://gitlab.freedesktop.org/pipewire/wireplumber/-/blob/master/docs/rst/daemon/configuration/migration.rst # https://gitlab.freedesktop.org/pipewire/wireplumber/-/blob/master/docs/rst/daemon/configuration/migration.rst
@ -70,8 +63,8 @@ in
percentageAction = 3; percentageAction = 3;
criticalPowerAction = "PowerOff"; criticalPowerAction = "PowerOff";
}; };
hardware.firmware = lib.mkAfter [ hw.firmware ]; hardware.firmware = lib.mkAfter [ pkgs.firmware-oneplus-sdm845 ];
boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor hw-kernel.linux_ccache); boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor pkgs-kernel.linux_enchilada_ccache);
hardware.deviceTree.enable = true; hardware.deviceTree.enable = true;
hardware.deviceTree.name = "qcom/sdm845-oneplus-enchilada.dtb"; hardware.deviceTree.name = "qcom/sdm845-oneplus-enchilada.dtb";
# loglevel=7 console=ttyMSM0,115200 is a way to delay boot # loglevel=7 console=ttyMSM0,115200 is a way to delay boot
@ -87,7 +80,7 @@ in
"firmware-oneplus-sdm845" "firmware-oneplus-sdm845"
"firmware-oneplus-sdm845-xz" "firmware-oneplus-sdm845-xz"
]; ];
system.build.uboot = pkgs.ubootImage; system.build.uboot = pkgs.ubootImageEnchilada;
boot.initrd.includeDefaultModules = false; boot.initrd.includeDefaultModules = false;
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [
"sd_mod" "sd_mod"
@ -195,7 +188,7 @@ in
}; };
boot.initrd.extraUtilsCommands = '' boot.initrd.extraUtilsCommands = ''
copy_bin_and_libs ${hw.adbd}/bin/adbd copy_bin_and_libs ${pkgs.adbd}/bin/adbd
cp -pv ${pkgs.glibc.out}/lib/libnss_files.so.* $out/lib cp -pv ${pkgs.glibc.out}/lib/libnss_files.so.* $out/lib
''; '';
@ -230,7 +223,7 @@ in
description = "adb daemon"; description = "adb daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
ExecStart = "${hw.adbd}/bin/adbd"; ExecStart = "${pkgs.adbd}/bin/adbd";
Restart = "always"; Restart = "always";
}; };
}; };

View file

@ -35,7 +35,7 @@ in {
meta.license = lib.licenses.mit; meta.license = lib.licenses.mit;
}; };
alsa-ucm-conf = pkgs.stdenvNoCC.mkDerivation { alsa-ucm-conf-enchilada = pkgs.stdenvNoCC.mkDerivation {
pname = "alsa-ucm-conf-enchilada"; pname = "alsa-ucm-conf-enchilada";
version = "unstable-2022-12-08"; version = "unstable-2022-12-08";
src = pkgs.fetchFromGitLab { src = pkgs.fetchFromGitLab {
@ -55,7 +55,7 @@ in {
meta.priority = -10; meta.priority = -10;
}; };
uboot = pkgs.buildUBoot { ubootEnchilada = pkgs.buildUBoot {
defconfig = "qcom_defconfig"; defconfig = "qcom_defconfig";
version = "unstable-2023-12-11"; version = "unstable-2023-12-11";
src = pkgs.fetchFromGitLab { src = pkgs.fetchFromGitLab {
@ -73,7 +73,7 @@ in {
filesToInstall = [ "u-boot-nodtb.bin" "u-boot-dtb.bin" "u-boot.dtb" ]; filesToInstall = [ "u-boot-nodtb.bin" "u-boot-dtb.bin" "u-boot.dtb" ];
}; };
ubootImage = pkgs.stdenvNoCC.mkDerivation { ubootImageEnchilada = pkgs.stdenvNoCC.mkDerivation {
name = "u-boot-enchilada.img"; name = "u-boot-enchilada.img";
nativeBuildInputs = [ nativeBuildInputs = [
# available from mobile-nixos's overlay # available from mobile-nixos's overlay
@ -97,13 +97,13 @@ in {
''; '';
}; };
firmware = pkgs.stdenvNoCC.mkDerivation { firmware-oneplus-sdm845 = pkgs.stdenvNoCC.mkDerivation {
name = "firmware-oneplus-sdm845"; name = "firmware-oneplus-sdm845";
src = pkgs.fetchFromGitLab { src = pkgs.fetchFromGitLab {
owner = "sdm845-mainline"; owner = "sdm845-mainline";
repo = "firmware-oneplus-sdm845"; repo = "firmware-oneplus-sdm845";
rev = "176ca713448c5237a983fb1f158cf3a5c251d775"; rev = "dc9c77f220d104d7224c03fcbfc419a03a58765e";
hash = "sha256-ZrBvYO+MY0tlamJngdwhCsI1qpA/2FXoyEys5FAYLj4="; hash = "sha256-jrbWIS4T9HgBPYOV2MqPiRQCxGMDEfQidKw9Jn5pgBI=";
}; };
installPhase = '' installPhase = ''
cp -a . "$out" cp -a . "$out"
@ -119,7 +119,7 @@ in {
meta.license = lib.licenses.unfreeRedistributableFirmware; meta.license = lib.licenses.unfreeRedistributableFirmware;
}; };
linux = pkgs.linux_latest.override { linux_enchilada = pkgs.linux_latest.override {
# TODO: uncomment # TODO: uncomment
# ignoreConfigErrors = false; # ignoreConfigErrors = false;
kernelPatches = [ kernelPatches = [
@ -627,5 +627,5 @@ in {
XEN_PVHVM.tristate = lib.mkForce null; XEN_SAVE_RESTORE.tristate = lib.mkForce null; XEN_SYS_HYPERVISOR.tristate = lib.mkForce null; XEN_PVHVM.tristate = lib.mkForce null; XEN_SAVE_RESTORE.tristate = lib.mkForce null; XEN_SYS_HYPERVISOR.tristate = lib.mkForce null;
}; };
}; };
linux_ccache = pkgs'.ccachePkgs.buildLinuxWithCcache pkgs'.hw.oneplus-enchilada.linux; linux_enchilada_ccache = pkgs'.buildLinuxWithCcache pkgs'.linux_enchilada;
} }