Compare commits
2 commits
910055176f
...
79154f71b1
Author | SHA1 | Date | |
---|---|---|---|
chayleaf | 79154f71b1 | ||
chayleaf | 7aacb1449a |
|
@ -189,10 +189,12 @@
|
||||||
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 = { inherit inputs lib; } // args.specialArgs or { };
|
specialArgs = {
|
||||||
|
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)
|
||||||
|
|
|
@ -93,7 +93,9 @@ 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; }
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
generic-extlinux-compatible.enable = true;
|
generic-extlinux-compatible.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.kernelPackages = pkgs-kernel.linuxPackagesFor (pkgs-kernel.buildLinuxWithCcache pkgs-kernel.linux_bpiR3);
|
boot.kernelPackages = pkgs-kernel.linuxPackagesFor (pkgs-kernel.ccachePkgs.buildLinuxWithCcache pkgs-kernel.hw.bpi-r3.linux);
|
||||||
|
|
||||||
hardware.deviceTree.enable = true;
|
hardware.deviceTree.enable = true;
|
||||||
hardware.deviceTree.filter = "mt7986a-bananapi-bpi-r3.dtb";
|
hardware.deviceTree.filter = "mt7986a-bananapi-bpi-r3.dtb";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
, ... }:
|
, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
armTrustedFirmwareBpiR3 = { bootDevice, uboot ? null }: pkgs.buildArmTrustedFirmware rec {
|
mkArmTrustedFirmwareBpiR3 = { 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
|
||||||
ubootConfig = storage: ''
|
mkUbootConfig = 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 {
|
||||||
ubootBpiR3Sd = pkgs.buildUBoot {
|
sd.uboot = pkgs.buildUBoot {
|
||||||
defconfig = "mt7986a_bpir3_sd_defconfig";
|
defconfig = "mt7986a_bpir3_sd_defconfig";
|
||||||
extraConfig = ubootConfig "sd";
|
extraConfig = mkUbootConfig "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" ];
|
||||||
};
|
};
|
||||||
ubootBpiR3Emmc = pkgs.buildUBoot {
|
emmc.uboot = pkgs.buildUBoot {
|
||||||
defconfig = "mt7986a_bpir3_emmc_defconfig";
|
defconfig = "mt7986a_bpir3_emmc_defconfig";
|
||||||
extraConfig = ubootConfig "emmc";
|
extraConfig = mkUbootConfig "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" ];
|
||||||
};
|
};
|
||||||
armTrustedFirmwareBpiR3Sd = armTrustedFirmwareBpiR3 { uboot = ubootBpiR3Sd; bootDevice = "sdmmc"; };
|
sd.armTrustedFirmware = mkArmTrustedFirmwareBpiR3 { inherit (sd) uboot; bootDevice = "sdmmc"; };
|
||||||
armTrustedFirmwareBpiR3Emmc = armTrustedFirmwareBpiR3 { uboot = ubootBpiR3Emmc; bootDevice = "emmc"; };
|
emmc.armTrustedFirmware = mkArmTrustedFirmwareBpiR3 { inherit (emmc) uboot; bootDevice = "emmc"; };
|
||||||
bpiR3StuffCombined = pkgs.stdenvNoCC.mkDerivation {
|
combinedStuff = 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 ${bpiR3StuffEmmc}/* $out/emmc
|
cp ${emmc.stuff}/* $out/emmc
|
||||||
cp ${bpiR3StuffSd}/* $out/sd
|
cp ${sd.stuff}/* $out/sd
|
||||||
'';
|
'';
|
||||||
fixupPhase = "true";
|
fixupPhase = "true";
|
||||||
};
|
};
|
||||||
bpiR3StuffEmmc = pkgs.stdenvNoCC.mkDerivation {
|
emmc.stuff = 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 ${ubootBpiR3Emmc}/*.* $out
|
cp ${emmc.uboot}/*.* $out
|
||||||
cp ${armTrustedFirmwareBpiR3Emmc}/*.* $out
|
cp ${emmc.armTrustedFirmware}/*.* $out
|
||||||
'';
|
'';
|
||||||
fixupPhase = "true";
|
fixupPhase = "true";
|
||||||
};
|
};
|
||||||
bpiR3StuffSd = pkgs.stdenvNoCC.mkDerivation {
|
sd.stuff = 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 ${ubootBpiR3Sd}/*.* $out
|
cp ${sd.uboot}/*.* $out
|
||||||
cp ${armTrustedFirmwareBpiR3Sd}/*.* $out
|
cp ${sd.armTrustedFirmware}/*.* $out
|
||||||
'';
|
'';
|
||||||
fixupPhase = "true";
|
fixupPhase = "true";
|
||||||
};
|
};
|
||||||
linux_bpiR3 = pkgs.linux_latest.override {
|
linux = 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_bpiR3 = pkgs.linuxPackagesFor linux_bpiR3;
|
linuxPackages = pkgs.linuxPackagesFor linux;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.phone;
|
cfg = config.phone;
|
||||||
|
hw = pkgs.hw.oneplus-enchilada;
|
||||||
|
hw-kernel = pkgs-kernel.hw.oneplus-enchilada;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -28,16 +30,21 @@ 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 = [ pkgs.alsa-ucm-conf-enchilada ];
|
environment.systemPackages = [ hw.alsa-ucm-conf ];
|
||||||
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 = "${pkgs.q6voiced}/bin/q6voiced hw:0,6";
|
serviceConfig.ExecStart = "${hw.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
|
||||||
|
@ -63,8 +70,8 @@ in
|
||||||
percentageAction = 3;
|
percentageAction = 3;
|
||||||
criticalPowerAction = "PowerOff";
|
criticalPowerAction = "PowerOff";
|
||||||
};
|
};
|
||||||
hardware.firmware = lib.mkAfter [ pkgs.firmware-oneplus-sdm845 ];
|
hardware.firmware = lib.mkAfter [ hw.firmware ];
|
||||||
boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor pkgs-kernel.linux_enchilada_ccache);
|
boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor hw-kernel.linux_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
|
||||||
|
@ -80,7 +87,7 @@ in
|
||||||
"firmware-oneplus-sdm845"
|
"firmware-oneplus-sdm845"
|
||||||
"firmware-oneplus-sdm845-xz"
|
"firmware-oneplus-sdm845-xz"
|
||||||
];
|
];
|
||||||
system.build.uboot = pkgs.ubootImageEnchilada;
|
system.build.uboot = pkgs.ubootImage;
|
||||||
boot.initrd.includeDefaultModules = false;
|
boot.initrd.includeDefaultModules = false;
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
"sd_mod"
|
"sd_mod"
|
||||||
|
@ -188,7 +195,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.initrd.extraUtilsCommands = ''
|
boot.initrd.extraUtilsCommands = ''
|
||||||
copy_bin_and_libs ${pkgs.adbd}/bin/adbd
|
copy_bin_and_libs ${hw.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
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -223,7 +230,7 @@ in
|
||||||
description = "adb daemon";
|
description = "adb daemon";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.adbd}/bin/adbd";
|
ExecStart = "${hw.adbd}/bin/adbd";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,7 +35,7 @@ in {
|
||||||
meta.license = lib.licenses.mit;
|
meta.license = lib.licenses.mit;
|
||||||
};
|
};
|
||||||
|
|
||||||
alsa-ucm-conf-enchilada = pkgs.stdenvNoCC.mkDerivation {
|
alsa-ucm-conf = 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
ubootEnchilada = pkgs.buildUBoot {
|
uboot = 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" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
ubootImageEnchilada = pkgs.stdenvNoCC.mkDerivation {
|
ubootImage = 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-oneplus-sdm845 = pkgs.stdenvNoCC.mkDerivation {
|
firmware = 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 = "dc9c77f220d104d7224c03fcbfc419a03a58765e";
|
rev = "176ca713448c5237a983fb1f158cf3a5c251d775";
|
||||||
hash = "sha256-jrbWIS4T9HgBPYOV2MqPiRQCxGMDEfQidKw9Jn5pgBI=";
|
hash = "sha256-ZrBvYO+MY0tlamJngdwhCsI1qpA/2FXoyEys5FAYLj4=";
|
||||||
};
|
};
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
cp -a . "$out"
|
cp -a . "$out"
|
||||||
|
@ -119,7 +119,7 @@ in {
|
||||||
meta.license = lib.licenses.unfreeRedistributableFirmware;
|
meta.license = lib.licenses.unfreeRedistributableFirmware;
|
||||||
};
|
};
|
||||||
|
|
||||||
linux_enchilada = pkgs.linux_latest.override {
|
linux = 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_enchilada_ccache = pkgs'.buildLinuxWithCcache pkgs'.linux_enchilada;
|
linux_ccache = pkgs'.ccachePkgs.buildLinuxWithCcache pkgs'.hw.oneplus-enchilada.linux;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue