From 51e51e601448705c0d2f92ef90ec7b680123077c Mon Sep 17 00:00:00 2001 From: Andre Date: Wed, 4 Jun 2025 12:11:03 -0400 Subject: [PATCH] chore: format repo using treefmt-nix and nixfmt-rfc-style --- airis/n990/default.nix | 6 +- apple/default.nix | 3 +- apple/imac/18-2/default.nix | 10 +- apple/macbook-air/3/default.nix | 2 +- apple/macbook-air/7/default.nix | 7 +- apple/macbook-pro/11-5/default.nix | 3 +- apple/macbook-pro/12-1/default.nix | 9 +- apple/macbook-pro/14-1/default.nix | 10 +- apple/macbook-pro/8-1/default.nix | 7 +- apple/t2/default.nix | 17 +- asus/ally/rc71l/default.nix | 4 +- asus/battery.nix | 17 +- asus/fa507nv/default.nix | 7 +- asus/fa507rm/default.nix | 24 +- asus/flow/gv302x/amdgpu/default.nix | 18 +- asus/flow/gv302x/nvidia/default.nix | 10 +- asus/flow/gv302x/shared.nix | 33 +- asus/fx504gd/default.nix | 2 +- asus/fx506hm/default.nix | 11 +- asus/rog-strix/g513im/default.nix | 28 +- asus/rog-strix/g533zw/default.nix | 2 +- asus/rog-strix/g713ie/default.nix | 22 +- asus/rog-strix/g733qs/default.nix | 4 +- asus/zenbook/ux481/nvidia/default.nix | 12 +- asus/zephyrus/ga402x/amdgpu/default.nix | 18 +- asus/zephyrus/ga402x/nvidia/default.nix | 6 +- asus/zephyrus/ga402x/shared.nix | 32 +- chuwi/minibook-x/default.nix | 9 +- common/cpu/amd/default.nix | 3 +- common/cpu/amd/pstate.nix | 24 +- common/gpu/24.05-compat.nix | 15 +- common/gpu/amd/sea-islands/default.nix | 5 +- common/gpu/amd/southern-islands/default.nix | 5 +- common/gpu/intel/default.nix | 12 +- common/gpu/nvidia/ada-lovelace/default.nix | 2 +- common/gpu/nvidia/ampere/default.nix | 2 +- common/gpu/nvidia/disable.nix | 9 +- common/gpu/nvidia/kepler/default.nix | 2 +- common/gpu/nvidia/maxwell/default.nix | 2 +- common/gpu/nvidia/pascal/default.nix | 2 +- common/gpu/nvidia/prime.nix | 4 +- common/gpu/nvidia/turing/default.nix | 2 +- common/pc/laptop/default.nix | 6 +- default.nix | 2 +- dell/inspiron/14-5420/default.nix | 34 +- dell/inspiron/5515/default.nix | 6 +- dell/inspiron/7405/default.nix | 5 +- dell/inspiron/7559/default.nix | 2 +- dell/latitude/5490/default.nix | 7 +- dell/precision/5490/default.nix | 4 +- dell/precision/5530/default.nix | 2 +- dell/precision/7520/default.nix | 17 +- dell/xps/13-9300/default.nix | 3 +- dell/xps/13-9310/default.nix | 8 +- dell/xps/13-9315/default.nix | 7 +- dell/xps/13-9333/default.nix | 7 +- dell/xps/13-9343/default.nix | 5 +- dell/xps/15-7590/nvidia/default.nix | 2 +- dell/xps/15-9510/default.nix | 3 +- dell/xps/15-9510/nvidia/default.nix | 8 +- dell/xps/15-9530/default.nix | 2 +- dell/xps/15-9560/default.nix | 4 +- dell/xps/15-9560/nvidia/default.nix | 1 - dell/xps/15-9570/nvidia/default.nix | 1 - dell/xps/15-9570/shared.nix | 2 +- dell/xps/17-9700/common.nix | 24 +- dell/xps/17-9710/intel/default.nix | 7 +- dell/xps/sleep-resume/bluetooth/default.nix | 10 +- .../sleep-resume/i2c-designware/default.nix | 13 +- flake.lock | 62 ++ flake.nix | 798 +++++++++--------- focus/m2/gen1/default.nix | 9 +- framework/13-inch/11th-gen-intel/default.nix | 10 +- framework/13-inch/12th-gen-intel/default.nix | 3 +- framework/13-inch/7040-amd/default.nix | 22 +- .../13-inch/amd-ai-300-series/default.nix | 10 +- framework/13-inch/common/amd.nix | 7 +- framework/13-inch/common/audio.nix | 644 +++++++------- framework/13-inch/common/intel.nix | 31 +- .../intel-core-ultra-series1/default.nix | 13 +- framework/16-inch/7040-amd/default.nix | 7 +- framework/16-inch/common/amd.nix | 7 +- framework/bluetooth.nix | 61 +- framework/framework-tool.nix | 3 +- framework/kmod.nix | 55 +- friendlyarm/nanopc-t4/default.nix | 22 +- friendlyarm/nanopi-r5s/default.nix | 5 +- gmktec/nucbox/g3-plus/default.nix | 38 +- gpd/pocket-3/default.nix | 72 +- gpd/pocket-4/default.nix | 6 +- gpd/win-2/default.nix | 10 +- gpd/win-max-2/2023/default.nix | 8 +- gpd/win-max-2/default.nix | 7 +- gpd/win-mini/default.nix | 3 - hardkernel/odroid-hc4/default.nix | 44 +- hp/elitebook/845/g7/default.nix | 19 +- hp/elitebook/845/g8/default.nix | 19 +- hp/elitebook/845/g9/default.nix | 19 +- huawei/machc-wa/default.nix | 3 +- kobol/helios4/modules/fancontrol.nix | 8 +- kobol/helios4/overlay.nix | 2 +- lenovo/ideacentre/k330/default.nix | 27 +- lenovo/legion/15ach6h/nvidia/default.nix | 14 +- lenovo/legion/16ach6h/nvidia/default.nix | 14 +- lenovo/legion/16achg6/nvidia/default.nix | 14 +- lenovo/legion/16aph8/default.nix | 20 +- lenovo/legion/16arh7h/hybrid/default.nix | 7 +- lenovo/legion/16arh7h/igpu-only/default.nix | 3 +- .../audio/lenovo-16ARHA7_speaker-fix.nix | 17 +- lenovo/legion/16arha7/default.nix | 11 +- lenovo/legion/16irx8h/default.nix | 10 +- lenovo/legion/16irx9h/default.nix | 5 +- lenovo/thinkpad/a475/default.nix | 6 +- lenovo/thinkpad/p1/3th-gen/audio.nix | 6 +- lenovo/thinkpad/p14s/amd/gen2/default.nix | 11 +- lenovo/thinkpad/p14s/amd/gen4/default.nix | 7 +- lenovo/thinkpad/p14s/default.nix | 11 +- lenovo/thinkpad/p14s/intel/gen5/default.nix | 2 +- lenovo/thinkpad/p16s/intel/gen2/default.nix | 3 +- lenovo/thinkpad/p43s/default.nix | 3 +- lenovo/thinkpad/p50/default.nix | 17 +- lenovo/thinkpad/p51/default.nix | 17 +- lenovo/thinkpad/p52/default.nix | 17 +- lenovo/thinkpad/t14/amd/gen4/default.nix | 7 +- lenovo/thinkpad/t14/amd/gen5/default.nix | 7 +- lenovo/thinkpad/t410/default.nix | 5 +- lenovo/thinkpad/t490/default.nix | 22 +- lenovo/thinkpad/t490s/default.nix | 3 +- lenovo/thinkpad/x1-nano/default.nix | 3 +- lenovo/thinkpad/x1-nano/gen1/default.nix | 26 +- lenovo/thinkpad/x1/13th-gen/default.nix | 2 +- lenovo/thinkpad/x1/9th-gen/default.nix | 6 +- lenovo/thinkpad/x1/yoga/7th-gen/default.nix | 9 +- lenovo/thinkpad/x1/yoga/default.nix | 3 +- lenovo/thinkpad/x13/amd/default.nix | 3 +- lenovo/thinkpad/x13/common.nix | 3 +- lenovo/thinkpad/x13/intel/default.nix | 3 +- lenovo/thinkpad/x13/yoga/3th-gen/default.nix | 3 +- lenovo/thinkpad/x13/yoga/default.nix | 5 +- lenovo/thinkpad/x13s/default.nix | 11 +- lenovo/thinkpad/x390/default.nix | 1 - lenovo/thinkpad/z/default.nix | 7 +- lenovo/thinkpad/z/gen1/default.nix | 7 +- lenovo/thinkpad/z/gen2/default.nix | 4 +- lenovo/yoga/7/14ARH7/nvidia/default.nix | 3 +- lenovo/yoga/7/14IAH7/hybrid/default.nix | 38 +- lenovo/yoga/7/14IAH7/integrated/default.nix | 42 +- lenovo/yoga/7/14IAH7/shared.nix | 8 +- lenovo/yoga/7/slim/gen8/default.nix | 27 +- .../common/bsp/hss-payload-generator.nix | 2 +- microchip/common/bsp/linux-icicle-kit.nix | 124 +-- microchip/common/bsp/uboot.nix | 17 +- microchip/common/modules.nix | 16 +- microchip/icicle-kit/overlay.nix | 5 +- microsoft/surface-pro/9/default.nix | 2 +- microsoft/surface/common/default.nix | 70 +- .../surface/common/kernel/6.12/patches.nix | 141 ++-- .../surface/common/kernel/6.14/patches.nix | 3 +- .../surface/common/kernel/linux-package.nix | 62 +- microsoft/surface/surface-go/default.nix | 3 +- .../firmware/ath10k/ath10k-replace.nix | 18 +- .../surface-go/firmware/ath10k/default.nix | 29 +- .../surface/surface-pro-intel/default.nix | 2 +- milkv/pioneer/default.nix | 15 +- milkv/pioneer/firmware.nix | 19 +- milkv/pioneer/linux.nix | 86 +- milkv/pioneer/linuxboot-initrd.nix | 13 +- milkv/pioneer/linuxboot-kernel.nix | 8 +- milkv/pioneer/sd-image.nix | 17 +- milkv/pioneer/zsbl.nix | 15 +- minisforum/v3/audio.nix | 2 +- minisforum/v3/sensors.nix | 4 +- morefine/m600/default.nix | 3 +- msi/b350-tomahawk/default.nix | 2 +- msi/b550-a-pro/default.nix | 2 +- nxp/common/bsp/imx-atf.nix | 15 +- nxp/common/bsp/imx-firmware.nix | 26 +- nxp/common/bsp/imx-optee-os.nix | 8 +- nxp/common/bsp/imx-uboot.nix | 32 +- nxp/common/modules.nix | 3 +- nxp/imx8mp-evk/bsp/imx8mp-atf.nix | 16 +- nxp/imx8mp-evk/bsp/imx8mp-boot.nix | 17 +- nxp/imx8mp-evk/bsp/imx8mp-firmware.nix | 30 +- nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix | 109 +-- nxp/imx8mp-evk/bsp/imx8mp-uboot.nix | 147 ++-- nxp/imx8mp-evk/default.nix | 5 +- nxp/imx8mp-evk/modules.nix | 7 +- nxp/imx8mp-evk/overlay.nix | 4 +- nxp/imx8mq-evk/bsp/imx8mq-atf.nix | 16 +- nxp/imx8mq-evk/bsp/imx8mq-boot.nix | 17 +- nxp/imx8mq-evk/bsp/imx8mq-firmware.nix | 30 +- nxp/imx8mq-evk/bsp/imx8mq-linux.nix | 94 ++- nxp/imx8mq-evk/bsp/imx8mq-optee-os.nix | 109 +-- nxp/imx8mq-evk/bsp/imx8mq-uboot.nix | 147 ++-- nxp/imx8mq-evk/default.nix | 5 +- nxp/imx8mq-evk/modules.nix | 7 +- nxp/imx8mq-evk/overlay.nix | 4 +- nxp/imx8qm-mek/default.nix | 4 +- nxp/imx8qm-mek/overlay.nix | 11 +- nxp/imx8qxp-mek/overlay.nix | 11 +- olimex/teres_i/default.nix | 10 +- onenetbook/4/default.nix | 2 +- .../4/goodix-stylus-mastykin/default.nix | 52 +- .../pinebook-pro/keyboard-updater/default.nix | 7 +- pine64/star64/default.nix | 54 +- pine64/star64/firmware.nix | 15 +- pine64/star64/linux-5.15.nix | 470 ++++++----- pine64/star64/opensbi.nix | 26 +- pine64/star64/sd-image.nix | 16 +- pine64/star64/spl-tool.nix | 2 +- purism/librem/5r4/audio.nix | 58 +- purism/librem/5r4/default.nix | 16 +- purism/librem/5r4/kernel.nix | 55 +- purism/librem/5r4/librem5-base/default.nix | 8 +- purism/librem/5r4/lockdown-fix.nix | 19 +- purism/librem/5r4/u-boot/default.nix | 19 +- radxa/default.nix | 12 +- radxa/disko.nix | 13 +- radxa/rock-4c-plus/default.nix | 12 +- radxa/rock-5b/default.nix | 12 +- radxa/rock-pi-4/default.nix | 12 +- radxa/rock-pi-e/default.nix | 12 +- raspberry-pi/2/default.nix | 2 +- raspberry-pi/3/default.nix | 10 +- raspberry-pi/4/apply-overlays-dtmerge.nix | 95 ++- raspberry-pi/4/audio.nix | 16 +- raspberry-pi/4/default.nix | 8 +- raspberry-pi/4/dwc2.nix | 6 +- raspberry-pi/4/gpio.nix | 49 +- raspberry-pi/4/i2c.nix | 63 +- raspberry-pi/4/leds.nix | 86 +- raspberry-pi/4/pkgs-overlays.nix | 3 +- raspberry-pi/4/poe-hat.nix | 3 +- raspberry-pi/4/poe-plus-hat.nix | 3 +- raspberry-pi/4/pwm0.nix | 52 +- raspberry-pi/4/tv-hat.nix | 3 +- raspberry-pi/4/xhci.nix | 6 +- raspberry-pi/5/default.nix | 19 +- rockchip/default.nix | 12 +- rockchip/disko.nix | 12 +- rockchip/rk3328/default.nix | 12 +- rockchip/rk3399/default.nix | 12 +- rockchip/rk3399/disko.nix | 20 +- rockchip/rk3588/default.nix | 12 +- samsung/np900x3c/default.nix | 2 +- starfive/visionfive/v1/default.nix | 21 +- starfive/visionfive/v1/firmware.nix | 52 +- starfive/visionfive/v1/linux.nix | 64 +- starfive/visionfive/v1/sd-image.nix | 10 +- starfive/visionfive/v1/uboot.nix | 10 +- starfive/visionfive/v2/firmware.nix | 27 +- starfive/visionfive/v2/sd-image.nix | 10 +- starfive/visionfive/v2/spl-tool.nix | 2 +- starfive/visionfive/v2/uboot.nix | 5 +- supermicro/default.nix | 5 +- supermicro/x10sll-f/default.nix | 5 +- system76/darp6/default.nix | 15 +- system76/galp5-1650/default.nix | 7 +- system76/gaze18/default.nix | 7 +- tests/build-profile.nix | 31 +- tests/flake.nix | 11 +- toshiba/swanky/default.nix | 14 +- treefmt.nix | 19 + tuxedo/infinitybook/pro14/gen9/default.nix | 8 +- tuxedo/pulse/14/gen3/default.nix | 10 +- tuxedo/pulse/15/gen2/default.nix | 18 +- 266 files changed, 3721 insertions(+), 2733 deletions(-) create mode 100644 flake.lock create mode 100644 treefmt.nix diff --git a/airis/n990/default.nix b/airis/n990/default.nix index e4711419..ab450958 100644 --- a/airis/n990/default.nix +++ b/airis/n990/default.nix @@ -9,10 +9,10 @@ kernelParams = [ "apm=on" "acpi=on" - "vga=0x317" # 1024x768 + "vga=0x317" # 1024x768 "console=tty1" - "video=vesafb:ywrap" # Faster scroll - ]; + "video=vesafb:ywrap" # Faster scroll + ]; }; hardware.firmware = with pkgs; [ intel2200BGFirmware ]; diff --git a/apple/default.nix b/apple/default.nix index a2ee2623..5663cfeb 100644 --- a/apple/default.nix +++ b/apple/default.nix @@ -5,8 +5,7 @@ "hid_apple.iso_layout=0" ]; - hardware.facetimehd.enable = lib.mkDefault - (config.nixpkgs.config.allowUnfree or false); + hardware.facetimehd.enable = lib.mkDefault (config.nixpkgs.config.allowUnfree or false); services.mbpfan.enable = lib.mkDefault true; } diff --git a/apple/imac/18-2/default.nix b/apple/imac/18-2/default.nix index 9d71ba32..6849037d 100644 --- a/apple/imac/18-2/default.nix +++ b/apple/imac/18-2/default.nix @@ -3,7 +3,8 @@ lib, pkgs, ... -}: { +}: +{ imports = [ ../. ../../../common/cpu/intel/kaby-lake @@ -14,7 +15,12 @@ # apple smc (TODO: check spi) boot = { - initrd.kernelModules = ["applespi" "spi_pxa2xx_platform" "intel_lpss_pci" "applesmc" ]; + initrd.kernelModules = [ + "applespi" + "spi_pxa2xx_platform" + "intel_lpss_pci" + "applesmc" + ]; kernelParams = [ "intel_iommu=on" ]; kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.0") pkgs.linuxPackages_latest; }; diff --git a/apple/macbook-air/3/default.nix b/apple/macbook-air/3/default.nix index 9589e762..72fbdb31 100644 --- a/apple/macbook-air/3/default.nix +++ b/apple/macbook-air/3/default.nix @@ -1,7 +1,7 @@ { config, lib, ... }: { - imports = [ + imports = [ ../../. ../../../common/cpu/intel ../../../common/pc/laptop diff --git a/apple/macbook-air/7/default.nix b/apple/macbook-air/7/default.nix index f6c82282..f6dd654a 100644 --- a/apple/macbook-air/7/default.nix +++ b/apple/macbook-air/7/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ diff --git a/apple/macbook-pro/11-5/default.nix b/apple/macbook-pro/11-5/default.nix index 1db2878f..0dcd557f 100644 --- a/apple/macbook-pro/11-5/default.nix +++ b/apple/macbook-pro/11-5/default.nix @@ -18,7 +18,6 @@ in services.udev.extraRules = # Disable XHC1 wakeup signal to avoid resume getting triggered some time # after suspend. Reboot required for this to take effect. - lib.optionalString - (lib.versionAtLeast kernelPackages.kernel.version "3.13") + lib.optionalString (lib.versionAtLeast kernelPackages.kernel.version "3.13") ''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"''; } diff --git a/apple/macbook-pro/12-1/default.nix b/apple/macbook-pro/12-1/default.nix index 6f1bc995..e48dbc24 100644 --- a/apple/macbook-pro/12-1/default.nix +++ b/apple/macbook-pro/12-1/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, modulesPath, ... }: +{ + lib, + pkgs, + modulesPath, + ... +}: { imports = [ @@ -19,7 +24,7 @@ powerDownCommands = lib.mkBefore '' ${pkgs.kmod}/bin/rmmod -f -v brcmfmac_wcc 2>/dev/null || true ${pkgs.kmod}/bin/rmmod brcmfmac - ''; + ''; }; # USB subsystem wakes up MBP right after suspend unless we disable it. diff --git a/apple/macbook-pro/14-1/default.nix b/apple/macbook-pro/14-1/default.nix index e7897708..ad8c5d1d 100644 --- a/apple/macbook-pro/14-1/default.nix +++ b/apple/macbook-pro/14-1/default.nix @@ -3,7 +3,8 @@ lib, pkgs, ... -}: { +}: +{ imports = [ ../. ../../../common/cpu/intel/kaby-lake @@ -15,7 +16,12 @@ # https://www.kernelconfig.io/config_keyboard_applespi boot = { - initrd.kernelModules = ["applespi" "spi_pxa2xx_platform" "intel_lpss_pci" "applesmc" ]; + initrd.kernelModules = [ + "applespi" + "spi_pxa2xx_platform" + "intel_lpss_pci" + "applesmc" + ]; kernelParams = [ "intel_iommu=on" ]; kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.0") pkgs.linuxPackages_latest; }; diff --git a/apple/macbook-pro/8-1/default.nix b/apple/macbook-pro/8-1/default.nix index a807da27..0b6eef12 100644 --- a/apple/macbook-pro/8-1/default.nix +++ b/apple/macbook-pro/8-1/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ diff --git a/apple/t2/default.nix b/apple/t2/default.nix index 38115ba2..825a181a 100644 --- a/apple/t2/default.nix +++ b/apple/t2/default.nix @@ -25,7 +25,7 @@ let overrideAudioFiles = package: pluginsPath: package.overrideAttrs ( - new: old: { + _new: old: { preConfigurePhases = old.preConfigurePhases or [ ] ++ [ "postPatchPhase" ]; postPatchPhase = '' cp -r ${audioFiles}/files/{profile-sets,paths} ${pluginsPath}/alsa/mixer/ @@ -106,11 +106,16 @@ in powerManagement.enable = true; } - (if lib.versionAtLeast nixosVersion "25.05" then { - services.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/"; - } else { - hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/"; - }) + ( + if lib.versionAtLeast nixosVersion "25.05" then + { + services.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/"; + } + else + { + hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/"; + } + ) (lib.mkIf t2Cfg.enableIGPU { # Enable the iGPU by default if present diff --git a/asus/ally/rc71l/default.nix b/asus/ally/rc71l/default.nix index 7f2552ec..5d1e58a7 100644 --- a/asus/ally/rc71l/default.nix +++ b/asus/ally/rc71l/default.nix @@ -11,5 +11,7 @@ # 6.5 adds many fixes and improvements for the Ally # This includes for example performance, audio and bluetooth - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.5") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.5") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/asus/battery.nix b/asus/battery.nix index d61e3502..4bdf6b64 100644 --- a/asus/battery.nix +++ b/asus/battery.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let p = pkgs.writeScriptBin "charge-upto" '' echo ''${0:-100} > /sys/class/power_supply/BAT?/charge_control_end_threshold @@ -22,8 +27,14 @@ in config = { environment.systemPackages = lib.mkIf cfg.enableChargeUptoScript [ p ]; systemd.services.battery-charge-threshold = { - wantedBy = [ "local-fs.target" "suspend.target" ]; - after = [ "local-fs.target" "suspend.target" ]; + wantedBy = [ + "local-fs.target" + "suspend.target" + ]; + after = [ + "local-fs.target" + "suspend.target" + ]; description = "Set the battery charge threshold to ${toString cfg.chargeUpto}%"; startLimitBurst = 5; startLimitIntervalSec = 1; diff --git a/asus/fa507nv/default.nix b/asus/fa507nv/default.nix index 3a304012..01fafbb2 100644 --- a/asus/fa507nv/default.nix +++ b/asus/fa507nv/default.nix @@ -3,7 +3,8 @@ pkgs, config, ... -}: { +}: +{ imports = [ ../../common/cpu/amd ../../common/cpu/amd/raphael/igpu.nix @@ -20,7 +21,9 @@ # The bottom 2 parts are taken from the framework 16-inch laptops configurations. # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ - boot.kernelParams = lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") ["rtc_cmos.use_acpi_alarm=1"]; + boot.kernelParams = + lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") + [ "rtc_cmos.use_acpi_alarm=1" ]; # AMD has better battery life with PPD over TLP: # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 diff --git a/asus/fa507rm/default.nix b/asus/fa507rm/default.nix index a07a6413..ffbae513 100644 --- a/asus/fa507rm/default.nix +++ b/asus/fa507rm/default.nix @@ -1,16 +1,16 @@ { ... }: { - imports = [ - ../../common/cpu/amd - ../../common/gpu/nvidia/prime.nix - ../../common/gpu/nvidia/ampere - ../../common/pc/laptop - ../../common/pc/ssd - ]; + imports = [ + ../../common/cpu/amd + ../../common/gpu/nvidia/prime.nix + ../../common/gpu/nvidia/ampere + ../../common/pc/laptop + ../../common/pc/ssd + ]; - hardware.nvidia.prime = { - amdgpuBusId = "PCI:5:0:0"; - nvidiaBusId = "PCI:1:0:0"; - }; - } + hardware.nvidia.prime = { + amdgpuBusId = "PCI:5:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; +} diff --git a/asus/flow/gv302x/amdgpu/default.nix b/asus/flow/gv302x/amdgpu/default.nix index 833e298f..8cfb2403 100644 --- a/asus/flow/gv302x/amdgpu/default.nix +++ b/asus/flow/gv302x/amdgpu/default.nix @@ -1,4 +1,5 @@ -{ config, +{ + config, lib, ... }: @@ -7,15 +8,22 @@ let inherit (lib) mkEnableOption mkIf mkMerge; cfg = config.hardware.asus.flow.gv302x; -in { +in +{ imports = [ ../shared.nix ]; options.hardware.asus.flow.gv302x.amdgpu = { - recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = false; }; - sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = true; }; - psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { default = true; }; + recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { + default = false; + }; + sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { + default = true; + }; + psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { + default = true; + }; }; config = mkMerge [ diff --git a/asus/flow/gv302x/nvidia/default.nix b/asus/flow/gv302x/nvidia/default.nix index 0c490c93..7abfea1d 100644 --- a/asus/flow/gv302x/nvidia/default.nix +++ b/asus/flow/gv302x/nvidia/default.nix @@ -1,4 +1,5 @@ -{ lib, +{ + lib, pkgs, config, ... @@ -7,7 +8,8 @@ let inherit (lib) mkDefault; -in { +in +{ imports = [ ../shared.nix ## "prime.nix" loads this, aleady: @@ -23,8 +25,6 @@ in { blacklistedKernelModules = [ "nouveau" ]; }; - - hardware = { ## Enable the Nvidia card, as well as Prime and Offload: amdgpu.initrd.enable = mkDefault true; @@ -49,7 +49,7 @@ in { }; dynamicBoost.enable = mkDefault true; - + }; }; } diff --git a/asus/flow/gv302x/shared.nix b/asus/flow/gv302x/shared.nix index 474eb584..a556e7d0 100644 --- a/asus/flow/gv302x/shared.nix +++ b/asus/flow/gv302x/shared.nix @@ -1,14 +1,23 @@ -{ config, +{ + config, pkgs, lib, ... }: let - inherit (lib) mkDefault mkEnableOption mkIf mkMerge version versionAtLeast versionOlder; + inherit (lib) + mkDefault + mkEnableOption + mkIf + mkMerge + version + versionAtLeast + ; cfg = config.hardware.asus.flow.gv302x; -in { +in +{ imports = [ ../../../common/cpu/amd @@ -26,12 +35,12 @@ in { # enables it for kernel 6.9.x onwards. # # Note: the device name is "ASUS N-KEY Device". - keyboard.autosuspend.enable = ( - mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Flow GV302X" - ) // { - default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9"; - defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\""; - }; + keyboard.autosuspend.enable = + (mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Flow GV302X") + // { + default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9"; + defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\""; + }; # The ASUS 8295 ITE device will cause an immediate wake-up when trying to suspend the laptop. # After the first successful hibernate, it will work as expected, however. # NOTE: I'm not actually sure what this device, as neither the touchpad nor the M1-M4 keys cause a wake-up. @@ -63,7 +72,7 @@ in { evdev:name:*:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:* KEYBOARD_KEY_ff31007c=f20 ''; - }; + }; }; #flow devices are 2 in 1 laptops @@ -71,7 +80,7 @@ in { } - (mkIf (! cfg.keyboard.autosuspend.enable) { + (mkIf (!cfg.keyboard.autosuspend.enable) { services.udev.extraRules = '' # Disable power auto-suspend for the ASUS N-KEY device, i.e. USB Keyboard. # Otherwise on certain kernel-versions, it will tend to take 1-2 key-presses to wake-up after the device suspends. @@ -79,7 +88,7 @@ in { ''; }) - (mkIf (! cfg.ite-device.wakeup.enable) { + (mkIf (!cfg.ite-device.wakeup.enable) { services.udev.extraRules = '' # Disable power wakeup for the 8295 ITE device. # Otherwise on certain kernel-versions, it will tend to cause the laptop to immediately wake-up when suspending. diff --git a/asus/fx504gd/default.nix b/asus/fx504gd/default.nix index 45132509..244eaae4 100644 --- a/asus/fx504gd/default.nix +++ b/asus/fx504gd/default.nix @@ -2,7 +2,7 @@ { imports = [ ../../common/cpu/intel - ../../common/pc/laptop + ../../common/pc/laptop ]; #Nouveau doesn't work at all on this model. diff --git a/asus/fx506hm/default.nix b/asus/fx506hm/default.nix index a50ffdf4..6f29a8b8 100644 --- a/asus/fx506hm/default.nix +++ b/asus/fx506hm/default.nix @@ -1,8 +1,7 @@ { config, lib, ... }: { - imports = - [ + imports = [ ../../common/cpu/intel ../../common/gpu/nvidia ../../common/gpu/nvidia/prime.nix @@ -11,14 +10,12 @@ ../battery.nix ]; - hardware.nvidia = - { + hardware.nvidia = { modesetting.enable = lib.mkDefault true; open = lib.mkIf (lib.versionAtLeast config.hardware.nvidia.package.version "555") true; - prime = - { - intelBusId = "PCI:0:2:0"; + prime = { + intelBusId = "PCI:0:2:0"; nvidiaBusId = "PCI:1:0:0"; }; }; diff --git a/asus/rog-strix/g513im/default.nix b/asus/rog-strix/g513im/default.nix index 654cdd14..12320165 100644 --- a/asus/rog-strix/g513im/default.nix +++ b/asus/rog-strix/g513im/default.nix @@ -1,17 +1,17 @@ { - imports = [ - ../../../common/cpu/amd - ../../../common/cpu/amd/pstate.nix - ../../../common/gpu/nvidia - ../../../common/gpu/nvidia/prime.nix - ../../../common/gpu/nvidia/ampere - ../../../common/pc/laptop - ../../../common/pc/ssd - ../../battery.nix - ]; + imports = [ + ../../../common/cpu/amd + ../../../common/cpu/amd/pstate.nix + ../../../common/gpu/nvidia + ../../../common/gpu/nvidia/prime.nix + ../../../common/gpu/nvidia/ampere + ../../../common/pc/laptop + ../../../common/pc/ssd + ../../battery.nix + ]; - hardware.nvidia.prime = { - amdgpuBusId = "PCI:05:00:0"; - nvidiaBusId = "PCI:01:00:0"; - }; + hardware.nvidia.prime = { + amdgpuBusId = "PCI:05:00:0"; + nvidiaBusId = "PCI:01:00:0"; + }; } diff --git a/asus/rog-strix/g533zw/default.nix b/asus/rog-strix/g533zw/default.nix index 635ae559..d93f4f4a 100644 --- a/asus/rog-strix/g533zw/default.nix +++ b/asus/rog-strix/g533zw/default.nix @@ -13,5 +13,5 @@ hardware.nvidia.prime = { intelBusId = "PCI:0:2:0"; nvidiaBusId = "PCI:1:0:0"; - }; + }; } diff --git a/asus/rog-strix/g713ie/default.nix b/asus/rog-strix/g713ie/default.nix index f82ddb9b..3ef4c23f 100644 --- a/asus/rog-strix/g713ie/default.nix +++ b/asus/rog-strix/g713ie/default.nix @@ -1,16 +1,16 @@ { - imports = [ - ../../../common/cpu/amd - ../../../common/cpu/amd/pstate.nix - ../../../common/gpu/nvidia - ../../../common/gpu/nvidia/prime.nix - ../../../common/gpu/nvidia/ampere - ../../../common/pc/laptop - ../../../common/pc/ssd - ../../battery.nix - ]; + imports = [ + ../../../common/cpu/amd + ../../../common/cpu/amd/pstate.nix + ../../../common/gpu/nvidia + ../../../common/gpu/nvidia/prime.nix + ../../../common/gpu/nvidia/ampere + ../../../common/pc/laptop + ../../../common/pc/ssd + ../../battery.nix + ]; - hardware.nvidia.prime = { + hardware.nvidia.prime = { amdgpuBusId = "PCI:5:0:0"; nvidiaBusId = "PCI:1:0:0"; }; diff --git a/asus/rog-strix/g733qs/default.nix b/asus/rog-strix/g733qs/default.nix index b09142af..41fda8ad 100644 --- a/asus/rog-strix/g733qs/default.nix +++ b/asus/rog-strix/g733qs/default.nix @@ -20,7 +20,9 @@ options snd-hda-intel patch=hda-jack-retask.fw ''; # before 5.12 it would interpret every keystroke as the power button - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") ( + lib.mkDefault pkgs.linuxPackages_latest + ); hardware.nvidia.prime = { amdgpuBusId = "PCI:5:0:0"; diff --git a/asus/zenbook/ux481/nvidia/default.nix b/asus/zenbook/ux481/nvidia/default.nix index 359a97d6..e65ed0bc 100644 --- a/asus/zenbook/ux481/nvidia/default.nix +++ b/asus/zenbook/ux481/nvidia/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: +{ lib, ... }: { imports = [ ../shared.nix @@ -7,11 +7,11 @@ ]; hardware.nvidia = { - prime = { - intelBusId = "PCI:0:2:0"; - nvidiaBusId = "PCI:2:0:0"; - }; + prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:2:0:0"; + }; - dynamicBoost.enable = lib.mkForce false; # Dynamic boost is not supported on Pascal architeture + dynamicBoost.enable = lib.mkForce false; # Dynamic boost is not supported on Pascal architeture }; } diff --git a/asus/zephyrus/ga402x/amdgpu/default.nix b/asus/zephyrus/ga402x/amdgpu/default.nix index 2610db89..09acc327 100644 --- a/asus/zephyrus/ga402x/amdgpu/default.nix +++ b/asus/zephyrus/ga402x/amdgpu/default.nix @@ -1,4 +1,5 @@ -{ config, +{ + config, lib, ... }: @@ -7,15 +8,22 @@ let inherit (lib) mkEnableOption mkIf mkMerge; cfg = config.hardware.asus.zephyrus.ga402x; -in { +in +{ imports = [ ../shared.nix ]; options.hardware.asus.zephyrus.ga402x.amdgpu = { - recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = false; }; - sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = true; }; - psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { default = true; }; + recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { + default = false; + }; + sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { + default = true; + }; + psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { + default = true; + }; }; config = mkMerge [ diff --git a/asus/zephyrus/ga402x/nvidia/default.nix b/asus/zephyrus/ga402x/nvidia/default.nix index 7c5b1d7f..c2750490 100644 --- a/asus/zephyrus/ga402x/nvidia/default.nix +++ b/asus/zephyrus/ga402x/nvidia/default.nix @@ -1,4 +1,5 @@ -{ lib, +{ + lib, pkgs, ... }: @@ -6,7 +7,8 @@ let inherit (lib) mkDefault; -in { +in +{ imports = [ ../shared.nix ## "prime.nix" loads this, aleady: diff --git a/asus/zephyrus/ga402x/shared.nix b/asus/zephyrus/ga402x/shared.nix index f1069037..bd0eda35 100644 --- a/asus/zephyrus/ga402x/shared.nix +++ b/asus/zephyrus/ga402x/shared.nix @@ -1,14 +1,24 @@ -{ config, +{ + config, pkgs, lib, ... }: let - inherit (lib) mkDefault mkEnableOption mkIf mkMerge version versionAtLeast versionOlder; + inherit (lib) + mkDefault + mkEnableOption + mkIf + mkMerge + version + versionAtLeast + versionOlder + ; cfg = config.hardware.asus.zephyrus.ga402x; -in { +in +{ imports = [ ../../../common/cpu/amd @@ -26,12 +36,12 @@ in { # enables it for kernel 6.9.x onwards. # # Note: the device name is "ASUS N-KEY Device". - keyboard.autosuspend.enable = ( - mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Zephyrus GA402X" - ) // { - default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9"; - defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\""; - }; + keyboard.autosuspend.enable = + (mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Zephyrus GA402X") + // { + default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9"; + defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\""; + }; # The ASUS 8295 ITE device will cause an immediate wake-up when trying to suspend the laptop. # After the first successful hibernate, it will work as expected, however. # NOTE: I'm not actually sure what this device, as neither the touchpad nor the M1-M4 keys cause a wake-up. @@ -67,7 +77,7 @@ in { }; } - (mkIf (! cfg.keyboard.autosuspend.enable) { + (mkIf (!cfg.keyboard.autosuspend.enable) { services.udev.extraRules = '' # Disable power auto-suspend for the ASUS N-KEY device, i.e. USB Keyboard. # Otherwise on certain kernel-versions, it will tend to take 1-2 key-presses to wake-up after the device suspends. @@ -75,7 +85,7 @@ in { ''; }) - (mkIf (! cfg.ite-device.wakeup.enable) { + (mkIf (!cfg.ite-device.wakeup.enable) { services.udev.extraRules = '' # Disable power wakeup for the 8295 ITE device. # Otherwise on certain kernel-versions, it will tend to cause the laptop to immediately wake-up when suspending. diff --git a/chuwi/minibook-x/default.nix b/chuwi/minibook-x/default.nix index 0b78d046..480909e2 100644 --- a/chuwi/minibook-x/default.nix +++ b/chuwi/minibook-x/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ../../common/cpu/intel ../../common/pc/laptop @@ -6,6 +7,8 @@ ../../common/hidpi.nix ]; # Fixes the display being rotated 90 degrees. - boot.kernelParams = - [ "fbcon=rotate:1" "video=DSI-1:panel_orientation=right_side_up" ]; + boot.kernelParams = [ + "fbcon=rotate:1" + "video=DSI-1:panel_orientation=right_side_up" + ]; } diff --git a/common/cpu/amd/default.nix b/common/cpu/amd/default.nix index d8c48a26..10ec6fd5 100644 --- a/common/cpu/amd/default.nix +++ b/common/cpu/amd/default.nix @@ -1,6 +1,5 @@ { config, lib, ... }: { - hardware.cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/common/cpu/amd/pstate.nix b/common/cpu/amd/pstate.nix index 6a84027a..19f1d74f 100644 --- a/common/cpu/amd/pstate.nix +++ b/common/cpu/amd/pstate.nix @@ -8,23 +8,13 @@ in imports = [ ./. ]; boot = lib.mkMerge [ - (lib.mkIf - ( - (lib.versionAtLeast kver "5.17") - && (lib.versionOlder kver "6.1") - ) - { - kernelParams = [ "initcall_blacklist=acpi_cpufreq_init" ]; - kernelModules = [ "amd-pstate" ]; - }) - (lib.mkIf - ( - (lib.versionAtLeast kver "6.1") - && (lib.versionOlder kver "6.3") - ) - { - kernelParams = [ "amd_pstate=passive" ]; - }) + (lib.mkIf ((lib.versionAtLeast kver "5.17") && (lib.versionOlder kver "6.1")) { + kernelParams = [ "initcall_blacklist=acpi_cpufreq_init" ]; + kernelModules = [ "amd-pstate" ]; + }) + (lib.mkIf ((lib.versionAtLeast kver "6.1") && (lib.versionOlder kver "6.3")) { + kernelParams = [ "amd_pstate=passive" ]; + }) (lib.mkIf (lib.versionAtLeast kver "6.3") { kernelParams = [ "amd_pstate=active" ]; }) diff --git a/common/gpu/24.05-compat.nix b/common/gpu/24.05-compat.nix index 17508882..bcccd2ca 100644 --- a/common/gpu/24.05-compat.nix +++ b/common/gpu/24.05-compat.nix @@ -6,9 +6,18 @@ # Backward-compat for 24.05, can be removed after we drop 24.05 support imports = lib.optionals (lib.versionOlder lib.version "24.11pre") [ (lib.mkAliasOptionModule [ "hardware" "graphics" "enable" ] [ "hardware" "opengl" "enable" ]) - (lib.mkAliasOptionModule [ "hardware" "graphics" "extraPackages" ] [ "hardware" "opengl" "extraPackages" ]) - (lib.mkAliasOptionModule [ "hardware" "graphics" "extraPackages32" ] [ "hardware" "opengl" "extraPackages32" ]) - (lib.mkAliasOptionModule [ "hardware" "graphics" "enable32Bit" ] [ "hardware" "opengl" "driSupport32Bit" ]) + (lib.mkAliasOptionModule + [ "hardware" "graphics" "extraPackages" ] + [ "hardware" "opengl" "extraPackages" ] + ) + (lib.mkAliasOptionModule + [ "hardware" "graphics" "extraPackages32" ] + [ "hardware" "opengl" "extraPackages32" ] + ) + (lib.mkAliasOptionModule + [ "hardware" "graphics" "enable32Bit" ] + [ "hardware" "opengl" "driSupport32Bit" ] + ) (lib.mkAliasOptionModule [ "hardware" "graphics" "package" ] [ "hardware" "opengl" "package" ]) (lib.mkAliasOptionModule [ "hardware" "graphics" "package32" ] [ "hardware" "opengl" "package32" ]) ]; diff --git a/common/gpu/amd/sea-islands/default.nix b/common/gpu/amd/sea-islands/default.nix index 697e8250..593d7437 100644 --- a/common/gpu/amd/sea-islands/default.nix +++ b/common/gpu/amd/sea-islands/default.nix @@ -1,5 +1,8 @@ { imports = [ ../. ]; # Explicitly set amdgpu support in place of radeon - boot.kernelParams = [ "radeon.cik_support=0" "amdgpu.cik_support=1" ]; + boot.kernelParams = [ + "radeon.cik_support=0" + "amdgpu.cik_support=1" + ]; } diff --git a/common/gpu/amd/southern-islands/default.nix b/common/gpu/amd/southern-islands/default.nix index 4939117f..fa98cb1a 100644 --- a/common/gpu/amd/southern-islands/default.nix +++ b/common/gpu/amd/southern-islands/default.nix @@ -1,5 +1,8 @@ { imports = [ ../. ]; # Explicitly set amdgpu support in place of radeon - boot.kernelParams = [ "radeon.si_support=0" "amdgpu.si_support=1" ]; + boot.kernelParams = [ + "radeon.si_support=0" + "amdgpu.si_support=1" + ]; } diff --git a/common/gpu/intel/default.nix b/common/gpu/intel/default.nix index 28c6e93e..a8671d41 100644 --- a/common/gpu/intel/default.nix +++ b/common/gpu/intel/default.nix @@ -45,11 +45,15 @@ intel-vaapi-driver = (pkgs.intel-vaapi-driver or pkgs.vaapiIntel).override { enableHybridCodec = cfg.enableHybridCodec; }; - intel-vaapi-driver-32 = (pkgs.driversi686Linux.intel-vaapi-driver or pkgs.driversi686Linux.vaapiIntel).override { - enableHybridCodec = cfg.enableHybridCodec; - }; + intel-vaapi-driver-32 = + (pkgs.driversi686Linux.intel-vaapi-driver or pkgs.driversi686Linux.vaapiIntel).override + { + enableHybridCodec = cfg.enableHybridCodec; + }; - useIntelOcl = useIntelVaapiDriver && (config.hardware.enableAllFirmware or config.nixpkgs.config.allowUnfree or false); + useIntelOcl = + useIntelVaapiDriver + && (config.hardware.enableAllFirmware or config.nixpkgs.config.allowUnfree or false); intel-ocl = pkgs.intel-ocl; useIntelMediaDriver = cfg.vaapiDriver == "intel-media-driver" || cfg.vaapiDriver == null; diff --git a/common/gpu/nvidia/ada-lovelace/default.nix b/common/gpu/nvidia/ada-lovelace/default.nix index 461ae914..5e8d48f6 100644 --- a/common/gpu/nvidia/ada-lovelace/default.nix +++ b/common/gpu/nvidia/ada-lovelace/default.nix @@ -1,4 +1,4 @@ -{lib, config, ...}: +{ lib, config, ... }: let nvidiaPackage = config.hardware.nvidia.package; in diff --git a/common/gpu/nvidia/ampere/default.nix b/common/gpu/nvidia/ampere/default.nix index 461ae914..5e8d48f6 100644 --- a/common/gpu/nvidia/ampere/default.nix +++ b/common/gpu/nvidia/ampere/default.nix @@ -1,4 +1,4 @@ -{lib, config, ...}: +{ lib, config, ... }: let nvidiaPackage = config.hardware.nvidia.package; in diff --git a/common/gpu/nvidia/disable.nix b/common/gpu/nvidia/disable.nix index 6ea07adc..550da56e 100644 --- a/common/gpu/nvidia/disable.nix +++ b/common/gpu/nvidia/disable.nix @@ -8,7 +8,7 @@ blacklist nouveau options nouveau modeset=0 ''; - + services.udev.extraRules = '' # Remove NVIDIA USB xHCI Host Controller devices, if present ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1" @@ -22,5 +22,10 @@ # Remove NVIDIA VGA/3D controller devices ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1" ''; - boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ]; + boot.blacklistedKernelModules = [ + "nouveau" + "nvidia" + "nvidia_drm" + "nvidia_modeset" + ]; } diff --git a/common/gpu/nvidia/kepler/default.nix b/common/gpu/nvidia/kepler/default.nix index f8d89a1e..129bcad4 100644 --- a/common/gpu/nvidia/kepler/default.nix +++ b/common/gpu/nvidia/kepler/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: +{ lib, ... }: { imports = [ ../. ]; diff --git a/common/gpu/nvidia/maxwell/default.nix b/common/gpu/nvidia/maxwell/default.nix index 89565090..194f39c9 100644 --- a/common/gpu/nvidia/maxwell/default.nix +++ b/common/gpu/nvidia/maxwell/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: +{ lib, ... }: { imports = [ ../. ]; diff --git a/common/gpu/nvidia/pascal/default.nix b/common/gpu/nvidia/pascal/default.nix index ad3555dc..acd77a2b 100644 --- a/common/gpu/nvidia/pascal/default.nix +++ b/common/gpu/nvidia/pascal/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: +{ lib, ... }: { imports = [ ../. ]; diff --git a/common/gpu/nvidia/prime.nix b/common/gpu/nvidia/prime.nix index cf3e7d45..edfda26d 100644 --- a/common/gpu/nvidia/prime.nix +++ b/common/gpu/nvidia/prime.nix @@ -19,7 +19,7 @@ specialisation = lib.mkIf config.hardware.nvidia.primeBatterySaverSpecialisation { battery-saver.configuration = { - system.nixos.tags = ["battery-saver"]; + system.nixos.tags = [ "battery-saver" ]; imports = [ # Leave only the integrated GPU enabled ./disable.nix @@ -28,7 +28,7 @@ prime.offload.enable = lib.mkForce false; powerManagement = { enable = lib.mkForce false; - finegrained = lib.mkForce false; + finegrained = lib.mkForce false; }; }; }; diff --git a/common/gpu/nvidia/turing/default.nix b/common/gpu/nvidia/turing/default.nix index 461ae914..5e8d48f6 100644 --- a/common/gpu/nvidia/turing/default.nix +++ b/common/gpu/nvidia/turing/default.nix @@ -1,4 +1,4 @@ -{lib, config, ...}: +{ lib, config, ... }: let nvidiaPackage = config.hardware.nvidia.package; in diff --git a/common/pc/laptop/default.nix b/common/pc/laptop/default.nix index 9121b5f0..abc76fa7 100644 --- a/common/pc/laptop/default.nix +++ b/common/pc/laptop/default.nix @@ -6,6 +6,8 @@ # Gnome 40 introduced a new way of managing power, without tlp. # However, these 2 services clash when enabled simultaneously. # https://github.com/NixOS/nixos-hardware/issues/260 - services.tlp.enable = lib.mkDefault ((lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") - || !config.services.power-profiles-daemon.enable); + services.tlp.enable = lib.mkDefault ( + (lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") + || !config.services.power-profiles-daemon.enable + ); } diff --git a/default.nix b/default.nix index fbb5b770..c73bd5ad 100644 --- a/default.nix +++ b/default.nix @@ -1,3 +1,3 @@ # This file is necessary so nix-env -qa does not break, # when nixos-hardware is used as a channel -{} +{ } diff --git a/dell/inspiron/14-5420/default.nix b/dell/inspiron/14-5420/default.nix index 658f0b3b..8958afe6 100644 --- a/dell/inspiron/14-5420/default.nix +++ b/dell/inspiron/14-5420/default.nix @@ -1,22 +1,22 @@ { lib, ... }: - + { - imports = [ - ../../../common/cpu/intel - ../../../common/pc/laptop - ../../../common/pc/ssd - ]; + imports = [ + ../../../common/cpu/intel + ../../../common/pc/laptop + ../../../common/pc/ssd + ]; - hardware = { - enableRedistributableFirmware = lib.mkDefault true; - }; + hardware = { + enableRedistributableFirmware = lib.mkDefault true; + }; - services = { - fwupd = { - enable = lib.mkDefault true; - }; - thermald = { - enable = lib.mkDefault true; - }; - }; + services = { + fwupd = { + enable = lib.mkDefault true; + }; + thermald = { + enable = lib.mkDefault true; + }; + }; } diff --git a/dell/inspiron/5515/default.nix b/dell/inspiron/5515/default.nix index c2e8e310..452e9fae 100644 --- a/dell/inspiron/5515/default.nix +++ b/dell/inspiron/5515/default.nix @@ -16,7 +16,10 @@ serviceConfig.Type = "oneshot"; description = "reload touchpad driver"; # must run at boot (and not too early), and after suspend - wantedBy = [ "display-manager.service" "post-resume.target" ]; + wantedBy = [ + "display-manager.service" + "post-resume.target" + ]; # prevent running before suspend after = [ "post-resume.target" ]; }; @@ -24,7 +27,6 @@ # so that post-resume.service exists powerManagement.enable = true; - # fix suspend # https://bbs.archlinux.org/viewtopic.php?id=266108 says linux >= 5.12 required boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") pkgs.linuxPackages_latest; diff --git a/dell/inspiron/7405/default.nix b/dell/inspiron/7405/default.nix index d894e179..8068e8eb 100644 --- a/dell/inspiron/7405/default.nix +++ b/dell/inspiron/7405/default.nix @@ -11,7 +11,10 @@ with lib; ]; # TSC is unstable - boot.kernelParams = [ "notsc" "trace_clock=local" ]; + boot.kernelParams = [ + "notsc" + "trace_clock=local" + ]; hardware.enableRedistributableFirmware = mkDefault true; } diff --git a/dell/inspiron/7559/default.nix b/dell/inspiron/7559/default.nix index da837ba2..d742d249 100644 --- a/dell/inspiron/7559/default.nix +++ b/dell/inspiron/7559/default.nix @@ -17,7 +17,7 @@ enableRedistributableFirmware = lib.mkDefault true; }; - + services = { thermald.enable = lib.mkDefault true; }; diff --git a/dell/latitude/5490/default.nix b/dell/latitude/5490/default.nix index 2cde4ad0..9790967c 100644 --- a/dell/latitude/5490/default.nix +++ b/dell/latitude/5490/default.nix @@ -12,10 +12,13 @@ boot = { # Kernel Panic on suspend fix, taken from ArchLinux wiki. - kernelParams = [ "acpi_enforce_resources=lax" "i915.enable_dc=0" ]; + kernelParams = [ + "acpi_enforce_resources=lax" + "i915.enable_dc=0" + ]; # Audio Mute LED extraModprobeConfig = '' - options snd-hda-intel model=mute-led-gpio + options snd-hda-intel model=mute-led-gpio ''; }; } diff --git a/dell/precision/5490/default.nix b/dell/precision/5490/default.nix index b2cbabe4..d3619547 100644 --- a/dell/precision/5490/default.nix +++ b/dell/precision/5490/default.nix @@ -4,7 +4,9 @@ ../../../common/gpu/nvidia/ada-lovelace ]; - boot.kernelParams = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.7") [ "i915.force_probe=7d55" ]; + boot.kernelParams = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.7") [ + "i915.force_probe=7d55" + ]; hardware.nvidia.prime = { intelBusId = "PCI:0:2:0"; diff --git a/dell/precision/5530/default.nix b/dell/precision/5530/default.nix index 1b7007af..38390c8d 100644 --- a/dell/precision/5530/default.nix +++ b/dell/precision/5530/default.nix @@ -39,7 +39,7 @@ }; services = { fwupd.enable = lib.mkDefault true; - # This will save you money and possibly your life! + # This will save you money and possibly your life! thermald.enable = lib.mkDefault true; }; } diff --git a/dell/precision/7520/default.nix b/dell/precision/7520/default.nix index 567aa382..4742afb3 100644 --- a/dell/precision/7520/default.nix +++ b/dell/precision/7520/default.nix @@ -2,7 +2,8 @@ config, lib, ... -}: { +}: +{ imports = [ ../../../common/cpu/intel/kaby-lake ../../../common/pc/laptop @@ -11,13 +12,19 @@ ]; hardware.enableRedistributableFirmware = lib.mkDefault true; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; boot = { - kernelModules = ["kvm-intel"]; - blacklistedKernelModules = ["nouveau"]; + kernelModules = [ "kvm-intel" ]; + blacklistedKernelModules = [ "nouveau" ]; }; - boot.kernelParams = ["i915.modeset=1"]; + boot.kernelParams = [ "i915.modeset=1" ]; hardware = { graphics = { diff --git a/dell/xps/13-9300/default.nix b/dell/xps/13-9300/default.nix index 53828cfa..046fde85 100644 --- a/dell/xps/13-9300/default.nix +++ b/dell/xps/13-9300/default.nix @@ -3,7 +3,8 @@ let inherit (lib) mkDefault; -in { +in +{ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index d5fcdc62..0f10b25f 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -1,16 +1,18 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop ../../../common/pc/ssd ]; - # Includes the Wi-Fi and Bluetooth firmware for the QCA6390. hardware.enableRedistributableFirmware = true; # Requires at least 5.12 for working wi-fi and bluetooth. - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # Touchpad goes over i2c. # Without this we get errors in dmesg on boot and hangs when shutting down. diff --git a/dell/xps/13-9315/default.nix b/dell/xps/13-9315/default.nix index 92ec28ce..c2a696b3 100644 --- a/dell/xps/13-9315/default.nix +++ b/dell/xps/13-9315/default.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop @@ -14,7 +15,7 @@ hardware.enableRedistributableFirmware = true; # touchpad uses I²C, so PS/2 is unnecessary - boot.blacklistedKernelModules = ["psmouse"]; + boot.blacklistedKernelModules = [ "psmouse" ]; # enable finger print sensor # configure with `sudo fprintd-enroll ` @@ -29,5 +30,5 @@ services.thermald.enable = lib.mkDefault true; # fix laptop's screen flickering, see https://wiki.archlinux.org/title/Intel_graphics#Screen_flickering - boot.kernelParams = ["i915.enable_psr=0"]; + boot.kernelParams = [ "i915.enable_psr=0" ]; } diff --git a/dell/xps/13-9333/default.nix b/dell/xps/13-9333/default.nix index a17c094d..c848e808 100644 --- a/dell/xps/13-9333/default.nix +++ b/dell/xps/13-9333/default.nix @@ -7,6 +7,9 @@ # Required to allow the touchpad to work boot.kernelParams = [ "i8042.nopnp=1" ]; - boot.blacklistedKernelModules = [ "i2c_hid" "i2c_hid_acpi" ]; - boot.kernelModules = [ "synaptics_i2c"]; + boot.blacklistedKernelModules = [ + "i2c_hid" + "i2c_hid_acpi" + ]; + boot.kernelModules = [ "synaptics_i2c" ]; } diff --git a/dell/xps/13-9343/default.nix b/dell/xps/13-9343/default.nix index 9cab0427..e98bb09b 100644 --- a/dell/xps/13-9343/default.nix +++ b/dell/xps/13-9343/default.nix @@ -14,7 +14,10 @@ boot = { # needs to be explicitly loaded or else bluetooth/wifi won't work - kernelModules = [ "kvm-intel" "wl" ]; + kernelModules = [ + "kvm-intel" + "wl" + ]; extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; }; } diff --git a/dell/xps/15-7590/nvidia/default.nix b/dell/xps/15-7590/nvidia/default.nix index 78da989d..dc80a2a3 100644 --- a/dell/xps/15-7590/nvidia/default.nix +++ b/dell/xps/15-7590/nvidia/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: +{ lib, ... }: { imports = [ ../. diff --git a/dell/xps/15-9510/default.nix b/dell/xps/15-9510/default.nix index 12a64450..14779f0f 100644 --- a/dell/xps/15-9510/default.nix +++ b/dell/xps/15-9510/default.nix @@ -1,4 +1,5 @@ -{ lib, ... }: { +{ lib, ... }: +{ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop diff --git a/dell/xps/15-9510/nvidia/default.nix b/dell/xps/15-9510/nvidia/default.nix index 6ca0fd5a..248738a4 100644 --- a/dell/xps/15-9510/nvidia/default.nix +++ b/dell/xps/15-9510/nvidia/default.nix @@ -1,4 +1,5 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../../../../common/gpu/nvidia/prime.nix ../../../../common/gpu/nvidia/ampere @@ -11,7 +12,10 @@ graphics = { enable = lib.mkDefault true; enable32Bit = lib.mkDefault true; - extraPackages = with pkgs; [ intel-media-driver intel-compute-runtime ]; + extraPackages = with pkgs; [ + intel-media-driver + intel-compute-runtime + ]; }; nvidia = { prime = { diff --git a/dell/xps/15-9530/default.nix b/dell/xps/15-9530/default.nix index 99fd8a71..eb7a184b 100644 --- a/dell/xps/15-9530/default.nix +++ b/dell/xps/15-9530/default.nix @@ -14,7 +14,7 @@ # - 00:14.3 Network controller: Intel Corporation Raptor Lake PCH CNVi WiFi (rev 01) # > sudo lspci -vv -s 00:14.3 # 00:14.3 Network controller: Intel Corporation Raptor Lake PCH CNVi WiFi (rev 01) - # Subsystem: Intel Corporation Wi-Fi 6E AX211 160MHz + # Subsystem: Intel Corporation Wi-Fi 6E AX211 160MHz # # WiFi speed is slow and crashes by default (https://bugzilla.kernel.org/show_bug.cgi?id=213381) # disable_11ax - required until ax driver support is fixed diff --git a/dell/xps/15-9560/default.nix b/dell/xps/15-9560/default.nix index bae517d8..a5ffff66 100644 --- a/dell/xps/15-9560/default.nix +++ b/dell/xps/15-9560/default.nix @@ -12,10 +12,10 @@ hardware.nvidia.modesetting.enable = true; hardware.nvidia.prime = { - # integrated + # integrated intelBusId = "PCI:0:2:0"; - # dedicated + # dedicated nvidiaBusId = "PCI:1:0:0"; }; } diff --git a/dell/xps/15-9560/nvidia/default.nix b/dell/xps/15-9560/nvidia/default.nix index 8026a227..46b122b8 100644 --- a/dell/xps/15-9560/nvidia/default.nix +++ b/dell/xps/15-9560/nvidia/default.nix @@ -9,7 +9,6 @@ ../../../../common/gpu/nvidia/pascal ]; - # This runs only nvidia, great for games or heavy use of render applications ##### disable intel, run nvidia only and as default diff --git a/dell/xps/15-9570/nvidia/default.nix b/dell/xps/15-9570/nvidia/default.nix index 7cbb908a..ce1c8e04 100644 --- a/dell/xps/15-9570/nvidia/default.nix +++ b/dell/xps/15-9570/nvidia/default.nix @@ -6,7 +6,6 @@ ../shared.nix ]; - # This runs only nvidia, great for games or heavy use of render applications ##### disable intel, run nvidia only and as default diff --git a/dell/xps/15-9570/shared.nix b/dell/xps/15-9570/shared.nix index 06701e75..dcf9191b 100644 --- a/dell/xps/15-9570/shared.nix +++ b/dell/xps/15-9570/shared.nix @@ -1,7 +1,7 @@ { lib, ... }: { - imports = [ + imports = [ ../../../common/cpu/intel/coffee-lake ../../../common/pc/laptop ]; diff --git a/dell/xps/17-9700/common.nix b/dell/xps/17-9700/common.nix index 04241061..cb130350 100644 --- a/dell/xps/17-9700/common.nix +++ b/dell/xps/17-9700/common.nix @@ -10,17 +10,17 @@ # This will save you money and possibly your life! services.thermald.enable = lib.mkDefault true; - boot.kernelPatches = [{ - name = "enable-soundwire-drivers"; - patch = null; - extraConfig = '' - SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES y - SND_SOC_INTEL_SOUNDWIRE_SOF_MACH m - SND_SOC_RT1308 m - ''; - }]; + boot.kernelPatches = [ + { + name = "enable-soundwire-drivers"; + patch = null; + extraConfig = '' + SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES y + SND_SOC_INTEL_SOUNDWIRE_SOF_MACH m + SND_SOC_RT1308 m + ''; + } + ]; - boot.kernelPackages = - lib.mkIf (lib.versionOlder pkgs.linux.version "5.11") - pkgs.linuxPackages_latest; + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.11") pkgs.linuxPackages_latest; } diff --git a/dell/xps/17-9710/intel/default.nix b/dell/xps/17-9710/intel/default.nix index b07c6095..3224b51a 100644 --- a/dell/xps/17-9710/intel/default.nix +++ b/dell/xps/17-9710/intel/default.nix @@ -1,4 +1,5 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../../../../common/cpu/intel ../../../../common/pc/laptop @@ -9,5 +10,7 @@ hardware.enableRedistributableFirmware = true; # Requires at least 5.12 for working sound - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/dell/xps/sleep-resume/bluetooth/default.nix b/dell/xps/sleep-resume/bluetooth/default.nix index e23e9c66..31731a1c 100644 --- a/dell/xps/sleep-resume/bluetooth/default.nix +++ b/dell/xps/sleep-resume/bluetooth/default.nix @@ -1,4 +1,9 @@ -{config, lib, pkgs, ...}: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkIf mkOption types; @@ -23,7 +28,8 @@ let }; cfg = config.services.sleep-resume.bluetooth; -in { +in +{ options = { services.sleep-resume.bluetooth = { enable = mkOption { diff --git a/dell/xps/sleep-resume/i2c-designware/default.nix b/dell/xps/sleep-resume/i2c-designware/default.nix index 55be5494..418abfb2 100644 --- a/dell/xps/sleep-resume/i2c-designware/default.nix +++ b/dell/xps/sleep-resume/i2c-designware/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkIf mkOption types; @@ -22,7 +27,8 @@ let }; cfg = config.services.sleep-resume.i2c-designware; -in { +in +{ options = { services.sleep-resume.i2c-designware = { enable = mkOption { @@ -37,6 +43,3 @@ in { powerManagement.resumeCommands = "${reloadDesignware}/bin/reload-i2c-designware.sh"; }; } - - - diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..0477b1ca --- /dev/null +++ b/flake.lock @@ -0,0 +1,62 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1748995760, + "narHash": "sha256-f6UIyqm6JZs45pG667YdHOFYgDt+gvxQvt32ZLBp1h4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "26a54a5886c238b5df6f1e9ba0aa713434d73f06", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1747958103, + "narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "fe51d34885f7b5e3e7b59572796e1bcb427eccb1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1748243702, + "narHash": "sha256-9YzfeN8CB6SzNPyPm2XjRRqSixDopTapaRsnTpXUEY8=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "1f3f7b784643d488ba4bf315638b2b0a4c5fb007", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index f7481983..4b2d832f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,391 +1,417 @@ { description = "nixos-hardware"; - outputs = _: { - nixosModules = - let - deprecated = - issue: name: value: - builtins.trace "warning: ${name} flake output is deprecated and will be removed. See https://github.com/NixOS/nixos-hardware/issues/${issue} for more information" value; - import = path: path; # let the module system know what we are exporting - in - { - acer-aspire-4810t = import ./acer/aspire/4810t; - airis-n990 = import ./airis/n990; - aoostar-r1-n100 = import ./aoostar/r1/n100; - apple-imac-14-2 = import ./apple/imac/14-2; - apple-imac-18-2 = import ./apple/imac/18-2; - apple-macbook-air-3 = import ./apple/macbook-air/3; - apple-macbook-air-4 = import ./apple/macbook-air/4; - apple-macbook-air-6 = import ./apple/macbook-air/6; - apple-macbook-air-7 = import ./apple/macbook-air/7; - apple-macbook-pro = import ./apple/macbook-pro; - apple-macbook-pro-8-1 = import ./apple/macbook-pro/8-1; - apple-macbook-pro-10-1 = import ./apple/macbook-pro/10-1; - apple-macbook-pro-11-1 = import ./apple/macbook-pro/11-1; - apple-macbook-pro-11-5 = import ./apple/macbook-pro/11-5; - apple-macbook-pro-12-1 = import ./apple/macbook-pro/12-1; - apple-macbook-pro-14-1 = import ./apple/macbook-pro/14-1; - apple-macmini-4-1 = import ./apple/macmini/4; - apple-t2 = import ./apple/t2; - asus-battery = import ./asus/battery.nix; - asus-ally-rc71l = import ./asus/ally/rc71l; - asus-fx504gd = import ./asus/fx504gd; - asus-fx506hm = import ./asus/fx506hm; - asus-fa506ic = import ./asus/fa506ic; - asus-fa507nv = import ./asus/fa507nv; - asus-fa507rm = import ./asus/fa507rm; - asus-flow-gv302x-amdgpu = import ./asus/flow/gv302x/amdgpu; - asus-flow-gv302x-nvidia = import ./asus/flow/gv302x/nvidia; - asus-pro-ws-x570-ace = import ./asus/pro-ws-x570-ace; - asus-rog-strix-g513im = import ./asus/rog-strix/g513im; - asus-rog-strix-g533zw = import ./asus/rog-strix/g533zw; - asus-rog-strix-g713ie = import ./asus/rog-strix/g713ie; - asus-rog-strix-g733qs = import ./asus/rog-strix/g733qs; - asus-rog-strix-x570e = import ./asus/rog-strix/x570e; - asus-zenbook-ux371 = import ./asus/zenbook/ux371; - asus-zenbook-ux535 = import ./asus/zenbook/ux535; - asus-zenbook-ux481-intelgpu = import ./asus/zenbook/ux481/intelgpu; - asus-zenbook-ux481-nvidia = import ./asus/zenbook/ux481/nvidia; - asus-zephyrus-ga401 = import ./asus/zephyrus/ga401; - asus-zephyrus-ga402 = import ./asus/zephyrus/ga402; - asus-zephyrus-ga402x = import ./asus/zephyrus/ga402x; - asus-zephyrus-ga402x-amdgpu = import ./asus/zephyrus/ga402x/amdgpu; - asus-zephyrus-ga402x-nvidia = import ./asus/zephyrus/ga402x/nvidia; - asus-zephyrus-ga502 = import ./asus/zephyrus/ga502; - asus-zephyrus-ga503 = import ./asus/zephyrus/ga503; - asus-zephyrus-gu603h = import ./asus/zephyrus/gu603h; - asus-zephyrus-gu605my = import ./asus/zephyrus/gu605my; - beagleboard-pocketbeagle = import ./beagleboard/pocketbeagle; - chuwi-minibook-x = import ./chuwi/minibook-x; - deciso-dec = import ./deciso/dec; - dell-e7240 = - deprecated "1326" "dell-e7240" - (import ./dell/e7240); - dell-g3-3779 = import ./dell/g3/3779; - dell-g3-3579 = import ./dell/g3/3579; - dell-inspiron-14-5420 = import ./dell/inspiron/14-5420; - dell-inspiron-5509 = import ./dell/inspiron/5509; - dell-inspiron-5515 = import ./dell/inspiron/5515; - dell-inspiron-7405 = import ./dell/inspiron/7405; - dell-inspiron-7460 = import ./dell/inspiron/7460; - dell-inspiron-7559 = import ./dell/inspiron/7559; - dell-latitude-3340 = import ./dell/latitude/3340; - dell-latitude-3480 = import ./dell/latitude/3480; - dell-latitude-5490 = import ./dell/latitude/5490; - dell-latitude-5520 = import ./dell/latitude/5520; - dell-latitude-7280 = import ./dell/latitude/7280; - dell-latitude-7390 = import ./dell/latitude/7390; - dell-latitude-7420 = import ./dell/latitude/7420; - dell-latitude-7430 = import ./dell/latitude/7430; - dell-latitude-7490 = import ./dell/latitude/7490; - dell-latitude-9430 = import ./dell/latitude/9430; - dell-latitude-e7240 = import ./dell/latitude/e7240; - dell-optiplex-3050 = import ./dell/optiplex/3050; - dell-poweredge-r7515 = import ./dell/poweredge/r7515; - dell-precision-3490 = import ./dell/precision/3490; - dell-precision-3541 = import ./dell/precision/3541; - dell-precision-5490 = import ./dell/precision/5490; - dell-precision-5530 = import ./dell/precision/5530; - dell-precision-5560 = import ./dell/precision/5560; - dell-precision-7520 = import ./dell/precision/7520; - dell-xps-13-7390 = import ./dell/xps/13-7390; - dell-xps-13-9300 = import ./dell/xps/13-9300; - dell-xps-13-9310 = import ./dell/xps/13-9310; - dell-xps-13-9315 = import ./dell/xps/13-9315; - dell-xps-13-9333 = import ./dell/xps/13-9333; - dell-xps-13-9343 = import ./dell/xps/13-9343; - dell-xps-13-9350 = import ./dell/xps/13-9350; - dell-xps-13-9360 = import ./dell/xps/13-9360; - dell-xps-13-9370 = import ./dell/xps/13-9370; - dell-xps-13-9380 = import ./dell/xps/13-9380; - dell-xps-15-7590 = import ./dell/xps/15-7590; - dell-xps-15-7590-nvidia = import ./dell/xps/15-7590/nvidia; - dell-xps-15-9500 = import ./dell/xps/15-9500; - dell-xps-15-9500-nvidia = import ./dell/xps/15-9500/nvidia; - dell-xps-15-9510 = import ./dell/xps/15-9510; - dell-xps-15-9510-nvidia = import ./dell/xps/15-9510/nvidia; - dell-xps-15-9520 = import ./dell/xps/15-9520; - dell-xps-15-9520-nvidia = import ./dell/xps/15-9520/nvidia; - dell-xps-15-9530 = import ./dell/xps/15-9530; - dell-xps-15-9530-nvidia = import ./dell/xps/15-9530/nvidia; - dell-xps-15-9550 = import ./dell/xps/15-9550; - dell-xps-15-9550-nvidia = import ./dell/xps/15-9550/nvidia; - dell-xps-15-9560 = import ./dell/xps/15-9560; - dell-xps-15-9560-intel = import ./dell/xps/15-9560/intel; - dell-xps-15-9560-nvidia = import ./dell/xps/15-9560/nvidia; - dell-xps-15-9570 = import ./dell/xps/15-9570; - dell-xps-15-9570-intel = import ./dell/xps/15-9570/intel; - dell-xps-15-9570-nvidia = import ./dell/xps/15-9570/nvidia; - dell-xps-17-9700-intel = import ./dell/xps/17-9700/intel; - dell-xps-17-9700-nvidia = import ./dell/xps/17-9700/nvidia; - dell-xps-17-9710-intel = import ./dell/xps/17-9710/intel; - framework = import ./framework; - framework-11th-gen-intel = import ./framework/13-inch/11th-gen-intel; - framework-12th-gen-intel = import ./framework/13-inch/12th-gen-intel; - framework-13th-gen-intel = import ./framework/13-inch/13th-gen-intel; - framework-12-13th-gen-intel = import ./framework/12-inch/13th-gen-intel; - framework-intel-core-ultra-series1 = import ./framework/13-inch/intel-core-ultra-series1; - framework-13-7040-amd = import ./framework/13-inch/7040-amd; - framework-amd-ai-300-series = import ./framework/13-inch/amd-ai-300-series; - framework-16-7040-amd = import ./framework/16-inch/7040-amd; - friendlyarm-nanopc-t4 = import ./friendlyarm/nanopc-t4; - friendlyarm-nanopi-r5s = import ./friendlyarm/nanopi-r5s; - focus-m2-gen1 = import ./focus/m2/gen1; - gigabyte-b550 = import ./gigabyte/b550; - gigabyte-b650 = import ./gigabyte/b650; - gmktec-nucbox-g3-plus = import ./gmktec/nucbox/g3-plus; - google-pixelbook = import ./google/pixelbook; - gpd-micropc = import ./gpd/micropc; - gpd-p2-max = import ./gpd/p2-max; - gpd-pocket-3 = import ./gpd/pocket-3; - gpd-pocket-4 = import ./gpd/pocket-4; - gpd-win-2 = import ./gpd/win-2; - gpd-win-max-2-2023 = import ./gpd/win-max-2/2023; - gpd-win-mini-2024 = import ./gpd/win-mini/2024; - hp-elitebook-2560p = import ./hp/elitebook/2560p; - hp-elitebook-830g6 = import ./hp/elitebook/830/g6; - hp-elitebook-845g7 = import ./hp/elitebook/845/g7; - hp-elitebook-845g8 = import ./hp/elitebook/845/g8; - hp-elitebook-845g9 = import ./hp/elitebook/845/g9; - hp-probook-440G5 = import ./hp/probook/440G5; - hp-laptop-14s-dq2024nf = import ./hp/laptop/14s-dq2024nf; - huawei-machc-wa = import ./huawei/machc-wa; - hp-notebook-14-df0023 = import ./hp/notebook/14-df0023; - intel-nuc-8i7beh = import ./intel/nuc/8i7beh; - lenovo-ideacentre-k330 = import ./lenovo/ideacentre/k330; - lenovo-ideapad-14imh9 = import ./lenovo/ideapad/14imh9; - lenovo-ideapad-15alc6 = import ./lenovo/ideapad/15alc6; - lenovo-ideapad-15arh05 = import ./lenovo/ideapad/15arh05; - lenovo-ideapad-15ach6 = import ./lenovo/ideapad/15ach6; - lenovo-ideapad-16ach6 = import ./lenovo/ideapad/16ach6; - lenovo-ideapad-16ahp9 = import ./lenovo/ideapad/16ahp9; - lenovo-ideapad-z510 = import ./lenovo/ideapad/z510; - lenovo-ideapad-slim-5 = import ./lenovo/ideapad/slim-5; - lenovo-ideapad-s145-15api = import ./lenovo/ideapad/s145-15api; - lenovo-legion-15ach6 = import ./lenovo/legion/15ach6; - lenovo-legion-15ach6h = import ./lenovo/legion/15ach6h; - lenovo-legion-15arh05h = import ./lenovo/legion/15arh05h; - lenovo-legion-16ach6h = import ./lenovo/legion/16ach6h; - lenovo-legion-16ach6h-hybrid = import ./lenovo/legion/16ach6h/hybrid; - lenovo-legion-16ach6h-nvidia = import ./lenovo/legion/16ach6h/nvidia; - lenovo-legion-16arh7h-igpu-only = import ./lenovo/legion/16arh7h/igpu-only; - lenovo-legion-16arh7h-hybrid = import ./lenovo/legion/16arh7h/hybrid; - lenovo-legion-16achg6-hybrid = import ./lenovo/legion/16achg6/hybrid; - lenovo-legion-16achg6-nvidia = import ./lenovo/legion/16achg6/nvidia; - lenovo-legion-16aph8 = import ./lenovo/legion/16aph8; - lenovo-legion-16arha7 = import ./lenovo/legion/16arha7; - lenovo-legion-16ithg6 = import ./lenovo/legion/16ithg6; - lenovo-legion-16irx8h = import ./lenovo/legion/16irx8h; - lenovo-legion-16irx9h = import ./lenovo/legion/16irx9h; - lenovo-legion-t526amr5 = import ./lenovo/legion/t526amr5; - lenovo-legion-y530-15ich = import ./lenovo/legion/15ich; - lenovo-thinkpad = import ./lenovo/thinkpad; - lenovo-thinkpad-a475 = import ./lenovo/thinkpad/a475; - lenovo-thinkpad-e14-amd = import ./lenovo/thinkpad/e14/amd; - lenovo-thinkpad-e14-intel = import ./lenovo/thinkpad/e14/intel; - lenovo-thinkpad-e14-intel-gen4 = import ./lenovo/thinkpad/e14/intel/gen4; - lenovo-thinkpad-e14-intel-gen6 = import ./lenovo/thinkpad/e14/intel/gen6; - lenovo-thinkpad-e15-intel = import ./lenovo/thinkpad/e15/intel; - lenovo-thinkpad-e470 = import ./lenovo/thinkpad/e470; - lenovo-thinkpad-e495 = import ./lenovo/thinkpad/e495; - lenovo-thinkpad-l13 = import ./lenovo/thinkpad/l13; - lenovo-thinkpad-l13-yoga = import ./lenovo/thinkpad/l13/yoga; - lenovo-thinkpad-l14-amd = import ./lenovo/thinkpad/l14/amd; - lenovo-thinkpad-l14-intel = import ./lenovo/thinkpad/l14/intel; - lenovo-thinkpad-l480 = import ./lenovo/thinkpad/l480; - lenovo-thinkpad-p1 = import ./lenovo/thinkpad/p1; - lenovo-thinkpad-p1-gen3 = import ./lenovo/thinkpad/p1/3th-gen; - lenovo-thinkpad-p14s-amd-gen1 = import ./lenovo/thinkpad/p14s/amd/gen1; - lenovo-thinkpad-p14s-amd-gen2 = import ./lenovo/thinkpad/p14s/amd/gen2; - lenovo-thinkpad-p14s-amd-gen3 = import ./lenovo/thinkpad/p14s/amd/gen3; - lenovo-thinkpad-p14s-amd-gen4 = import ./lenovo/thinkpad/p14s/amd/gen4; - lenovo-thinkpad-p14s-amd-gen5 = import ./lenovo/thinkpad/p14s/amd/gen5; - lenovo-thinkpad-p14s-intel-gen3 = import ./lenovo/thinkpad/p14s/intel/gen3; - lenovo-thinkpad-p14s-intel-gen5 = import ./lenovo/thinkpad/p14s/intel/gen5; - lenovo-thinkpad-p16s-amd-gen1 = import ./lenovo/thinkpad/p16s/amd/gen1; - lenovo-thinkpad-p16s-amd-gen2 = import ./lenovo/thinkpad/p16s/amd/gen2; - lenovo-thinkpad-p16s-intel-gen2 = import ./lenovo/thinkpad/p16s/intel/gen2; - lenovo-thinkpad-p43s = import ./lenovo/thinkpad/p43s; - lenovo-thinkpad-p50 = import ./lenovo/thinkpad/p50; - lenovo-thinkpad-p51 = import ./lenovo/thinkpad/p51; - lenovo-thinkpad-p52 = import ./lenovo/thinkpad/p52; - lenovo-thinkpad-p53 = import ./lenovo/thinkpad/p53; - lenovo-thinkpad-t14 = import ./lenovo/thinkpad/t14; - lenovo-thinkpad-t14-amd-gen1 = import ./lenovo/thinkpad/t14/amd/gen1; - lenovo-thinkpad-t14-amd-gen2 = import ./lenovo/thinkpad/t14/amd/gen2; - lenovo-thinkpad-t14-amd-gen3 = import ./lenovo/thinkpad/t14/amd/gen3; - lenovo-thinkpad-t14-amd-gen4 = import ./lenovo/thinkpad/t14/amd/gen4; - lenovo-thinkpad-t14-amd-gen5 = import ./lenovo/thinkpad/t14/amd/gen5; - lenovo-thinkpad-t14s = import ./lenovo/thinkpad/t14s; - lenovo-thinkpad-t14s-amd-gen1 = import ./lenovo/thinkpad/t14s/amd/gen1; - lenovo-thinkpad-t14s-amd-gen4 = import ./lenovo/thinkpad/t14s/amd/gen4; - lenovo-thinkpad-t410 = import ./lenovo/thinkpad/t410; - lenovo-thinkpad-t420 = import ./lenovo/thinkpad/t420; - lenovo-thinkpad-t430 = import ./lenovo/thinkpad/t430; - lenovo-thinkpad-t440p = import ./lenovo/thinkpad/t440p; - lenovo-thinkpad-t440s = import ./lenovo/thinkpad/t440s; - lenovo-thinkpad-t450s = import ./lenovo/thinkpad/t450s; - lenovo-thinkpad-t460 = import ./lenovo/thinkpad/t460; - lenovo-thinkpad-t460p = import ./lenovo/thinkpad/t460p; - lenovo-thinkpad-t460s = import ./lenovo/thinkpad/t460s; - lenovo-thinkpad-t470s = import ./lenovo/thinkpad/t470s; - lenovo-thinkpad-t480 = import ./lenovo/thinkpad/t480; - lenovo-thinkpad-t480s = import ./lenovo/thinkpad/t480s; - lenovo-thinkpad-t490 = import ./lenovo/thinkpad/t490; - lenovo-thinkpad-t490s = import ./lenovo/thinkpad/t490s; - lenovo-thinkpad-t495 = import ./lenovo/thinkpad/t495; - lenovo-thinkpad-t520 = import ./lenovo/thinkpad/t520; - lenovo-thinkpad-w520 = import ./lenovo/thinkpad/w520; - lenovo-thinkpad-t550 = import ./lenovo/thinkpad/t550; - lenovo-thinkpad-t590 = import ./lenovo/thinkpad/t590; - lenovo-thinkpad-x1 = import ./lenovo/thinkpad/x1; - lenovo-thinkpad-x1-yoga = import ./lenovo/thinkpad/x1/yoga; - lenovo-thinkpad-x1-yoga-7th-gen = import ./lenovo/thinkpad/x1/yoga/7th-gen; - lenovo-thinkpad-x1-yoga-8th-gen = import ./lenovo/thinkpad/x1/yoga/8th-gen; - lenovo-thinkpad-x1-2nd-gen = import ./lenovo/thinkpad/x1/2nd-gen; - lenovo-thinkpad-x1-6th-gen = import ./lenovo/thinkpad/x1/6th-gen; - lenovo-thinkpad-x1-7th-gen = import ./lenovo/thinkpad/x1/7th-gen; - lenovo-thinkpad-x1-9th-gen = import ./lenovo/thinkpad/x1/9th-gen; - lenovo-thinkpad-x1-10th-gen = import ./lenovo/thinkpad/x1/10th-gen; - lenovo-thinkpad-x1-11th-gen = import ./lenovo/thinkpad/x1/11th-gen; - lenovo-thinkpad-x1-12th-gen = import ./lenovo/thinkpad/x1/12th-gen; - lenovo-thinkpad-x1-13th-gen = import ./lenovo/thinkpad/x1/13th-gen; - lenovo-thinkpad-x1-extreme = import ./lenovo/thinkpad/x1-extreme; - lenovo-thinkpad-x1-extreme-gen2 = import ./lenovo/thinkpad/x1-extreme/gen2; - lenovo-thinkpad-x1-extreme-gen3 = import ./lenovo/thinkpad/x1-extreme/gen3; - lenovo-thinkpad-x1-extreme-gen4 = import ./lenovo/thinkpad/x1-extreme/gen4; - lenovo-thinkpad-x1-nano = import ./lenovo/thinkpad/x1-nano; - lenovo-thinkpad-x1-nano-gen1 = import ./lenovo/thinkpad/x1-nano/gen1; - lenovo-thinkpad-x13 = import ./lenovo/thinkpad/x13/intel; - lenovo-thinkpad-x13-amd = import ./lenovo/thinkpad/x13/amd; - lenovo-thinkpad-x13-yoga = import ./lenovo/thinkpad/x13/yoga; - lenovo-thinkpad-x13-yoga-3th-gen = import ./lenovo/thinkpad/x13/yoga/3th-gen; - lenovo-thinkpad-x13s = import ./lenovo/thinkpad/x13s; - lenovo-thinkpad-x140e = import ./lenovo/thinkpad/x140e; - lenovo-thinkpad-x200s = import ./lenovo/thinkpad/x200s; - lenovo-thinkpad-x220 = import ./lenovo/thinkpad/x220; - lenovo-thinkpad-x230 = import ./lenovo/thinkpad/x230; - lenovo-thinkpad-x250 = import ./lenovo/thinkpad/x250; - lenovo-thinkpad-x260 = import ./lenovo/thinkpad/x260; - lenovo-thinkpad-x270 = import ./lenovo/thinkpad/x270; - lenovo-thinkpad-x280 = import ./lenovo/thinkpad/x280; - lenovo-thinkpad-x390 = import ./lenovo/thinkpad/x390; - lenovo-thinkpad-z = import ./lenovo/thinkpad/z; - lenovo-thinkpad-z13-gen1 = import ./lenovo/thinkpad/z/gen1/z13; - lenovo-thinkpad-z13-gen2 = import ./lenovo/thinkpad/z/gen2/z13; - lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; - lenovo-yoga-7-14ARH7 = import ./lenovo/yoga/7/14ARH7; - lenovo-yoga-7-14ARH7-amdgpu = import ./lenovo/yoga/7/14ARH7/amdgpu; - lenovo-yoga-7-14ARH7-nvidia = import ./lenovo/yoga/7/14ARH7/nvidia; - lenovo-yoga-7-14IAH7-integrated = import ./lenovo/yoga/7/14IAH7/integrated; - lenovo-yoga-7-14IAH7-hybrid = import ./lenovo/yoga/7/14IAH7/hybrid; - lenovo-yoga-7-14ILL10 = import ./lenovo/yoga/7/14ILL10; - lenovo-yoga-7-slim-gen8 = import ./lenovo/yoga/7/slim/gen8; - letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; - malibal-aon-s1-intel = import ./malibal/aon/s1; - microchip-icicle-kit = import ./microchip/icicle-kit; - microsoft-surface-go = import ./microsoft/surface/surface-go; - microsoft-surface-pro-intel = import ./microsoft/surface/surface-pro-intel; - microsoft-surface-laptop-amd = import ./microsoft/surface/surface-laptop-amd; - microsoft-surface-common = import ./microsoft/surface/common; - microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; - microsoft-surface-pro-9 = import ./microsoft/surface-pro/9; - milkv-pioneer = import ./milkv/pioneer; - minisforum-v3 = import ./minisforum/v3; - morefine-m600 = import ./morefine/m600; - msi-b350-tomahawk = import ./msi/b350-tomahawk; - msi-b550-a-pro = import ./msi/b550-a-pro; - msi-gs60 = import ./msi/gs60; - msi-gl62 = import ./msi/gl62; - msi-gl65-10SDR-492 = import ./msi/gl65/10SDR-492; - nxp-imx8mp-evk = import ./nxp/imx8mp-evk; - nxp-imx8mq-evk = import ./nxp/imx8mq-evk; - nxp-imx8qm-mek = import ./nxp/imx8qm-mek; - hardkernel-odroid-hc4 = import ./hardkernel/odroid-hc4; - hardkernel-odroid-h3 = import ./hardkernel/odroid-h3; - hardkernel-odroid-h4 = import ./hardkernel/odroid-h4; - omen-14-fb0798ng = import ./omen/14-fb0798ng; - omen-15-ce002ns = import ./omen/15-ce002ns; - omen-15-en0010ca = import ./omen/15-en0010ca; - omen-16-n0005ne = import ./omen/16-n0005ne; - omen-16-n0280nd = import ./omen/16-n0280nd; - omen-15-en1007sa = import ./omen/15-en1007sa; - omen-15-en0002np = import ./omen/15-en0002np; - onenetbook-4 = import ./onenetbook/4; - olimex-teres_i = import ./olimex/teres_i; - pcengines-apu = import ./pcengines/apu; - pine64-pinebook-pro = import ./pine64/pinebook-pro; - pine64-rockpro64 = import ./pine64/rockpro64; - pine64-star64 = import ./pine64/star64; - protectli-vp4670 = import ./protectli/vp4670; - purism-librem-13v3 = import ./purism/librem/13v3; - purism-librem-15v3 = import ./purism/librem/15v3; - purism-librem-5r4 = import ./purism/librem/5r4; - raspberry-pi-2 = import ./raspberry-pi/2; - raspberry-pi-3 = import ./raspberry-pi/3; - raspberry-pi-4 = import ./raspberry-pi/4; - raspberry-pi-5 = import ./raspberry-pi/5; - rock-4c-plus = import ./radxa/rock-4c-plus; - rock-5b = import ./radxa/rock-5b; - rock-pi-4 = import ./radxa/rock-pi-4; - rock-pi-e = import ./radxa/rock-pi-e; - kobol-helios4 = import ./kobol/helios4; - samsung-np900x3c = import ./samsung/np900x3c; - slimbook-hero-rpl-rtx = import ./slimbook/hero/rpl-rtx; - starfive-visionfive-v1 = import ./starfive/visionfive/v1; - starfive-visionfive-2 = import ./starfive/visionfive/v2; - starlabs-starlite-i5 = import ./starlabs/starlite/i5; - supermicro = import ./supermicro; - supermicro-a1sri-2758f = import ./supermicro/a1sri-2758f; - supermicro-m11sdv-8c-ln4f = import ./supermicro/m11sdv-8c-ln4f; - supermicro-x10sll-f = import ./supermicro/x10sll-f; - supermicro-x12scz-tln4f = import ./supermicro/x12scz-tln4f; - system76 = import ./system76; - system76-gaze18 = import ./system76/gaze18; - system76-galp5-1650 = import ./system76/galp5-1650; - system76-darp6 = import ./system76/darp6; - toshiba-swanky = import ./toshiba/swanky; - tuxedo-aura-15-gen1 = import ./tuxedo/aura/15/gen1; - tuxedo-infinitybook-v4 = import ./tuxedo/infinitybook/v4; - tuxedo-infinitybook-pro14-gen7 = import ./tuxedo/infinitybook/pro14/gen7; - tuxedo-infinitybook-pro14-gen9-intel = import ./tuxedo/infinitybook/pro14/gen9/intel; - tuxedo-pulse-14-gen3 = import ./tuxedo/pulse/14/gen3; - tuxedo-pulse-15-gen2 = import ./tuxedo/pulse/15/gen2; - xiaomi-redmibook-16-pro-2024 = import ./xiaomi/redmibook/16-pro-2024; - - common-cpu-amd = import ./common/cpu/amd; - common-cpu-amd-pstate = import ./common/cpu/amd/pstate.nix; - common-cpu-amd-zenpower = import ./common/cpu/amd/zenpower.nix; - common-cpu-amd-raphael-igpu = import ./common/cpu/amd/raphael/igpu.nix; - common-cpu-intel = import ./common/cpu/intel; - common-gpu-intel-comet-lake = - deprecated "992" "common-gpu-intel-comet-lake" - (import ./common/gpu/intel/comet-lake); - common-cpu-intel-cpu-only = import ./common/cpu/intel/cpu-only.nix; - common-gpu-intel-kaby-lake = - deprecated "992" "common-gpu-intel-kaby-lake" - (import ./common/gpu/intel/kaby-lake); - common-gpu-intel-sandy-bridge = - deprecated "992" "common-gpu-intel-sandy-bridge" - (import ./common/gpu/intel/sandy-bridge); - common-gpu-amd = import ./common/gpu/amd; - common-gpu-amd-sea-islands = import ./common/gpu/amd/sea-islands; - common-gpu-amd-southern-islands = import ./common/gpu/amd/southern-islands; - common-gpu-intel = import ./common/gpu/intel; - common-gpu-intel-disable = import ./common/gpu/intel/disable.nix; - common-gpu-nvidia = import ./common/gpu/nvidia/prime.nix; - common-gpu-nvidia-sync = import ./common/gpu/nvidia/prime-sync.nix; - common-gpu-nvidia-nonprime = import ./common/gpu/nvidia; - common-gpu-nvidia-disable = import ./common/gpu/nvidia/disable.nix; - common-hidpi = import ./common/hidpi.nix; - common-pc = import ./common/pc; - common-pc-hdd = import ./common/pc/hdd; - common-pc-laptop = import ./common/pc/laptop; - common-pc-laptop-acpi_call = throw "common-pc-laptop-acpi_call has been removed because it is obsolete: https://github.com/NixOS/nixos-hardware/issues/1114"; - common-pc-laptop-hdd = import ./common/pc/laptop/hdd; - common-pc-laptop-ssd = import ./common/pc/ssd; - common-pc-ssd = import ./common/pc/ssd; - }; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05-small"; + treefmt-nix.url = "github:numtide/treefmt-nix"; }; + + outputs = + { + nixpkgs, + self, + treefmt-nix, + }: + let + systems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + forEachSystem = + function: nixpkgs.lib.genAttrs (systems) (system: function nixpkgs.legacyPackages.${system}); + + treefmtEval = forEachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix); + in + { + checks = forEachSystem (pkgs: { + formatting = treefmtEval.${pkgs.system}.config.build.check self; + }); + formatter = forEachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper); + + nixosModules = + let + deprecated = + issue: name: value: + builtins.trace "warning: ${name} flake output is deprecated and will be removed. See https://github.com/NixOS/nixos-hardware/issues/${issue} for more information" value; + import = path: path; # let the module system know what we are exporting + in + { + acer-aspire-4810t = import ./acer/aspire/4810t; + airis-n990 = import ./airis/n990; + aoostar-r1-n100 = import ./aoostar/r1/n100; + apple-imac-14-2 = import ./apple/imac/14-2; + apple-imac-18-2 = import ./apple/imac/18-2; + apple-macbook-air-3 = import ./apple/macbook-air/3; + apple-macbook-air-4 = import ./apple/macbook-air/4; + apple-macbook-air-6 = import ./apple/macbook-air/6; + apple-macbook-air-7 = import ./apple/macbook-air/7; + apple-macbook-pro = import ./apple/macbook-pro; + apple-macbook-pro-8-1 = import ./apple/macbook-pro/8-1; + apple-macbook-pro-10-1 = import ./apple/macbook-pro/10-1; + apple-macbook-pro-11-1 = import ./apple/macbook-pro/11-1; + apple-macbook-pro-11-5 = import ./apple/macbook-pro/11-5; + apple-macbook-pro-12-1 = import ./apple/macbook-pro/12-1; + apple-macbook-pro-14-1 = import ./apple/macbook-pro/14-1; + apple-macmini-4-1 = import ./apple/macmini/4; + apple-t2 = import ./apple/t2; + asus-battery = import ./asus/battery.nix; + asus-ally-rc71l = import ./asus/ally/rc71l; + asus-fx504gd = import ./asus/fx504gd; + asus-fx506hm = import ./asus/fx506hm; + asus-fa506ic = import ./asus/fa506ic; + asus-fa507nv = import ./asus/fa507nv; + asus-fa507rm = import ./asus/fa507rm; + asus-flow-gv302x-amdgpu = import ./asus/flow/gv302x/amdgpu; + asus-flow-gv302x-nvidia = import ./asus/flow/gv302x/nvidia; + asus-pro-ws-x570-ace = import ./asus/pro-ws-x570-ace; + asus-rog-strix-g513im = import ./asus/rog-strix/g513im; + asus-rog-strix-g533zw = import ./asus/rog-strix/g533zw; + asus-rog-strix-g713ie = import ./asus/rog-strix/g713ie; + asus-rog-strix-g733qs = import ./asus/rog-strix/g733qs; + asus-rog-strix-x570e = import ./asus/rog-strix/x570e; + asus-zenbook-ux371 = import ./asus/zenbook/ux371; + asus-zenbook-ux535 = import ./asus/zenbook/ux535; + asus-zenbook-ux481-intelgpu = import ./asus/zenbook/ux481/intelgpu; + asus-zenbook-ux481-nvidia = import ./asus/zenbook/ux481/nvidia; + asus-zephyrus-ga401 = import ./asus/zephyrus/ga401; + asus-zephyrus-ga402 = import ./asus/zephyrus/ga402; + asus-zephyrus-ga402x = import ./asus/zephyrus/ga402x; + asus-zephyrus-ga402x-amdgpu = import ./asus/zephyrus/ga402x/amdgpu; + asus-zephyrus-ga402x-nvidia = import ./asus/zephyrus/ga402x/nvidia; + asus-zephyrus-ga502 = import ./asus/zephyrus/ga502; + asus-zephyrus-ga503 = import ./asus/zephyrus/ga503; + asus-zephyrus-gu603h = import ./asus/zephyrus/gu603h; + asus-zephyrus-gu605my = import ./asus/zephyrus/gu605my; + beagleboard-pocketbeagle = import ./beagleboard/pocketbeagle; + chuwi-minibook-x = import ./chuwi/minibook-x; + deciso-dec = import ./deciso/dec; + dell-e7240 = deprecated "1326" "dell-e7240" (import ./dell/e7240); + dell-g3-3779 = import ./dell/g3/3779; + dell-g3-3579 = import ./dell/g3/3579; + dell-inspiron-14-5420 = import ./dell/inspiron/14-5420; + dell-inspiron-5509 = import ./dell/inspiron/5509; + dell-inspiron-5515 = import ./dell/inspiron/5515; + dell-inspiron-7405 = import ./dell/inspiron/7405; + dell-inspiron-7460 = import ./dell/inspiron/7460; + dell-inspiron-7559 = import ./dell/inspiron/7559; + dell-latitude-3340 = import ./dell/latitude/3340; + dell-latitude-3480 = import ./dell/latitude/3480; + dell-latitude-5490 = import ./dell/latitude/5490; + dell-latitude-5520 = import ./dell/latitude/5520; + dell-latitude-7280 = import ./dell/latitude/7280; + dell-latitude-7390 = import ./dell/latitude/7390; + dell-latitude-7420 = import ./dell/latitude/7420; + dell-latitude-7430 = import ./dell/latitude/7430; + dell-latitude-7490 = import ./dell/latitude/7490; + dell-latitude-9430 = import ./dell/latitude/9430; + dell-latitude-e7240 = import ./dell/latitude/e7240; + dell-optiplex-3050 = import ./dell/optiplex/3050; + dell-poweredge-r7515 = import ./dell/poweredge/r7515; + dell-precision-3490 = import ./dell/precision/3490; + dell-precision-3541 = import ./dell/precision/3541; + dell-precision-5490 = import ./dell/precision/5490; + dell-precision-5530 = import ./dell/precision/5530; + dell-precision-5560 = import ./dell/precision/5560; + dell-precision-7520 = import ./dell/precision/7520; + dell-xps-13-7390 = import ./dell/xps/13-7390; + dell-xps-13-9300 = import ./dell/xps/13-9300; + dell-xps-13-9310 = import ./dell/xps/13-9310; + dell-xps-13-9315 = import ./dell/xps/13-9315; + dell-xps-13-9333 = import ./dell/xps/13-9333; + dell-xps-13-9343 = import ./dell/xps/13-9343; + dell-xps-13-9350 = import ./dell/xps/13-9350; + dell-xps-13-9360 = import ./dell/xps/13-9360; + dell-xps-13-9370 = import ./dell/xps/13-9370; + dell-xps-13-9380 = import ./dell/xps/13-9380; + dell-xps-15-7590 = import ./dell/xps/15-7590; + dell-xps-15-7590-nvidia = import ./dell/xps/15-7590/nvidia; + dell-xps-15-9500 = import ./dell/xps/15-9500; + dell-xps-15-9500-nvidia = import ./dell/xps/15-9500/nvidia; + dell-xps-15-9510 = import ./dell/xps/15-9510; + dell-xps-15-9510-nvidia = import ./dell/xps/15-9510/nvidia; + dell-xps-15-9520 = import ./dell/xps/15-9520; + dell-xps-15-9520-nvidia = import ./dell/xps/15-9520/nvidia; + dell-xps-15-9530 = import ./dell/xps/15-9530; + dell-xps-15-9530-nvidia = import ./dell/xps/15-9530/nvidia; + dell-xps-15-9550 = import ./dell/xps/15-9550; + dell-xps-15-9550-nvidia = import ./dell/xps/15-9550/nvidia; + dell-xps-15-9560 = import ./dell/xps/15-9560; + dell-xps-15-9560-intel = import ./dell/xps/15-9560/intel; + dell-xps-15-9560-nvidia = import ./dell/xps/15-9560/nvidia; + dell-xps-15-9570 = import ./dell/xps/15-9570; + dell-xps-15-9570-intel = import ./dell/xps/15-9570/intel; + dell-xps-15-9570-nvidia = import ./dell/xps/15-9570/nvidia; + dell-xps-17-9700-intel = import ./dell/xps/17-9700/intel; + dell-xps-17-9700-nvidia = import ./dell/xps/17-9700/nvidia; + dell-xps-17-9710-intel = import ./dell/xps/17-9710/intel; + framework = import ./framework; + framework-11th-gen-intel = import ./framework/13-inch/11th-gen-intel; + framework-12th-gen-intel = import ./framework/13-inch/12th-gen-intel; + framework-13th-gen-intel = import ./framework/13-inch/13th-gen-intel; + framework-12-13th-gen-intel = import ./framework/12-inch/13th-gen-intel; + framework-intel-core-ultra-series1 = import ./framework/13-inch/intel-core-ultra-series1; + framework-13-7040-amd = import ./framework/13-inch/7040-amd; + framework-amd-ai-300-series = import ./framework/13-inch/amd-ai-300-series; + framework-16-7040-amd = import ./framework/16-inch/7040-amd; + friendlyarm-nanopc-t4 = import ./friendlyarm/nanopc-t4; + friendlyarm-nanopi-r5s = import ./friendlyarm/nanopi-r5s; + focus-m2-gen1 = import ./focus/m2/gen1; + gigabyte-b550 = import ./gigabyte/b550; + gigabyte-b650 = import ./gigabyte/b650; + gmktec-nucbox-g3-plus = import ./gmktec/nucbox/g3-plus; + google-pixelbook = import ./google/pixelbook; + gpd-micropc = import ./gpd/micropc; + gpd-p2-max = import ./gpd/p2-max; + gpd-pocket-3 = import ./gpd/pocket-3; + gpd-pocket-4 = import ./gpd/pocket-4; + gpd-win-2 = import ./gpd/win-2; + gpd-win-max-2-2023 = import ./gpd/win-max-2/2023; + gpd-win-mini-2024 = import ./gpd/win-mini/2024; + hp-elitebook-2560p = import ./hp/elitebook/2560p; + hp-elitebook-830g6 = import ./hp/elitebook/830/g6; + hp-elitebook-845g7 = import ./hp/elitebook/845/g7; + hp-elitebook-845g8 = import ./hp/elitebook/845/g8; + hp-elitebook-845g9 = import ./hp/elitebook/845/g9; + hp-probook-440G5 = import ./hp/probook/440G5; + hp-laptop-14s-dq2024nf = import ./hp/laptop/14s-dq2024nf; + huawei-machc-wa = import ./huawei/machc-wa; + hp-notebook-14-df0023 = import ./hp/notebook/14-df0023; + intel-nuc-8i7beh = import ./intel/nuc/8i7beh; + lenovo-ideacentre-k330 = import ./lenovo/ideacentre/k330; + lenovo-ideapad-14imh9 = import ./lenovo/ideapad/14imh9; + lenovo-ideapad-15alc6 = import ./lenovo/ideapad/15alc6; + lenovo-ideapad-15arh05 = import ./lenovo/ideapad/15arh05; + lenovo-ideapad-15ach6 = import ./lenovo/ideapad/15ach6; + lenovo-ideapad-16ach6 = import ./lenovo/ideapad/16ach6; + lenovo-ideapad-16ahp9 = import ./lenovo/ideapad/16ahp9; + lenovo-ideapad-z510 = import ./lenovo/ideapad/z510; + lenovo-ideapad-slim-5 = import ./lenovo/ideapad/slim-5; + lenovo-ideapad-s145-15api = import ./lenovo/ideapad/s145-15api; + lenovo-legion-15ach6 = import ./lenovo/legion/15ach6; + lenovo-legion-15ach6h = import ./lenovo/legion/15ach6h; + lenovo-legion-15arh05h = import ./lenovo/legion/15arh05h; + lenovo-legion-16ach6h = import ./lenovo/legion/16ach6h; + lenovo-legion-16ach6h-hybrid = import ./lenovo/legion/16ach6h/hybrid; + lenovo-legion-16ach6h-nvidia = import ./lenovo/legion/16ach6h/nvidia; + lenovo-legion-16arh7h-igpu-only = import ./lenovo/legion/16arh7h/igpu-only; + lenovo-legion-16arh7h-hybrid = import ./lenovo/legion/16arh7h/hybrid; + lenovo-legion-16achg6-hybrid = import ./lenovo/legion/16achg6/hybrid; + lenovo-legion-16achg6-nvidia = import ./lenovo/legion/16achg6/nvidia; + lenovo-legion-16aph8 = import ./lenovo/legion/16aph8; + lenovo-legion-16arha7 = import ./lenovo/legion/16arha7; + lenovo-legion-16ithg6 = import ./lenovo/legion/16ithg6; + lenovo-legion-16irx8h = import ./lenovo/legion/16irx8h; + lenovo-legion-16irx9h = import ./lenovo/legion/16irx9h; + lenovo-legion-t526amr5 = import ./lenovo/legion/t526amr5; + lenovo-legion-y530-15ich = import ./lenovo/legion/15ich; + lenovo-thinkpad = import ./lenovo/thinkpad; + lenovo-thinkpad-a475 = import ./lenovo/thinkpad/a475; + lenovo-thinkpad-e14-amd = import ./lenovo/thinkpad/e14/amd; + lenovo-thinkpad-e14-intel = import ./lenovo/thinkpad/e14/intel; + lenovo-thinkpad-e14-intel-gen4 = import ./lenovo/thinkpad/e14/intel/gen4; + lenovo-thinkpad-e14-intel-gen6 = import ./lenovo/thinkpad/e14/intel/gen6; + lenovo-thinkpad-e15-intel = import ./lenovo/thinkpad/e15/intel; + lenovo-thinkpad-e470 = import ./lenovo/thinkpad/e470; + lenovo-thinkpad-e495 = import ./lenovo/thinkpad/e495; + lenovo-thinkpad-l13 = import ./lenovo/thinkpad/l13; + lenovo-thinkpad-l13-yoga = import ./lenovo/thinkpad/l13/yoga; + lenovo-thinkpad-l14-amd = import ./lenovo/thinkpad/l14/amd; + lenovo-thinkpad-l14-intel = import ./lenovo/thinkpad/l14/intel; + lenovo-thinkpad-l480 = import ./lenovo/thinkpad/l480; + lenovo-thinkpad-p1 = import ./lenovo/thinkpad/p1; + lenovo-thinkpad-p1-gen3 = import ./lenovo/thinkpad/p1/3th-gen; + lenovo-thinkpad-p14s-amd-gen1 = import ./lenovo/thinkpad/p14s/amd/gen1; + lenovo-thinkpad-p14s-amd-gen2 = import ./lenovo/thinkpad/p14s/amd/gen2; + lenovo-thinkpad-p14s-amd-gen3 = import ./lenovo/thinkpad/p14s/amd/gen3; + lenovo-thinkpad-p14s-amd-gen4 = import ./lenovo/thinkpad/p14s/amd/gen4; + lenovo-thinkpad-p14s-amd-gen5 = import ./lenovo/thinkpad/p14s/amd/gen5; + lenovo-thinkpad-p14s-intel-gen3 = import ./lenovo/thinkpad/p14s/intel/gen3; + lenovo-thinkpad-p14s-intel-gen5 = import ./lenovo/thinkpad/p14s/intel/gen5; + lenovo-thinkpad-p16s-amd-gen1 = import ./lenovo/thinkpad/p16s/amd/gen1; + lenovo-thinkpad-p16s-amd-gen2 = import ./lenovo/thinkpad/p16s/amd/gen2; + lenovo-thinkpad-p16s-intel-gen2 = import ./lenovo/thinkpad/p16s/intel/gen2; + lenovo-thinkpad-p43s = import ./lenovo/thinkpad/p43s; + lenovo-thinkpad-p50 = import ./lenovo/thinkpad/p50; + lenovo-thinkpad-p51 = import ./lenovo/thinkpad/p51; + lenovo-thinkpad-p52 = import ./lenovo/thinkpad/p52; + lenovo-thinkpad-p53 = import ./lenovo/thinkpad/p53; + lenovo-thinkpad-t14 = import ./lenovo/thinkpad/t14; + lenovo-thinkpad-t14-amd-gen1 = import ./lenovo/thinkpad/t14/amd/gen1; + lenovo-thinkpad-t14-amd-gen2 = import ./lenovo/thinkpad/t14/amd/gen2; + lenovo-thinkpad-t14-amd-gen3 = import ./lenovo/thinkpad/t14/amd/gen3; + lenovo-thinkpad-t14-amd-gen4 = import ./lenovo/thinkpad/t14/amd/gen4; + lenovo-thinkpad-t14-amd-gen5 = import ./lenovo/thinkpad/t14/amd/gen5; + lenovo-thinkpad-t14s = import ./lenovo/thinkpad/t14s; + lenovo-thinkpad-t14s-amd-gen1 = import ./lenovo/thinkpad/t14s/amd/gen1; + lenovo-thinkpad-t14s-amd-gen4 = import ./lenovo/thinkpad/t14s/amd/gen4; + lenovo-thinkpad-t410 = import ./lenovo/thinkpad/t410; + lenovo-thinkpad-t420 = import ./lenovo/thinkpad/t420; + lenovo-thinkpad-t430 = import ./lenovo/thinkpad/t430; + lenovo-thinkpad-t440p = import ./lenovo/thinkpad/t440p; + lenovo-thinkpad-t440s = import ./lenovo/thinkpad/t440s; + lenovo-thinkpad-t450s = import ./lenovo/thinkpad/t450s; + lenovo-thinkpad-t460 = import ./lenovo/thinkpad/t460; + lenovo-thinkpad-t460p = import ./lenovo/thinkpad/t460p; + lenovo-thinkpad-t460s = import ./lenovo/thinkpad/t460s; + lenovo-thinkpad-t470s = import ./lenovo/thinkpad/t470s; + lenovo-thinkpad-t480 = import ./lenovo/thinkpad/t480; + lenovo-thinkpad-t480s = import ./lenovo/thinkpad/t480s; + lenovo-thinkpad-t490 = import ./lenovo/thinkpad/t490; + lenovo-thinkpad-t490s = import ./lenovo/thinkpad/t490s; + lenovo-thinkpad-t495 = import ./lenovo/thinkpad/t495; + lenovo-thinkpad-t520 = import ./lenovo/thinkpad/t520; + lenovo-thinkpad-w520 = import ./lenovo/thinkpad/w520; + lenovo-thinkpad-t550 = import ./lenovo/thinkpad/t550; + lenovo-thinkpad-t590 = import ./lenovo/thinkpad/t590; + lenovo-thinkpad-x1 = import ./lenovo/thinkpad/x1; + lenovo-thinkpad-x1-yoga = import ./lenovo/thinkpad/x1/yoga; + lenovo-thinkpad-x1-yoga-7th-gen = import ./lenovo/thinkpad/x1/yoga/7th-gen; + lenovo-thinkpad-x1-yoga-8th-gen = import ./lenovo/thinkpad/x1/yoga/8th-gen; + lenovo-thinkpad-x1-2nd-gen = import ./lenovo/thinkpad/x1/2nd-gen; + lenovo-thinkpad-x1-6th-gen = import ./lenovo/thinkpad/x1/6th-gen; + lenovo-thinkpad-x1-7th-gen = import ./lenovo/thinkpad/x1/7th-gen; + lenovo-thinkpad-x1-9th-gen = import ./lenovo/thinkpad/x1/9th-gen; + lenovo-thinkpad-x1-10th-gen = import ./lenovo/thinkpad/x1/10th-gen; + lenovo-thinkpad-x1-11th-gen = import ./lenovo/thinkpad/x1/11th-gen; + lenovo-thinkpad-x1-12th-gen = import ./lenovo/thinkpad/x1/12th-gen; + lenovo-thinkpad-x1-13th-gen = import ./lenovo/thinkpad/x1/13th-gen; + lenovo-thinkpad-x1-extreme = import ./lenovo/thinkpad/x1-extreme; + lenovo-thinkpad-x1-extreme-gen2 = import ./lenovo/thinkpad/x1-extreme/gen2; + lenovo-thinkpad-x1-extreme-gen3 = import ./lenovo/thinkpad/x1-extreme/gen3; + lenovo-thinkpad-x1-extreme-gen4 = import ./lenovo/thinkpad/x1-extreme/gen4; + lenovo-thinkpad-x1-nano = import ./lenovo/thinkpad/x1-nano; + lenovo-thinkpad-x1-nano-gen1 = import ./lenovo/thinkpad/x1-nano/gen1; + lenovo-thinkpad-x13 = import ./lenovo/thinkpad/x13/intel; + lenovo-thinkpad-x13-amd = import ./lenovo/thinkpad/x13/amd; + lenovo-thinkpad-x13-yoga = import ./lenovo/thinkpad/x13/yoga; + lenovo-thinkpad-x13-yoga-3th-gen = import ./lenovo/thinkpad/x13/yoga/3th-gen; + lenovo-thinkpad-x13s = import ./lenovo/thinkpad/x13s; + lenovo-thinkpad-x140e = import ./lenovo/thinkpad/x140e; + lenovo-thinkpad-x200s = import ./lenovo/thinkpad/x200s; + lenovo-thinkpad-x220 = import ./lenovo/thinkpad/x220; + lenovo-thinkpad-x230 = import ./lenovo/thinkpad/x230; + lenovo-thinkpad-x250 = import ./lenovo/thinkpad/x250; + lenovo-thinkpad-x260 = import ./lenovo/thinkpad/x260; + lenovo-thinkpad-x270 = import ./lenovo/thinkpad/x270; + lenovo-thinkpad-x280 = import ./lenovo/thinkpad/x280; + lenovo-thinkpad-x390 = import ./lenovo/thinkpad/x390; + lenovo-thinkpad-z = import ./lenovo/thinkpad/z; + lenovo-thinkpad-z13-gen1 = import ./lenovo/thinkpad/z/gen1/z13; + lenovo-thinkpad-z13-gen2 = import ./lenovo/thinkpad/z/gen2/z13; + lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; + lenovo-yoga-7-14ARH7 = import ./lenovo/yoga/7/14ARH7; + lenovo-yoga-7-14ARH7-amdgpu = import ./lenovo/yoga/7/14ARH7/amdgpu; + lenovo-yoga-7-14ARH7-nvidia = import ./lenovo/yoga/7/14ARH7/nvidia; + lenovo-yoga-7-14IAH7-integrated = import ./lenovo/yoga/7/14IAH7/integrated; + lenovo-yoga-7-14IAH7-hybrid = import ./lenovo/yoga/7/14IAH7/hybrid; + lenovo-yoga-7-14ILL10 = import ./lenovo/yoga/7/14ILL10; + lenovo-yoga-7-slim-gen8 = import ./lenovo/yoga/7/slim/gen8; + letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; + malibal-aon-s1-intel = import ./malibal/aon/s1; + microchip-icicle-kit = import ./microchip/icicle-kit; + microsoft-surface-go = import ./microsoft/surface/surface-go; + microsoft-surface-pro-intel = import ./microsoft/surface/surface-pro-intel; + microsoft-surface-laptop-amd = import ./microsoft/surface/surface-laptop-amd; + microsoft-surface-common = import ./microsoft/surface/common; + microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; + microsoft-surface-pro-9 = import ./microsoft/surface-pro/9; + milkv-pioneer = import ./milkv/pioneer; + minisforum-v3 = import ./minisforum/v3; + morefine-m600 = import ./morefine/m600; + msi-b350-tomahawk = import ./msi/b350-tomahawk; + msi-b550-a-pro = import ./msi/b550-a-pro; + msi-gs60 = import ./msi/gs60; + msi-gl62 = import ./msi/gl62; + msi-gl65-10SDR-492 = import ./msi/gl65/10SDR-492; + nxp-imx8mp-evk = import ./nxp/imx8mp-evk; + nxp-imx8mq-evk = import ./nxp/imx8mq-evk; + nxp-imx8qm-mek = import ./nxp/imx8qm-mek; + hardkernel-odroid-hc4 = import ./hardkernel/odroid-hc4; + hardkernel-odroid-h3 = import ./hardkernel/odroid-h3; + hardkernel-odroid-h4 = import ./hardkernel/odroid-h4; + omen-14-fb0798ng = import ./omen/14-fb0798ng; + omen-15-ce002ns = import ./omen/15-ce002ns; + omen-15-en0010ca = import ./omen/15-en0010ca; + omen-16-n0005ne = import ./omen/16-n0005ne; + omen-16-n0280nd = import ./omen/16-n0280nd; + omen-15-en1007sa = import ./omen/15-en1007sa; + omen-15-en0002np = import ./omen/15-en0002np; + onenetbook-4 = import ./onenetbook/4; + olimex-teres_i = import ./olimex/teres_i; + pcengines-apu = import ./pcengines/apu; + pine64-pinebook-pro = import ./pine64/pinebook-pro; + pine64-rockpro64 = import ./pine64/rockpro64; + pine64-star64 = import ./pine64/star64; + protectli-vp4670 = import ./protectli/vp4670; + purism-librem-13v3 = import ./purism/librem/13v3; + purism-librem-15v3 = import ./purism/librem/15v3; + purism-librem-5r4 = import ./purism/librem/5r4; + raspberry-pi-2 = import ./raspberry-pi/2; + raspberry-pi-3 = import ./raspberry-pi/3; + raspberry-pi-4 = import ./raspberry-pi/4; + raspberry-pi-5 = import ./raspberry-pi/5; + rock-4c-plus = import ./radxa/rock-4c-plus; + rock-5b = import ./radxa/rock-5b; + rock-pi-4 = import ./radxa/rock-pi-4; + rock-pi-e = import ./radxa/rock-pi-e; + kobol-helios4 = import ./kobol/helios4; + samsung-np900x3c = import ./samsung/np900x3c; + slimbook-hero-rpl-rtx = import ./slimbook/hero/rpl-rtx; + starfive-visionfive-v1 = import ./starfive/visionfive/v1; + starfive-visionfive-2 = import ./starfive/visionfive/v2; + starlabs-starlite-i5 = import ./starlabs/starlite/i5; + supermicro = import ./supermicro; + supermicro-a1sri-2758f = import ./supermicro/a1sri-2758f; + supermicro-m11sdv-8c-ln4f = import ./supermicro/m11sdv-8c-ln4f; + supermicro-x10sll-f = import ./supermicro/x10sll-f; + supermicro-x12scz-tln4f = import ./supermicro/x12scz-tln4f; + system76 = import ./system76; + system76-gaze18 = import ./system76/gaze18; + system76-galp5-1650 = import ./system76/galp5-1650; + system76-darp6 = import ./system76/darp6; + toshiba-swanky = import ./toshiba/swanky; + tuxedo-aura-15-gen1 = import ./tuxedo/aura/15/gen1; + tuxedo-infinitybook-v4 = import ./tuxedo/infinitybook/v4; + tuxedo-infinitybook-pro14-gen7 = import ./tuxedo/infinitybook/pro14/gen7; + tuxedo-infinitybook-pro14-gen9-intel = import ./tuxedo/infinitybook/pro14/gen9/intel; + tuxedo-pulse-14-gen3 = import ./tuxedo/pulse/14/gen3; + tuxedo-pulse-15-gen2 = import ./tuxedo/pulse/15/gen2; + xiaomi-redmibook-16-pro-2024 = import ./xiaomi/redmibook/16-pro-2024; + + common-cpu-amd = import ./common/cpu/amd; + common-cpu-amd-pstate = import ./common/cpu/amd/pstate.nix; + common-cpu-amd-zenpower = import ./common/cpu/amd/zenpower.nix; + common-cpu-amd-raphael-igpu = import ./common/cpu/amd/raphael/igpu.nix; + common-cpu-intel = import ./common/cpu/intel; + common-gpu-intel-comet-lake = + deprecated "992" "common-gpu-intel-comet-lake" + (import ./common/gpu/intel/comet-lake); + common-cpu-intel-cpu-only = import ./common/cpu/intel/cpu-only.nix; + common-gpu-intel-kaby-lake = + deprecated "992" "common-gpu-intel-kaby-lake" + (import ./common/gpu/intel/kaby-lake); + common-gpu-intel-sandy-bridge = + deprecated "992" "common-gpu-intel-sandy-bridge" + (import ./common/gpu/intel/sandy-bridge); + common-gpu-amd = import ./common/gpu/amd; + common-gpu-amd-sea-islands = import ./common/gpu/amd/sea-islands; + common-gpu-amd-southern-islands = import ./common/gpu/amd/southern-islands; + common-gpu-intel = import ./common/gpu/intel; + common-gpu-intel-disable = import ./common/gpu/intel/disable.nix; + common-gpu-nvidia = import ./common/gpu/nvidia/prime.nix; + common-gpu-nvidia-sync = import ./common/gpu/nvidia/prime-sync.nix; + common-gpu-nvidia-nonprime = import ./common/gpu/nvidia; + common-gpu-nvidia-disable = import ./common/gpu/nvidia/disable.nix; + common-hidpi = import ./common/hidpi.nix; + common-pc = import ./common/pc; + common-pc-hdd = import ./common/pc/hdd; + common-pc-laptop = import ./common/pc/laptop; + common-pc-laptop-acpi_call = throw "common-pc-laptop-acpi_call has been removed because it is obsolete: https://github.com/NixOS/nixos-hardware/issues/1114"; + common-pc-laptop-hdd = import ./common/pc/laptop/hdd; + common-pc-laptop-ssd = import ./common/pc/ssd; + common-pc-ssd = import ./common/pc/ssd; + }; + }; } diff --git a/focus/m2/gen1/default.nix b/focus/m2/gen1/default.nix index 2b8e5e7c..34996510 100644 --- a/focus/m2/gen1/default.nix +++ b/focus/m2/gen1/default.nix @@ -9,7 +9,14 @@ ../../../common/pc/ssd ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; boot.kernelModules = [ "kvm-intel" ]; boot.kernelParams = [ "tpm_tis.interrupts=0" # Upstream bug: https://bugzilla.kernel.org/show_bug.cgi?id=204121 diff --git a/framework/13-inch/11th-gen-intel/default.nix b/framework/13-inch/11th-gen-intel/default.nix index 2ea33969..4a24c4cb 100644 --- a/framework/13-inch/11th-gen-intel/default.nix +++ b/framework/13-inch/11th-gen-intel/default.nix @@ -1,4 +1,5 @@ -{ lib, pkgs, ...}: { +{ lib, pkgs, ... }: +{ imports = [ ../common ../common/intel.nix @@ -6,7 +7,10 @@ # Requires at least 5.16 for working wi-fi and bluetooth. # https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89 - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") ( + lib.mkDefault pkgs.linuxPackages_latest + ); - hardware.framework.laptop13.audioEnhancement.rawDeviceName = lib.mkDefault "alsa_output.pci-0000_00_1f.3.analog-stereo"; + hardware.framework.laptop13.audioEnhancement.rawDeviceName = + lib.mkDefault "alsa_output.pci-0000_00_1f.3.analog-stereo"; } diff --git a/framework/13-inch/12th-gen-intel/default.nix b/framework/13-inch/12th-gen-intel/default.nix index 4cce4446..f8ff0c01 100644 --- a/framework/13-inch/12th-gen-intel/default.nix +++ b/framework/13-inch/12th-gen-intel/default.nix @@ -9,7 +9,8 @@ { hardware.intelgpu.loadInInitrd = lib.versionOlder config.boot.kernelPackages.kernel.version "6.2"; # same as 13th gen framework 13-inch - hardware.framework.laptop13.audioEnhancement.rawDeviceName = lib.mkDefault "alsa_output.pci-0000_00_1f.3.analog-stereo"; + hardware.framework.laptop13.audioEnhancement.rawDeviceName = + lib.mkDefault "alsa_output.pci-0000_00_1f.3.analog-stereo"; } # https://community.frame.work/t/tracking-hard-freezing-on-fedora-36-with-the-new-12th-gen-system/20675/391 (lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.2") { diff --git a/framework/13-inch/7040-amd/default.nix b/framework/13-inch/7040-amd/default.nix index 9ec5e728..2cd21f60 100644 --- a/framework/13-inch/7040-amd/default.nix +++ b/framework/13-inch/7040-amd/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.hardware.framework.amd-7040; @@ -27,12 +32,15 @@ in config = { # Workaround applied upstream in Linux >=6.7 (on BIOS 03.03) # https://github.com/torvalds/linux/commit/a55bdad5dfd1efd4ed9ffe518897a21ca8e4e193 - services.udev.extraRules = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.7" && cfg.preventWakeOnAC) '' - # Prevent wake when plugging in AC during suspend. Trade-off: keyboard wake disabled. See: - # https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45 - ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="atkbd", ATTR{power/wakeup}="disabled" - ''; + services.udev.extraRules = + lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.7" && cfg.preventWakeOnAC) + '' + # Prevent wake when plugging in AC during suspend. Trade-off: keyboard wake disabled. See: + # https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45 + ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="atkbd", ATTR{power/wakeup}="disabled" + ''; - hardware.framework.laptop13.audioEnhancement.rawDeviceName = lib.mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo"; + hardware.framework.laptop13.audioEnhancement.rawDeviceName = + lib.mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo"; }; } diff --git a/framework/13-inch/amd-ai-300-series/default.nix b/framework/13-inch/amd-ai-300-series/default.nix index 33c5ec67..5eecb38b 100644 --- a/framework/13-inch/amd-ai-300-series/default.nix +++ b/framework/13-inch/amd-ai-300-series/default.nix @@ -1,9 +1,15 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ ../common ../common/amd.nix ]; - config.hardware.framework.laptop13.audioEnhancement.rawDeviceName = lib.mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo"; + config.hardware.framework.laptop13.audioEnhancement.rawDeviceName = + lib.mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo"; } diff --git a/framework/13-inch/common/amd.nix b/framework/13-inch/common/amd.nix index 20d9d235..ae35fffe 100644 --- a/framework/13-inch/common/amd.nix +++ b/framework/13-inch/common/amd.nix @@ -1,4 +1,5 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ imports = [ ../../../common/cpu/amd ../../../common/cpu/amd/pstate.nix @@ -15,7 +16,9 @@ "amdgpu.dcdebugmask=0x10" ] # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ - ++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") ["rtc_cmos.use_acpi_alarm=1"]; + ++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [ + "rtc_cmos.use_acpi_alarm=1" + ]; # AMD has better battery life with PPD over TLP: # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 diff --git a/framework/13-inch/common/audio.nix b/framework/13-inch/common/audio.nix index 8133ab88..7010c35a 100644 --- a/framework/13-inch/common/audio.nix +++ b/framework/13-inch/common/audio.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.hardware.framework.laptop13.audioEnhancement; in @@ -51,332 +56,335 @@ in }; }; - config = lib.mkIf cfg.enable (let - outputName = cfg.rawDeviceName; - prettyName = "Framework Speakers"; + config = lib.mkIf cfg.enable ( + let + outputName = cfg.rawDeviceName; + prettyName = "Framework Speakers"; - # These are pre-made decibel to linear value conversions, since Nix doesn't have pow(). - # Use the formula `10 ** (db / 20)` to calculate. - db = { - "-18.1" = 0.1244514611771385; - "-5.48" = 0.5321082592667942; - "-4.76" = 0.5780960474057181; - "8.1" = 2.5409727055493048; - "-36" = 1.5848931924611134e-2; - }; - - json = pkgs.formats.json { }; - - # The filter chain, heavily inspired by the asahi-audio project: https://github.com/AsahiLinux/asahi-audio - filter-chain = json.generate "filter-chain.json" { - "node.description" = prettyName; - "media.name" = prettyName; - "filter.graph" = { - nodes = [ - # Psychoacoustic bass extension, - # it creates harmonics of the missing bass to fool our ears into hearing it. - { - type = "lv2"; - plugin = "https://chadmed.au/bankstown"; - name = "bassex"; - control = { - bypass = 0; - amt = 1.2; - sat_second = 1.3; - sat_third = 2.5; - blend = 1.0; - ceil = 200.0; - floor = 20.0; - }; - } - # Loudness compensation, - # it ensures that the sound profile stays consistent across different volumes. - { - type = "lv2"; - plugin = "http://lsp-plug.in/plugins/lv2/loud_comp_stereo"; - name = "el"; - control = { - enabled = 1; - input = 1.0; - fft = 4; - }; - } - # 8-band equalizer, - # it tries to lessen frequencies where the laptop might resonate, - # and tries to make the frequency curve more pleasing; - # this is the "Lappy McTopface" profile (https://github.com/ceiphr/ee-framework-presets) - # further tuned for the Framework Laptop 13 AMD 7040 series - # and might need some tuning on other models. - { - type = "lv2"; - plugin = "http://lsp-plug.in/plugins/lv2/para_equalizer_x8_lr"; - name = "fw13eq"; - control = { - mode = 0; - react = 0.2; - zoom = db."-36"; - - fl_0 = 101.0; - fml_0 = 0; - ftl_0 = 5; - gl_0 = db."-18.1"; - huel_0 = 0.0; - ql_0 = 4.36; - sl_0 = 0; - wl_0 = 4.0; - - fl_1 = 451.0; - fml_1 = 0; - ftl_1 = 1; - gl_1 = db."-5.48"; - huel_1 = 3.125e-2; - ql_1 = 2.46; - sl_1 = 0; - wl_1 = 4.0; - - fl_2 = 918.0; - fml_2 = 0; - ftl_2 = 1; - gl_2 = db."-4.76"; - huel_2 = 6.25e-2; - ql_2 = 2.44; - sl_2 = 0; - wl_2 = 4.0; - - fl_3 = 9700.0; - fml_3 = 0; - ftl_3 = 1; - gl_3 = db."8.1"; - huel_3 = 9.375e-2; - ql_3 = 2.0; - sl_3 = 0; - wl_3 = 4.0; - - fr_0 = 101.0; - fmr_0 = 0; - ftr_0 = 5; - gr_0 = db."-18.1"; - huer_0 = 0.0; - qr_0 = 4.36; - sr_0 = 0; - wr_0 = 4.0; - - fr_1 = 451.0; - fmr_1 = 0; - ftr_1 = 1; - gr_1 = db."-5.48"; - huer_1 = 3.125e-2; - qr_1 = 2.46; - sr_1 = 0; - wr_1 = 4.0; - - fr_2 = 918.0; - fmr_2 = 0; - ftr_2 = 1; - gr_2 = db."-4.76"; - huer_2 = 6.25e-2; - qr_2 = 2.44; - sr_2 = 0; - wr_2 = 4.0; - - fr_3 = 9700.0; - fmr_3 = 0; - ftr_3 = 1; - gr_3 = db."8.1"; - huer_3 = 9.375e-2; - qr_3 = 2.0; - sr_3 = 0; - wr_3 = 4.0; - }; - } - # Compressors. The settings were taken from the asahi-audio project. - { - type = "lv2"; - plugin = "http://lsp-plug.in/plugins/lv2/mb_compressor_stereo"; - name = "woofer_bp"; - control = { - mode = 0; - ce_0 = 1; - sla_0 = 5.0; - cr_0 = 1.75; - al_0 = 0.725; - at_0 = 1.0; - rt_0 = 100; - kn_0 = 0.125; - cbe_1 = 1; - sf_1 = 200.0; - ce_1 = 0; - cbe_2 = 0; - ce_2 = 0; - cbe_3 = 0; - ce_3 = 0; - cbe_4 = 0; - ce_4 = 0; - cbe_5 = 0; - ce_5 = 0; - cbe_6 = 0; - ce_6 = 0; - }; - } - { - type = "lv2"; - plugin = "http://lsp-plug.in/plugins/lv2/compressor_stereo"; - name = "woofer_lim"; - control = { - sla = 5.0; - al = 1.0; - at = 1.0; - rt = 100.0; - cr = 15.0; - kn = 0.5; - }; - } - ]; - - # Now, we're chaining together the modules instantiated above. - links = [ - { - output = "bassex:out_l"; - input = "el:in_l"; - } - { - output = "bassex:out_r"; - input = "el:in_r"; - } - - { - output = "el:out_l"; - input = "fw13eq:in_l"; - } - { - output = "el:out_r"; - input = "fw13eq:in_r"; - } - { - output = "fw13eq:out_l"; - input = "woofer_bp:in_l"; - } - { - output = "fw13eq:out_r"; - input = "woofer_bp:in_r"; - } - { - output = "woofer_bp:out_l"; - input = "woofer_lim:in_l"; - } - { - output = "woofer_bp:out_r"; - input = "woofer_lim:in_r"; - } - ]; - - inputs = [ - "bassex:in_l" - "bassex:in_r" - ]; - outputs = [ - "woofer_lim:out_l" - "woofer_lim:out_r" - ]; - - # This makes pipewire's volume control actually control the loudness comp module - "capture.volumes" = [ - { - control = "el:volume"; - min = -47.5; - max = 0.0; - scale = "cubic"; - } - ]; + # These are pre-made decibel to linear value conversions, since Nix doesn't have pow(). + # Use the formula `10 ** (db / 20)` to calculate. + db = { + "-18.1" = 0.1244514611771385; + "-5.48" = 0.5321082592667942; + "-4.76" = 0.5780960474057181; + "8.1" = 2.5409727055493048; + "-36" = 1.5848931924611134e-2; }; - "capture.props" = { - "node.name" = "audio_effect.laptop-convolver"; - "media.class" = "Audio/Sink"; - "audio.channels" = "2"; - "audio.position" = [ - "FL" - "FR" - ]; - "audio.allowed-rates" = [ - 44100 - 48000 - 88200 - 96000 - 176400 - 192000 - ]; - "device.api" = "dsp"; - "node.virtual" = "false"; - # Lower seems to mean "more preferred", - # bluetooth devices seem to be ~1000, speakers seem to be ~2000 - # since this is between the two, bluetooth devices take over when they connect, - # and hand over to this instead of the speakers when they disconnect. - "priority.session" = 1500; - "priority.driver" = 1500; - "state.default-volume" = 0.343; - "device.icon-name" = "audio-card-analog-pci"; - }; - "playback.props" = { - "node.name" = "audio_effect.laptop-convolver"; - "target.object" = outputName; - "node.passive" = "true"; - "audio.channels" = "2"; - "audio.allowed-rates" = [ - 44100 - 48000 - 88200 - 96000 - 176400 - 192000 - ]; - "audio.position" = [ - "FL" - "FR" - ]; - "device.icon-name" = "audio-card-analog-pci"; - }; - }; + json = pkgs.formats.json { }; - configPackage = - (pkgs.writeTextDir "share/wireplumber/wireplumber.conf.d/99-laptop.conf" '' - monitor.alsa.rules = [ - { - matches = [{ node.name = "${outputName}" }] - actions = { - update-props = { - audio.allowed-rates = [44100, 48000, 88200, 96000, 176400, 192000] + # The filter chain, heavily inspired by the asahi-audio project: https://github.com/AsahiLinux/asahi-audio + filter-chain = json.generate "filter-chain.json" { + "node.description" = prettyName; + "media.name" = prettyName; + "filter.graph" = { + nodes = [ + # Psychoacoustic bass extension, + # it creates harmonics of the missing bass to fool our ears into hearing it. + { + type = "lv2"; + plugin = "https://chadmed.au/bankstown"; + name = "bassex"; + control = { + bypass = 0; + amt = 1.2; + sat_second = 1.3; + sat_third = 2.5; + blend = 1.0; + ceil = 200.0; + floor = 20.0; + }; + } + # Loudness compensation, + # it ensures that the sound profile stays consistent across different volumes. + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/loud_comp_stereo"; + name = "el"; + control = { + enabled = 1; + input = 1.0; + fft = 4; + }; + } + # 8-band equalizer, + # it tries to lessen frequencies where the laptop might resonate, + # and tries to make the frequency curve more pleasing; + # this is the "Lappy McTopface" profile (https://github.com/ceiphr/ee-framework-presets) + # further tuned for the Framework Laptop 13 AMD 7040 series + # and might need some tuning on other models. + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/para_equalizer_x8_lr"; + name = "fw13eq"; + control = { + mode = 0; + react = 0.2; + zoom = db."-36"; + + fl_0 = 101.0; + fml_0 = 0; + ftl_0 = 5; + gl_0 = db."-18.1"; + huel_0 = 0.0; + ql_0 = 4.36; + sl_0 = 0; + wl_0 = 4.0; + + fl_1 = 451.0; + fml_1 = 0; + ftl_1 = 1; + gl_1 = db."-5.48"; + huel_1 = 3.125e-2; + ql_1 = 2.46; + sl_1 = 0; + wl_1 = 4.0; + + fl_2 = 918.0; + fml_2 = 0; + ftl_2 = 1; + gl_2 = db."-4.76"; + huel_2 = 6.25e-2; + ql_2 = 2.44; + sl_2 = 0; + wl_2 = 4.0; + + fl_3 = 9700.0; + fml_3 = 0; + ftl_3 = 1; + gl_3 = db."8.1"; + huel_3 = 9.375e-2; + ql_3 = 2.0; + sl_3 = 0; + wl_3 = 4.0; + + fr_0 = 101.0; + fmr_0 = 0; + ftr_0 = 5; + gr_0 = db."-18.1"; + huer_0 = 0.0; + qr_0 = 4.36; + sr_0 = 0; + wr_0 = 4.0; + + fr_1 = 451.0; + fmr_1 = 0; + ftr_1 = 1; + gr_1 = db."-5.48"; + huer_1 = 3.125e-2; + qr_1 = 2.46; + sr_1 = 0; + wr_1 = 4.0; + + fr_2 = 918.0; + fmr_2 = 0; + ftr_2 = 1; + gr_2 = db."-4.76"; + huer_2 = 6.25e-2; + qr_2 = 2.44; + sr_2 = 0; + wr_2 = 4.0; + + fr_3 = 9700.0; + fmr_3 = 0; + ftr_3 = 1; + gr_3 = db."8.1"; + huer_3 = 9.375e-2; + qr_3 = 2.0; + sr_3 = 0; + wr_3 = 4.0; + }; + } + # Compressors. The settings were taken from the asahi-audio project. + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/mb_compressor_stereo"; + name = "woofer_bp"; + control = { + mode = 0; + ce_0 = 1; + sla_0 = 5.0; + cr_0 = 1.75; + al_0 = 0.725; + at_0 = 1.0; + rt_0 = 100; + kn_0 = 0.125; + cbe_1 = 1; + sf_1 = 200.0; + ce_1 = 0; + cbe_2 = 0; + ce_2 = 0; + cbe_3 = 0; + ce_3 = 0; + cbe_4 = 0; + ce_4 = 0; + cbe_5 = 0; + ce_5 = 0; + cbe_6 = 0; + ce_6 = 0; + }; + } + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/compressor_stereo"; + name = "woofer_lim"; + control = { + sla = 5.0; + al = 1.0; + at = 1.0; + rt = 100.0; + cr = 15.0; + kn = 0.5; + }; + } + ]; + + # Now, we're chaining together the modules instantiated above. + links = [ + { + output = "bassex:out_l"; + input = "el:in_l"; + } + { + output = "bassex:out_r"; + input = "el:in_r"; + } + + { + output = "el:out_l"; + input = "fw13eq:in_l"; + } + { + output = "el:out_r"; + input = "fw13eq:in_r"; + } + { + output = "fw13eq:out_l"; + input = "woofer_bp:in_l"; + } + { + output = "fw13eq:out_r"; + input = "woofer_bp:in_r"; + } + { + output = "woofer_bp:out_l"; + input = "woofer_lim:in_l"; + } + { + output = "woofer_bp:out_r"; + input = "woofer_lim:in_r"; + } + ]; + + inputs = [ + "bassex:in_l" + "bassex:in_r" + ]; + outputs = [ + "woofer_lim:out_l" + "woofer_lim:out_r" + ]; + + # This makes pipewire's volume control actually control the loudness comp module + "capture.volumes" = [ + { + control = "el:volume"; + min = -47.5; + max = 0.0; + scale = "cubic"; + } + ]; + }; + "capture.props" = { + "node.name" = "audio_effect.laptop-convolver"; + "media.class" = "Audio/Sink"; + "audio.channels" = "2"; + "audio.position" = [ + "FL" + "FR" + ]; + "audio.allowed-rates" = [ + 44100 + 48000 + 88200 + 96000 + 176400 + 192000 + ]; + "device.api" = "dsp"; + "node.virtual" = "false"; + + # Lower seems to mean "more preferred", + # bluetooth devices seem to be ~1000, speakers seem to be ~2000 + # since this is between the two, bluetooth devices take over when they connect, + # and hand over to this instead of the speakers when they disconnect. + "priority.session" = 1500; + "priority.driver" = 1500; + "state.default-volume" = 0.343; + "device.icon-name" = "audio-card-analog-pci"; + }; + "playback.props" = { + "node.name" = "audio_effect.laptop-convolver"; + "target.object" = outputName; + "node.passive" = "true"; + "audio.channels" = "2"; + "audio.allowed-rates" = [ + 44100 + 48000 + 88200 + 96000 + 176400 + 192000 + ]; + "audio.position" = [ + "FL" + "FR" + ]; + "device.icon-name" = "audio-card-analog-pci"; + }; + }; + + configPackage = + (pkgs.writeTextDir "share/wireplumber/wireplumber.conf.d/99-laptop.conf" '' + monitor.alsa.rules = [ + { + matches = [{ node.name = "${outputName}" }] + actions = { + update-props = { + audio.allowed-rates = [44100, 48000, 88200, 96000, 176400, 192000] + } } } - } - ] + ] - node.software-dsp.rules = [ - { - matches = [{ node.name = "${outputName}" }] - actions = { - create-filter = { - filter-path = "${filter-chain}" - hide-parent = ${lib.boolToString cfg.hideRawDevice} + node.software-dsp.rules = [ + { + matches = [{ node.name = "${outputName}" }] + actions = { + create-filter = { + filter-path = "${filter-chain}" + hide-parent = ${lib.boolToString cfg.hideRawDevice} + } } } + ] + + wireplumber.profiles = { + main = { node.software-dsp = "required" } } - ] + '') + // { + passthru.requiredLv2Packages = with pkgs; [ + lsp-plugins + bankstown-lv2 + ]; + }; + in + { + services.pipewire.wireplumber.configPackages = [ configPackage ]; - wireplumber.profiles = { - main = { node.software-dsp = "required" } - } - '') - // { - passthru.requiredLv2Packages = with pkgs; [ - lsp-plugins - bankstown-lv2 - ]; - }; - in { - services.pipewire.wireplumber.configPackages = [ configPackage ]; - - # Pipewire is needed for this. - services.pipewire.enable = lib.mkDefault true; - }); + # Pipewire is needed for this. + services.pipewire.enable = lib.mkDefault true; + } + ); } diff --git a/framework/13-inch/common/intel.nix b/framework/13-inch/common/intel.nix index 96bbec97..6248e75f 100644 --- a/framework/13-inch/common/intel.nix +++ b/framework/13-inch/common/intel.nix @@ -1,21 +1,30 @@ -{ config, lib, pkgs, ... }: { +{ + config, + lib, + pkgs, + ... +}: +{ imports = [ ../../../common/cpu/intel ]; - boot.kernelParams = [ - # For Power consumption - # https://community.frame.work/t/linux-battery-life-tuning/6665/156 - "nvme.noacpi=1" - ] - # Fixes a regression in s2idle, making it more power efficient than deep sleep - # Update 04/2024: It appears that s2idle-regression got fixed in newer kernel-versions (SebTM) - # (see: https://github.com/NixOS/nixos-hardware/pull/903#discussion_r1556096657) - ++ lib.lists.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") "acpi_osi=\"!Windows 2020\""; + boot.kernelParams = + [ + # For Power consumption + # https://community.frame.work/t/linux-battery-life-tuning/6665/156 + "nvme.noacpi=1" + ] + # Fixes a regression in s2idle, making it more power efficient than deep sleep + # Update 04/2024: It appears that s2idle-regression got fixed in newer kernel-versions (SebTM) + # (see: https://github.com/NixOS/nixos-hardware/pull/903#discussion_r1556096657) + ++ lib.lists.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") "acpi_osi=\"!Windows 2020\""; # Requires at least 5.16 for working wi-fi and bluetooth. # https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89 - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # Module is not used for Framework EC but causes boot time error log. boot.blacklistedKernelModules = [ "cros-usbpd-charger" ]; diff --git a/framework/13-inch/intel-core-ultra-series1/default.nix b/framework/13-inch/intel-core-ultra-series1/default.nix index 7ac20d6e..4851d54f 100644 --- a/framework/13-inch/intel-core-ultra-series1/default.nix +++ b/framework/13-inch/intel-core-ultra-series1/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ @@ -8,7 +13,9 @@ # Need at least 6.9 to make suspend properly # Specifically this patch: https://github.com/torvalds/linux/commit/073237281a508ac80ec025872ad7de50cfb5a28a - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.9") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.9") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # Intel NPU Driver # https://discourse.nixos.org/t/new-installation-on-asus-zenbook-ux5406-intel-vpu-firmware-error-2/58732/2 @@ -32,6 +39,6 @@ warnings = lib.mkIf (!config.hardware.enableRedistributableFirmware) [ ''For Intel NPU support, set the option: hardware.enableRedistributableFirmware = true;'' - ]; + ]; } diff --git a/framework/16-inch/7040-amd/default.nix b/framework/16-inch/7040-amd/default.nix index 6c02455a..70275e69 100644 --- a/framework/16-inch/7040-amd/default.nix +++ b/framework/16-inch/7040-amd/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ diff --git a/framework/16-inch/common/amd.nix b/framework/16-inch/common/amd.nix index 20d9d235..ae35fffe 100644 --- a/framework/16-inch/common/amd.nix +++ b/framework/16-inch/common/amd.nix @@ -1,4 +1,5 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ imports = [ ../../../common/cpu/amd ../../../common/cpu/amd/pstate.nix @@ -15,7 +16,9 @@ "amdgpu.dcdebugmask=0x10" ] # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ - ++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") ["rtc_cmos.use_acpi_alarm=1"]; + ++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [ + "rtc_cmos.use_acpi_alarm=1" + ]; # AMD has better battery life with PPD over TLP: # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 diff --git a/framework/bluetooth.nix b/framework/bluetooth.nix index ba76081c..0e08adb7 100644 --- a/framework/bluetooth.nix +++ b/framework/bluetooth.nix @@ -10,29 +10,46 @@ pkgs, ... # TODO: drop this if linux 6.11 goes EOL -}: lib.mkIf ((config.boot.kernelPackages.kernelAtLeast "6.11") && (config.boot.kernelPackages.kernelOlder "6.12")) { - systemd.services = { - bluetooth-rfkill-suspend = { - description = "Soft block Bluetooth on suspend/hibernate"; - before = ["sleep.target"]; - unitConfig.StopWhenUnneeded = true; - serviceConfig = { - Type = "oneshot"; - ExecStart = "${pkgs.util-linux}/bin/rfkill block bluetooth"; - ExecStartPost = "${pkgs.coreutils}/bin/sleep 3"; - RemainAfterExit = true; +}: +lib.mkIf + ( + (config.boot.kernelPackages.kernelAtLeast "6.11") && (config.boot.kernelPackages.kernelOlder "6.12") + ) + { + systemd.services = { + bluetooth-rfkill-suspend = { + description = "Soft block Bluetooth on suspend/hibernate"; + before = [ "sleep.target" ]; + unitConfig.StopWhenUnneeded = true; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.util-linux}/bin/rfkill block bluetooth"; + ExecStartPost = "${pkgs.coreutils}/bin/sleep 3"; + RemainAfterExit = true; + }; + wantedBy = [ + "suspend.target" + "hibernate.target" + "suspend-then-hibernate.target" + ]; }; - wantedBy = ["suspend.target" "hibernate.target" "suspend-then-hibernate.target"]; - }; - bluetooth-rfkill-resume = { - description = "Unblock Bluetooth on resume"; - after = ["suspend.target" "hibernate.target" "suspend-then-hibernate.target"]; - serviceConfig = { - Type = "oneshot"; - ExecStart = "${pkgs.util-linux}/bin/rfkill unblock bluetooth"; + bluetooth-rfkill-resume = { + description = "Unblock Bluetooth on resume"; + after = [ + "suspend.target" + "hibernate.target" + "suspend-then-hibernate.target" + ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.util-linux}/bin/rfkill unblock bluetooth"; + }; + wantedBy = [ + "suspend.target" + "hibernate.target" + "suspend-then-hibernate.target" + ]; }; - wantedBy = ["suspend.target" "hibernate.target" "suspend-then-hibernate.target"]; }; - }; -} + } diff --git a/framework/framework-tool.nix b/framework/framework-tool.nix index 4effcca8..4c70193e 100644 --- a/framework/framework-tool.nix +++ b/framework/framework-tool.nix @@ -1,3 +1,4 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ environment.systemPackages = [ pkgs.framework-tool ]; } diff --git a/framework/kmod.nix b/framework/kmod.nix index 6ed05b9a..7cb53746 100644 --- a/framework/kmod.nix +++ b/framework/kmod.nix @@ -1,17 +1,20 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let kernel_version_compatible = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.10"; -in { - options.hardware.framework.enableKmod = (lib.mkEnableOption - "Enable the community created Framework kernel module that allows interacting with the embedded controller from sysfs." - ) // { - # enable by default on NixOS >= 24.05 and kernel >= 6.10 - default = lib.and - (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.05") - kernel_version_compatible; - defaultText = "enabled by default on NixOS >= 24.05 and kernel >= 6.10"; - }; - +in +{ + options.hardware.framework.enableKmod = + (lib.mkEnableOption "Enable the community created Framework kernel module that allows interacting with the embedded controller from sysfs.") + // { + # enable by default on NixOS >= 24.05 and kernel >= 6.10 + default = lib.and (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.05") kernel_version_compatible; + defaultText = "enabled by default on NixOS >= 24.05 and kernel >= 6.10"; + }; config.boot = lib.mkIf config.hardware.framework.enableKmod { extraModulePackages = with config.boot.kernelPackages; [ @@ -19,7 +22,10 @@ in { ]; # https://github.com/DHowett/framework-laptop-kmod?tab=readme-ov-file#usage - kernelModules = [ "cros_ec" "cros_ec_lpcs" ]; + kernelModules = [ + "cros_ec" + "cros_ec_lpcs" + ]; # add required patch if enabled on kernel <6.10 kernelPatches = lib.mkIf (!kernel_version_compatible) [ @@ -28,15 +34,22 @@ in { msgid = "20240403004713.130365-1-dustin@howett.net"; version = "3"; hash = "sha256-aQSyys8CMzlj9EdNhg8vtp76fg1qEwUVeJL0E+8w5HU="; - patch = pkgs.runCommandLocal "patch-${msgid}" { - nativeBuildInputs = with pkgs; [ b4 git cacert ]; - SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; + patch = + pkgs.runCommandLocal "patch-${msgid}" + { + nativeBuildInputs = with pkgs; [ + b4 + git + cacert + ]; + SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; - outputHash = hash; - } '' - export HOME="$TMP" - PYTHONHASHSEED=0 ${pkgs.b4}/bin/b4 -n am -C -T -v ${version} -o- "${msgid}" > "$out" - ''; + outputHash = hash; + } + '' + export HOME="$TMP" + PYTHONHASHSEED=0 ${pkgs.b4}/bin/b4 -n am -C -T -v ${version} -o- "${msgid}" > "$out" + ''; } ]; }; diff --git a/friendlyarm/nanopc-t4/default.nix b/friendlyarm/nanopc-t4/default.nix index 61b86576..55bbf6b4 100644 --- a/friendlyarm/nanopc-t4/default.nix +++ b/friendlyarm/nanopc-t4/default.nix @@ -14,13 +14,17 @@ hardware.enableRedistributableFirmware = lib.mkDefault true; # Fix for not detecting the M.2 NVMe SSD. Will cause recompilation. - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.10") (lib.mkDefault pkgs.linuxPackages_latest); - boot.kernelPatches = lib.mkDefault [{ - name = "pcie-rockchip-config.patch"; - patch = null; - extraConfig = '' - PHY_ROCKCHIP_PCIE y - PCIE_ROCKCHIP_HOST y - ''; - }]; + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.10") ( + lib.mkDefault pkgs.linuxPackages_latest + ); + boot.kernelPatches = lib.mkDefault [ + { + name = "pcie-rockchip-config.patch"; + patch = null; + extraConfig = '' + PHY_ROCKCHIP_PCIE y + PCIE_ROCKCHIP_HOST y + ''; + } + ]; } diff --git a/friendlyarm/nanopi-r5s/default.nix b/friendlyarm/nanopi-r5s/default.nix index b7ecb916..ba018200 100644 --- a/friendlyarm/nanopi-r5s/default.nix +++ b/friendlyarm/nanopi-r5s/default.nix @@ -1,5 +1,6 @@ -{ lib -, ... +{ + lib, + ... }: { diff --git a/gmktec/nucbox/g3-plus/default.nix b/gmktec/nucbox/g3-plus/default.nix index 7cd7d6f3..1396aa71 100644 --- a/gmktec/nucbox/g3-plus/default.nix +++ b/gmktec/nucbox/g3-plus/default.nix @@ -1,23 +1,23 @@ /* - * `gmktec-nucbox-g3-plus`: - * - * Product page: - * - * - * This profile just configures the Intel - * Twin Lake N150 CPU and integrated - * graphics for this mini-PC. fstrim is also - * enabled for the SSD. That's all this seemed - * to need to function properly. As is now - * expected from Intel NUC systems, it provides - * a solid "out-of-the-box" experience. No - * special quirks are apparent. - * - * We import the Alder Lake modules since Twin - * Lake is just a refreshed version of the - * Alder Lake-N series. Re-using those seems - * to be fine for this purpose. - */ + `gmktec-nucbox-g3-plus`: + + Product page: + + + This profile just configures the Intel + Twin Lake N150 CPU and integrated + graphics for this mini-PC. fstrim is also + enabled for the SSD. That's all this seemed + to need to function properly. As is now + expected from Intel NUC systems, it provides + a solid "out-of-the-box" experience. No + special quirks are apparent. + + We import the Alder Lake modules since Twin + Lake is just a refreshed version of the + Alder Lake-N series. Re-using those seems + to be fine for this purpose. +*/ { imports = [ ../../../common/cpu/intel/alder-lake diff --git a/gpd/pocket-3/default.nix b/gpd/pocket-3/default.nix index a271a644..730249be 100644 --- a/gpd/pocket-3/default.nix +++ b/gpd/pocket-3/default.nix @@ -1,44 +1,56 @@ { lib, pkgs, ... }: -let inherit (lib) mkDefault mkIf; +let + inherit (lib) mkDefault mkIf; in { - imports = [ - ../../common/pc/laptop - ../../common/pc/ssd + imports = [ + ../../common/pc/laptop + ../../common/pc/ssd ../../common/hidpi.nix ../../common/gpu/24.05-compat.nix - ]; + ]; # Necessary kernel modules - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "thunderbolt" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "usbhid" + "thunderbolt" + ]; - # GPU is an Intel Iris Xe, on a “TigerLake” mobile CPU - boot.initrd.kernelModules = [ "i915" ]; # Early loading so the passphrase prompt appears on external displays - hardware.graphics.extraPackages = with pkgs; [ - intel-media-driver - (if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then vaapiIntel else intel-vaapi-driver) - ]; + # GPU is an Intel Iris Xe, on a “TigerLake” mobile CPU + boot.initrd.kernelModules = [ "i915" ]; # Early loading so the passphrase prompt appears on external displays + hardware.graphics.extraPackages = with pkgs; [ + intel-media-driver + ( + if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then + vaapiIntel + else + intel-vaapi-driver + ) + ]; - boot.kernelParams = [ - # The GPD Pocket3 uses a tablet OLED display, that is mounted rotated 90° counter-clockwise - "fbcon=rotate:1" "video=DSI-1:panel_orientation=right_side_up" - ]; + boot.kernelParams = [ + # The GPD Pocket3 uses a tablet OLED display, that is mounted rotated 90° counter-clockwise + "fbcon=rotate:1" + "video=DSI-1:panel_orientation=right_side_up" + ]; - fonts.fontconfig = { - subpixel.rgba = "vbgr"; # Pixel order for rotated screen + fonts.fontconfig = { + subpixel.rgba = "vbgr"; # Pixel order for rotated screen - # The OLED display has √(1920² + 1200²) px / 8in ≃ 283 dpi - # Per the documentation, antialiasing, hinting, etc. have no visible effect at such high pixel densities anyhow. - # Set manually, as the hiDPI module had incorrect settings prior to NixOS 22.11; see nixpkgs#194594. - hinting.enable = mkDefault false; - antialias = mkIf (lib.versionOlder (lib.versions.majorMinor lib.version) "22.11") false; - }; + # The OLED display has √(1920² + 1200²) px / 8in ≃ 283 dpi + # Per the documentation, antialiasing, hinting, etc. have no visible effect at such high pixel densities anyhow. + # Set manually, as the hiDPI module had incorrect settings prior to NixOS 22.11; see nixpkgs#194594. + hinting.enable = mkDefault false; + antialias = mkIf (lib.versionOlder (lib.versions.majorMinor lib.version) "22.11") false; + }; - # More HiDPI settings - services.xserver.dpi = 280; + # More HiDPI settings + services.xserver.dpi = 280; - # Necessary for audio support on the 1195G7 model - boot.extraModprobeConfig = '' - options snd-intel-dspcfg dsp_driver=1 - ''; + # Necessary for audio support on the 1195G7 model + boot.extraModprobeConfig = '' + options snd-intel-dspcfg dsp_driver=1 + ''; } diff --git a/gpd/pocket-4/default.nix b/gpd/pocket-4/default.nix index 4ec54b63..8d08b2e8 100644 --- a/gpd/pocket-4/default.nix +++ b/gpd/pocket-4/default.nix @@ -1,5 +1,6 @@ { lib, pkgs, ... }: -let inherit (lib) mkIf mkDefault; +let + inherit (lib) mkIf mkDefault; in { imports = [ @@ -17,7 +18,8 @@ in kernelParams = [ # The GPD Pocket 4 uses a tablet LTPS display, that is mounted rotated 90° counter-clockwise - "fbcon=rotate:1" "video=eDP-1:panel_orientation=right_side_up" + "fbcon=rotate:1" + "video=eDP-1:panel_orientation=right_side_up" ]; }; diff --git a/gpd/win-2/default.nix b/gpd/win-2/default.nix index aaaba374..e7247534 100644 --- a/gpd/win-2/default.nix +++ b/gpd/win-2/default.nix @@ -1,17 +1,19 @@ -{ config, lib, ...}: +{ config, lib, ... }: { imports = [ ../../common/cpu/intel ../../common/pc/ssd - ]; + ]; boot.kernelParams = [ "fbcon=rotate:1" "video=eDP-1:panel_orientation=right_side_up" ]; - services.tlp.enable = lib.mkDefault ((lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") - || !config.services.power-profiles-daemon.enable); + services.tlp.enable = lib.mkDefault ( + (lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") + || !config.services.power-profiles-daemon.enable + ); # Required for grub to properly display the boot menu. boot.loader.grub.gfxmodeEfi = lib.mkDefault "720x1280x32"; diff --git a/gpd/win-max-2/2023/default.nix b/gpd/win-max-2/2023/default.nix index b20f2ca3..1338c843 100644 --- a/gpd/win-max-2/2023/default.nix +++ b/gpd/win-max-2/2023/default.nix @@ -1,4 +1,4 @@ -{ config, lib, ...}: +{ config, lib, ... }: with lib; { imports = [ @@ -12,6 +12,10 @@ with lib; hardware.sensor.iio.bmi260.enable = lib.mkDefault true; #see README - boot.blacklistedKernelModules = mkIf config.hardware.sensor.iio.bmi260.enable [ "bmi160_spi" "bmi160_i2c" "bmi160_core" ]; + boot.blacklistedKernelModules = mkIf config.hardware.sensor.iio.bmi260.enable [ + "bmi160_spi" + "bmi160_i2c" + "bmi160_core" + ]; hardware.sensor.iio.enable = mkIf config.hardware.sensor.iio.bmi260.enable true; } diff --git a/gpd/win-max-2/default.nix b/gpd/win-max-2/default.nix index d7ff52d6..c9762cd6 100644 --- a/gpd/win-max-2/default.nix +++ b/gpd/win-max-2/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; let cfg = config.hardware.gpd.ppt; diff --git a/gpd/win-mini/default.nix b/gpd/win-mini/default.nix index 6361d576..f0d23926 100644 --- a/gpd/win-mini/default.nix +++ b/gpd/win-mini/default.nix @@ -5,9 +5,6 @@ ... }: with lib; -let - cfg = config.hardware.gpd.ppt; -in { imports = [ ../../common/pc/laptop diff --git a/hardkernel/odroid-hc4/default.nix b/hardkernel/odroid-hc4/default.nix index e591a871..a6442aba 100644 --- a/hardkernel/odroid-hc4/default.nix +++ b/hardkernel/odroid-hc4/default.nix @@ -4,25 +4,31 @@ # Based on the config from https://www.armbian.com/odroid-hc4/ hardware.fancontrol = { enable = lib.mkDefault true; - config = let - # According to https://www.armbian.com/odroid-hc4/ the FCFANS line should be removed on kernel 5.15. - kernelVersion = config.boot.kernelPackages.kernel.version; - needFcFans = lib.versions.majorMinor kernelVersion != "5.15"; - in lib.mkDefault ('' - INTERVAL=10 - DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon2=devices/platform/pwm-fan - DEVNAME=hwmon0=cpu_thermal hwmon2=pwmfan - FCTEMPS=hwmon2/pwm1=hwmon0/temp1_input - '' + lib.optionalString needFcFans '' - FCFANS= hwmon2/pwm1=hwmon2/fan1_input - '' + '' - MINTEMP=hwmon2/pwm1=50 - MAXTEMP=hwmon2/pwm1=60 - MINSTART=hwmon2/pwm1=20 - MINSTOP=hwmon2/pwm1=28 - MINPWM=hwmon2/pwm1=0 - MAXPWM=hwmon2/pwm1=255 - ''); + config = + let + # According to https://www.armbian.com/odroid-hc4/ the FCFANS line should be removed on kernel 5.15. + kernelVersion = config.boot.kernelPackages.kernel.version; + needFcFans = lib.versions.majorMinor kernelVersion != "5.15"; + in + lib.mkDefault ( + '' + INTERVAL=10 + DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon2=devices/platform/pwm-fan + DEVNAME=hwmon0=cpu_thermal hwmon2=pwmfan + FCTEMPS=hwmon2/pwm1=hwmon0/temp1_input + '' + + lib.optionalString needFcFans '' + FCFANS= hwmon2/pwm1=hwmon2/fan1_input + '' + + '' + MINTEMP=hwmon2/pwm1=50 + MAXTEMP=hwmon2/pwm1=60 + MINSTART=hwmon2/pwm1=20 + MINSTOP=hwmon2/pwm1=28 + MINPWM=hwmon2/pwm1=0 + MAXPWM=hwmon2/pwm1=255 + '' + ); }; # Linux 5.15 sometimes crash under heavy network usage diff --git a/hp/elitebook/845/g7/default.nix b/hp/elitebook/845/g7/default.nix index d18ef3cf..542921e0 100644 --- a/hp/elitebook/845/g7/default.nix +++ b/hp/elitebook/845/g7/default.nix @@ -1,18 +1,19 @@ { pkgs, lib, ... }: { - imports = - [ - ../../../../common/cpu/amd - ../../../../common/cpu/amd/pstate.nix - ../../../../common/gpu/amd - ../../../../common/pc/laptop - ../../../../common/pc/ssd - ]; + imports = [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/amd + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ]; hardware.enableRedistributableFirmware = lib.mkDefault true; boot.kernelModules = [ "synaptics_usb" ]; - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # disable Scatter/Gather APU recently enabled by default, # which results in white screen after display reconfiguration diff --git a/hp/elitebook/845/g8/default.nix b/hp/elitebook/845/g8/default.nix index d18ef3cf..542921e0 100644 --- a/hp/elitebook/845/g8/default.nix +++ b/hp/elitebook/845/g8/default.nix @@ -1,18 +1,19 @@ { pkgs, lib, ... }: { - imports = - [ - ../../../../common/cpu/amd - ../../../../common/cpu/amd/pstate.nix - ../../../../common/gpu/amd - ../../../../common/pc/laptop - ../../../../common/pc/ssd - ]; + imports = [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/amd + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ]; hardware.enableRedistributableFirmware = lib.mkDefault true; boot.kernelModules = [ "synaptics_usb" ]; - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # disable Scatter/Gather APU recently enabled by default, # which results in white screen after display reconfiguration diff --git a/hp/elitebook/845/g9/default.nix b/hp/elitebook/845/g9/default.nix index d18ef3cf..542921e0 100644 --- a/hp/elitebook/845/g9/default.nix +++ b/hp/elitebook/845/g9/default.nix @@ -1,18 +1,19 @@ { pkgs, lib, ... }: { - imports = - [ - ../../../../common/cpu/amd - ../../../../common/cpu/amd/pstate.nix - ../../../../common/gpu/amd - ../../../../common/pc/laptop - ../../../../common/pc/ssd - ]; + imports = [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/amd + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ]; hardware.enableRedistributableFirmware = lib.mkDefault true; boot.kernelModules = [ "synaptics_usb" ]; - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") ( + lib.mkDefault pkgs.linuxPackages_latest + ); # disable Scatter/Gather APU recently enabled by default, # which results in white screen after display reconfiguration diff --git a/huawei/machc-wa/default.nix b/huawei/machc-wa/default.nix index 9e3259d8..6279843d 100644 --- a/huawei/machc-wa/default.nix +++ b/huawei/machc-wa/default.nix @@ -3,7 +3,8 @@ pkgs, config, ... -}: { +}: +{ imports = [ ../../common/cpu/intel/comet-lake ../../common/gpu/nvidia diff --git a/kobol/helios4/modules/fancontrol.nix b/kobol/helios4/modules/fancontrol.nix index 27722765..3ab73a9d 100644 --- a/kobol/helios4/modules/fancontrol.nix +++ b/kobol/helios4/modules/fancontrol.nix @@ -19,7 +19,11 @@ services.udev.packages = [ # Fan control (pkgs.callPackage ( - { stdenv, lib, coreutils }: + { + stdenv, + lib, + coreutils, + }: stdenv.mkDerivation { name = "helios4-udev-fancontrol"; @@ -39,6 +43,6 @@ platforms = platforms.linux; }; } - ) {}) + ) { }) ]; } diff --git a/kobol/helios4/overlay.nix b/kobol/helios4/overlay.nix index 32262c56..1ffd02ff 100644 --- a/kobol/helios4/overlay.nix +++ b/kobol/helios4/overlay.nix @@ -11,6 +11,6 @@ final: _prev: { rev = "v${version}"; sha256 = "sha256-QxrTPcx0n0NWUJ990EuIWyOBtknW/fHDRcrYP0yQzTo="; }; - patches = []; + patches = [ ]; }; } diff --git a/lenovo/ideacentre/k330/default.nix b/lenovo/ideacentre/k330/default.nix index ff5cf3c4..9639b738 100644 --- a/lenovo/ideacentre/k330/default.nix +++ b/lenovo/ideacentre/k330/default.nix @@ -1,19 +1,20 @@ { config, lib, ... }: { - imports = [ - ../../../common/cpu/intel - ../../../common/gpu/nvidia/fermi # Is it possible/advisable to pin this to the 390.xx driver family in case the user wants to use non-free drivers? - ../../../common/gpu/amd # The K330 could be bought with AMD GPUs but I don't have that configuration - ../../../common/pc - ]; + imports = [ + ../../../common/cpu/intel + ../../../common/gpu/nvidia/fermi # Is it possible/advisable to pin this to the 390.xx driver family in case the user wants to use non-free drivers? + ../../../common/gpu/amd # The K330 could be bought with AMD GPUs but I don't have that configuration + ../../../common/pc + ]; - # On my machine Wayland causes the desktop to freeze after a short time of operation - services.displayManager.sddm.wayland.enable = false; + # On my machine Wayland causes the desktop to freeze after a short time of operation + services.displayManager.sddm.wayland.enable = false; - # Should this be a conditional default in case plasma is activated? - # What if somebody installs both plasma AND another DE? - # The goal is to prefer x11 over wayland due to compatibility issues with the old hardware + # Should this be a conditional default in case plasma is activated? + # What if somebody installs both plasma AND another DE? + # The goal is to prefer x11 over wayland due to compatibility issues with the old hardware - - services.displayManager.defaultSession = lib.mkIf config.services.xserver.desktopManager.plasma6.enable (lib.mkDefault "plasmax11"); + services.displayManager.defaultSession = lib.mkIf config.services.xserver.desktopManager.plasma6.enable ( + lib.mkDefault "plasmax11" + ); } diff --git a/lenovo/legion/15ach6h/nvidia/default.nix b/lenovo/legion/15ach6h/nvidia/default.nix index 33f32652..37dd1148 100644 --- a/lenovo/legion/15ach6h/nvidia/default.nix +++ b/lenovo/legion/15ach6h/nvidia/default.nix @@ -10,10 +10,12 @@ # remove all packages for amd igpu. I only removed amdgpu from # services.xserver.videoDrivers by overriding. This is because the specialization # of nix cannot implement such an operation as canceling an import. - hardware = { - nvidia.prime.offload.enable = false; - } // lib.optionalAttrs (options ? amdgpu.opencl.enable) { - # introduced in https://github.com/NixOS/nixpkgs/pull/319865 - amdgpu.opencl.enable = lib.mkDefault false; - }; + hardware = + { + nvidia.prime.offload.enable = false; + } + // lib.optionalAttrs (options ? amdgpu.opencl.enable) { + # introduced in https://github.com/NixOS/nixpkgs/pull/319865 + amdgpu.opencl.enable = lib.mkDefault false; + }; } diff --git a/lenovo/legion/16ach6h/nvidia/default.nix b/lenovo/legion/16ach6h/nvidia/default.nix index 33f32652..37dd1148 100644 --- a/lenovo/legion/16ach6h/nvidia/default.nix +++ b/lenovo/legion/16ach6h/nvidia/default.nix @@ -10,10 +10,12 @@ # remove all packages for amd igpu. I only removed amdgpu from # services.xserver.videoDrivers by overriding. This is because the specialization # of nix cannot implement such an operation as canceling an import. - hardware = { - nvidia.prime.offload.enable = false; - } // lib.optionalAttrs (options ? amdgpu.opencl.enable) { - # introduced in https://github.com/NixOS/nixpkgs/pull/319865 - amdgpu.opencl.enable = lib.mkDefault false; - }; + hardware = + { + nvidia.prime.offload.enable = false; + } + // lib.optionalAttrs (options ? amdgpu.opencl.enable) { + # introduced in https://github.com/NixOS/nixpkgs/pull/319865 + amdgpu.opencl.enable = lib.mkDefault false; + }; } diff --git a/lenovo/legion/16achg6/nvidia/default.nix b/lenovo/legion/16achg6/nvidia/default.nix index 5c933fad..d279b6a2 100644 --- a/lenovo/legion/16achg6/nvidia/default.nix +++ b/lenovo/legion/16achg6/nvidia/default.nix @@ -3,10 +3,12 @@ { imports = [ ../hybrid ]; services.xserver.videoDrivers = [ "nvidia" ]; - hardware = { - nvidia.prime.offload.enable = false; - } // lib.optionalAttrs (options ? amdgpu.opencl.enable) { - # introduced in https://github.com/NixOS/nixpkgs/pull/319865 - amdgpu.opencl.enable = lib.mkDefault false; - }; + hardware = + { + nvidia.prime.offload.enable = false; + } + // lib.optionalAttrs (options ? amdgpu.opencl.enable) { + # introduced in https://github.com/NixOS/nixpkgs/pull/319865 + amdgpu.opencl.enable = lib.mkDefault false; + }; } diff --git a/lenovo/legion/16aph8/default.nix b/lenovo/legion/16aph8/default.nix index e44329fa..5771d65b 100644 --- a/lenovo/legion/16aph8/default.nix +++ b/lenovo/legion/16aph8/default.nix @@ -14,20 +14,20 @@ boot = lib.mkMerge [ (lib.mkIf (lib.versionOlder pkgs.linux.version "6.6") { kernelPackages = pkgs.linuxPackages_latest; - kernelParams = ["amdgpu.sg_display=0"]; + kernelParams = [ "amdgpu.sg_display=0" ]; }) ]; hardware.nvidia = { - modesetting.enable = lib.mkDefault true; - powerManagement.enable = lib.mkDefault false; - powerManagement.finegrained = lib.mkDefault false; - open = lib.mkDefault false; - prime = { - sync.enable = lib.mkDefault true; - amdgpuBusId = "PCI:5:0:0"; - nvidiaBusId = "PCI:1:0:0"; - }; + modesetting.enable = lib.mkDefault true; + powerManagement.enable = lib.mkDefault false; + powerManagement.finegrained = lib.mkDefault false; + open = lib.mkDefault false; + prime = { + sync.enable = lib.mkDefault true; + amdgpuBusId = "PCI:5:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; }; # Avoid issues with modesetting causing blank screen diff --git a/lenovo/legion/16arh7h/hybrid/default.nix b/lenovo/legion/16arh7h/hybrid/default.nix index 1654e23c..8dcfb46d 100644 --- a/lenovo/legion/16arh7h/hybrid/default.nix +++ b/lenovo/legion/16arh7h/hybrid/default.nix @@ -2,7 +2,8 @@ config, lib, ... -}: { +}: +{ imports = [ ../../../../common/cpu/amd ../../../../common/cpu/amd/pstate.nix @@ -12,8 +13,8 @@ ../../../../common/pc/ssd ]; - boot.kernelModules = ["amdgpu"]; - services.xserver.videoDrivers = ["nvidia"]; + boot.kernelModules = [ "amdgpu" ]; + services.xserver.videoDrivers = [ "nvidia" ]; hardware = { amdgpu.initrd.enable = false; diff --git a/lenovo/legion/16arh7h/igpu-only/default.nix b/lenovo/legion/16arh7h/igpu-only/default.nix index bd61814f..24de7ddf 100644 --- a/lenovo/legion/16arh7h/igpu-only/default.nix +++ b/lenovo/legion/16arh7h/igpu-only/default.nix @@ -1,5 +1,6 @@ # This will enable only the integrated AMD GPU, while disabling the dedicated Nvidia GPU -{...}: { +{ ... }: +{ imports = [ ../../../../common/cpu/amd ../../../../common/cpu/amd/pstate.nix diff --git a/lenovo/legion/16arha7/audio/lenovo-16ARHA7_speaker-fix.nix b/lenovo/legion/16arha7/audio/lenovo-16ARHA7_speaker-fix.nix index 3e163b6b..40843b0d 100644 --- a/lenovo/legion/16arha7/audio/lenovo-16ARHA7_speaker-fix.nix +++ b/lenovo/legion/16arha7/audio/lenovo-16ARHA7_speaker-fix.nix @@ -1,9 +1,18 @@ # Patch sourced from https://github.com/christian-bendiksen/kernel-6.8.0-63.16ARHA7.fc40 -{ pkgs, lib, kernel ? pkgs.linuxPackages_latest.kernel }: +{ + pkgs, + lib, + kernel ? pkgs.linuxPackages_latest.kernel, +}: pkgs.stdenv.mkDerivation { pname = "lenovo-16ARHA7-speaker-fix-module"; - inherit (kernel) src version postPatch nativeBuildInputs; + inherit (kernel) + src + version + postPatch + nativeBuildInputs + ; kernel_dev = kernel.dev; kernelVersion = kernel.modDirVersion; @@ -29,10 +38,10 @@ pkgs.stdenv.mkDerivation { modules_install ''; - patches = [ ./lenovo_16ARHA7_sound_fix.patch ]; + patches = [ ./lenovo_16ARHA7_sound_fix.patch ]; meta = { description = "Patch to get the speakers working for Lenovo Legion Slim 7 Gen 7 AMD (16ARHA7)"; license = lib.licenses.gpl3; }; -} \ No newline at end of file +} diff --git a/lenovo/legion/16arha7/default.nix b/lenovo/legion/16arha7/default.nix index c6e3a8c4..39fcc6be 100644 --- a/lenovo/legion/16arha7/default.nix +++ b/lenovo/legion/16arha7/default.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let lenovo-speaker-fix = pkgs.callPackage ./audio/lenovo-16ARHA7_speaker-fix.nix { @@ -15,7 +20,9 @@ in ]; # Kernel 6.10 includes the speaker fix, so only install this on systems with older kernels. - boot.extraModulePackages = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.10") [ lenovo-speaker-fix ]; + boot.extraModulePackages = + lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.10") + [ lenovo-speaker-fix ]; # √(2560² + 1600²) px / 16 in ≃ 189 dpi services.xserver.dpi = 189; diff --git a/lenovo/legion/16irx8h/default.nix b/lenovo/legion/16irx8h/default.nix index e4b6ca86..c39d8d46 100644 --- a/lenovo/legion/16irx8h/default.nix +++ b/lenovo/legion/16irx8h/default.nix @@ -2,7 +2,8 @@ lib, config, ... -}: { +}: +{ imports = [ ../../../common/cpu/intel ../../../common/gpu/nvidia/prime.nix @@ -12,8 +13,11 @@ ../../../common/hidpi.nix ]; - boot.initrd.kernelModules = ["nvidia"]; - boot.extraModulePackages = [config.boot.kernelPackages.lenovo-legion-module config.boot.kernelPackages.nvidia_x11]; + boot.initrd.kernelModules = [ "nvidia" ]; + boot.extraModulePackages = [ + config.boot.kernelPackages.lenovo-legion-module + config.boot.kernelPackages.nvidia_x11 + ]; hardware = { nvidia = { diff --git a/lenovo/legion/16irx9h/default.nix b/lenovo/legion/16irx9h/default.nix index 6a8077d8..877d31f7 100644 --- a/lenovo/legion/16irx9h/default.nix +++ b/lenovo/legion/16irx9h/default.nix @@ -2,7 +2,8 @@ lib, config, ... -}: { +}: +{ imports = [ ../../../common/cpu/intel ../../../common/gpu/nvidia/prime.nix @@ -12,7 +13,7 @@ ../../../common/hidpi.nix ]; - boot.extraModulePackages = [config.boot.kernelPackages.lenovo-legion-module]; + boot.extraModulePackages = [ config.boot.kernelPackages.lenovo-legion-module ]; hardware = { nvidia = { diff --git a/lenovo/thinkpad/a475/default.nix b/lenovo/thinkpad/a475/default.nix index dc89dc12..7a4f68cc 100644 --- a/lenovo/thinkpad/a475/default.nix +++ b/lenovo/thinkpad/a475/default.nix @@ -10,6 +10,8 @@ ../. ]; - boot.kernelParams = [ "i8042.nomux=1" "i8042.reset" ]; # Fix trackpoint and touchpad working only after reboot + boot.kernelParams = [ + "i8042.nomux=1" + "i8042.reset" + ]; # Fix trackpoint and touchpad working only after reboot } - diff --git a/lenovo/thinkpad/p1/3th-gen/audio.nix b/lenovo/thinkpad/p1/3th-gen/audio.nix index 8b6c854f..25baf545 100644 --- a/lenovo/thinkpad/p1/3th-gen/audio.nix +++ b/lenovo/thinkpad/p1/3th-gen/audio.nix @@ -1,7 +1,7 @@ { lib, pkgs, ... }: { # This can be removed when the default kernel is at least version 5.11 due to sof module - boot.kernelPackages = lib.mkIf - (lib.versionOlder pkgs.linux.version "5.11") - (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.11") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/lenovo/thinkpad/p14s/amd/gen2/default.nix b/lenovo/thinkpad/p14s/amd/gen2/default.nix index 7c496f6e..b79e1cf3 100644 --- a/lenovo/thinkpad/p14s/amd/gen2/default.nix +++ b/lenovo/thinkpad/p14s/amd/gen2/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: { imports = [ ../. @@ -9,7 +14,9 @@ # amdgpu.backlight=0 makes the backlight work # acpi_backlight=none allows the backlight save/load systemd service to work on older kernel versions - boot.kernelParams = [ "amdgpu.backlight=0" ] ++ lib.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.1.6") "acpi_backlight=none"; + boot.kernelParams = + [ "amdgpu.backlight=0" ] + ++ lib.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.1.6") "acpi_backlight=none"; # For mainline support of rtw89 wireless networking boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") pkgs.linuxPackages_latest; diff --git a/lenovo/thinkpad/p14s/amd/gen4/default.nix b/lenovo/thinkpad/p14s/amd/gen4/default.nix index cc6244e7..1e9182b7 100644 --- a/lenovo/thinkpad/p14s/amd/gen4/default.nix +++ b/lenovo/thinkpad/p14s/amd/gen4/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: { imports = [ ../. diff --git a/lenovo/thinkpad/p14s/default.nix b/lenovo/thinkpad/p14s/default.nix index 3a19fc1c..78396d32 100644 --- a/lenovo/thinkpad/p14s/default.nix +++ b/lenovo/thinkpad/p14s/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { # P14s is a rebadged T14 with slight internal differences. @@ -14,7 +19,9 @@ # "vendor" setting, in this case the thinkpad_acpi driver. # See https://hansdegoede.livejournal.com/27130.html # See https://lore.kernel.org/linux-acpi/20221105145258.12700-1-hdegoede@redhat.com/ - boot.kernelParams = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.2") [ "acpi_backlight=native" ]; + boot.kernelParams = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.2") [ + "acpi_backlight=native" + ]; # see https://github.com/NixOS/nixpkgs/issues/69289 boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.2") pkgs.linuxPackages_latest; diff --git a/lenovo/thinkpad/p14s/intel/gen5/default.nix b/lenovo/thinkpad/p14s/intel/gen5/default.nix index 919df030..49c3fc7c 100644 --- a/lenovo/thinkpad/p14s/intel/gen5/default.nix +++ b/lenovo/thinkpad/p14s/intel/gen5/default.nix @@ -8,7 +8,7 @@ ]; hardware = { - intelgpu.driver = "i915"; #xe driver may be used on newer kernels + intelgpu.driver = "i915"; # xe driver may be used on newer kernels nvidia = { prime = { intelBusId = "PCI:0:2:0"; diff --git a/lenovo/thinkpad/p16s/intel/gen2/default.nix b/lenovo/thinkpad/p16s/intel/gen2/default.nix index 39940255..299f07a3 100644 --- a/lenovo/thinkpad/p16s/intel/gen2/default.nix +++ b/lenovo/thinkpad/p16s/intel/gen2/default.nix @@ -1,4 +1,5 @@ -{lib, ...}: { +{ lib, ... }: +{ imports = [ ../. ../../../../../common/cpu/intel/raptor-lake diff --git a/lenovo/thinkpad/p43s/default.nix b/lenovo/thinkpad/p43s/default.nix index c5e34ff0..9a05aeeb 100644 --- a/lenovo/thinkpad/p43s/default.nix +++ b/lenovo/thinkpad/p43s/default.nix @@ -1,4 +1,5 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ imports = [ ../. ../../../common/cpu/intel/whiskey-lake diff --git a/lenovo/thinkpad/p50/default.nix b/lenovo/thinkpad/p50/default.nix index 62edb254..1deaddd1 100644 --- a/lenovo/thinkpad/p50/default.nix +++ b/lenovo/thinkpad/p50/default.nix @@ -1,4 +1,5 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ imports = [ ../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/maxwell @@ -19,16 +20,14 @@ hardware.enableAllFirmware = lib.mkDefault true; # fix suspend/resume screen corruption in sync mode - hardware.nvidia.powerManagement = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.powerManagement = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # fix screen tearing in sync mode - hardware.nvidia.modesetting = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.modesetting = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # Make the DPI the same in sync mode as in offload mode (disabled because # these thinkpads come with many kinds of screens, but this is valid for the diff --git a/lenovo/thinkpad/p51/default.nix b/lenovo/thinkpad/p51/default.nix index 38f5614d..da133e49 100644 --- a/lenovo/thinkpad/p51/default.nix +++ b/lenovo/thinkpad/p51/default.nix @@ -1,4 +1,5 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ imports = [ ../../../common/gpu/24.05-compat.nix ../../../common/gpu/nvidia/prime.nix @@ -25,16 +26,14 @@ hardware.enableAllFirmware = lib.mkDefault true; # fix suspend/resume screen corruption in sync mode - hardware.nvidia.powerManagement = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.powerManagement = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # fix screen tearing in sync mode - hardware.nvidia.modesetting = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.modesetting = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # Make the DPI the same in sync mode as in offload mode (disabled because # these thinkpads come with many kinds of screens, but this is valid for the diff --git a/lenovo/thinkpad/p52/default.nix b/lenovo/thinkpad/p52/default.nix index 6c9ea67b..fc8811f6 100644 --- a/lenovo/thinkpad/p52/default.nix +++ b/lenovo/thinkpad/p52/default.nix @@ -1,4 +1,5 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ imports = [ ../../../common/gpu/24.05-compat.nix ../../../common/gpu/nvidia/prime.nix @@ -26,16 +27,14 @@ hardware.enableAllFirmware = lib.mkDefault true; # fix suspend/resume screen corruption in sync mode - hardware.nvidia.powerManagement = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.powerManagement = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # fix screen tearing in sync mode - hardware.nvidia.modesetting = - lib.mkIf config.hardware.nvidia.prime.sync.enable { - enable = lib.mkDefault true; - }; + hardware.nvidia.modesetting = lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; # Make the DPI the same in sync mode as in offload mode (disabled because # these thinkpads come with many kinds of screens, but this is valid for the diff --git a/lenovo/thinkpad/t14/amd/gen4/default.nix b/lenovo/thinkpad/t14/amd/gen4/default.nix index e61a3a0d..6ca06529 100644 --- a/lenovo/thinkpad/t14/amd/gen4/default.nix +++ b/lenovo/thinkpad/t14/amd/gen4/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: { imports = [ diff --git a/lenovo/thinkpad/t14/amd/gen5/default.nix b/lenovo/thinkpad/t14/amd/gen5/default.nix index 917da63f..a092523c 100644 --- a/lenovo/thinkpad/t14/amd/gen5/default.nix +++ b/lenovo/thinkpad/t14/amd/gen5/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: { imports = [ diff --git a/lenovo/thinkpad/t410/default.nix b/lenovo/thinkpad/t410/default.nix index 9cb15b3d..cd77abaf 100644 --- a/lenovo/thinkpad/t410/default.nix +++ b/lenovo/thinkpad/t410/default.nix @@ -28,7 +28,10 @@ "i915.i915_enable_rc6=1" ]; blacklistedKernelModules = [ - "sierra_net" "cdc_mbim" "cdc_ncm" "btusb" + "sierra_net" + "cdc_mbim" + "cdc_ncm" + "btusb" ]; }; } diff --git a/lenovo/thinkpad/t490/default.nix b/lenovo/thinkpad/t490/default.nix index f524223d..cc6bfc55 100644 --- a/lenovo/thinkpad/t490/default.nix +++ b/lenovo/thinkpad/t490/default.nix @@ -12,18 +12,20 @@ # This configures a profile set for pulseaudio which offers multiple sinks corresponding to the # speaker + 4 HDMI ports. This allows the user to play audio streams on the speaker and any of the 4 HDMI/USB-C # ports at the same time. - udev.extraRules = let - t490ProfileSet = ./t490-profile-set.conf; - in '' - SUBSYSTEM!="sound", GOTO="pulseaudio_end" - ACTION!="change", GOTO="pulseaudio_end" - KERNEL!="card*", GOTO="pulseaudio_end" + udev.extraRules = + let + t490ProfileSet = ./t490-profile-set.conf; + in + '' + SUBSYSTEM!="sound", GOTO="pulseaudio_end" + ACTION!="change", GOTO="pulseaudio_end" + KERNEL!="card*", GOTO="pulseaudio_end" - # Lenovo T490 - ATTRS{vendor}=="0x8086" ATTRS{device}=="0x9dc8" ATTRS{subsystem_vendor}=="0x17aa", ATTRS{subsystem_device}=="0x2279", ENV{PULSE_PROFILE_SET}="${t490ProfileSet}" + # Lenovo T490 + ATTRS{vendor}=="0x8086" ATTRS{device}=="0x9dc8" ATTRS{subsystem_vendor}=="0x17aa", ATTRS{subsystem_device}=="0x2279", ENV{PULSE_PROFILE_SET}="${t490ProfileSet}" - LABEL="pulseaudio_end" - ''; + LABEL="pulseaudio_end" + ''; throttled.enable = lib.mkDefault true; }; diff --git a/lenovo/thinkpad/t490s/default.nix b/lenovo/thinkpad/t490s/default.nix index 35a0055b..2ee6567a 100644 --- a/lenovo/thinkpad/t490s/default.nix +++ b/lenovo/thinkpad/t490s/default.nix @@ -1,4 +1,5 @@ -{lib, ...}: { +{ lib, ... }: +{ imports = [ ../../../common/cpu/intel ../../../common/pc/ssd diff --git a/lenovo/thinkpad/x1-nano/default.nix b/lenovo/thinkpad/x1-nano/default.nix index b67595c3..fdbf9f32 100644 --- a/lenovo/thinkpad/x1-nano/default.nix +++ b/lenovo/thinkpad/x1-nano/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ # Reference to hardware: https://ubuntu.com/certified/202012-28574 imports = [ ../. diff --git a/lenovo/thinkpad/x1-nano/gen1/default.nix b/lenovo/thinkpad/x1-nano/gen1/default.nix index 22c4019f..5ce106c1 100644 --- a/lenovo/thinkpad/x1-nano/gen1/default.nix +++ b/lenovo/thinkpad/x1-nano/gen1/default.nix @@ -1,19 +1,19 @@ -{ pkgs, ... }: +{ pkgs, ... }: { imports = [ ../. ]; - environment.systemPackages = with pkgs; [ - alsa-utils - ]; + environment.systemPackages = with pkgs; [ + alsa-utils + ]; - systemd.services.x1-fix = { - description = "Use alsa-utils to fix sound interference on Thinkpad x1 Nano"; - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.alsa-tools}/bin/hda-verb /dev/snd/hwC0D0 0x1d SET_PIN_WIDGET_CONTROL 0x0"; - Restart = "on-failure"; - }; - wantedBy = [ "default.target" ]; - }; + systemd.services.x1-fix = { + description = "Use alsa-utils to fix sound interference on Thinkpad x1 Nano"; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.alsa-tools}/bin/hda-verb /dev/snd/hwC0D0 0x1d SET_PIN_WIDGET_CONTROL 0x0"; + Restart = "on-failure"; + }; + wantedBy = [ "default.target" ]; + }; } diff --git a/lenovo/thinkpad/x1/13th-gen/default.nix b/lenovo/thinkpad/x1/13th-gen/default.nix index 399ea64a..a2caba51 100644 --- a/lenovo/thinkpad/x1/13th-gen/default.nix +++ b/lenovo/thinkpad/x1/13th-gen/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: +{ lib, ... }: { imports = [ diff --git a/lenovo/thinkpad/x1/9th-gen/default.nix b/lenovo/thinkpad/x1/9th-gen/default.nix index ef8bd9f1..cb2f5b80 100644 --- a/lenovo/thinkpad/x1/9th-gen/default.nix +++ b/lenovo/thinkpad/x1/9th-gen/default.nix @@ -6,7 +6,7 @@ ]; # This solves lagging noticeable on high-resolution screens. - boot.kernelPackages = lib.mkIf - (lib.versionOlder pkgs.linux.version "5.15") - (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.15") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/lenovo/thinkpad/x1/yoga/7th-gen/default.nix b/lenovo/thinkpad/x1/yoga/7th-gen/default.nix index ed1a747f..8f5365a7 100644 --- a/lenovo/thinkpad/x1/yoga/7th-gen/default.nix +++ b/lenovo/thinkpad/x1/yoga/7th-gen/default.nix @@ -1,11 +1,12 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../. ../../../../../common/pc/ssd ]; # At least kernel 5.19 is required for the system to work properly. - boot.kernelPackages = lib.mkIf - (lib.versionOlder pkgs.linux.version "5.19") - (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.19") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/lenovo/thinkpad/x1/yoga/default.nix b/lenovo/thinkpad/x1/yoga/default.nix index 2b13440f..25b85378 100644 --- a/lenovo/thinkpad/x1/yoga/default.nix +++ b/lenovo/thinkpad/x1/yoga/default.nix @@ -1,4 +1,5 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ imports = [ ../. ../../yoga.nix diff --git a/lenovo/thinkpad/x13/amd/default.nix b/lenovo/thinkpad/x13/amd/default.nix index 61ca7b75..4543132d 100644 --- a/lenovo/thinkpad/x13/amd/default.nix +++ b/lenovo/thinkpad/x13/amd/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ../common.nix ../../../../common/cpu/amd diff --git a/lenovo/thinkpad/x13/common.nix b/lenovo/thinkpad/x13/common.nix index 131f468c..1b9a75cf 100644 --- a/lenovo/thinkpad/x13/common.nix +++ b/lenovo/thinkpad/x13/common.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ../. ../../../common/pc/ssd diff --git a/lenovo/thinkpad/x13/intel/default.nix b/lenovo/thinkpad/x13/intel/default.nix index ed4771fd..71d0324a 100644 --- a/lenovo/thinkpad/x13/intel/default.nix +++ b/lenovo/thinkpad/x13/intel/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ # Reference to hardware: https://certification.ubuntu.com/hardware/202004-27844 imports = [ ../common.nix diff --git a/lenovo/thinkpad/x13/yoga/3th-gen/default.nix b/lenovo/thinkpad/x13/yoga/3th-gen/default.nix index 1b02f61f..971b925f 100644 --- a/lenovo/thinkpad/x13/yoga/3th-gen/default.nix +++ b/lenovo/thinkpad/x13/yoga/3th-gen/default.nix @@ -1,4 +1,5 @@ -{ lib, ... }: { +{ lib, ... }: +{ imports = [ ../. ]; diff --git a/lenovo/thinkpad/x13/yoga/default.nix b/lenovo/thinkpad/x13/yoga/default.nix index b7ff8778..7719520a 100644 --- a/lenovo/thinkpad/x13/yoga/default.nix +++ b/lenovo/thinkpad/x13/yoga/default.nix @@ -1,10 +1,11 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ imports = [ ../intel ../../yoga.nix ]; services.xserver.wacom.enable = lib.mkDefault config.services.xserver.enable; - + services.hardware.bolt.enable = lib.mkDefault true; } diff --git a/lenovo/thinkpad/x13s/default.nix b/lenovo/thinkpad/x13s/default.nix index dd9159dc..59cf01b4 100644 --- a/lenovo/thinkpad/x13s/default.nix +++ b/lenovo/thinkpad/x13s/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (config.boot.kernelPackages) kernel; @@ -8,8 +13,8 @@ let # Version the dtb based on the kernel dtbEfiPath = "dtbs/x13s-${kernel.version}.dtb"; cfg = { - wifiMac = "e4:65:38:52:22:a9"; - bluetoothMac = "E4:25:18:22:44:AA"; + wifiMac = "e4:65:38:52:22:a9"; + bluetoothMac = "E4:25:18:22:44:AA"; }; inherit (lib) mkDefault; in diff --git a/lenovo/thinkpad/x390/default.nix b/lenovo/thinkpad/x390/default.nix index 80c893ba..7a3b5508 100644 --- a/lenovo/thinkpad/x390/default.nix +++ b/lenovo/thinkpad/x390/default.nix @@ -9,4 +9,3 @@ services.throttled.enable = lib.mkDefault true; } - diff --git a/lenovo/thinkpad/z/default.nix b/lenovo/thinkpad/z/default.nix index 11dda086..d3af3e5f 100644 --- a/lenovo/thinkpad/z/default.nix +++ b/lenovo/thinkpad/z/default.nix @@ -1,4 +1,5 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../../../lenovo/thinkpad ../../../common/cpu/amd @@ -15,5 +16,7 @@ # kernel versions below 6.0 don’t contain ACPI suspend2idle drivers for the Z-series’ AMD hardware # my Z13 froze after waking up from suspend/ hibernate - services.logind.lidSwitch = lib.mkIf (lib.versionOlder pkgs.linux.version "6.00") (lib.mkDefault "lock"); + services.logind.lidSwitch = lib.mkIf (lib.versionOlder pkgs.linux.version "6.00") ( + lib.mkDefault "lock" + ); } diff --git a/lenovo/thinkpad/z/gen1/default.nix b/lenovo/thinkpad/z/gen1/default.nix index b51da6e8..22d49544 100644 --- a/lenovo/thinkpad/z/gen1/default.nix +++ b/lenovo/thinkpad/z/gen1/default.nix @@ -1,8 +1,11 @@ -{ lib, pkgs, ... }: { +{ lib, pkgs, ... }: +{ imports = [ ../../../../lenovo/thinkpad/z ]; # Kernel 5.18 is required for the Ryzen 6000 series - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") ( + lib.mkDefault pkgs.linuxPackages_latest + ); } diff --git a/lenovo/thinkpad/z/gen2/default.nix b/lenovo/thinkpad/z/gen2/default.nix index cb7e05c2..a91581d8 100644 --- a/lenovo/thinkpad/z/gen2/default.nix +++ b/lenovo/thinkpad/z/gen2/default.nix @@ -6,7 +6,9 @@ ]; # Kernel 6.4 is required for the Ryzen 7040 series - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.4") (lib.mkDefault pkgs.linuxPackages_latest); + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.4") ( + lib.mkDefault pkgs.linuxPackages_latest + ); systemd.services = { # Modified from Arch Wiki diff --git a/lenovo/yoga/7/14ARH7/nvidia/default.nix b/lenovo/yoga/7/14ARH7/nvidia/default.nix index cf7aedc9..71b7e00b 100644 --- a/lenovo/yoga/7/14ARH7/nvidia/default.nix +++ b/lenovo/yoga/7/14ARH7/nvidia/default.nix @@ -5,7 +5,8 @@ let inherit (lib) mkDefault; -in { +in +{ imports = [ ../shared.nix ## "prime.nix" loads this, aleady: diff --git a/lenovo/yoga/7/14IAH7/hybrid/default.nix b/lenovo/yoga/7/14IAH7/hybrid/default.nix index d202352c..0a46b053 100644 --- a/lenovo/yoga/7/14IAH7/hybrid/default.nix +++ b/lenovo/yoga/7/14IAH7/hybrid/default.nix @@ -1,23 +1,23 @@ /* - * `lenovo-yoga-7-14IAH7-hybrid`: - * - * This is a hybrid profile that enables the NVIDIA - * driver and PRIME offload mode for making use of both - * integrated and dedicated graphics. Use this profile if - * you want to use the NVIDIA GeForce RTX 3050 Mobile. - * Read about PRIME offload mode here: - * - * - * The `lenovo-yoga-7-14IAH7-integrated` profile only - * has the integrated Intel GPU enabled. The dedicated - * NVIDIA GPU is disabled entirely. Use that profile - * instead if you want to only use integrated graphics. - * - * `nouveau` wasn't added to any profiles since it - * is known to cause freezes for this device. - * `nouveau` is blacklisted by default when enabling this: - * - */ + `lenovo-yoga-7-14IAH7-hybrid`: + + This is a hybrid profile that enables the NVIDIA + driver and PRIME offload mode for making use of both + integrated and dedicated graphics. Use this profile if + you want to use the NVIDIA GeForce RTX 3050 Mobile. + Read about PRIME offload mode here: + + + The `lenovo-yoga-7-14IAH7-integrated` profile only + has the integrated Intel GPU enabled. The dedicated + NVIDIA GPU is disabled entirely. Use that profile + instead if you want to only use integrated graphics. + + `nouveau` wasn't added to any profiles since it + is known to cause freezes for this device. + `nouveau` is blacklisted by default when enabling this: + +*/ { lib, ... }: { imports = [ diff --git a/lenovo/yoga/7/14IAH7/integrated/default.nix b/lenovo/yoga/7/14IAH7/integrated/default.nix index 6ba257b0..3a3ce89a 100644 --- a/lenovo/yoga/7/14IAH7/integrated/default.nix +++ b/lenovo/yoga/7/14IAH7/integrated/default.nix @@ -1,25 +1,25 @@ /* - * `lenovo-yoga-7-14IAH7-integrated`: - * - * This profile only has the integrated Intel GPU - * enabled. The dedicated NVIDIA GPU is disabled - * entirely. Use this profile if you want to only - * use the integrated GPU. - * - * It is recommended to use this profile to disable - * dedicated graphics, rather than doing it through - * the BIOS, since that method causes issues with - * the integrated graphics drivers. Doing it - * through blacklisting achieves the same result - * with no side-effects. - * - * The `lenovo-yoga-7-14IAH7-hybrid` hybrid profile - * enables the NVIDIA driver and PRIME offload mode - * for making use of both GPUs. Use that profile - * instead if you want to use the NVIDIA GPU. - * Read about PRIME offload mode here: - * - */ + `lenovo-yoga-7-14IAH7-integrated`: + + This profile only has the integrated Intel GPU + enabled. The dedicated NVIDIA GPU is disabled + entirely. Use this profile if you want to only + use the integrated GPU. + + It is recommended to use this profile to disable + dedicated graphics, rather than doing it through + the BIOS, since that method causes issues with + the integrated graphics drivers. Doing it + through blacklisting achieves the same result + with no side-effects. + + The `lenovo-yoga-7-14IAH7-hybrid` hybrid profile + enables the NVIDIA driver and PRIME offload mode + for making use of both GPUs. Use that profile + instead if you want to use the NVIDIA GPU. + Read about PRIME offload mode here: + +*/ { imports = [ ../shared.nix diff --git a/lenovo/yoga/7/14IAH7/shared.nix b/lenovo/yoga/7/14IAH7/shared.nix index 91220cd7..22f868e0 100644 --- a/lenovo/yoga/7/14IAH7/shared.nix +++ b/lenovo/yoga/7/14IAH7/shared.nix @@ -1,8 +1,8 @@ /* - * Here are configurations for the - * Intel Core i7-12700H CPU, along - * with a few others. - */ + Here are configurations for the + Intel Core i7-12700H CPU, along + with a few others. +*/ { imports = [ ../../../../common/cpu/intel/alder-lake diff --git a/lenovo/yoga/7/slim/gen8/default.nix b/lenovo/yoga/7/slim/gen8/default.nix index 5f87802d..7e3099c4 100644 --- a/lenovo/yoga/7/slim/gen8/default.nix +++ b/lenovo/yoga/7/slim/gen8/default.nix @@ -1,20 +1,25 @@ -{ pkgs, lib, ... }: { +{ pkgs, lib, ... }: +{ boot.initrd.kernelModules = [ "amdgpu" ]; boot.kernelModules = [ "kvm-amd" ]; - # https://gitlab.freedesktop.org/drm/amd/-/issues/2812#note_2190544 - boot.kernelParams = ["mem_sleep_default=deep" "rtc_cmos.use_acpi_alarm=1"]; + # https://gitlab.freedesktop.org/drm/amd/-/issues/2812#note_2190544 + boot.kernelParams = [ + "mem_sleep_default=deep" + "rtc_cmos.use_acpi_alarm=1" + ]; # suspend needs kernel 6.7 or later - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.7") pkgs.linuxPackages_latest; + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.7") pkgs.linuxPackages_latest; - # https://gitlab.freedesktop.org/drm/amd/-/issues/2812#note_2190544 + # https://gitlab.freedesktop.org/drm/amd/-/issues/2812#note_2190544 hardware.enableRedistributableFirmware = true; hardware.cpu.amd.updateMicrocode = true; - boot.initrd.prepend = lib.mkOrder 0 [ "${pkgs.fetchurl { - url = "https://gitlab.freedesktop.org/drm/amd/uploads/9fe228c7aa403b78c61fb1e29b3b35e3/slim7-ssdt"; - sha256 = "sha256-Ef4QTxdjt33OJEPLAPEChvvSIXx3Wd/10RGvLfG5JUs="; - name = "slim7-ssdt"; - }}" ]; + boot.initrd.prepend = lib.mkOrder 0 [ + "${pkgs.fetchurl { + url = "https://gitlab.freedesktop.org/drm/amd/uploads/9fe228c7aa403b78c61fb1e29b3b35e3/slim7-ssdt"; + sha256 = "sha256-Ef4QTxdjt33OJEPLAPEChvvSIXx3Wd/10RGvLfG5JUs="; + name = "slim7-ssdt"; + }}" + ]; } - diff --git a/microchip/common/bsp/hss-payload-generator.nix b/microchip/common/bsp/hss-payload-generator.nix index 4044d51f..74bbe07b 100644 --- a/microchip/common/bsp/hss-payload-generator.nix +++ b/microchip/common/bsp/hss-payload-generator.nix @@ -1,4 +1,4 @@ -{ pkgs, ...}: +{ pkgs, ... }: with pkgs; stdenv.mkDerivation rec { pname = "hss"; diff --git a/microchip/common/bsp/linux-icicle-kit.nix b/microchip/common/bsp/linux-icicle-kit.nix index 6ac1eb14..13d4f34f 100644 --- a/microchip/common/bsp/linux-icicle-kit.nix +++ b/microchip/common/bsp/linux-icicle-kit.nix @@ -1,65 +1,77 @@ -{ lib, buildLinux, fetchFromGitHub -, kernelPatches ? [] -, structuredExtraConfig ? {} -, extraMeta ? {} -, argsOverride ? {} -, ... } @ args: +{ + lib, + buildLinux, + fetchFromGitHub, + kernelPatches ? [ ], + structuredExtraConfig ? { }, + extraMeta ? { }, + argsOverride ? { }, + ... +}@args: let version = "6.1.43-linux4microchip+fpga-2023.09"; -in buildLinux (args // { - inherit version kernelPatches extraMeta; +in +buildLinux ( + args + // { + inherit version kernelPatches extraMeta; - # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = version; + # modDirVersion needs to be x.y.z, will automatically add .0 if needed + modDirVersion = version; - defconfig = "mpfs_defconfig"; + defconfig = "mpfs_defconfig"; - autoModules = false; + autoModules = false; - structuredExtraConfig = with lib.kernel; { - OF_OVERLAY = yes; - OF_CONFIGFS = yes; - MFD_SENSEHAT_CORE = module; - INPUT_JOYDEV = module; - INPUT_JOYSTICK = yes; - JOYSTICK_SENSEHAT = module; - AUXDISPLAY = yes; - SENSEHAT_DISPLAY = module; - HTS221 = module; - IIO_ST_PRESS = module; - IIO_ST_LSM6DSX = module; - IIO_ST_MAGN_3AXIS = module; - POLARFIRE_SOC_DMA_NONCOHERENT = yes; - MTD_SPI_NOR_USE_4K_SECTORS = no; - MTD_UBI = yes; - MTD_CMDLINE_PARTS = yes; - UBIFS_FS = yes; - USB_UAS = module; - EFI_STUB = yes; - EFI = yes; - USBIP_CORE = module; - USBIP_VHCI_HCD = module; - USBIP_HOST = module; - USBIP_VUDC = module; - CRYPTO_TLS = module; - MD = yes; - BLK_DEV_MD = module; - MD_LINEAR = module; - MD_RAID0 = module; - MD_RAID1 = module; - MD_RAID10 = module; - MD_RAID456 = module; + structuredExtraConfig = + with lib.kernel; + { + OF_OVERLAY = yes; + OF_CONFIGFS = yes; + MFD_SENSEHAT_CORE = module; + INPUT_JOYDEV = module; + INPUT_JOYSTICK = yes; + JOYSTICK_SENSEHAT = module; + AUXDISPLAY = yes; + SENSEHAT_DISPLAY = module; + HTS221 = module; + IIO_ST_PRESS = module; + IIO_ST_LSM6DSX = module; + IIO_ST_MAGN_3AXIS = module; + POLARFIRE_SOC_DMA_NONCOHERENT = yes; + MTD_SPI_NOR_USE_4K_SECTORS = no; + MTD_UBI = yes; + MTD_CMDLINE_PARTS = yes; + UBIFS_FS = yes; + USB_UAS = module; + EFI_STUB = yes; + EFI = yes; + USBIP_CORE = module; + USBIP_VHCI_HCD = module; + USBIP_HOST = module; + USBIP_VUDC = module; + CRYPTO_TLS = module; + MD = yes; + BLK_DEV_MD = module; + MD_LINEAR = module; + MD_RAID0 = module; + MD_RAID1 = module; + MD_RAID10 = module; + MD_RAID456 = module; - # This device doesn't have any kind of display output at all - FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = lib.mkForce no; - FB_EFI = lib.mkForce no; - } // structuredExtraConfig; + # This device doesn't have any kind of display output at all + FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = lib.mkForce no; + FB_EFI = lib.mkForce no; + } + // structuredExtraConfig; - src = fetchFromGitHub { - owner = "linux4microchip"; - repo = "linux"; - rev = "25e35c7c54ad853d03c14a02b189b408cb5b5eb3"; - sha256 = "sha256-wj7lz247MkhxmhSHUcNeWmcZK+DL+5PAnLwTmALD97M="; - }; -} // argsOverride) + src = fetchFromGitHub { + owner = "linux4microchip"; + repo = "linux"; + rev = "25e35c7c54ad853d03c14a02b189b408cb5b5eb3"; + sha256 = "sha256-wj7lz247MkhxmhSHUcNeWmcZK+DL+5PAnLwTmALD97M="; + }; + } + // argsOverride +) diff --git a/microchip/common/bsp/uboot.nix b/microchip/common/bsp/uboot.nix index 2db04d56..22be6d0b 100644 --- a/microchip/common/bsp/uboot.nix +++ b/microchip/common/bsp/uboot.nix @@ -1,9 +1,12 @@ { - pkgs, targetBoard, ... + pkgs, + targetBoard, + ... }: -with pkgs; let - payload-generator = pkgs.callPackage ./hss-payload-generator.nix {}; +with pkgs; +let + payload-generator = pkgs.callPackage ./hss-payload-generator.nix { }; payload_config = ./uboot.yaml; in buildUBoot rec { @@ -19,7 +22,7 @@ buildUBoot rec { }; extraMakeFlags = [ - "OPENSBI=${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin" + "OPENSBI=${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin" ]; patches = [ @@ -27,9 +30,9 @@ buildUBoot rec { ]; defconfig = "${targetBoard}_defconfig"; enableParallelBuilding = true; - extraMeta.platforms = ["riscv64-linux"]; + extraMeta.platforms = [ "riscv64-linux" ]; postBuild = '' - ${payload-generator}/hss-payload-generator -c ${payload_config} payload.bin - ''; + ${payload-generator}/hss-payload-generator -c ${payload_config} payload.bin + ''; filesToInstall = [ "payload.bin" ]; } diff --git a/microchip/common/modules.nix b/microchip/common/modules.nix index c6a75198..34874aac 100644 --- a/microchip/common/modules.nix +++ b/microchip/common/modules.nix @@ -1,8 +1,16 @@ -{ pkgs, lib, config, ... }: { +{ + pkgs, + lib, + config, + ... +}: +{ boot = { - kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/linux-icicle-kit.nix { - inherit (config.boot) kernelPatches; - }); + kernelPackages = pkgs.linuxPackagesFor ( + pkgs.callPackage ./bsp/linux-icicle-kit.nix { + inherit (config.boot) kernelPatches; + } + ); initrd.includeDefaultModules = lib.mkDefault false; }; } diff --git a/microchip/icicle-kit/overlay.nix b/microchip/icicle-kit/overlay.nix index f145dcf6..86b60d93 100644 --- a/microchip/icicle-kit/overlay.nix +++ b/microchip/icicle-kit/overlay.nix @@ -1,3 +1,6 @@ final: _prev: { - uboot-icicle-kit = final.callPackage ./../common/bsp/uboot.nix { pkgs = final; targetBoard = "microchip_mpfs_icicle";}; + uboot-icicle-kit = final.callPackage ./../common/bsp/uboot.nix { + pkgs = final; + targetBoard = "microchip_mpfs_icicle"; + }; } diff --git a/microsoft/surface-pro/9/default.nix b/microsoft/surface-pro/9/default.nix index 60b82ad3..b8334cac 100644 --- a/microsoft/surface-pro/9/default.nix +++ b/microsoft/surface-pro/9/default.nix @@ -2,4 +2,4 @@ imports = [ ../../surface/surface-pro-intel ]; boot.kernelParams = [ "i915.enable_psr=0" ]; # Disable Intel Panel Self Refresh -} \ No newline at end of file +} diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index 5d9d7d98..236ddc4b 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -1,10 +1,21 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) mkDefault mkOption types versions; + inherit (lib) + mkDefault + mkOption + types + versions + ; # Set the version and hash for the kernel sources - srcVersion = with config.hardware.microsoft-surface; + srcVersion = + with config.hardware.microsoft-surface; if kernelVersion == "longterm" then "6.12.19" else if kernelVersion == "stable" then @@ -12,7 +23,8 @@ let else abort "Invalid kernel version: ${kernelVersion}"; - srcHash = with config.hardware.microsoft-surface; + srcHash = + with config.hardware.microsoft-surface; if kernelVersion == "longterm" then "sha256-1zvwV77ARDSxadG2FkGTb30Ml865I6KB8y413U3MZTE=" else if kernelVersion == "stable" then @@ -21,15 +33,17 @@ let abort "Invalid kernel version: ${kernelVersion}"; # Set the version and hash for the linux-surface releases - pkgVersion = with config.hardware.microsoft-surface; + pkgVersion = + with config.hardware.microsoft-surface; if kernelVersion == "longterm" then "6.12.7" else if kernelVersion == "stable" then "6.14.2" else abort "Invalid kernel version: ${kernelVersion}"; - - pkgHash = with config.hardware.microsoft-surface; + + pkgHash = + with config.hardware.microsoft-surface; if kernelVersion == "longterm" then "sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY=" else if kernelVersion == "stable" then @@ -38,28 +52,46 @@ let abort "Invalid kernel version: ${kernelVersion}"; # Fetch the linux-surface package - repos = pkgs.callPackage ({ fetchFromGitHub, rev, hash }: { - linux-surface = fetchFromGitHub { - owner = "linux-surface"; - repo = "linux-surface"; - rev = rev; - hash = hash; - }; - }) { hash = pkgHash; rev = "arch-${pkgVersion}-1"; }; + repos = + pkgs.callPackage + ( + { + fetchFromGitHub, + rev, + hash, + }: + { + linux-surface = fetchFromGitHub { + owner = "linux-surface"; + repo = "linux-surface"; + rev = rev; + hash = hash; + }; + } + ) + { + hash = pkgHash; + rev = "arch-${pkgVersion}-1"; + }; # Fetch and build the kernel package - inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; }) linuxPackage surfacePatches; + inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; }) + linuxPackage + surfacePatches + ; kernelPatches = surfacePatches { version = pkgVersion; patchFn = ./kernel/${versions.majorMinor pkgVersion}/patches.nix; }; kernelPackages = linuxPackage { - inherit kernelPatches; version = srcVersion; + inherit kernelPatches; + version = srcVersion; sha256 = srcHash; - ignoreConfigErrors=true; + ignoreConfigErrors = true; }; -in { +in +{ options.hardware.microsoft-surface.kernelVersion = mkOption { description = "Kernel Version to use (patched for MS Surface)"; type = types.enum [ diff --git a/microsoft/surface/common/kernel/6.12/patches.nix b/microsoft/surface/common/kernel/6.12/patches.nix index 93e3c2ef..d5cc8ccc 100644 --- a/microsoft/surface/common/kernel/6.12/patches.nix +++ b/microsoft/surface/common/kernel/6.12/patches.nix @@ -1,4 +1,5 @@ -{ lib, +{ + lib, kernel ? lib.kernel, patchSrc, version, @@ -11,87 +12,87 @@ extraStructuredConfig = with kernel; { STAGING_MEDIA = yes; -## -## Surface Aggregator Module -## -CONFIG_SURFACE_AGGREGATOR= module; -# CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION is not set -CONFIG_SURFACE_AGGREGATOR_BUS= yes; -CONFIG_SURFACE_AGGREGATOR_CDEV= module; -CONFIG_SURFACE_AGGREGATOR_HUB= module; -CONFIG_SURFACE_AGGREGATOR_REGISTRY= module; -CONFIG_SURFACE_AGGREGATOR_TABLET_SWITCH= module; + ## + ## Surface Aggregator Module + ## + CONFIG_SURFACE_AGGREGATOR = module; + # CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION is not set + CONFIG_SURFACE_AGGREGATOR_BUS = yes; + CONFIG_SURFACE_AGGREGATOR_CDEV = module; + CONFIG_SURFACE_AGGREGATOR_HUB = module; + CONFIG_SURFACE_AGGREGATOR_REGISTRY = module; + CONFIG_SURFACE_AGGREGATOR_TABLET_SWITCH = module; -CONFIG_SURFACE_ACPI_NOTIFY= module; -CONFIG_SURFACE_DTX= module; -CONFIG_SURFACE_PLATFORM_PROFILE= module; + CONFIG_SURFACE_ACPI_NOTIFY = module; + CONFIG_SURFACE_DTX = module; + CONFIG_SURFACE_PLATFORM_PROFILE = module; -CONFIG_SURFACE_HID= module; -CONFIG_SURFACE_KBD= module; + CONFIG_SURFACE_HID = module; + CONFIG_SURFACE_KBD = module; -CONFIG_BATTERY_SURFACE= module; -CONFIG_CHARGER_SURFACE= module; + CONFIG_BATTERY_SURFACE = module; + CONFIG_CHARGER_SURFACE = module; -CONFIG_SENSORS_SURFACE_TEMP= module; -CONFIG_SENSORS_SURFACE_FAN= module; + CONFIG_SENSORS_SURFACE_TEMP = module; + CONFIG_SENSORS_SURFACE_FAN = module; -## -## Surface Hotplug -## -CONFIG_SURFACE_HOTPLUG= module; + ## + ## Surface Hotplug + ## + CONFIG_SURFACE_HOTPLUG = module; -## -## IPTS and ITHC touchscreen -## -## This only enables the user interface for IPTS/ITHC data. -## For the touchscreen to work, you need to install iptsd. -## -CONFIG_HID_IPTS= module; -CONFIG_HID_ITHC= module; + ## + ## IPTS and ITHC touchscreen + ## + ## This only enables the user interface for IPTS/ITHC data. + ## For the touchscreen to work, you need to install iptsd. + ## + CONFIG_HID_IPTS = module; + CONFIG_HID_ITHC = module; -## -## Cameras: IPU3 -## -CONFIG_VIDEO_DW9719= module; -CONFIG_VIDEO_IPU3_IMGU= module; -CONFIG_VIDEO_IPU3_CIO2= module; -CONFIG_IPU_BRIDGE= module; -CONFIG_INTEL_SKL_INT3472= module; -CONFIG_REGULATOR_TPS68470= module; -CONFIG_COMMON_CLK_TPS68470= module; -CONFIG_LEDS_TPS68470= module; + ## + ## Cameras: IPU3 + ## + CONFIG_VIDEO_DW9719 = module; + CONFIG_VIDEO_IPU3_IMGU = module; + CONFIG_VIDEO_IPU3_CIO2 = module; + CONFIG_IPU_BRIDGE = module; + CONFIG_INTEL_SKL_INT3472 = module; + CONFIG_REGULATOR_TPS68470 = module; + CONFIG_COMMON_CLK_TPS68470 = module; + CONFIG_LEDS_TPS68470 = module; -## -## Cameras: Sensor drivers -## -CONFIG_VIDEO_OV5693= module; -CONFIG_VIDEO_OV7251= module; -CONFIG_VIDEO_OV8865= module; + ## + ## Cameras: Sensor drivers + ## + CONFIG_VIDEO_OV5693 = module; + CONFIG_VIDEO_OV7251 = module; + CONFIG_VIDEO_OV8865 = module; -## -## Surface 3: atomisp causes problems (see issue #1095). Disable it for now. -## -# CONFIG_INTEL_ATOMISP is not set + ## + ## Surface 3: atomisp causes problems (see issue #1095). Disable it for now. + ## + # CONFIG_INTEL_ATOMISP is not set -## -## ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 -## -CONFIG_APDS9960= module; + ## + ## ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 + ## + CONFIG_APDS9960 = module; -## -## Build-in UFS support (required for some Surface Go devices) -## -CONFIG_SCSI_UFSHCD= module; -CONFIG_SCSI_UFSHCD_PCI= module; + ## + ## Build-in UFS support (required for some Surface Go devices) + ## + CONFIG_SCSI_UFSHCD = module; + CONFIG_SCSI_UFSHCD_PCI = module; -## -## Other Drivers -## -CONFIG_INPUT_SOC_BUTTON_ARRAY= module; -CONFIG_SURFACE_3_POWER_OPREGION= module; -CONFIG_SURFACE_PRO3_BUTTON= module; -CONFIG_SURFACE_GPE= module; -CONFIG_SURFACE_BOOK1_DGPU_SWITCH= module; + ## + ## Other Drivers + ## + CONFIG_INPUT_SOC_BUTTON_ARRAY = module; + CONFIG_SURFACE_3_POWER_OPREGION = module; + CONFIG_SURFACE_PRO3_BUTTON = module; + CONFIG_SURFACE_GPE = module; + CONFIG_SURFACE_BOOK1_DGPU_SWITCH = module; }; } { diff --git a/microsoft/surface/common/kernel/6.14/patches.nix b/microsoft/surface/common/kernel/6.14/patches.nix index a78be406..6f685ee4 100644 --- a/microsoft/surface/common/kernel/6.14/patches.nix +++ b/microsoft/surface/common/kernel/6.14/patches.nix @@ -1,4 +1,5 @@ -{ lib, +{ + lib, kernel ? lib.kernel, patchSrc, version, diff --git a/microsoft/surface/common/kernel/linux-package.nix b/microsoft/surface/common/kernel/linux-package.nix index 28e3e0e7..995ba75c 100644 --- a/microsoft/surface/common/kernel/linux-package.nix +++ b/microsoft/surface/common/kernel/linux-package.nix @@ -1,4 +1,5 @@ -{ pkgs, +{ + pkgs, lib, fetchurl, buildLinux, @@ -11,44 +12,73 @@ let inherit (lib) recurseIntoAttrs types versions; linuxPackage = - { url ? "mirror://kernel/linux/kernel/v${versions.major version}.x/linux-${version}.tar.xz", + { + url ? "mirror://kernel/linux/kernel/v${versions.major version}.x/linux-${version}.tar.xz", sha256 ? null, src ? (fetchurl { inherit url sha256; }), version, modDirVersion ? (versions.pad 3 version), - kernelPatches ? [], + kernelPatches ? [ ], ... - } @ args: let + }@args: + let inherit (builtins) removeAttrs; - args' = { - inherit src version modDirVersion kernelPatches; - } // removeAttrs args [ "url" "sha256" ]; + args' = + { + inherit + src + version + modDirVersion + kernelPatches + ; + } + // removeAttrs args [ + "url" + "sha256" + ]; linuxPackage = buildLinux args'; linuxPackages' = recurseIntoAttrs (linuxPackagesFor linuxPackage); - in linuxPackages'; + in + linuxPackages'; surfacePatches = - { patchSrc ? (repos.linux-surface + "/patches/${versions.majorMinor version}"), + { + patchSrc ? (repos.linux-surface + "/patches/${versions.majorMinor version}"), version, patchFn, - }: pkgs.callPackage patchFn { + }: + pkgs.callPackage patchFn { inherit (lib) kernel; inherit version patchSrc; }; - versionsOf = version: + versionsOf = + version: # Provides a list of versions that can be used as an enum option for this full version: - [ version (versions.majorMinor version) ]; + [ + version + (versions.majorMinor version) + ]; - versionsOfEnum = version: + versionsOfEnum = + version: # Provide an enum option for versions of this kernel: types.enum (versionsOf version); - isVersionOf = kernelVersion: version: + isVersionOf = + kernelVersion: version: # Test if the provided version is considered one of the list of versions from above: elem kernelVersion (versionsOf version); -in { - inherit linuxPackage repos surfacePatches versionsOf isVersionOf versionsOfEnum; +in +{ + inherit + linuxPackage + repos + surfacePatches + versionsOf + isVersionOf + versionsOfEnum + ; } diff --git a/microsoft/surface/surface-go/default.nix b/microsoft/surface/surface-go/default.nix index a86f741d..a5d717b1 100644 --- a/microsoft/surface/surface-go/default.nix +++ b/microsoft/surface/surface-go/default.nix @@ -6,7 +6,8 @@ let inherit (lib) mkDefault; -in { +in +{ imports = [ ../common ./firmware/ath10k diff --git a/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix b/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix index 132695e5..e5cf182d 100644 --- a/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix +++ b/microsoft/surface/surface-go/firmware/ath10k/ath10k-replace.nix @@ -1,4 +1,10 @@ -{ stdenv, lib, pkgs, firmwareLinuxNonfree, ... }: +{ + stdenv, + lib, + pkgs, + firmwareLinuxNonfree, + ... +}: let repos = pkgs.callPackage { @@ -8,14 +14,18 @@ let rev = "74e5409e699383d6ca2bc4da4a8433d16f3850b1"; sha256 = "169vgvxpgad9anmchs22fj5qm6ahzjfdnwhd8pc280q705vx6pjk"; }; - } {}; + } { }; killernetworking_firmware = repos.surface-go-ath10k-firmware_backup + "/K1535_Debian"; -in stdenv.mkDerivation { +in +stdenv.mkDerivation { pname = "microsoft-surface-go-firmware-linux-nonfree"; inherit (firmwareLinuxNonfree) version; src = firmwareLinuxNonfree; - phases = [ "unpackPhase" "installPhase" ]; + phases = [ + "unpackPhase" + "installPhase" + ]; installPhase = '' # Install the Surface Go Wifi firmware: diff --git a/microsoft/surface/surface-go/firmware/ath10k/default.nix b/microsoft/surface/surface-go/firmware/ath10k/default.nix index a7ad6a9a..efed6de8 100644 --- a/microsoft/surface/surface-go/firmware/ath10k/default.nix +++ b/microsoft/surface/surface-go/firmware/ath10k/default.nix @@ -1,11 +1,17 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkDefault mkEnableOption mkIf; cfg = config.hardware.microsoft-surface.firmware.surface-go-ath10k; -in { +in +{ options = { hardware.microsoft-surface.firmware.surface-go-ath10k = { replace = mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.''; @@ -13,18 +19,21 @@ in { }; config = mkIf cfg.replace { - warnings = [''A working version of the ath10k QCA6174 firmware has been added to the kernel.org linux-firmware - repo, making this fix obsolete. - See: - - https://github.com/linux-surface/linux-surface/issues/542#issuecomment-976995453 - - https://github.com/linux-surface/linux-surface/wiki/Surface-Go#wi-fi-firmware + warnings = [ + '' + A working version of the ath10k QCA6174 firmware has been added to the kernel.org linux-firmware + repo, making this fix obsolete. + See: + - https://github.com/linux-surface/linux-surface/issues/542#issuecomment-976995453 + - https://github.com/linux-surface/linux-surface/wiki/Surface-Go#wi-fi-firmware - NOTE: This module option will probably be removed in the near future. - '']; + NOTE: This module option will probably be removed in the near future. + '' + ]; hardware.enableAllFirmware = true; hardware.firmware = [ - (pkgs.callPackage ./ath10k-replace.nix {}) + (pkgs.callPackage ./ath10k-replace.nix { }) ]; boot.extraModprobeConfig = mkDefault '' diff --git a/microsoft/surface/surface-pro-intel/default.nix b/microsoft/surface/surface-pro-intel/default.nix index 20ebbbab..c50e4515 100644 --- a/microsoft/surface/surface-pro-intel/default.nix +++ b/microsoft/surface/surface-pro-intel/default.nix @@ -15,7 +15,7 @@ services.iptsd.enable = lib.mkDefault true; environment.systemPackages = [ pkgs.surface-control ]; - + services.thermald = lib.mkDefault { enable = true; configFile = ./thermal-conf.xml; diff --git a/milkv/pioneer/default.nix b/milkv/pioneer/default.nix index aaf685a7..a7297e6d 100644 --- a/milkv/pioneer/default.nix +++ b/milkv/pioneer/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { boot = { @@ -11,9 +16,11 @@ "sdhci_sophgo" ]; }; - kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./linux.nix { - inherit (config.boot) kernelPatches; - }); + kernelPackages = pkgs.linuxPackagesFor ( + pkgs.callPackage ./linux.nix { + inherit (config.boot) kernelPatches; + } + ); kernelParams = lib.mkDefault [ "earlycon" "console=ttyS0,115200" diff --git a/milkv/pioneer/firmware.nix b/milkv/pioneer/firmware.nix index fb49962b..2adedf74 100644 --- a/milkv/pioneer/firmware.nix +++ b/milkv/pioneer/firmware.nix @@ -1,12 +1,13 @@ -{ stdenv -, writeText -, opensbi -, fip -, zsbl -, linuxboot-kernel -, linuxboot-initrd -, dtbs ? "${linuxboot-kernel}/dtbs" -, ... +{ + stdenv, + writeText, + opensbi, + fip, + zsbl, + linuxboot-kernel, + linuxboot-initrd, + dtbs ? "${linuxboot-kernel}/dtbs", + ... }: let diff --git a/milkv/pioneer/linux.nix b/milkv/pioneer/linux.nix index b2396c75..48c4ecd1 100644 --- a/milkv/pioneer/linux.nix +++ b/milkv/pioneer/linux.nix @@ -1,44 +1,58 @@ -{ buildLinux, fetchFromGitHub, kernelPatches, lib, ... } @ args: +{ + buildLinux, + fetchFromGitHub, + kernelPatches, + lib, + ... +}@args: let modDirVersion = "6.6.20"; in -buildLinux (args // { - inherit kernelPatches modDirVersion; - version = "${modDirVersion}-milkv-pioneer"; - src = fetchFromGitHub { - owner = "sophgo"; - repo = "linux-riscv"; - rev = "caa949e3690fe8a4656313b2b56f52666fa880db"; - hash = "sha256-qJpR3KMgvP4tfPfBfQ/MiEWg/uuuxHYuACK8taKKK3E="; - }; +buildLinux ( + args + // { + inherit kernelPatches modDirVersion; + version = "${modDirVersion}-milkv-pioneer"; + src = fetchFromGitHub { + owner = "sophgo"; + repo = "linux-riscv"; + rev = "caa949e3690fe8a4656313b2b56f52666fa880db"; + hash = "sha256-qJpR3KMgvP4tfPfBfQ/MiEWg/uuuxHYuACK8taKKK3E="; + }; - defconfig = "sophgo_mango_normal_defconfig"; - structuredExtraConfig = let inherit (lib.kernel) freeform module yes; in { - # LinuxBoot will override the console bootparams which will result - # in the distro kernel to be booted with e.g. console=tty1 only. - # https://github.com/sophgo/bootloader-riscv/issues/71 - # Force output on serial console through the config. This is also - # needed to get the forced serial-getty to be started. - # We also list tty1 again because according to - # https://docs.kernel.org/admin-guide/serial-console.html and - # https://0pointer.de/blog/projects/serial-console.html - # this will be the main console. - CMDLINE = freeform "console=ttyS0,115200 console=tty1"; - CMDLINE_EXTEND = yes; + defconfig = "sophgo_mango_normal_defconfig"; + structuredExtraConfig = + let + inherit (lib.kernel) freeform module yes; + in + { + # LinuxBoot will override the console bootparams which will result + # in the distro kernel to be booted with e.g. console=tty1 only. + # https://github.com/sophgo/bootloader-riscv/issues/71 + # Force output on serial console through the config. This is also + # needed to get the forced serial-getty to be started. + # We also list tty1 again because according to + # https://docs.kernel.org/admin-guide/serial-console.html and + # https://0pointer.de/blog/projects/serial-console.html + # this will be the main console. + CMDLINE = freeform "console=ttyS0,115200 console=tty1"; + CMDLINE_EXTEND = yes; - # Enable these explicitly because they are not enabled by the defconfig. - # The all-hardware profile expects these to be built. - VIRTIO_MENU = yes; - VIRTIO_PCI = module; + # Enable these explicitly because they are not enabled by the defconfig. + # The all-hardware profile expects these to be built. + VIRTIO_MENU = yes; + VIRTIO_PCI = module; - # There is an i2c mcu driver (drivers/soc/sophgo/umcu) which is always - # compiled into the kernel. Hence some of the i2c support also needs to - # be compiled in instead of being compiled as a module. - I2C = yes; - I2C_CHARDEV = yes; - I2C_DESIGNWARE_PLATFORM = yes; - }; + # There is an i2c mcu driver (drivers/soc/sophgo/umcu) which is always + # compiled into the kernel. Hence some of the i2c support also needs to + # be compiled in instead of being compiled as a module. + I2C = yes; + I2C_CHARDEV = yes; + I2C_DESIGNWARE_PLATFORM = yes; + }; - extraMeta.branch = "sg2042-dev-6.6"; -} // (args.argsOverride or { })) + extraMeta.branch = "sg2042-dev-6.6"; + } + // (args.argsOverride or { }) +) diff --git a/milkv/pioneer/linuxboot-initrd.nix b/milkv/pioneer/linuxboot-initrd.nix index 507fc0e3..a0cfd7ef 100644 --- a/milkv/pioneer/linuxboot-initrd.nix +++ b/milkv/pioneer/linuxboot-initrd.nix @@ -1,9 +1,10 @@ -{ buildPackages -, fetchFromGitHub -, fetchpatch -, linux-firmware -, buildGoModule -, ... +{ + buildPackages, + fetchFromGitHub, + fetchpatch, + linux-firmware, + buildGoModule, + ... }: # Based on diff --git a/milkv/pioneer/linuxboot-kernel.nix b/milkv/pioneer/linuxboot-kernel.nix index 5f8fd815..d7d400e3 100644 --- a/milkv/pioneer/linuxboot-kernel.nix +++ b/milkv/pioneer/linuxboot-kernel.nix @@ -1,4 +1,10 @@ -{ fetchFromGitHub, lib, linuxManualConfig, stdenv, ... }: +{ + fetchFromGitHub, + lib, + linuxManualConfig, + stdenv, + ... +}: linuxManualConfig rec { inherit lib stdenv; diff --git a/milkv/pioneer/sd-image.nix b/milkv/pioneer/sd-image.nix index eaa378c4..dccfdd28 100644 --- a/milkv/pioneer/sd-image.nix +++ b/milkv/pioneer/sd-image.nix @@ -1,4 +1,10 @@ -{ config, lib, modulesPath, pkgs, ... }: +{ + config, + lib, + modulesPath, + pkgs, + ... +}: let inherit (pkgs) callPackage; @@ -10,7 +16,14 @@ let linuxboot-initrd = callPackage ./linuxboot-initrd.nix { }; dtbs = config.hardware.deviceTree.package; firmware = callPackage ./firmware.nix { - inherit fip zsbl opensbi linuxboot-kernel linuxboot-initrd dtbs; + inherit + fip + zsbl + opensbi + linuxboot-kernel + linuxboot-initrd + dtbs + ; }; in { diff --git a/milkv/pioneer/zsbl.nix b/milkv/pioneer/zsbl.nix index a275d301..9890e6fc 100644 --- a/milkv/pioneer/zsbl.nix +++ b/milkv/pioneer/zsbl.nix @@ -1,11 +1,12 @@ -{ buildPackages -, bison -, fetchFromGitHub -, flex -, lib -, stdenv +{ + buildPackages, + bison, + fetchFromGitHub, + flex, + lib, + stdenv, -, ... + ... }: stdenv.mkDerivation rec { pname = "zsbl-sg2042"; diff --git a/minisforum/v3/audio.nix b/minisforum/v3/audio.nix index 029b87ce..0cefc40a 100644 --- a/minisforum/v3/audio.nix +++ b/minisforum/v3/audio.nix @@ -1,7 +1,7 @@ { ... }: { # Fix microphone. - # Based on https://github.com/mudkipme/awesome-minisforum-v3/issues/10#issuecomment-2317474057 (Volume control workaround doesn't work on Arch) + # Based on https://github.com/mudkipme/awesome-minisforum-v3/issues/10#issuecomment-2317474057 (Volume control workaround doesn't work on Arch) boot.extraModprobeConfig = '' options snd-hda-intel model=alc256-asus-aio ''; diff --git a/minisforum/v3/sensors.nix b/minisforum/v3/sensors.nix index 0f336e90..453f29ed 100644 --- a/minisforum/v3/sensors.nix +++ b/minisforum/v3/sensors.nix @@ -5,7 +5,7 @@ hardware.sensor.iio.enable = lib.mkDefault true; services.fprintd.enable = lib.mkDefault true; - + # Override ACPI DSDT to fix the accelerometer. # A driver already exists for a similar sensor. # This overrides the IDs to make the existing driver work. @@ -16,7 +16,7 @@ name = "minisforum-acpi-override"; CPIO_PATH = "kernel/firmware/acpi"; - src = pkgs.callPackage ./src.nix {}; + src = pkgs.callPackage ./src.nix { }; patches = [ ./dsdt.patch ]; nativeBuildInputs = with pkgs; [ diff --git a/morefine/m600/default.nix b/morefine/m600/default.nix index 48790760..a2cae8d8 100644 --- a/morefine/m600/default.nix +++ b/morefine/m600/default.nix @@ -1,4 +1,5 @@ -{ lib, ...}: { +{ lib, ... }: +{ imports = [ ../../common/cpu/amd ../../common/cpu/amd/pstate.nix diff --git a/msi/b350-tomahawk/default.nix b/msi/b350-tomahawk/default.nix index 664c1029..440f32ae 100644 --- a/msi/b350-tomahawk/default.nix +++ b/msi/b350-tomahawk/default.nix @@ -5,5 +5,5 @@ ../../common/pc ]; - boot.kernelModules = ["nct6775"]; + boot.kernelModules = [ "nct6775" ]; } diff --git a/msi/b550-a-pro/default.nix b/msi/b550-a-pro/default.nix index e1070b0e..e1588005 100644 --- a/msi/b550-a-pro/default.nix +++ b/msi/b550-a-pro/default.nix @@ -5,5 +5,5 @@ ../../common/pc ]; - boot.kernelModules = ["nct6683"]; + boot.kernelModules = [ "nct6683" ]; } diff --git a/nxp/common/bsp/imx-atf.nix b/nxp/common/bsp/imx-atf.nix index efd8c43f..3325a13a 100644 --- a/nxp/common/bsp/imx-atf.nix +++ b/nxp/common/bsp/imx-atf.nix @@ -1,7 +1,7 @@ { - buildArmTrustedFirmware , - targetBoard , - fetchgit , + buildArmTrustedFirmware, + targetBoard, + fetchgit, }: { @@ -15,8 +15,11 @@ platform = targetBoard; enableParallelBuilding = true; # To build with tee.bin use extraMakeFlags = [ "bl31 SPD=opteed" ]; - extraMakeFlags = [ "PIE_LDFLAGS=--no-warn-rwx-segments LDFLAGS=--no-warn-rwx-segments" "bl31" ]; - extraMeta.platforms = ["aarch64-linux"]; - filesToInstall = ["build/${targetBoard}/release/bl31.bin"]; + extraMakeFlags = [ + "PIE_LDFLAGS=--no-warn-rwx-segments LDFLAGS=--no-warn-rwx-segments" + "bl31" + ]; + extraMeta.platforms = [ "aarch64-linux" ]; + filesToInstall = [ "build/${targetBoard}/release/bl31.bin" ]; }; } diff --git a/nxp/common/bsp/imx-firmware.nix b/nxp/common/bsp/imx-firmware.nix index 207d7ea2..46e905f8 100644 --- a/nxp/common/bsp/imx-firmware.nix +++ b/nxp/common/bsp/imx-firmware.nix @@ -1,5 +1,5 @@ { - pkgs , + pkgs, targetBoard, }: @@ -47,15 +47,21 @@ pkgs.stdenv.mkDerivation rec { ${firmwareSeco} --auto-accept --force ''; - filesToInstall = [ - "firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/dpfw.bin" - "firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/hdmi?xfw.bin" - ] ++ pkgs.lib.optional ( targetBoard == "imx8qm" ) - ("imx-sc-firmware-${fwScVersion}/mx8qm-mek-scfw-tcm.bin" + " " + - "imx-seco-${fwSecoVersion}/firmware/seco/mx8qmb0-ahab-container.img") - ++ pkgs.lib.optional ( targetBoard == "imx8qxp" ) - ("imx-sc-firmware-${fwScVersion}/mx8qx-mek-scfw-tcm.bin" + " " + - "imx-seco-${fwSecoVersion}/firmware/seco/mx8qxc0-ahab-container.img"); + filesToInstall = + [ + "firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/dpfw.bin" + "firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/hdmi?xfw.bin" + ] + ++ pkgs.lib.optional (targetBoard == "imx8qm") ( + "imx-sc-firmware-${fwScVersion}/mx8qm-mek-scfw-tcm.bin" + + " " + + "imx-seco-${fwSecoVersion}/firmware/seco/mx8qmb0-ahab-container.img" + ) + ++ pkgs.lib.optional (targetBoard == "imx8qxp") ( + "imx-sc-firmware-${fwScVersion}/mx8qx-mek-scfw-tcm.bin" + + " " + + "imx-seco-${fwSecoVersion}/firmware/seco/mx8qxc0-ahab-container.img" + ); installPhase = '' mkdir -p $out diff --git a/nxp/common/bsp/imx-optee-os.nix b/nxp/common/bsp/imx-optee-os.nix index eeef5a85..839d3dcd 100644 --- a/nxp/common/bsp/imx-optee-os.nix +++ b/nxp/common/bsp/imx-optee-os.nix @@ -5,9 +5,9 @@ let pkgsCross = import { - crossSystem = { - config = "aarch64-unknown-linux-gnu"; - }; + crossSystem = { + config = "aarch64-unknown-linux-gnu"; + }; }; outdir = "out/arm-plat-imx/core"; @@ -18,7 +18,7 @@ let in pkgs.stdenv.mkDerivation rec { - + pname = "imx-optee-os"; version = "5.15.32_2.0.0"; diff --git a/nxp/common/bsp/imx-uboot.nix b/nxp/common/bsp/imx-uboot.nix index 25cca39e..c2773f43 100644 --- a/nxp/common/bsp/imx-uboot.nix +++ b/nxp/common/bsp/imx-uboot.nix @@ -1,8 +1,10 @@ -{ pkgs , +{ + pkgs, targetBoard, }: -with pkgs; let +with pkgs; +let inherit buildUBoot; imx8qxp-attrs = { @@ -21,14 +23,25 @@ with pkgs; let patches = [ ../patches/0001-Add-UEFI-boot-for-imx8qm.patch ]; }; - imx8-attrs = if (targetBoard == "imx8qxp") then imx8qxp-attrs - else if (targetBoard == "imx8qm") then imx8qm-attrs - else {}; + imx8-attrs = + if (targetBoard == "imx8qxp") then + imx8qxp-attrs + else if (targetBoard == "imx8qm") then + imx8qm-attrs + else + { }; - inherit (callPackage ./imx-atf.nix { inherit buildArmTrustedFirmware; targetBoard = imx8-attrs.atf; }) armTrustedFirmwareiMX8; + inherit + (callPackage ./imx-atf.nix { + inherit buildArmTrustedFirmware; + targetBoard = imx8-attrs.atf; + }) + armTrustedFirmwareiMX8 + ; imx-firmware = callPackage ./imx-firmware.nix { inherit pkgs targetBoard; }; imx-mkimage = buildPackages.callPackage ./imx-mkimage.nix { inherit pkgs; }; -in { +in +{ ubootImx8 = buildUBoot { version = "2022.04"; src = fetchgit { @@ -41,7 +54,7 @@ in { patches = imx8-attrs.patches; enableParallelBuilding = true; defconfig = "${targetBoard}_mek_defconfig"; - extraMeta.platforms = ["aarch64-linux"]; + extraMeta.platforms = [ "aarch64-linux" ]; preBuildPhases = [ "copyBinaries" ]; copyBinaries = '' @@ -54,10 +67,9 @@ in { cat u-boot.bin head.hash > u-boot-hash.bin dd if=u-boot-hash.bin of=u-boot-atf.bin bs=1K seek=128 ${imx-mkimage} -soc ${imx8-attrs.soc} -rev B0 -append ahab-container.img -c -scfw ${imx8-attrs.scfw} -ap u-boot-atf.bin a35 0x80000000 -out flash.bin - ''; + ''; filesToInstall = [ "flash.bin" ]; }; inherit imx-firmware; } - diff --git a/nxp/common/modules.nix b/nxp/common/modules.nix index 16bf0ca4..e35eb405 100644 --- a/nxp/common/modules.nix +++ b/nxp/common/modules.nix @@ -1,4 +1,5 @@ -{ pkgs, lib, ... }: { +{ pkgs, lib, ... }: +{ nixpkgs.hostPlatform = "aarch64-linux"; boot = { diff --git a/nxp/imx8mp-evk/bsp/imx8mp-atf.nix b/nxp/imx8mp-evk/bsp/imx8mp-atf.nix index a75cec33..a3ac8107 100644 --- a/nxp/imx8mp-evk/bsp/imx8mp-atf.nix +++ b/nxp/imx8mp-evk/bsp/imx8mp-atf.nix @@ -1,8 +1,17 @@ -{ lib, fetchgit, enable-tee, stdenv, buildPackages, pkgsCross, openssl, }: +{ + lib, + fetchgit, + enable-tee, + stdenv, + buildPackages, + pkgsCross, + openssl, +}: let opteedflag = if enable-tee then "SPD=opteed" else ""; target-board = "imx8mp"; -in stdenv.mkDerivation rec { +in +stdenv.mkDerivation rec { pname = "imx8mp-atf"; version = "lf6.1.55_2.2.0"; platform = target-board; @@ -48,8 +57,7 @@ in stdenv.mkDerivation rec { meta = with lib; { homepage = "https://github.com/nxp-imx/imx-atf"; - description = - "Reference implementation of secure world software for ARMv8-A"; + description = "Reference implementation of secure world software for ARMv8-A"; license = [ licenses.bsd3 ]; maintainers = with maintainers; [ gngram ]; platforms = [ "aarch64-linux" ]; diff --git a/nxp/imx8mp-evk/bsp/imx8mp-boot.nix b/nxp/imx8mp-evk/bsp/imx8mp-boot.nix index b7fec803..8a74f500 100644 --- a/nxp/imx8mp-evk/bsp/imx8mp-boot.nix +++ b/nxp/imx8mp-evk/bsp/imx8mp-boot.nix @@ -2,26 +2,25 @@ pkgs, enable-tee ? true, }: -with pkgs; let +with pkgs; +let fw-ver = "202006"; - cp-tee = - if enable-tee - then "install -m 0644 ${imx8mp-optee-os}/tee.bin ./iMX8M/tee.bin" - else ""; + cp-tee = if enable-tee then "install -m 0644 ${imx8mp-optee-os}/tee.bin ./iMX8M/tee.bin" else ""; imx8mp-atf = pkgs.callPackage ./imx8mp-atf.nix { inherit enable-tee; }; - imx8mp-firmware = pkgs.callPackage ./imx8mp-firmware.nix {}; - imx8mp-uboot = pkgs.callPackage ./imx8mp-uboot.nix {}; - imx8mp-optee-os = pkgs.callPackage ./imx8mp-optee-os.nix {}; + imx8mp-firmware = pkgs.callPackage ./imx8mp-firmware.nix { }; + imx8mp-uboot = pkgs.callPackage ./imx8mp-uboot.nix { }; + imx8mp-optee-os = pkgs.callPackage ./imx8mp-optee-os.nix { }; src = pkgs.fetchgit { url = "https://github.com/nxp-imx/imx-mkimage.git"; rev = "c4365450fb115d87f245df2864fee1604d97c06a"; sha256 = "sha256-KVIVHwBpAwd1RKy3RrYxGIniE45CDlN5RQTXsMg1Jwk="; }; shortRev = builtins.substring 0 8 src.rev; -in { +in +{ imx8m-boot = pkgs.stdenv.mkDerivation rec { inherit src; name = "imx8mp-mkimage"; diff --git a/nxp/imx8mp-evk/bsp/imx8mp-firmware.nix b/nxp/imx8mp-evk/bsp/imx8mp-firmware.nix index 5dba9c70..361257fb 100644 --- a/nxp/imx8mp-evk/bsp/imx8mp-firmware.nix +++ b/nxp/imx8mp-evk/bsp/imx8mp-firmware.nix @@ -1,19 +1,19 @@ -{pkgs, ...}: +{ pkgs, ... }: with pkgs; - stdenv.mkDerivation rec { - pname = "imx8mp-firmware"; - version = "8.22"; +stdenv.mkDerivation rec { + pname = "imx8mp-firmware"; + version = "8.22"; - src = pkgs.fetchurl { - url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin"; - sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A="; - }; + src = pkgs.fetchurl { + url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin"; + sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A="; + }; - dontUnpack = true; - dontStrip = true; + dontUnpack = true; + dontStrip = true; - installPhase = '' - ${pkgs.bash}/bin/bash $src --auto-accept --force - mv firmware-imx-${version} $out - ''; - } + installPhase = '' + ${pkgs.bash}/bin/bash $src --auto-accept --force + mv firmware-imx-${version} $out + ''; +} diff --git a/nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix b/nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix index 70789f11..4119efb1 100644 --- a/nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix +++ b/nxp/imx8mp-evk/bsp/imx8mp-optee-os.nix @@ -1,66 +1,67 @@ -{pkgs}: let +{ pkgs }: +let python3 = pkgs.buildPackages.python3; toolchain = pkgs.gcc9Stdenv.cc; binutils = pkgs.gcc9Stdenv.cc.bintools.bintools_bin; cpp = pkgs.gcc; in - pkgs.stdenv.mkDerivation rec { - pname = "imx8mp-optee-os"; - version = "lf-6.1.55-2.2.0"; +pkgs.stdenv.mkDerivation rec { + pname = "imx8mp-optee-os"; + version = "lf-6.1.55-2.2.0"; - nativeBuildInputs = [ - python3 - ]; + nativeBuildInputs = [ + python3 + ]; - enableParallelBuilding = true; + enableParallelBuilding = true; - propagatedBuildInputs = with python3.pkgs; [ - pycryptodomex - pyelftools - cryptography - ]; + propagatedBuildInputs = with python3.pkgs; [ + pycryptodomex + pyelftools + cryptography + ]; - src = pkgs.fetchgit { - url = "https://github.com/nxp-imx/imx-optee-os.git"; - rev = "a303fc80f7c4bd713315687a1fa1d6ed136e78ee"; - sha256 = "sha256-OpyG812DX0c06bRZPKWB2cNu6gtZCOvewDhsKgrGB+s="; - }; + src = pkgs.fetchgit { + url = "https://github.com/nxp-imx/imx-optee-os.git"; + rev = "a303fc80f7c4bd713315687a1fa1d6ed136e78ee"; + sha256 = "sha256-OpyG812DX0c06bRZPKWB2cNu6gtZCOvewDhsKgrGB+s="; + }; - postPatch = '' - substituteInPlace scripts/arm32_sysreg.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace scripts/gen_tee_bin.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace scripts/pem_to_pub_c.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \ - --replace '/bin/bash' '${pkgs.bash}/bin/bash' - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp - ''; + postPatch = '' + substituteInPlace scripts/arm32_sysreg.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace scripts/gen_tee_bin.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace scripts/pem_to_pub_c.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \ + --replace '/bin/bash' '${pkgs.bash}/bin/bash' + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp + ''; - makeFlags = [ - "PLATFORM=imx" - "PLATFORM_FLAVOR=mx8mpevk" - "CFG_ARM64_core=y" - "CFG_TEE_TA_LOG_LEVEL=0" - "CFG_TEE_CORE_LOG_LEVEL=0" - "CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}" - "CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}" - ]; + makeFlags = [ + "PLATFORM=imx" + "PLATFORM_FLAVOR=mx8mpevk" + "CFG_ARM64_core=y" + "CFG_TEE_TA_LOG_LEVEL=0" + "CFG_TEE_CORE_LOG_LEVEL=0" + "CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}" + "CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}" + ]; - installPhase = '' - mkdir -p $out - cp ./out/arm-plat-imx/core/tee-raw.bin $out/tee.bin - ''; - } + installPhase = '' + mkdir -p $out + cp ./out/arm-plat-imx/core/tee-raw.bin $out/tee.bin + ''; +} diff --git a/nxp/imx8mp-evk/bsp/imx8mp-uboot.nix b/nxp/imx8mp-evk/bsp/imx8mp-uboot.nix index c542af22..14586d47 100644 --- a/nxp/imx8mp-evk/bsp/imx8mp-uboot.nix +++ b/nxp/imx8mp-evk/bsp/imx8mp-uboot.nix @@ -1,90 +1,91 @@ -{ stdenv -, lib -, bison -, dtc -, fetchgit -, flex -, gnutls -, libuuid -, ncurses -, openssl -, which -, perl -, buildPackages +{ + stdenv, + lib, + bison, + dtc, + fetchgit, + flex, + gnutls, + libuuid, + ncurses, + openssl, + which, + perl, + buildPackages, }: let ubsrc = fetchgit { - url = "https://github.com/nxp-imx/uboot-imx.git"; - # tag: "lf-6.1.55-2.2.0" - rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f"; - sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA="; - }; + url = "https://github.com/nxp-imx/uboot-imx.git"; + # tag: "lf-6.1.55-2.2.0" + rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f"; + sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA="; + }; in - (stdenv.mkDerivation { - pname = "imx8mp-uboot"; - version = "2023.04"; - src = ubsrc; +(stdenv.mkDerivation { + pname = "imx8mp-uboot"; + version = "2023.04"; + src = ubsrc; - postPatch = '' - patchShebangs tools - patchShebangs scripts - ''; + postPatch = '' + patchShebangs tools + patchShebangs scripts + ''; - nativeBuildInputs = [ - bison - flex - openssl - which - ncurses - libuuid - gnutls - openssl - perl - ]; + nativeBuildInputs = [ + bison + flex + openssl + which + ncurses + libuuid + gnutls + openssl + perl + ]; - depsBuildBuild = [ buildPackages.stdenv.cc ]; - hardeningDisable = [ "all" ]; - enableParallelBuilding = true; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + hardeningDisable = [ "all" ]; + enableParallelBuilding = true; - makeFlags = [ - "DTC=${lib.getExe buildPackages.dtc}" - "CROSS_COMPILE=${stdenv.cc.targetPrefix}" - ]; + makeFlags = [ + "DTC=${lib.getExe buildPackages.dtc}" + "CROSS_COMPILE=${stdenv.cc.targetPrefix}" + ]; - extraConfig = '' - CONFIG_USE_BOOTCOMMAND=y - CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x45000000; setenv fdt_addr_r 0x44000000; run distro_bootcmd; " - CONFIG_CMD_BOOTEFI_SELFTEST=y - CONFIG_CMD_BOOTEFI=y - CONFIG_EFI_LOADER=y - CONFIG_BLK=y - CONFIG_PARTITIONS=y - CONFIG_DM_DEVICE_REMOVE=n - CONFIG_CMD_CACHE=y - ''; + extraConfig = '' + CONFIG_USE_BOOTCOMMAND=y + CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x45000000; setenv fdt_addr_r 0x44000000; run distro_bootcmd; " + CONFIG_CMD_BOOTEFI_SELFTEST=y + CONFIG_CMD_BOOTEFI=y + CONFIG_EFI_LOADER=y + CONFIG_BLK=y + CONFIG_PARTITIONS=y + CONFIG_DM_DEVICE_REMOVE=n + CONFIG_CMD_CACHE=y + ''; - passAsFile = [ "extraConfig" ]; + passAsFile = [ "extraConfig" ]; - configurePhase = '' - runHook preConfigure + configurePhase = '' + runHook preConfigure - make imx8mp_evk_defconfig - cat $extraConfigPath >> .config + make imx8mp_evk_defconfig + cat $extraConfigPath >> .config - runHook postConfigure - ''; + runHook postConfigure + ''; - installPhase = '' - runHook preInstall + installPhase = '' + runHook preInstall - mkdir -p $out - cp ./u-boot-nodtb.bin $out - cp ./spl/u-boot-spl.bin $out - cp ./arch/arm/dts/imx8mp-evk.dtb $out - cp .config $out + mkdir -p $out + cp ./u-boot-nodtb.bin $out + cp ./spl/u-boot-spl.bin $out + cp ./arch/arm/dts/imx8mp-evk.dtb $out + cp .config $out - runHook postInstall - ''; + runHook postInstall + ''; - dontStrip = true; - }) + dontStrip = true; +}) diff --git a/nxp/imx8mp-evk/default.nix b/nxp/imx8mp-evk/default.nix index c4ba0505..13ec359a 100644 --- a/nxp/imx8mp-evk/default.nix +++ b/nxp/imx8mp-evk/default.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ nixpkgs.overlays = [ (import ./overlay.nix) ]; @@ -8,7 +9,7 @@ ]; boot.loader.grub.extraFiles = { - "imx8mp-evk.dtb" = "${pkgs.callPackage ./bsp/imx8mp-linux.nix {}}/dtbs/freescale/imx8mp-evk.dtb"; + "imx8mp-evk.dtb" = "${pkgs.callPackage ./bsp/imx8mp-linux.nix { }}/dtbs/freescale/imx8mp-evk.dtb"; }; hardware.deviceTree = { diff --git a/nxp/imx8mp-evk/modules.nix b/nxp/imx8mp-evk/modules.nix index d53f60d2..ec4e28f7 100644 --- a/nxp/imx8mp-evk/modules.nix +++ b/nxp/imx8mp-evk/modules.nix @@ -2,15 +2,16 @@ pkgs, lib, ... -}: { +}: +{ nixpkgs.hostPlatform = "aarch64-linux"; boot = { - kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/imx8mp-linux.nix {}); + kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/imx8mp-linux.nix { }); initrd.includeDefaultModules = lib.mkForce false; }; - disabledModules = ["profiles/all-hardware.nix"]; + disabledModules = [ "profiles/all-hardware.nix" ]; hardware.deviceTree.enable = true; } diff --git a/nxp/imx8mp-evk/overlay.nix b/nxp/imx8mp-evk/overlay.nix index 7f5d0c71..72166a37 100644 --- a/nxp/imx8mp-evk/overlay.nix +++ b/nxp/imx8mp-evk/overlay.nix @@ -1,3 +1,3 @@ -final: prev: { - inherit (final.callPackage ./bsp/imx8mp-boot.nix {pkgs = final;}) imx8m-boot; +final: _prev: { + inherit (final.callPackage ./bsp/imx8mp-boot.nix { pkgs = final; }) imx8m-boot; } diff --git a/nxp/imx8mq-evk/bsp/imx8mq-atf.nix b/nxp/imx8mq-evk/bsp/imx8mq-atf.nix index a7e86b86..151008bf 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-atf.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-atf.nix @@ -1,8 +1,17 @@ -{ lib, fetchgit, enable-tee, stdenv, buildPackages, pkgsCross, openssl, }: +{ + lib, + fetchgit, + enable-tee, + stdenv, + buildPackages, + pkgsCross, + openssl, +}: let opteedflag = if enable-tee then "SPD=opteed" else ""; target-board = "imx8mq"; -in stdenv.mkDerivation rec { +in +stdenv.mkDerivation rec { pname = "imx8mq-atf"; version = "lf6.1.55_2.2.0"; platform = target-board; @@ -48,8 +57,7 @@ in stdenv.mkDerivation rec { meta = with lib; { homepage = "https://github.com/nxp-imx/imx-atf"; - description = - "Reference implementation of secure world software for ARMv8-A"; + description = "Reference implementation of secure world software for ARMv8-A"; license = [ licenses.bsd3 ]; maintainers = with maintainers; [ gngram ]; platforms = [ "aarch64-linux" ]; diff --git a/nxp/imx8mq-evk/bsp/imx8mq-boot.nix b/nxp/imx8mq-evk/bsp/imx8mq-boot.nix index 2b5c246d..f38b3501 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-boot.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-boot.nix @@ -2,25 +2,24 @@ pkgs, enable-tee ? false, }: -with pkgs; let - cp-tee = - if enable-tee - then "install -m 0644 ${imx8mq-optee-os}/tee.bin ./iMX8M/tee.bin" - else ""; +with pkgs; +let + cp-tee = if enable-tee then "install -m 0644 ${imx8mq-optee-os}/tee.bin ./iMX8M/tee.bin" else ""; imx8mq-atf = pkgs.callPackage ./imx8mq-atf.nix { inherit enable-tee; }; - imx8mq-firmware = pkgs.callPackage ./imx8mq-firmware.nix {}; - imx8mq-uboot = pkgs.callPackage ./imx8mq-uboot.nix {}; - imx8mq-optee-os = pkgs.callPackage ./imx8mq-optee-os.nix {}; + imx8mq-firmware = pkgs.callPackage ./imx8mq-firmware.nix { }; + imx8mq-uboot = pkgs.callPackage ./imx8mq-uboot.nix { }; + imx8mq-optee-os = pkgs.callPackage ./imx8mq-optee-os.nix { }; src = pkgs.fetchgit { url = "https://github.com/nxp-imx/imx-mkimage.git"; rev = "c4365450fb115d87f245df2864fee1604d97c06a"; sha256 = "sha256-KVIVHwBpAwd1RKy3RrYxGIniE45CDlN5RQTXsMg1Jwk="; }; shortRev = builtins.substring 0 8 src.rev; -in { +in +{ imx8m-boot = pkgs.stdenv.mkDerivation rec { inherit src; name = "imx8mq-mkimage"; diff --git a/nxp/imx8mq-evk/bsp/imx8mq-firmware.nix b/nxp/imx8mq-evk/bsp/imx8mq-firmware.nix index e576f87f..05dba5f3 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-firmware.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-firmware.nix @@ -1,19 +1,19 @@ -{pkgs, ...}: +{ pkgs, ... }: with pkgs; - stdenv.mkDerivation rec { - pname = "imx8mq-firmware"; - version = "8.22"; +stdenv.mkDerivation rec { + pname = "imx8mq-firmware"; + version = "8.22"; - src = pkgs.fetchurl { - url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin"; - sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A="; - }; + src = pkgs.fetchurl { + url = "https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-${version}.bin"; + sha256 = "sha256-lMi86sVuxQPCMuYU931rvY4Xx9qnHU5lHqj9UDTDA1A="; + }; - dontUnpack = true; - dontStrip = true; + dontUnpack = true; + dontStrip = true; - installPhase = '' - ${pkgs.bash}/bin/bash $src --auto-accept --force - mv firmware-imx-${version} $out - ''; - } + installPhase = '' + ${pkgs.bash}/bin/bash $src --auto-accept --force + mv firmware-imx-${version} $out + ''; +} diff --git a/nxp/imx8mq-evk/bsp/imx8mq-linux.nix b/nxp/imx8mq-evk/bsp/imx8mq-linux.nix index 8e433b8c..5c2fb535 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-linux.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-linux.nix @@ -1,54 +1,56 @@ -{pkgs, ...} @ args: +{ pkgs, ... }@args: with pkgs; - buildLinux (args - // rec { - version = "6.1.55"; - name = "imx8mq-linux"; +buildLinux ( + args + // rec { + version = "6.1.55"; + name = "imx8mq-linux"; - # modDirVersion needs to be x.y.z, will automatically add .0 if needed - modDirVersion = version; + # modDirVersion needs to be x.y.z, will automatically add .0 if needed + modDirVersion = version; - defconfig = "imx_v8_defconfig"; + defconfig = "imx_v8_defconfig"; - # https://github.com/NixOS/nixpkgs/pull/366004 - # introduced a breaking change that if a module is declared but it is not being used it will faill. - ignoreConfigErrors = true; + # https://github.com/NixOS/nixpkgs/pull/366004 + # introduced a breaking change that if a module is declared but it is not being used it will faill. + ignoreConfigErrors = true; - kernelPatches = [ - ]; + kernelPatches = [ + ]; - autoModules = false; + autoModules = false; - extraConfig = '' - CRYPTO_TLS m - TLS y - MD_RAID0 m - MD_RAID1 m - MD_RAID10 m - MD_RAID456 m - DM_VERITY m - LOGO y - FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER n - FB_EFI n - EFI_STUB y - EFI y - VIRTIO y - VIRTIO_PCI y - VIRTIO_BLK y - DRM_VIRTIO_GPU y - EXT4_FS y - USBIP_CORE m - USBIP_VHCI_HCD m - USBIP_HOST m - USBIP_VUDC m - ''; + extraConfig = '' + CRYPTO_TLS m + TLS y + MD_RAID0 m + MD_RAID1 m + MD_RAID10 m + MD_RAID456 m + DM_VERITY m + LOGO y + FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER n + FB_EFI n + EFI_STUB y + EFI y + VIRTIO y + VIRTIO_PCI y + VIRTIO_BLK y + DRM_VIRTIO_GPU y + EXT4_FS y + USBIP_CORE m + USBIP_VHCI_HCD m + USBIP_HOST m + USBIP_VUDC m + ''; - src = fetchFromGitHub { - owner = "nxp-imx"; - repo = "linux-imx"; - # tag: lf-6.1.55-2.2.0 - rev = "770c5fe2c1d1529fae21b7043911cd50c6cf087e"; - sha256 = "sha256-tIWt75RUrjB6KmUuAYBVyAC1dmVGSUAgqV5ROJh3xU0="; - }; - } - // (args.argsOverride or {})) + src = fetchFromGitHub { + owner = "nxp-imx"; + repo = "linux-imx"; + # tag: lf-6.1.55-2.2.0 + rev = "770c5fe2c1d1529fae21b7043911cd50c6cf087e"; + sha256 = "sha256-tIWt75RUrjB6KmUuAYBVyAC1dmVGSUAgqV5ROJh3xU0="; + }; + } + // (args.argsOverride or { }) +) diff --git a/nxp/imx8mq-evk/bsp/imx8mq-optee-os.nix b/nxp/imx8mq-evk/bsp/imx8mq-optee-os.nix index 4fa6e3e5..73b60a35 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-optee-os.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-optee-os.nix @@ -1,66 +1,67 @@ -{pkgs}: let +{ pkgs }: +let python3 = pkgs.buildPackages.python3; toolchain = pkgs.gcc9Stdenv.cc; binutils = pkgs.gcc9Stdenv.cc.bintools.bintools_bin; cpp = pkgs.gcc; in - pkgs.stdenv.mkDerivation rec { - pname = "imx8mq-optee-os"; - version = "lf-6.1.55-2.2.0"; +pkgs.stdenv.mkDerivation rec { + pname = "imx8mq-optee-os"; + version = "lf-6.1.55-2.2.0"; - nativeBuildInputs = [ - python3 - ]; + nativeBuildInputs = [ + python3 + ]; - enableParallelBuilding = true; + enableParallelBuilding = true; - propagatedBuildInputs = with python3.pkgs; [ - pycryptodomex - pyelftools - cryptography - ]; + propagatedBuildInputs = with python3.pkgs; [ + pycryptodomex + pyelftools + cryptography + ]; - src = pkgs.fetchgit { - url = "https://github.com/nxp-imx/imx-optee-os.git"; - rev = "a303fc80f7c4bd713315687a1fa1d6ed136e78ee"; - sha256 = "sha256-OpyG812DX0c06bRZPKWB2cNu6gtZCOvewDhsKgrGB+s="; - }; + src = pkgs.fetchgit { + url = "https://github.com/nxp-imx/imx-optee-os.git"; + rev = "a303fc80f7c4bd713315687a1fa1d6ed136e78ee"; + sha256 = "sha256-OpyG812DX0c06bRZPKWB2cNu6gtZCOvewDhsKgrGB+s="; + }; - postPatch = '' - substituteInPlace scripts/arm32_sysreg.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace scripts/gen_tee_bin.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace scripts/pem_to_pub_c.py \ - --replace '/usr/bin/env python3' '${python3}/bin/python' - substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \ - --replace '/bin/bash' '${pkgs.bash}/bin/bash' - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar - substituteInPlace mk/gcc.mk \ - --replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp - ''; + postPatch = '' + substituteInPlace scripts/arm32_sysreg.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace scripts/gen_tee_bin.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace scripts/pem_to_pub_c.py \ + --replace '/usr/bin/env python3' '${python3}/bin/python' + substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \ + --replace '/bin/bash' '${pkgs.bash}/bin/bash' + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar + substituteInPlace mk/gcc.mk \ + --replace "\$(CROSS_COMPILE_\$(sm))cpp" ${cpp}/bin/cpp + ''; - makeFlags = [ - "PLATFORM=imx" - "PLATFORM_FLAVOR=mx8mqevk" - "CFG_ARM64_core=y" - "CFG_TEE_TA_LOG_LEVEL=0" - "CFG_TEE_CORE_LOG_LEVEL=0" - "CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}" - "CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}" - ]; + makeFlags = [ + "PLATFORM=imx" + "PLATFORM_FLAVOR=mx8mqevk" + "CFG_ARM64_core=y" + "CFG_TEE_TA_LOG_LEVEL=0" + "CFG_TEE_CORE_LOG_LEVEL=0" + "CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}" + "CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}" + ]; - installPhase = '' - mkdir -p $out - cp ./out/arm-plat-imx/core/tee-raw.bin $out/tee.bin - ''; - } + installPhase = '' + mkdir -p $out + cp ./out/arm-plat-imx/core/tee-raw.bin $out/tee.bin + ''; +} diff --git a/nxp/imx8mq-evk/bsp/imx8mq-uboot.nix b/nxp/imx8mq-evk/bsp/imx8mq-uboot.nix index fbbf92a1..7bb9c2df 100644 --- a/nxp/imx8mq-evk/bsp/imx8mq-uboot.nix +++ b/nxp/imx8mq-evk/bsp/imx8mq-uboot.nix @@ -1,90 +1,91 @@ -{ stdenv -, lib -, bison -, dtc -, fetchgit -, flex -, gnutls -, libuuid -, ncurses -, openssl -, which -, perl -, buildPackages +{ + stdenv, + lib, + bison, + dtc, + fetchgit, + flex, + gnutls, + libuuid, + ncurses, + openssl, + which, + perl, + buildPackages, }: let ubsrc = fetchgit { - url = "https://github.com/nxp-imx/uboot-imx.git"; - # tag: "lf-6.1.55-2.2.0" - rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f"; - sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA="; - }; + url = "https://github.com/nxp-imx/uboot-imx.git"; + # tag: "lf-6.1.55-2.2.0" + rev = "49b102d98881fc28af6e0a8af5ea2186c1d90a5f"; + sha256 = "sha256-1j6X82DqezEizeWoSS600XKPNwrQ4yT0vZuUImKAVVA="; + }; in - (stdenv.mkDerivation { - pname = "imx8mq-uboot"; - version = "2023.04"; - src = ubsrc; +(stdenv.mkDerivation { + pname = "imx8mq-uboot"; + version = "2023.04"; + src = ubsrc; - postPatch = '' - patchShebangs tools - patchShebangs scripts - ''; + postPatch = '' + patchShebangs tools + patchShebangs scripts + ''; - nativeBuildInputs = [ - bison - flex - openssl - which - ncurses - libuuid - gnutls - openssl - perl - ]; + nativeBuildInputs = [ + bison + flex + openssl + which + ncurses + libuuid + gnutls + openssl + perl + ]; - depsBuildBuild = [ buildPackages.stdenv.cc ]; - hardeningDisable = [ "all" ]; - enableParallelBuilding = true; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + hardeningDisable = [ "all" ]; + enableParallelBuilding = true; - makeFlags = [ - "DTC=${lib.getExe buildPackages.dtc}" - "CROSS_COMPILE=${stdenv.cc.targetPrefix}" - ]; + makeFlags = [ + "DTC=${lib.getExe buildPackages.dtc}" + "CROSS_COMPILE=${stdenv.cc.targetPrefix}" + ]; - extraConfig = '' - CONFIG_USE_BOOTCOMMAND=y - CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x45000000; setenv fdt_addr_r 0x44000000; run distro_bootcmd; " - CONFIG_CMD_BOOTEFI_SELFTEST=y - CONFIG_CMD_BOOTEFI=y - CONFIG_EFI_LOADER=y - CONFIG_BLK=y - CONFIG_PARTITIONS=y - CONFIG_DM_DEVICE_REMOVE=n - CONFIG_CMD_CACHE=y - ''; + extraConfig = '' + CONFIG_USE_BOOTCOMMAND=y + CONFIG_BOOTCOMMAND="setenv ramdisk_addr_r 0x45000000; setenv fdt_addr_r 0x44000000; run distro_bootcmd; " + CONFIG_CMD_BOOTEFI_SELFTEST=y + CONFIG_CMD_BOOTEFI=y + CONFIG_EFI_LOADER=y + CONFIG_BLK=y + CONFIG_PARTITIONS=y + CONFIG_DM_DEVICE_REMOVE=n + CONFIG_CMD_CACHE=y + ''; - passAsFile = [ "extraConfig" ]; + passAsFile = [ "extraConfig" ]; - configurePhase = '' - runHook preConfigure + configurePhase = '' + runHook preConfigure - make imx8mq_evk_defconfig - cat $extraConfigPath >> .config + make imx8mq_evk_defconfig + cat $extraConfigPath >> .config - runHook postConfigure - ''; + runHook postConfigure + ''; - installPhase = '' - runHook preInstall + installPhase = '' + runHook preInstall - mkdir -p $out - cp ./u-boot-nodtb.bin $out - cp ./spl/u-boot-spl.bin $out - cp ./arch/arm/dts/imx8mq-evk.dtb $out - cp .config $out + mkdir -p $out + cp ./u-boot-nodtb.bin $out + cp ./spl/u-boot-spl.bin $out + cp ./arch/arm/dts/imx8mq-evk.dtb $out + cp .config $out - runHook postInstall - ''; + runHook postInstall + ''; - dontStrip = true; - }) + dontStrip = true; +}) diff --git a/nxp/imx8mq-evk/default.nix b/nxp/imx8mq-evk/default.nix index ca35c269..95504599 100644 --- a/nxp/imx8mq-evk/default.nix +++ b/nxp/imx8mq-evk/default.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ nixpkgs.overlays = [ (import ./overlay.nix) ]; @@ -8,7 +9,7 @@ ]; boot.loader.grub.extraFiles = { - "imx8mq-evk.dtb" = "${pkgs.callPackage ./bsp/imx8mq-linux.nix {}}/dtbs/freescale/imx8mq-evk.dtb"; + "imx8mq-evk.dtb" = "${pkgs.callPackage ./bsp/imx8mq-linux.nix { }}/dtbs/freescale/imx8mq-evk.dtb"; }; hardware.deviceTree = { diff --git a/nxp/imx8mq-evk/modules.nix b/nxp/imx8mq-evk/modules.nix index 4408bebc..0307d133 100644 --- a/nxp/imx8mq-evk/modules.nix +++ b/nxp/imx8mq-evk/modules.nix @@ -2,15 +2,16 @@ pkgs, lib, ... -}: { +}: +{ nixpkgs.hostPlatform = "aarch64-linux"; boot = { - kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/imx8mq-linux.nix {}); + kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./bsp/imx8mq-linux.nix { }); initrd.includeDefaultModules = lib.mkForce false; }; - disabledModules = ["profiles/all-hardware.nix"]; + disabledModules = [ "profiles/all-hardware.nix" ]; hardware.deviceTree.enable = true; } diff --git a/nxp/imx8mq-evk/overlay.nix b/nxp/imx8mq-evk/overlay.nix index 31af2bdc..ea53ce88 100644 --- a/nxp/imx8mq-evk/overlay.nix +++ b/nxp/imx8mq-evk/overlay.nix @@ -1,3 +1,3 @@ -final: prev: { - inherit (final.callPackage ./bsp/imx8mq-boot.nix {pkgs = final;}) imx8m-boot; +final: _prev: { + inherit (final.callPackage ./bsp/imx8mq-boot.nix { pkgs = final; }) imx8m-boot; } diff --git a/nxp/imx8qm-mek/default.nix b/nxp/imx8qm-mek/default.nix index 4974455c..52c8697f 100644 --- a/nxp/imx8qm-mek/default.nix +++ b/nxp/imx8qm-mek/default.nix @@ -10,7 +10,9 @@ ]; boot.loader.grub.extraFiles = { - "imx8qm-mek.dtb" = "${pkgs.callPackage ../common/bsp/linux-imx8.nix { }}/dtbs/freescale/imx8qm-mek.dtb"; + "imx8qm-mek.dtb" = "${ + pkgs.callPackage ../common/bsp/linux-imx8.nix { } + }/dtbs/freescale/imx8qm-mek.dtb"; }; hardware.deviceTree = { diff --git a/nxp/imx8qm-mek/overlay.nix b/nxp/imx8qm-mek/overlay.nix index db250883..12d1d946 100644 --- a/nxp/imx8qm-mek/overlay.nix +++ b/nxp/imx8qm-mek/overlay.nix @@ -1,3 +1,10 @@ -final: prev: { - inherit ( final.callPackage ../common/bsp/imx-uboot.nix { pkgs = final; targetBoard = "imx8qm"; }) ubootImx8 imx-firmware; +final: _prev: { + inherit + (final.callPackage ../common/bsp/imx-uboot.nix { + pkgs = final; + targetBoard = "imx8qm"; + }) + ubootImx8 + imx-firmware + ; } diff --git a/nxp/imx8qxp-mek/overlay.nix b/nxp/imx8qxp-mek/overlay.nix index 21b339d7..bcb344b7 100644 --- a/nxp/imx8qxp-mek/overlay.nix +++ b/nxp/imx8qxp-mek/overlay.nix @@ -1,3 +1,10 @@ -final: prev: { - inherit ( final.callPackage ../common/bsp/imx-uboot.nix { pkgs = final; targetBoard = "imx8qxp"; }) ubootImx8 imx-firmware; +final: _prev: { + inherit + (final.callPackage ../common/bsp/imx-uboot.nix { + pkgs = final; + targetBoard = "imx8qxp"; + }) + ubootImx8 + imx-firmware + ; } diff --git a/olimex/teres_i/default.nix b/olimex/teres_i/default.nix index f72cb1d4..4f2c97d5 100644 --- a/olimex/teres_i/default.nix +++ b/olimex/teres_i/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ...}: +{ lib, pkgs, ... }: { hardware.deviceTree = { @@ -10,12 +10,12 @@ consoleLogLevel = lib.mkDefault 7; kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; - kernelParams = lib.mkDefault ["console=ttyS0,115200n8"]; - extraModulePackages = lib.mkDefault []; + kernelParams = lib.mkDefault [ "console=ttyS0,115200n8" ]; + extraModulePackages = lib.mkDefault [ ]; initrd = { - availableKernelModules = lib.mkDefault ["usbhid"]; - kernelModules = lib.mkDefault []; + availableKernelModules = lib.mkDefault [ "usbhid" ]; + kernelModules = lib.mkDefault [ ]; }; loader = { diff --git a/onenetbook/4/default.nix b/onenetbook/4/default.nix index 251bc651..c0b77f94 100644 --- a/onenetbook/4/default.nix +++ b/onenetbook/4/default.nix @@ -16,7 +16,7 @@ # `hid-multitouch-onenetbook4` is the fixed one, don't use `hid-multitouch`. boot.blacklistedKernelModules = [ "hid-multitouch" ]; boot.extraModulePackages = [ - (config.boot.kernelPackages.callPackage ./goodix-stylus-mastykin {}) + (config.boot.kernelPackages.callPackage ./goodix-stylus-mastykin { }) ]; # OneNetbook 4 has an accelerometer, diff --git a/onenetbook/4/goodix-stylus-mastykin/default.nix b/onenetbook/4/goodix-stylus-mastykin/default.nix index 14c5e5cd..8b81fdb0 100644 --- a/onenetbook/4/goodix-stylus-mastykin/default.nix +++ b/onenetbook/4/goodix-stylus-mastykin/default.nix @@ -1,4 +1,11 @@ -{ stdenv, lib, kernel, fetchpatch, runCommand, patch }: +{ + stdenv, + lib, + kernel, + fetchpatch, + runCommand, + patch, +}: let patch1_original = fetchpatch { @@ -6,24 +13,18 @@ let name = "goodix-stylus-mastykin-1-pen-support.patch"; sha256 = "sha256-1oc8OvfhScYvtsMeV9A4hU+09i59tEJ6HZS6jspsJR8="; }; - patch1_updated_5_12_12 = runCommand - "goodix-stylus-mastykin-1-pen-support-5.12.12.patch" {} - '' - cat ${patch1_original} > $out - ${patch}/bin/patch $out < ${./5.12.12.patch.patch} - ''; - patch1_updated_6_1 = runCommand - "goodix-stylus-mastykin-1-pen-support-6.1.patch" {} - '' - cat ${patch1_original} > $out - ${patch}/bin/patch $out < ${./6.1.patch.patch} - ''; - patch1_updated_6_12 = runCommand - "goodix-stylus-mastykin-1-pen-support-6.12.patch" {} - '' - cat ${patch1_original} > $out - ${patch}/bin/patch $out < ${./6.12.patch.patch} - ''; + patch1_updated_5_12_12 = runCommand "goodix-stylus-mastykin-1-pen-support-5.12.12.patch" { } '' + cat ${patch1_original} > $out + ${patch}/bin/patch $out < ${./5.12.12.patch.patch} + ''; + patch1_updated_6_1 = runCommand "goodix-stylus-mastykin-1-pen-support-6.1.patch" { } '' + cat ${patch1_original} > $out + ${patch}/bin/patch $out < ${./6.1.patch.patch} + ''; + patch1_updated_6_12 = runCommand "goodix-stylus-mastykin-1-pen-support-6.12.patch" { } '' + cat ${patch1_original} > $out + ${patch}/bin/patch $out < ${./6.12.patch.patch} + ''; patch1 = if (lib.versionAtLeast kernel.version "6.12") then patch1_updated_6_12 @@ -31,7 +32,8 @@ let patch1_updated_6_1 else if (lib.versionAtLeast kernel.version "5.12.12") then patch1_updated_5_12_12 - else patch1_original; + else + patch1_original; patch2 = fetchpatch { url = "https://marc.info/?l=linux-input&m=161847127221531&q=p4"; name = "goodix-stylus-mastykin-2-buttons.patch"; @@ -42,11 +44,17 @@ stdenv.mkDerivation rec { name = "hid-multitouch-onenetbook4-${version}"; inherit (kernel) version; - hardeningDisable = [ "pic" "format" ]; + hardeningDisable = [ + "pic" + "format" + ]; nativeBuildInputs = kernel.moduleBuildDependencies; src = ./.; - patches = [ patch1 patch2 ]; + patches = [ + patch1 + patch2 + ]; postUnpack = '' tar -C goodix-stylus-mastykin \ diff --git a/pine64/pinebook-pro/keyboard-updater/default.nix b/pine64/pinebook-pro/keyboard-updater/default.nix index 3138277f..2ed428cf 100644 --- a/pine64/pinebook-pro/keyboard-updater/default.nix +++ b/pine64/pinebook-pro/keyboard-updater/default.nix @@ -1,4 +1,9 @@ -{ stdenv, fetchFromGitHub, xxd, libusb1 }: +{ + stdenv, + fetchFromGitHub, + xxd, + libusb1, +}: stdenv.mkDerivation { pname = "pinebook-pro-keyboard-updater"; diff --git a/pine64/star64/default.nix b/pine64/star64/default.nix index ce7134bd..e286533c 100644 --- a/pine64/star64/default.nix +++ b/pine64/star64/default.nix @@ -1,9 +1,22 @@ -{ config, lib, pkgs, ... }: { - nixpkgs.overlays = [(self: super: { - makeModulesClosure = x: super.makeModulesClosure (x // { - allowMissing = true; - }); - })]; +{ + config, + lib, + pkgs, + ... +}: +{ + nixpkgs.overlays = [ + (_self: super: { + makeModulesClosure = + x: + super.makeModulesClosure ( + x + // { + allowMissing = true; + } + ); + }) + ]; # Somehow ttyS0 doesn't get enabled by default systemd.services."serial-getty@ttyS0".enable = lib.mkDefault true; @@ -12,15 +25,27 @@ boot = { # Force no ZFS (from nixos/modules/profiles/base.nix) until updated to kernel 6.0 # TODO still valid for star64? - supportedFilesystems = - lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" ]; + supportedFilesystems = lib.mkForce [ + "btrfs" + "reiserfs" + "vfat" + "f2fs" + "xfs" + "ntfs" + "cifs" + ]; consoleLogLevel = lib.mkDefault 7; - kernelPackages = lib.mkDefault (pkgs.callPackage ./linux-5.15.nix { - inherit (config.boot) kernelPatches; - }); + kernelPackages = lib.mkDefault ( + pkgs.callPackage ./linux-5.15.nix { + inherit (config.boot) kernelPatches; + } + ); - kernelParams = - lib.mkDefault [ "console=tty0" "console=ttyS0,115200n8" "earlycon=sbi" ]; + kernelParams = lib.mkDefault [ + "console=tty0" + "console=ttyS0,115200n8" + "earlycon=sbi" + ]; initrd.availableKernelModules = [ "8250_dw" # serial port driver @@ -39,8 +64,7 @@ }; }; - hardware.deviceTree.name = - lib.mkDefault "starfive/jh7110-pine64-star64.dtb"; + hardware.deviceTree.name = lib.mkDefault "starfive/jh7110-pine64-star64.dtb"; # Only "performance" and "schedutil" are available, # and "performance" takes precedence by default, which is a waste of power. diff --git a/pine64/star64/firmware.nix b/pine64/star64/firmware.nix index e0173a6c..5242f779 100644 --- a/pine64/star64/firmware.nix +++ b/pine64/star64/firmware.nix @@ -1,5 +1,13 @@ -{ callPackage, pkgsBuildHost, writeText, writeShellApplication -, stdenv, dtc, mtdutils, coreutils }: +{ + callPackage, + pkgsBuildHost, + writeText, + writeShellApplication, + stdenv, + dtc, + mtdutils, + coreutils, +}: let uboot = callPackage ./uboot.nix { }; opensbi = callPackage ./opensbi.nix { @@ -37,7 +45,8 @@ let }; }; ''; -in rec { +in +rec { inherit opensbi uboot; spl = stdenv.mkDerivation { name = "pine64-star64-spl"; diff --git a/pine64/star64/linux-5.15.nix b/pine64/star64/linux-5.15.nix index 020af357..28d9adbb 100644 --- a/pine64/star64/linux-5.15.nix +++ b/pine64/star64/linux-5.15.nix @@ -1,237 +1,257 @@ -{ lib, callPackage, linuxPackagesFor, kernelPatches, fetchpatch, ... }: +{ + lib, + callPackage, + linuxPackagesFor, + kernelPatches, + fetchpatch, + ... +}: let modDirVersion = "5.15.131"; - linuxPkg = { lib, fetchFromGitHub, buildLinux, ... }@args: - buildLinux (args // { - version = "${modDirVersion}-fishwaldo-star64"; + linuxPkg = + { + lib, + fetchFromGitHub, + buildLinux, + ... + }@args: + buildLinux ( + args + // { + version = "${modDirVersion}-fishwaldo-star64"; - src = fetchFromGitHub { - owner = "Fishwaldo"; - repo = "Star64_linux"; - rev = "1456c984f15e21e28fb8a9ce96d0ca10e61a71c4"; # Star64_devel branch - hash = "sha256-I5wzmxiY7PWpahYCqTOAmYEiJvpRPpUV7S21Kn9lLwg="; - }; + src = fetchFromGitHub { + owner = "Fishwaldo"; + repo = "Star64_linux"; + rev = "1456c984f15e21e28fb8a9ce96d0ca10e61a71c4"; # Star64_devel branch + hash = "sha256-I5wzmxiY7PWpahYCqTOAmYEiJvpRPpUV7S21Kn9lLwg="; + }; - inherit modDirVersion; - defconfig = "pine64_star64_defconfig"; - kernelPatches = [ - { patch = fetchpatch { - url = "https://github.com/torvalds/linux/commit/215bebc8c6ac438c382a6a56bd2764a2d4e1da72.diff"; - hash = "sha256-1ZqmVOkgcDBRkHvVRPH8I5G1STIS1R/l/63PzQQ0z0I="; - includes = ["security/keys/dh.c"]; - }; - } - { patch = fetchpatch { - url = "https://github.com/starfive-tech/linux/pull/108/commits/9ae8cb751c4d1fd2146b279a8e67887590e9d07a.diff"; - hash = "sha256-EY0lno+HkY5mradBUPII3qqu0xh+BVQRzveCQcaht0M="; - }; - } - { patch = ./irq-desc-to-data.patch; } - ] ++ kernelPatches; + inherit modDirVersion; + defconfig = "pine64_star64_defconfig"; + kernelPatches = [ + { + patch = fetchpatch { + url = "https://github.com/torvalds/linux/commit/215bebc8c6ac438c382a6a56bd2764a2d4e1da72.diff"; + hash = "sha256-1ZqmVOkgcDBRkHvVRPH8I5G1STIS1R/l/63PzQQ0z0I="; + includes = [ "security/keys/dh.c" ]; + }; + } + { + patch = fetchpatch { + url = "https://github.com/starfive-tech/linux/pull/108/commits/9ae8cb751c4d1fd2146b279a8e67887590e9d07a.diff"; + hash = "sha256-EY0lno+HkY5mradBUPII3qqu0xh+BVQRzveCQcaht0M="; + }; + } + { patch = ./irq-desc-to-data.patch; } + ] ++ kernelPatches; - structuredExtraConfig = with lib.kernel; { - # A ton of stuff just does not build. We disable it all. - # Most of it is not important except drm. - # https://github.com/starfive-tech/linux/issues/79 + structuredExtraConfig = with lib.kernel; { + # A ton of stuff just does not build. We disable it all. + # Most of it is not important except drm. + # https://github.com/starfive-tech/linux/issues/79 - # Removed files, re-added to the makefile by accident in - # https://github.com/Fishwaldo/Star64_linux/commit/cd96097d17a494974dfc5e9909476145ab4f09f5 - CRYPTO_RMD128 = no; - CRYPTO_RMD256 = no; - CRYPTO_RMD320 = no; - CRYPTO_TGR192 = no; - CRYPTO_SALSA20 = no; + # Removed files, re-added to the makefile by accident in + # https://github.com/Fishwaldo/Star64_linux/commit/cd96097d17a494974dfc5e9909476145ab4f09f5 + CRYPTO_RMD128 = no; + CRYPTO_RMD256 = no; + CRYPTO_RMD320 = no; + CRYPTO_TGR192 = no; + CRYPTO_SALSA20 = no; - CRYPTO_SM4 = no; # modpost: undefined stuff - CRYPTO_DEV_CCREE = no; # reverse dep of CRYPTO_SM4 - NLS_CODEPAGE_949 = no; - VIDEO_OV5640 = no; # conflicts with starfive VIN_SENSOR_OV5640 + CRYPTO_SM4 = no; # modpost: undefined stuff + CRYPTO_DEV_CCREE = no; # reverse dep of CRYPTO_SM4 + NLS_CODEPAGE_949 = no; + VIDEO_OV5640 = no; # conflicts with starfive VIN_SENSOR_OV5640 - DRM_IMG = no; - DRM_IMG_ROGUE = no; - DRM_VERISILICON = no; + DRM_IMG = no; + DRM_IMG_ROGUE = no; + DRM_VERISILICON = no; - # brute force disable drm - CEC_CORE = no; - CEC_NOTIFIER = no; - DRM = lib.mkForce no; - DRM_MIPI_DBI = no; - DRM_MIPI_DSI = no; - DRM_DP_AUX_BUS = no; - DRM_DP_AUX_CHARDEV = lib.mkForce no; - DRM_KMS_HELPER = no; - DRM_FBDEV_EMULATION = lib.mkForce no; - DRM_LOAD_EDID_FIRMWARE = lib.mkForce no; - DRM_TTM = no; - DRM_VRAM_HELPER = no; - DRM_TTM_HELPER = no; - DRM_GEM_CMA_HELPER = no; - DRM_KMS_CMA_HELPER = no; - DRM_GEM_SHMEM_HELPER = no; - DRM_SCHED = no; - DRM_I2C_CH7006 = no; - DRM_I2C_SIL164 = no; - DRM_I2C_NXP_TDA998X = no; # https://github.com/starfive-tech/linux/pull/86 - DRM_I2C_NXP_TDA9950 = no; - DRM_KOMEDA = no; - DRM_RADEON = no; - DRM_AMDGPU = no; - DRM_AMDGPU_SI = lib.mkForce no; - DRM_AMDGPU_CIK = lib.mkForce no; - DRM_AMDGPU_USERPTR = lib.mkForce no; - DRM_AMD_DC = no; - DRM_AMD_DC_HDCP = lib.mkForce no; - DRM_AMD_DC_SI = lib.mkForce no; - DRM_NOUVEAU = no; - NOUVEAU_LEGACY_CTX_SUPPORT = no; - DRM_NOUVEAU_BACKLIGHT = no; - DRM_VGEM = no; - DRM_VKMS = no; - DRM_UDL = no; - DRM_AST = no; - DRM_MGAG200 = no; - DRM_RCAR_DW_HDMI = no; - DRM_QXL = no; - DRM_VIRTIO_GPU = no; - DRM_PANEL = no; - DRM_PANEL_ABT_Y030XX067A = no; - DRM_PANEL_ARM_VERSATILE = no; - DRM_PANEL_ASUS_Z00T_TM5P5_NT35596 = no; - DRM_PANEL_BOE_HIMAX8279D = no; - DRM_PANEL_BOE_TV101WUM_NL6 = no; - DRM_PANEL_DSI_CM = no; - DRM_PANEL_LVDS = no; - DRM_PANEL_SIMPLE = no; - DRM_PANEL_ELIDA_KD35T133 = no; - DRM_PANEL_FEIXIN_K101_IM2BA02 = no; - DRM_PANEL_FEIYANG_FY07024DI26A30D = no; - DRM_PANEL_ILITEK_IL9322 = no; - DRM_PANEL_ILITEK_ILI9341 = no; - DRM_PANEL_ILITEK_ILI9881C = no; - DRM_PANEL_INNOLUX_EJ030NA = no; - DRM_PANEL_INNOLUX_P079ZCA = no; - DRM_PANEL_JDI_LT070ME05000 = no; - DRM_PANEL_KHADAS_TS050 = no; - DRM_PANEL_KINGDISPLAY_KD097D04 = no; - DRM_PANEL_LEADTEK_LTK050H3146W = no; - DRM_PANEL_LEADTEK_LTK500HD1829 = no; - DRM_PANEL_SAMSUNG_LD9040 = no; - DRM_PANEL_LG_LB035Q02 = no; - DRM_PANEL_LG_LG4573 = no; - DRM_PANEL_NEC_NL8048HL11 = no; - DRM_PANEL_NOVATEK_NT35510 = no; - DRM_PANEL_NOVATEK_NT36672A = no; - DRM_PANEL_NOVATEK_NT39016 = no; - DRM_PANEL_MANTIX_MLAF057WE51 = no; - DRM_PANEL_OLIMEX_LCD_OLINUXINO = no; - DRM_PANEL_ORISETECH_OTM8009A = no; - DRM_PANEL_OSD_OSD101T2587_53TS = no; - DRM_PANEL_PANASONIC_VVX10F034N00 = no; - DRM_PANEL_RASPBERRYPI_TOUCHSCREEN = no; - DRM_PANEL_RAYDIUM_RM67191 = no; - DRM_PANEL_RAYDIUM_RM68200 = no; - DRM_PANEL_RONBO_RB070D30 = no; - DRM_PANEL_SAMSUNG_ATNA33XC20 = no; - DRM_PANEL_SAMSUNG_DB7430 = no; - DRM_PANEL_SAMSUNG_S6D16D0 = no; - DRM_PANEL_SAMSUNG_S6E3HA2 = no; - DRM_PANEL_SAMSUNG_S6E63J0X03 = no; - DRM_PANEL_SAMSUNG_S6E63M0 = no; - DRM_PANEL_SAMSUNG_S6E63M0_SPI = no; - DRM_PANEL_SAMSUNG_S6E63M0_DSI = no; - DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 = no; - DRM_PANEL_SAMSUNG_S6E8AA0 = no; - DRM_PANEL_SAMSUNG_SOFEF00 = no; - DRM_PANEL_SEIKO_43WVF1G = no; - DRM_PANEL_SHARP_LQ101R1SX01 = no; - DRM_PANEL_SHARP_LS037V7DW01 = no; - DRM_PANEL_SHARP_LS043T1LE01 = no; - DRM_PANEL_SITRONIX_ST7701 = no; - DRM_PANEL_SITRONIX_ST7703 = no; - DRM_PANEL_SITRONIX_ST7789V = no; - DRM_PANEL_SONY_ACX565AKM = no; - DRM_PANEL_TDO_TL070WSH30 = no; - DRM_PANEL_TPO_TD028TTEC1 = no; - DRM_PANEL_TPO_TD043MTEA1 = no; - DRM_PANEL_TPO_TPG110 = no; - DRM_PANEL_TRULY_NT35597_WQXGA = no; - DRM_PANEL_VISIONOX_RM69299 = no; - DRM_PANEL_WIDECHIPS_WS2401 = no; - DRM_PANEL_XINPENG_XPP055C272 = no; - DRM_BRIDGE = no; - DRM_PANEL_BRIDGE = no; - DRM_CDNS_DSI = no; - DRM_CHIPONE_ICN6211 = no; - DRM_CHRONTEL_CH7033 = no; - DRM_DISPLAY_CONNECTOR = no; - DRM_LONTIUM_LT8912B = no; - DRM_LONTIUM_LT9611 = no; - DRM_LONTIUM_LT9611UXC = no; - DRM_ITE_IT66121 = no; - DRM_LVDS_CODEC = no; - DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW = no; - DRM_NWL_MIPI_DSI = no; - DRM_NXP_PTN3460 = no; - DRM_PARADE_PS8622 = no; - DRM_PARADE_PS8640 = no; - DRM_SIL_SII8620 = no; - DRM_SII902X = no; - DRM_SII9234 = no; - DRM_SIMPLE_BRIDGE = no; - DRM_THINE_THC63LVD1024 = no; - DRM_TOSHIBA_TC358762 = no; - DRM_TOSHIBA_TC358764 = no; - DRM_TOSHIBA_TC358767 = no; - DRM_TOSHIBA_TC358768 = no; - DRM_TOSHIBA_TC358775 = no; - DRM_TI_TFP410 = no; - DRM_TI_SN65DSI83 = no; - DRM_TI_SN65DSI86 = no; - DRM_TI_TPD12S015 = no; - DRM_ANALOGIX_ANX6345 = no; - DRM_ANALOGIX_ANX78XX = no; - DRM_ANALOGIX_DP = no; - DRM_ANALOGIX_ANX7625 = no; - DRM_I2C_ADV7511 = no; - DRM_I2C_ADV7511_CEC = no; - DRM_CDNS_MHDP8546 = no; - DRM_DW_HDMI = no; - DRM_DW_HDMI_AHB_AUDIO = no; - DRM_DW_HDMI_I2S_AUDIO = no; - DRM_DW_HDMI_CEC = no; - DRM_ETNAVIV = no; - DRM_ETNAVIV_THERMAL = no; - DRM_MXS = no; - DRM_MXSFB = no; - DRM_ARCPGU = no; - DRM_BOCHS = no; - DRM_CIRRUS_QEMU = no; - DRM_GM12U320 = no; - TINYDRM_HX8357D = no; - TINYDRM_ILI9225 = no; - TINYDRM_ILI9341 = no; - TINYDRM_ILI9486 = no; - TINYDRM_MI0283QT = no; - TINYDRM_REPAPER = no; - TINYDRM_ST7586 = no; - TINYDRM_ST7735R = no; - DRM_GUD = no; - DRM_LEGACY = no; - DRM_TDFX = no; - DRM_R128 = no; - DRM_MGA = no; - DRM_VIA = no; - DRM_SAVAGE = no; - VIDEOMODE_HELPERS = no; - SND_PCM_ELD = no; - SND_PCM_IEC958 = no; - SND_HDA_COMPONENT = no; - SND_SOC_HDMI_CODEC = no; - VIRTIO_DMA_SHARED_BUFFER = no; - }; + # brute force disable drm + CEC_CORE = no; + CEC_NOTIFIER = no; + DRM = lib.mkForce no; + DRM_MIPI_DBI = no; + DRM_MIPI_DSI = no; + DRM_DP_AUX_BUS = no; + DRM_DP_AUX_CHARDEV = lib.mkForce no; + DRM_KMS_HELPER = no; + DRM_FBDEV_EMULATION = lib.mkForce no; + DRM_LOAD_EDID_FIRMWARE = lib.mkForce no; + DRM_TTM = no; + DRM_VRAM_HELPER = no; + DRM_TTM_HELPER = no; + DRM_GEM_CMA_HELPER = no; + DRM_KMS_CMA_HELPER = no; + DRM_GEM_SHMEM_HELPER = no; + DRM_SCHED = no; + DRM_I2C_CH7006 = no; + DRM_I2C_SIL164 = no; + DRM_I2C_NXP_TDA998X = no; # https://github.com/starfive-tech/linux/pull/86 + DRM_I2C_NXP_TDA9950 = no; + DRM_KOMEDA = no; + DRM_RADEON = no; + DRM_AMDGPU = no; + DRM_AMDGPU_SI = lib.mkForce no; + DRM_AMDGPU_CIK = lib.mkForce no; + DRM_AMDGPU_USERPTR = lib.mkForce no; + DRM_AMD_DC = no; + DRM_AMD_DC_HDCP = lib.mkForce no; + DRM_AMD_DC_SI = lib.mkForce no; + DRM_NOUVEAU = no; + NOUVEAU_LEGACY_CTX_SUPPORT = no; + DRM_NOUVEAU_BACKLIGHT = no; + DRM_VGEM = no; + DRM_VKMS = no; + DRM_UDL = no; + DRM_AST = no; + DRM_MGAG200 = no; + DRM_RCAR_DW_HDMI = no; + DRM_QXL = no; + DRM_VIRTIO_GPU = no; + DRM_PANEL = no; + DRM_PANEL_ABT_Y030XX067A = no; + DRM_PANEL_ARM_VERSATILE = no; + DRM_PANEL_ASUS_Z00T_TM5P5_NT35596 = no; + DRM_PANEL_BOE_HIMAX8279D = no; + DRM_PANEL_BOE_TV101WUM_NL6 = no; + DRM_PANEL_DSI_CM = no; + DRM_PANEL_LVDS = no; + DRM_PANEL_SIMPLE = no; + DRM_PANEL_ELIDA_KD35T133 = no; + DRM_PANEL_FEIXIN_K101_IM2BA02 = no; + DRM_PANEL_FEIYANG_FY07024DI26A30D = no; + DRM_PANEL_ILITEK_IL9322 = no; + DRM_PANEL_ILITEK_ILI9341 = no; + DRM_PANEL_ILITEK_ILI9881C = no; + DRM_PANEL_INNOLUX_EJ030NA = no; + DRM_PANEL_INNOLUX_P079ZCA = no; + DRM_PANEL_JDI_LT070ME05000 = no; + DRM_PANEL_KHADAS_TS050 = no; + DRM_PANEL_KINGDISPLAY_KD097D04 = no; + DRM_PANEL_LEADTEK_LTK050H3146W = no; + DRM_PANEL_LEADTEK_LTK500HD1829 = no; + DRM_PANEL_SAMSUNG_LD9040 = no; + DRM_PANEL_LG_LB035Q02 = no; + DRM_PANEL_LG_LG4573 = no; + DRM_PANEL_NEC_NL8048HL11 = no; + DRM_PANEL_NOVATEK_NT35510 = no; + DRM_PANEL_NOVATEK_NT36672A = no; + DRM_PANEL_NOVATEK_NT39016 = no; + DRM_PANEL_MANTIX_MLAF057WE51 = no; + DRM_PANEL_OLIMEX_LCD_OLINUXINO = no; + DRM_PANEL_ORISETECH_OTM8009A = no; + DRM_PANEL_OSD_OSD101T2587_53TS = no; + DRM_PANEL_PANASONIC_VVX10F034N00 = no; + DRM_PANEL_RASPBERRYPI_TOUCHSCREEN = no; + DRM_PANEL_RAYDIUM_RM67191 = no; + DRM_PANEL_RAYDIUM_RM68200 = no; + DRM_PANEL_RONBO_RB070D30 = no; + DRM_PANEL_SAMSUNG_ATNA33XC20 = no; + DRM_PANEL_SAMSUNG_DB7430 = no; + DRM_PANEL_SAMSUNG_S6D16D0 = no; + DRM_PANEL_SAMSUNG_S6E3HA2 = no; + DRM_PANEL_SAMSUNG_S6E63J0X03 = no; + DRM_PANEL_SAMSUNG_S6E63M0 = no; + DRM_PANEL_SAMSUNG_S6E63M0_SPI = no; + DRM_PANEL_SAMSUNG_S6E63M0_DSI = no; + DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 = no; + DRM_PANEL_SAMSUNG_S6E8AA0 = no; + DRM_PANEL_SAMSUNG_SOFEF00 = no; + DRM_PANEL_SEIKO_43WVF1G = no; + DRM_PANEL_SHARP_LQ101R1SX01 = no; + DRM_PANEL_SHARP_LS037V7DW01 = no; + DRM_PANEL_SHARP_LS043T1LE01 = no; + DRM_PANEL_SITRONIX_ST7701 = no; + DRM_PANEL_SITRONIX_ST7703 = no; + DRM_PANEL_SITRONIX_ST7789V = no; + DRM_PANEL_SONY_ACX565AKM = no; + DRM_PANEL_TDO_TL070WSH30 = no; + DRM_PANEL_TPO_TD028TTEC1 = no; + DRM_PANEL_TPO_TD043MTEA1 = no; + DRM_PANEL_TPO_TPG110 = no; + DRM_PANEL_TRULY_NT35597_WQXGA = no; + DRM_PANEL_VISIONOX_RM69299 = no; + DRM_PANEL_WIDECHIPS_WS2401 = no; + DRM_PANEL_XINPENG_XPP055C272 = no; + DRM_BRIDGE = no; + DRM_PANEL_BRIDGE = no; + DRM_CDNS_DSI = no; + DRM_CHIPONE_ICN6211 = no; + DRM_CHRONTEL_CH7033 = no; + DRM_DISPLAY_CONNECTOR = no; + DRM_LONTIUM_LT8912B = no; + DRM_LONTIUM_LT9611 = no; + DRM_LONTIUM_LT9611UXC = no; + DRM_ITE_IT66121 = no; + DRM_LVDS_CODEC = no; + DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW = no; + DRM_NWL_MIPI_DSI = no; + DRM_NXP_PTN3460 = no; + DRM_PARADE_PS8622 = no; + DRM_PARADE_PS8640 = no; + DRM_SIL_SII8620 = no; + DRM_SII902X = no; + DRM_SII9234 = no; + DRM_SIMPLE_BRIDGE = no; + DRM_THINE_THC63LVD1024 = no; + DRM_TOSHIBA_TC358762 = no; + DRM_TOSHIBA_TC358764 = no; + DRM_TOSHIBA_TC358767 = no; + DRM_TOSHIBA_TC358768 = no; + DRM_TOSHIBA_TC358775 = no; + DRM_TI_TFP410 = no; + DRM_TI_SN65DSI83 = no; + DRM_TI_SN65DSI86 = no; + DRM_TI_TPD12S015 = no; + DRM_ANALOGIX_ANX6345 = no; + DRM_ANALOGIX_ANX78XX = no; + DRM_ANALOGIX_DP = no; + DRM_ANALOGIX_ANX7625 = no; + DRM_I2C_ADV7511 = no; + DRM_I2C_ADV7511_CEC = no; + DRM_CDNS_MHDP8546 = no; + DRM_DW_HDMI = no; + DRM_DW_HDMI_AHB_AUDIO = no; + DRM_DW_HDMI_I2S_AUDIO = no; + DRM_DW_HDMI_CEC = no; + DRM_ETNAVIV = no; + DRM_ETNAVIV_THERMAL = no; + DRM_MXS = no; + DRM_MXSFB = no; + DRM_ARCPGU = no; + DRM_BOCHS = no; + DRM_CIRRUS_QEMU = no; + DRM_GM12U320 = no; + TINYDRM_HX8357D = no; + TINYDRM_ILI9225 = no; + TINYDRM_ILI9341 = no; + TINYDRM_ILI9486 = no; + TINYDRM_MI0283QT = no; + TINYDRM_REPAPER = no; + TINYDRM_ST7586 = no; + TINYDRM_ST7735R = no; + DRM_GUD = no; + DRM_LEGACY = no; + DRM_TDFX = no; + DRM_R128 = no; + DRM_MGA = no; + DRM_VIA = no; + DRM_SAVAGE = no; + VIDEOMODE_HELPERS = no; + SND_PCM_ELD = no; + SND_PCM_IEC958 = no; + SND_HDA_COMPONENT = no; + SND_SOC_HDMI_CODEC = no; + VIRTIO_DMA_SHARED_BUFFER = no; + }; - extraMeta.branch = "Star64_devel"; - } // (args.argsOverride or { })); + extraMeta.branch = "Star64_devel"; + } + // (args.argsOverride or { }) + ); -in lib.recurseIntoAttrs (linuxPackagesFor (callPackage linuxPkg { })) +in +lib.recurseIntoAttrs (linuxPackagesFor (callPackage linuxPkg { })) diff --git a/pine64/star64/opensbi.nix b/pine64/star64/opensbi.nix index 5b46fec6..e9a79129 100644 --- a/pine64/star64/opensbi.nix +++ b/pine64/star64/opensbi.nix @@ -1,14 +1,18 @@ -{ opensbi, withPayload, withFDT }: +{ + opensbi, + withPayload, + withFDT, +}: (opensbi.override { inherit withPayload withFDT; -}).overrideAttrs (attrs: { - makeFlags = attrs.makeFlags ++ [ - # opensbi generic platform default FW_TEXT_START is 0x80000000 - # For JH7110, need to specify the FW_TEXT_START to 0x40000000 - # Otherwise, the fw_payload.bin downloading via jtag will not run. - # https://github.com/starfive-tech/VisionFive2/blob/7733673d27052dc5a48f1cb1d060279dfa3f0241/Makefile#L274 - "FW_TEXT_START=0x40000000" - ]; -}) - +}).overrideAttrs + (attrs: { + makeFlags = attrs.makeFlags ++ [ + # opensbi generic platform default FW_TEXT_START is 0x80000000 + # For JH7110, need to specify the FW_TEXT_START to 0x40000000 + # Otherwise, the fw_payload.bin downloading via jtag will not run. + # https://github.com/starfive-tech/VisionFive2/blob/7733673d27052dc5a48f1cb1d060279dfa3f0241/Makefile#L274 + "FW_TEXT_START=0x40000000" + ]; + }) diff --git a/pine64/star64/sd-image.nix b/pine64/star64/sd-image.nix index 07d00ae8..e76b0c03 100644 --- a/pine64/star64/sd-image.nix +++ b/pine64/star64/sd-image.nix @@ -1,7 +1,14 @@ -{ config, pkgs, modulesPath, ... }: +{ + config, + pkgs, + modulesPath, + ... +}: -let firmware = pkgs.callPackage ./firmware.nix { }; -in { +let + firmware = pkgs.callPackage ./firmware.nix { }; +in +{ imports = [ "${modulesPath}/profiles/base.nix" "${modulesPath}/installer/sd-card/sd-image.nix" @@ -9,8 +16,7 @@ in { ]; sdImage = { - imageName = - "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-pine64-star64.img"; + imageName = "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-pine64-star64.img"; # Overridden by postBuildCommands populateFirmwareCommands = ""; diff --git a/pine64/star64/spl-tool.nix b/pine64/star64/spl-tool.nix index 6b91a36e..0f1f8df9 100644 --- a/pine64/star64/spl-tool.nix +++ b/pine64/star64/spl-tool.nix @@ -1,6 +1,6 @@ { stdenv, fetchFromGitHub }: -stdenv.mkDerivation rec{ +stdenv.mkDerivation rec { pname = "spi_tool"; version = "unstable-2023-04-14"; src = fetchFromGitHub { diff --git a/purism/librem/5r4/audio.nix b/purism/librem/5r4/audio.nix index 8c8b00b9..9c49fa7a 100644 --- a/purism/librem/5r4/audio.nix +++ b/purism/librem/5r4/audio.nix @@ -1,13 +1,14 @@ -{ config -, lib -, pkgs -, ... -}: { +{ + config, + lib, + pkgs, + ... +}: +{ config = - lib.mkIf config.hardware.librem5.audio - { - services.dbus.packages = [ pkgs.callaudiod ]; - } + lib.mkIf config.hardware.librem5.audio { + services.dbus.packages = [ pkgs.callaudiod ]; + } // ( let paConfig = { @@ -18,24 +19,25 @@ ''; }; in - if lib.versionOlder (lib.versions.majorMinor lib.version) "25.05" - then { - assertions = [ - { - assertion = config.hardware.pulseaudio.enable; - message = "Call audio on Librem5 requires pulse audio to be enabled through `hardware.pulseaudio.enable`."; - } - ]; - hardware.pulseaudio = paConfig; - } - else { - assertions = [ - { - assertion = config.services.pulseaudio.enable; - message = "Call audio on Librem5 requires pulse audio to be enabled through `services.pulseaudio.enable`."; - } - ]; - services.pulseaudio = paConfig; - } + if lib.versionOlder (lib.versions.majorMinor lib.version) "25.05" then + { + assertions = [ + { + assertion = config.hardware.pulseaudio.enable; + message = "Call audio on Librem5 requires pulse audio to be enabled through `hardware.pulseaudio.enable`."; + } + ]; + hardware.pulseaudio = paConfig; + } + else + { + assertions = [ + { + assertion = config.services.pulseaudio.enable; + message = "Call audio on Librem5 requires pulse audio to be enabled through `services.pulseaudio.enable`."; + } + ]; + services.pulseaudio = paConfig; + } ); } diff --git a/purism/librem/5r4/default.nix b/purism/librem/5r4/default.nix index 339b43b3..33eeefdd 100644 --- a/purism/librem/5r4/default.nix +++ b/purism/librem/5r4/default.nix @@ -1,9 +1,15 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.hardware.librem5; linuxPackages_librem5 = pkgs.linuxPackagesFor (pkgs.callPackage ./kernel.nix { }); ubootLibrem5 = pkgs.callPackage ./u-boot { }; -in { +in +{ options = { hardware.librem5 = { package = lib.mkOption { @@ -11,7 +17,11 @@ in { default = pkgs.callPackage ./librem5-base { }; }; wifiCard = lib.mkOption { - type = lib.types.enum [ "redpine" "sparklan" "none" ]; + type = lib.types.enum [ + "redpine" + "sparklan" + "none" + ]; description = '' Which wi-fi card is installed in your phone. diff --git a/purism/librem/5r4/kernel.nix b/purism/librem/5r4/kernel.nix index 0ffbb3d3..9e42a586 100644 --- a/purism/librem/5r4/kernel.nix +++ b/purism/librem/5r4/kernel.nix @@ -1,28 +1,31 @@ -{ lib -, buildLinux -, fetchFromGitLab -, ... -} @ args: -buildLinux (args +{ + lib, + buildLinux, + fetchFromGitLab, + ... +}@args: +buildLinux ( + args // rec { - defconfig = "librem5_defconfig"; - version = "6.6.74-librem5"; - modDirVersion = version; - src = fetchFromGitLab { - domain = "source.puri.sm"; - owner = "Librem5"; - repo = "linux"; - rev = "pureos/6.6.74pureos1"; - hash = "sha256-qUPY+2fHVu7SFc+Uf8U7QtkQJJsE/4I1SavpLqJ/34c="; - }; - kernelPatches = [ ]; - # see https://github.com/NixOS/nixpkgs/pull/366004 - ignoreConfigErrors = true; + defconfig = "librem5_defconfig"; + version = "6.6.74-librem5"; + modDirVersion = version; + src = fetchFromGitLab { + domain = "source.puri.sm"; + owner = "Librem5"; + repo = "linux"; + rev = "pureos/6.6.74pureos1"; + hash = "sha256-qUPY+2fHVu7SFc+Uf8U7QtkQJJsE/4I1SavpLqJ/34c="; + }; + kernelPatches = [ ]; + # see https://github.com/NixOS/nixpkgs/pull/366004 + ignoreConfigErrors = true; - structuredExtraConfig = with lib.kernel; { - # buildLinux overrides this and defaults to 32, so go back to the value defined librem5_defconfig - # this is required for millipixels to take photos, otherwise the VIDIOC_REQ_BUFS ioctl returns ENOMEM - CMA_SIZE_MBYTES = lib.mkForce (freeform "320"); - }; -} - // args.argsOverride or { }) + structuredExtraConfig = with lib.kernel; { + # buildLinux overrides this and defaults to 32, so go back to the value defined librem5_defconfig + # this is required for millipixels to take photos, otherwise the VIDIOC_REQ_BUFS ioctl returns ENOMEM + CMA_SIZE_MBYTES = lib.mkForce (freeform "320"); + }; + } + // args.argsOverride or { } +) diff --git a/purism/librem/5r4/librem5-base/default.nix b/purism/librem/5r4/librem5-base/default.nix index da9a39e2..5ad48597 100644 --- a/purism/librem/5r4/librem5-base/default.nix +++ b/purism/librem/5r4/librem5-base/default.nix @@ -1,4 +1,10 @@ -{ stdenv, fetchFromGitLab, shellcheck, kmod, lib }: +{ + stdenv, + fetchFromGitLab, + shellcheck, + kmod, + lib, +}: stdenv.mkDerivation { pname = "librem5-base"; version = "unstable"; diff --git a/purism/librem/5r4/lockdown-fix.nix b/purism/librem/5r4/lockdown-fix.nix index 121ded30..08ee137f 100644 --- a/purism/librem/5r4/lockdown-fix.nix +++ b/purism/librem/5r4/lockdown-fix.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: lib.mkIf config.hardware.librem5.lockdownFix { # We blacklist the drivers so they don't load during early boot when the sensors are disconnected, boot.blacklistedKernelModules = [ @@ -17,10 +22,10 @@ lib.mkIf config.hardware.librem5.lockdownFix { }; # udev rules from librem5-base handle going into "lockdown mode" and back. - assertions = [{ - assertion = with config.hardware.librem5; - lockdownFix -> installUdevPackages; - message = - "'hardware.librem5.lockdownFix' requires 'hardware.librem5.installUdevPackages', but it is not enabled."; - }]; + assertions = [ + { + assertion = with config.hardware.librem5; lockdownFix -> installUdevPackages; + message = "'hardware.librem5.lockdownFix' requires 'hardware.librem5.installUdevPackages', but it is not enabled."; + } + ]; } diff --git a/purism/librem/5r4/u-boot/default.nix b/purism/librem/5r4/u-boot/default.nix index a6b00a79..43dcee43 100644 --- a/purism/librem/5r4/u-boot/default.nix +++ b/purism/librem/5r4/u-boot/default.nix @@ -1,4 +1,12 @@ -{ stdenv, gcc11Stdenv, buildUBoot, fetchurl, fetchFromGitLab, lib, bison }: +{ + stdenv, + gcc11Stdenv, + buildUBoot, + fetchurl, + fetchFromGitLab, + lib, + bison, +}: let firmware-imx = stdenv.mkDerivation (fa: { pname = "firmware-imx"; @@ -20,7 +28,7 @@ let meta.license = lib.licenses.unfree; }); - arm-trusted-firmware-imx8mq = gcc11Stdenv.mkDerivation (fa: { + arm-trusted-firmware-imx8mq = gcc11Stdenv.mkDerivation (_fa: { pname = "arm-trusted-firmware-bl31"; version = "unstable-2020-07-08"; src = fetchFromGitLab { @@ -33,7 +41,10 @@ let enableParallelBuilding = true; hardeningDisable = [ "all" ]; NIX_LDFLAGS = "--no-warn-rwx-segments"; - buildFlags = [ "PLAT=imx8mq" "bl31" ]; + buildFlags = [ + "PLAT=imx8mq" + "bl31" + ]; installPhase = '' mkdir -p $out cp build/imx8mq/release/bl31.bin $out @@ -51,7 +62,7 @@ let rev = "956aa590c93977992743b41c45d3c7ee5a024915"; # this is the latest commit on the upstream/librem5 branch hash = "sha256-MsIIlarN+WFFEzc0ptLAgS7BwJ6Cosy42xo0EwPn1AU="; }; - patches = []; + patches = [ ]; BL31 = "${arm-trusted-firmware-imx8mq}/bl31.bin"; preConfigure = '' cp $BL31 . diff --git a/radxa/default.nix b/radxa/default.nix index fb311df7..e687ff88 100644 --- a/radxa/default.nix +++ b/radxa/default.nix @@ -1,11 +1,13 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.radxa; -in { +in +{ options.hardware.radxa = { enable = lib.mkEnableOption "Radxa system support"; }; diff --git a/radxa/disko.nix b/radxa/disko.nix index 30c30a97..739f4575 100644 --- a/radxa/disko.nix +++ b/radxa/disko.nix @@ -1,11 +1,10 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: -let - cfg = config.hardware.radxa; -in { +{ imports = [ ../rockchip/disko.nix ]; diff --git a/radxa/rock-4c-plus/default.nix b/radxa/rock-4c-plus/default.nix index e432dd74..956fc546 100644 --- a/radxa/rock-4c-plus/default.nix +++ b/radxa/rock-4c-plus/default.nix @@ -1,8 +1,10 @@ -{ lib -, pkgs -, config -, ... -}: { +{ + lib, + pkgs, + config, + ... +}: +{ imports = [ ../. ../../rockchip diff --git a/radxa/rock-5b/default.nix b/radxa/rock-5b/default.nix index c8a899dd..891ae26c 100644 --- a/radxa/rock-5b/default.nix +++ b/radxa/rock-5b/default.nix @@ -1,8 +1,10 @@ -{ lib -, pkgs -, config -, ... -}: { +{ + lib, + pkgs, + config, + ... +}: +{ imports = [ ../. ../../rockchip diff --git a/radxa/rock-pi-4/default.nix b/radxa/rock-pi-4/default.nix index e205a46e..d6000816 100644 --- a/radxa/rock-pi-4/default.nix +++ b/radxa/rock-pi-4/default.nix @@ -1,8 +1,10 @@ -{ lib -, pkgs -, config -, ... -}: { +{ + lib, + pkgs, + config, + ... +}: +{ imports = [ ../. ../../rockchip diff --git a/radxa/rock-pi-e/default.nix b/radxa/rock-pi-e/default.nix index 0eec4e9a..95ad4106 100644 --- a/radxa/rock-pi-e/default.nix +++ b/radxa/rock-pi-e/default.nix @@ -1,8 +1,10 @@ -{ lib -, pkgs -, config -, ... -}: { +{ + lib, + pkgs, + config, + ... +}: +{ imports = [ ../. ../../rockchip diff --git a/raspberry-pi/2/default.nix b/raspberry-pi/2/default.nix index 368cb27f..2e61025c 100644 --- a/raspberry-pi/2/default.nix +++ b/raspberry-pi/2/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ...}: +{ lib, pkgs, ... }: { boot = { diff --git a/raspberry-pi/3/default.nix b/raspberry-pi/3/default.nix index 57da74a3..00e052f6 100644 --- a/raspberry-pi/3/default.nix +++ b/raspberry-pi/3/default.nix @@ -1,6 +1,7 @@ -{ lib -, pkgs -, ... +{ + lib, + pkgs, + ... }: { @@ -11,8 +12,7 @@ # https://github.com/NixOS/nixpkgs/issues/154163#issuecomment-1350599022 nixpkgs.overlays = [ (_final: super: { - makeModulesClosure = x: - super.makeModulesClosure (x // { allowMissing = true; }); + makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; }); }) ]; diff --git a/raspberry-pi/4/apply-overlays-dtmerge.nix b/raspberry-pi/4/apply-overlays-dtmerge.nix index e5b52d37..ab6d5296 100644 --- a/raspberry-pi/4/apply-overlays-dtmerge.nix +++ b/raspberry-pi/4/apply-overlays-dtmerge.nix @@ -1,48 +1,67 @@ # modification of nixpkgs deviceTree.applyOverlays to resolve https://github.com/NixOS/nixpkgs/issues/125354 # derived from https://github.com/NixOS/nixpkgs/blob/916ca8f2b0c208def051f8ea9760c534a40309db/pkgs/os-specific/linux/device-tree/default.nix -{ lib, stdenvNoCC, dtc, libraspberrypi }: +{ + lib, + stdenvNoCC, + dtc, + libraspberrypi, +}: -with lib; (base: overlays': stdenvNoCC.mkDerivation { - name = "device-tree-overlays"; - nativeBuildInputs = [ dtc libraspberrypi ]; - buildCommand = let - overlays = toList overlays'; - in '' - mkdir -p $out - cd "${base}" - find . -type f -name '*.dtb' -print0 \ - | xargs -0 cp -v --no-preserve=mode --target-directory "$out" --parents +with lib; +( + base: overlays': + stdenvNoCC.mkDerivation { + name = "device-tree-overlays"; + nativeBuildInputs = [ + dtc + libraspberrypi + ]; + buildCommand = + let + overlays = toList overlays'; + in + '' + mkdir -p $out + cd "${base}" + find . -type f -name '*.dtb' -print0 \ + | xargs -0 cp -v --no-preserve=mode --target-directory "$out" --parents - for dtb in $(find "$out" -type f -name '*.dtb'); do - dtbCompat=$(fdtget -t s "$dtb" / compatible 2>/dev/null || true) - # skip files without `compatible` string - test -z "$dtbCompat" && continue + for dtb in $(find "$out" -type f -name '*.dtb'); do + dtbCompat=$(fdtget -t s "$dtb" / compatible 2>/dev/null || true) + # skip files without `compatible` string + test -z "$dtbCompat" && continue - ${flip (concatMapStringsSep "\n") overlays (o: '' - overlayCompat="$(fdtget -t s "${o.dtboFile}" / compatible)" + ${flip (concatMapStringsSep "\n") overlays (o: '' + overlayCompat="$(fdtget -t s "${o.dtboFile}" / compatible)" - # skip incompatible and non-matching overlays - if [[ ! "$dtbCompat" =~ "$overlayCompat" ]]; then - echo "Skipping overlay ${o.name}: incompatible with $(basename "$dtb")" - elif ${if ((o.filter or null) == null) then "false" else '' - [[ "''${dtb//${o.filter}/}" == "$dtb" ]] - ''} - then - echo "Skipping overlay ${o.name}: filter does not match $(basename "$dtb")" - else - echo -n "Applying overlay ${o.name} to $(basename "$dtb")... " - mv "$dtb"{,.in} + # skip incompatible and non-matching overlays + if [[ ! "$dtbCompat" =~ "$overlayCompat" ]]; then + echo "Skipping overlay ${o.name}: incompatible with $(basename "$dtb")" + elif ${ + if ((o.filter or null) == null) then + "false" + else + '' + [[ "''${dtb//${o.filter}/}" == "$dtb" ]] + '' + } + then + echo "Skipping overlay ${o.name}: filter does not match $(basename "$dtb")" + else + echo -n "Applying overlay ${o.name} to $(basename "$dtb")... " + mv "$dtb"{,.in} - # dtmerge requires a .dtbo ext for dtbo files, otherwise it adds it to the given file implicitly - dtboWithExt="$TMPDIR/$(basename "${o.dtboFile}").dtbo" - cp -r ${o.dtboFile} "$dtboWithExt" + # dtmerge requires a .dtbo ext for dtbo files, otherwise it adds it to the given file implicitly + dtboWithExt="$TMPDIR/$(basename "${o.dtboFile}").dtbo" + cp -r ${o.dtboFile} "$dtboWithExt" - dtmerge "$dtb.in" "$dtb" "$dtboWithExt" + dtmerge "$dtb.in" "$dtb" "$dtboWithExt" - echo "ok" - rm "$dtb.in" "$dtboWithExt" - fi - '')} + echo "ok" + rm "$dtb.in" "$dtboWithExt" + fi + '')} - done''; -}) + done''; + } +) diff --git a/raspberry-pi/4/audio.nix b/raspberry-pi/4/audio.nix index 38773864..08c0b921 100644 --- a/raspberry-pi/4/audio.nix +++ b/raspberry-pi/4/audio.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.hardware.raspberry-pi."4".audio; @@ -38,9 +43,10 @@ in # set tsched=0 in pulseaudio config to avoid audio glitches # see https://wiki.archlinux.org/title/PulseAudio/Troubleshooting#Glitches,_skips_or_crackling - hardware.pulseaudio.configFile = lib.mkOverride 990 (pkgs.runCommand "default.pa" {} '' - sed 's/module-udev-detect$/module-udev-detect tsched=0/' ${config.hardware.pulseaudio.package}/etc/pulse/default.pa > $out - ''); + hardware.pulseaudio.configFile = lib.mkOverride 990 ( + pkgs.runCommand "default.pa" { } '' + sed 's/module-udev-detect$/module-udev-detect tsched=0/' ${config.hardware.pulseaudio.package}/etc/pulse/default.pa > $out + '' + ); }; } - diff --git a/raspberry-pi/4/default.nix b/raspberry-pi/4/default.nix index 150a66b9..e02ba0b3 100644 --- a/raspberry-pi/4/default.nix +++ b/raspberry-pi/4/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: { imports = [ @@ -40,7 +45,6 @@ hardware.deviceTree.filter = lib.mkDefault "bcm2711-rpi-*.dtb"; - assertions = [ { assertion = (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.1"); diff --git a/raspberry-pi/4/dwc2.nix b/raspberry-pi/4/dwc2.nix index bdb63b18..874efa24 100644 --- a/raspberry-pi/4/dwc2.nix +++ b/raspberry-pi/4/dwc2.nix @@ -25,7 +25,11 @@ in https://www.kernel.org/doc/Documentation/usb/gadget-testing.txt ''; dr_mode = lib.mkOption { - type = lib.types.enum [ "host" "peripheral" "otg" ]; + type = lib.types.enum [ + "host" + "peripheral" + "otg" + ]; default = "otg"; description = '' Dual role mode setting for the dwc2 USB controller driver. diff --git a/raspberry-pi/4/gpio.nix b/raspberry-pi/4/gpio.nix index 23c7bdae..dc12965c 100644 --- a/raspberry-pi/4/gpio.nix +++ b/raspberry-pi/4/gpio.nix @@ -1,36 +1,41 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: { options.hardware.raspberry-pi."4".gpio = { enable = lib.mkOption { type = lib.types.bool; - description = - "Enable udev rules and kernelParams that make lgpio and pigpio work"; + description = "Enable udev rules and kernelParams that make lgpio and pigpio work"; default = false; }; }; - config = let - cfg = config.hardware.raspberry-pi."4".gpio; + config = + let + cfg = config.hardware.raspberry-pi."4".gpio; in - lib.mkIf cfg.enable { - users.groups.gpio = lib.mkDefault { }; + lib.mkIf cfg.enable { + users.groups.gpio = lib.mkDefault { }; - # the bit that matters to lgpio here is - # "${pkgs.coreutils}/bin/chgrp gpio /dev/%k && chmod 660 /dev/%k" - # see https://github.com/NixOS/nixpkgs/pull/352308 + # the bit that matters to lgpio here is + # "${pkgs.coreutils}/bin/chgrp gpio /dev/%k && chmod 660 /dev/%k" + # see https://github.com/NixOS/nixpkgs/pull/352308 - # sudo udevadm test --action=add /dev/gpiochip0 to test + # sudo udevadm test --action=add /dev/gpiochip0 to test - # import lgpio; lgpio.gpiochip_open(0) should show "1" and not raise - # an exception + # import lgpio; lgpio.gpiochip_open(0) should show "1" and not raise + # an exception - services.udev.extraRules = lib.mkBefore '' - KERNEL=="gpiomem", GROUP="gpio", MODE="0660" - SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="${pkgs.bash}/bin/bash -c '${pkgs.coreutils}/bin/chgrp gpio /dev/%k && chmod 660 /dev/%k && ${pkgs.coreutils}/bin/chgrp -R gpio /sys/class/gpio && ${pkgs.coreutils}/bin/chmod -R g=u /sys/class/gpio'" - SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="${pkgs.bash}/bin/bash -c '${pkgs.coreutils}/bin/chgrp -R gpio /sys%p && ${pkgs.coreutils}/bin/chmod -R g=u /sys%p'" - ''; + services.udev.extraRules = lib.mkBefore '' + KERNEL=="gpiomem", GROUP="gpio", MODE="0660" + SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="${pkgs.bash}/bin/bash -c '${pkgs.coreutils}/bin/chgrp gpio /dev/%k && chmod 660 /dev/%k && ${pkgs.coreutils}/bin/chgrp -R gpio /sys/class/gpio && ${pkgs.coreutils}/bin/chmod -R g=u /sys/class/gpio'" + SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="${pkgs.bash}/bin/bash -c '${pkgs.coreutils}/bin/chgrp -R gpio /sys%p && ${pkgs.coreutils}/bin/chmod -R g=u /sys%p'" + ''; - boot.kernelParams = [ - "iomem=relaxed" # for pigpiod - ]; - }; + boot.kernelParams = [ + "iomem=relaxed" # for pigpiod + ]; + }; } diff --git a/raspberry-pi/4/i2c.nix b/raspberry-pi/4/i2c.nix index 0355397e..5939a78a 100644 --- a/raspberry-pi/4/i2c.nix +++ b/raspberry-pi/4/i2c.nix @@ -2,24 +2,31 @@ let cfg = config.hardware.raspberry-pi."4"; - optionalProperty = name: value: lib.optionalString (value != null) "${name} = <${builtins.toString value}>;"; - simple-overlay = { target, status, frequency }: { - name = "${target}-${status}-overlay"; - dtsText = '' - /dts-v1/; - /plugin/; - / { - compatible = "brcm,bcm2711"; - fragment@0 { - target = <&${target}>; - __overlay__ { - status = "${status}"; - ${optionalProperty "clock-frequency" frequency} + optionalProperty = + name: value: lib.optionalString (value != null) "${name} = <${builtins.toString value}>;"; + simple-overlay = + { + target, + status, + frequency, + }: + { + name = "${target}-${status}-overlay"; + dtsText = '' + /dts-v1/; + /plugin/; + / { + compatible = "brcm,bcm2711"; + fragment@0 { + target = <&${target}>; + __overlay__ { + status = "${status}"; + ${optionalProperty "clock-frequency" frequency} + }; }; }; - }; - ''; - }; + ''; + }; in { options.hardware.raspberry-pi."4" = { @@ -54,21 +61,25 @@ in (lib.mkIf cfg.i2c0.enable { i2c.enable = lib.mkDefault true; deviceTree = { - overlays = [ (simple-overlay { - target = "i2c0if"; - status = "okay"; - inherit (cfg.i2c0) frequency; - }) ]; + overlays = [ + (simple-overlay { + target = "i2c0if"; + status = "okay"; + inherit (cfg.i2c0) frequency; + }) + ]; }; }) (lib.mkIf cfg.i2c1.enable { i2c.enable = lib.mkDefault true; deviceTree = { - overlays = [ (simple-overlay { - target = "i2c1"; - status = "okay"; - inherit (cfg.i2c1) frequency; - }) ]; + overlays = [ + (simple-overlay { + target = "i2c1"; + status = "okay"; + inherit (cfg.i2c1) frequency; + }) + ]; }; }) ]; diff --git a/raspberry-pi/4/leds.nix b/raspberry-pi/4/leds.nix index 5f58fa22..3860fff5 100644 --- a/raspberry-pi/4/leds.nix +++ b/raspberry-pi/4/leds.nix @@ -2,12 +2,14 @@ let cfg = config.hardware.raspberry-pi."4".leds; - mkDisableOption = name: lib.mkOption { - default = false; - example = true; - description = "Whether to disable ${name}."; - type = lib.types.bool; - }; + mkDisableOption = + name: + lib.mkOption { + default = false; + example = true; + description = "Whether to disable ${name}."; + type = lib.types.bool; + }; in { options.hardware = { @@ -71,23 +73,25 @@ in { name = "disable-act-led"; filter = "*rpi-4-b*"; - dtsText = let - kernelVersion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.2"; - target = if kernelVersion then "<&led_act>" else "<&act_led>"; - in '' - /dts-v1/; - /plugin/; - /{ - compatible = "raspberrypi,4-model-b"; - fragment@0 { - target = ${target}; - __overlay__ { - gpios = <&gpio 42 0>; /* first two values copied from bcm2711-rpi-4-b.dts */ - linux,default-trigger = "none"; - }; - }; - }; - ''; + dtsText = + let + kernelVersion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.2"; + target = if kernelVersion then "<&led_act>" else "<&act_led>"; + in + '' + /dts-v1/; + /plugin/; + /{ + compatible = "raspberrypi,4-model-b"; + fragment@0 { + target = ${target}; + __overlay__ { + gpios = <&gpio 42 0>; /* first two values copied from bcm2711-rpi-4-b.dts */ + linux,default-trigger = "none"; + }; + }; + }; + ''; } ]; }; @@ -101,23 +105,25 @@ in { name = "disable-pwr-led"; filter = "*rpi-4-b*"; - dtsText = let - kernelVersion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.2"; - target = if kernelVersion then "<&led_pwr>" else "<&pwr_led>"; - in '' - /dts-v1/; - /plugin/; - /{ - compatible = "raspberrypi,4-model-b"; - fragment@0 { - target = ${target}; - __overlay__ { - gpios = <&expgpio 2 0>; /* first two values copied from bcm2711-rpi-4-b.dts */ - linux,default-trigger = "default-on"; - }; - }; - }; - ''; + dtsText = + let + kernelVersion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.2"; + target = if kernelVersion then "<&led_pwr>" else "<&pwr_led>"; + in + '' + /dts-v1/; + /plugin/; + /{ + compatible = "raspberrypi,4-model-b"; + fragment@0 { + target = ${target}; + __overlay__ { + gpios = <&expgpio 2 0>; /* first two values copied from bcm2711-rpi-4-b.dts */ + linux,default-trigger = "default-on"; + }; + }; + }; + ''; } ]; }; diff --git a/raspberry-pi/4/pkgs-overlays.nix b/raspberry-pi/4/pkgs-overlays.nix index 8c3e29af..95109c21 100644 --- a/raspberry-pi/4/pkgs-overlays.nix +++ b/raspberry-pi/4/pkgs-overlays.nix @@ -6,7 +6,8 @@ let applyOverlays = _final.callPackage ./apply-overlays-dtmerge.nix { }; }; }; -in { +in +{ options.hardware = { raspberry-pi."4".apply-overlays-dtmerge = { enable = lib.mkEnableOption '' diff --git a/raspberry-pi/4/poe-hat.nix b/raspberry-pi/4/poe-hat.nix index 07bc4e46..0eb8d847 100644 --- a/raspberry-pi/4/poe-hat.nix +++ b/raspberry-pi/4/poe-hat.nix @@ -2,7 +2,8 @@ let cfg = config.hardware.raspberry-pi."4".poe-hat; -in { +in +{ options.hardware = { raspberry-pi."4".poe-hat = { enable = lib.mkEnableOption '' diff --git a/raspberry-pi/4/poe-plus-hat.nix b/raspberry-pi/4/poe-plus-hat.nix index 96f50e40..985971f3 100644 --- a/raspberry-pi/4/poe-plus-hat.nix +++ b/raspberry-pi/4/poe-plus-hat.nix @@ -2,7 +2,8 @@ let cfg = config.hardware.raspberry-pi."4".poe-plus-hat; -in { +in +{ options.hardware = { raspberry-pi."4".poe-plus-hat = { enable = lib.mkEnableOption '' diff --git a/raspberry-pi/4/pwm0.nix b/raspberry-pi/4/pwm0.nix index 5470eaf4..665f81be 100644 --- a/raspberry-pi/4/pwm0.nix +++ b/raspberry-pi/4/pwm0.nix @@ -14,37 +14,39 @@ in config = lib.mkIf cfg.enable { hardware.deviceTree = { - overlays = [{ - name = "pwm-overlay"; - dtsText = '' - /dts-v1/; - /plugin/; - / { - compatible = "brcm,bcm2711"; + overlays = [ + { + name = "pwm-overlay"; + dtsText = '' + /dts-v1/; + /plugin/; + / { + compatible = "brcm,bcm2711"; - fragment@0 { - target = <&gpio>; - __overlay__ { - pwm_pins: pwm_pins { - brcm,pins = <18>; - brcm,function = <2>; /* Alt5 */ + fragment@0 { + target = <&gpio>; + __overlay__ { + pwm_pins: pwm_pins { + brcm,pins = <18>; + brcm,function = <2>; /* Alt5 */ + }; }; }; - }; - fragment@1 { - target = <&pwm>; - __overlay__ { - pinctrl-names = "default"; - assigned-clock-rates = <100000000>; - status = "okay"; - pinctrl-0 = <&pwm_pins>; + fragment@1 { + target = <&pwm>; + __overlay__ { + pinctrl-names = "default"; + assigned-clock-rates = <100000000>; + status = "okay"; + pinctrl-0 = <&pwm_pins>; + }; }; - }; - }; - ''; - }]; + }; + ''; + } + ]; }; }; } diff --git a/raspberry-pi/4/tv-hat.nix b/raspberry-pi/4/tv-hat.nix index 8c480f43..263d6fcf 100644 --- a/raspberry-pi/4/tv-hat.nix +++ b/raspberry-pi/4/tv-hat.nix @@ -2,7 +2,8 @@ let cfg = config.hardware.raspberry-pi."4".tv-hat; -in { +in +{ options.hardware = { raspberry-pi."4".tv-hat = { enable = lib.mkEnableOption '' diff --git a/raspberry-pi/4/xhci.nix b/raspberry-pi/4/xhci.nix index b5398f2e..eb1d2ada 100644 --- a/raspberry-pi/4/xhci.nix +++ b/raspberry-pi/4/xhci.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.hardware.raspberry-pi."4".xhci; -in { +in +{ options.hardware = { raspberry-pi."4".xhci = { enable = lib.mkEnableOption '' diff --git a/raspberry-pi/5/default.nix b/raspberry-pi/5/default.nix index aba0178f..12d51b4d 100644 --- a/raspberry-pi/5/default.nix +++ b/raspberry-pi/5/default.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: +{ + lib, + pkgs, + config, + ... +}: let linux_rpi5 = pkgs.linux_rpi4.override { rpiVersion = 5; @@ -18,12 +23,12 @@ in # Needed for Xorg to start (https://github.com/raspberrypi-ui/gldriver-test/blob/master/usr/lib/systemd/scripts/rp1_test.sh) # This won't work for displays connected to the RP1 (DPI/composite/MIPI DSI), since I don't have one to test. services.xserver.extraConfig = '' - Section "OutputClass" - Identifier "vc4" - MatchDriver "vc4" - Driver "modesetting" - Option "PrimaryGPU" "true" - EndSection + Section "OutputClass" + Identifier "vc4" + MatchDriver "vc4" + Driver "modesetting" + Option "PrimaryGPU" "true" + EndSection ''; assertions = [ diff --git a/rockchip/default.nix b/rockchip/default.nix index 68bbb83f..f0195f9d 100644 --- a/rockchip/default.nix +++ b/rockchip/default.nix @@ -1,11 +1,13 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.rockchip; -in { +in +{ imports = [ ./rk3328 ./rk3399 diff --git a/rockchip/disko.nix b/rockchip/disko.nix index 7d6b4c9a..fa846c2e 100644 --- a/rockchip/disko.nix +++ b/rockchip/disko.nix @@ -1,11 +1,13 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.rockchip; -in { +in +{ imports = [ rk3399/disko.nix ]; diff --git a/rockchip/rk3328/default.nix b/rockchip/rk3328/default.nix index f2d53910..804be1a5 100644 --- a/rockchip/rk3328/default.nix +++ b/rockchip/rk3328/default.nix @@ -1,11 +1,13 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.rockchip.rk3328; -in { +in +{ options.hardware.rockchip.rk3328 = { enable = lib.mkEnableOption "Rockchip RK3328 support"; }; diff --git a/rockchip/rk3399/default.nix b/rockchip/rk3399/default.nix index 5748c33e..17f92779 100644 --- a/rockchip/rk3399/default.nix +++ b/rockchip/rk3399/default.nix @@ -1,11 +1,13 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.rockchip.rk3399; -in { +in +{ options.hardware.rockchip.rk3399 = { enable = lib.mkEnableOption "Rockchip RK3399 support"; }; diff --git a/rockchip/rk3399/disko.nix b/rockchip/rk3399/disko.nix index bae10ef5..b48972b4 100644 --- a/rockchip/rk3399/disko.nix +++ b/rockchip/rk3399/disko.nix @@ -1,14 +1,18 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.rockchip.rk3399; -in { +in +{ config = lib.mkIf cfg.enable { - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "arm-trusted-firmware-rk3399" - ]; + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "arm-trusted-firmware-rk3399" + ]; }; } diff --git a/rockchip/rk3588/default.nix b/rockchip/rk3588/default.nix index cabc04b2..7dff0b64 100644 --- a/rockchip/rk3588/default.nix +++ b/rockchip/rk3588/default.nix @@ -1,11 +1,13 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: let cfg = config.hardware.rockchip.rk3588; -in { +in +{ options.hardware.rockchip.rk3588 = { enable = lib.mkEnableOption "Rockchip RK3588 support"; }; diff --git a/samsung/np900x3c/default.nix b/samsung/np900x3c/default.nix index 1d850eb5..83261ed9 100644 --- a/samsung/np900x3c/default.nix +++ b/samsung/np900x3c/default.nix @@ -1,2 +1,2 @@ # TODO: use ../../common/pc/laptop -{} +{ } diff --git a/starfive/visionfive/v1/default.nix b/starfive/visionfive/v1/default.nix index 4a3c3dd0..0d55a3e9 100644 --- a/starfive/visionfive/v1/default.nix +++ b/starfive/visionfive/v1/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ...}: +{ + config, + lib, + pkgs, + ... +}: { hardware.deviceTree.name = lib.mkDefault "starfive/jh7100-starfive-visionfive-v1.dtb"; @@ -7,9 +12,19 @@ boot = { # Force no ZFS (from nixos/modules/profiles/base.nix) until updated to kernel 6.0 - supportedFilesystems = lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" ]; + supportedFilesystems = lib.mkForce [ + "btrfs" + "reiserfs" + "vfat" + "f2fs" + "xfs" + "ntfs" + "cifs" + ]; consoleLogLevel = lib.mkDefault 7; - kernelPackages = lib.mkDefault (pkgs.callPackage ./linux.nix { inherit (config.boot) kernelPatches; }); + kernelPackages = lib.mkDefault ( + pkgs.callPackage ./linux.nix { inherit (config.boot) kernelPatches; } + ); kernelParams = lib.mkDefault [ "console=tty0" diff --git a/starfive/visionfive/v1/firmware.nix b/starfive/visionfive/v1/firmware.nix index 3ea63757..308e355c 100644 --- a/starfive/visionfive/v1/firmware.nix +++ b/starfive/visionfive/v1/firmware.nix @@ -1,6 +1,7 @@ -{ runCommand -, buildPackages -, pkgs +{ + runCommand, + buildPackages, + pkgs, }: let @@ -10,26 +11,29 @@ let withPayload = "${uboot}/u-boot.bin"; withFDT = "${uboot}/u-boot.dtb"; }; -in runCommand "firmware-starfive-visionfive-v1" { - nativeBuildInputs = with buildPackages; [ xxd ]; -} '' - function handle_file { - inFile=$1 - echo inFile: $inFile - outFile=$2 - inSize=`stat -c "%s" $inFile` - inSize32HexBe=`printf "%08x\n" $inSize` - inSize32HexLe=''${inSize32HexBe:6:2}''${inSize32HexBe:4:2}''${inSize32HexBe:2:2}''${inSize32HexBe:0:2} - echo "inSize: $inSize (0x$inSize32HexBe, LE:0x$inSize32HexLe)" - echo $inSize32HexLe | xxd -r -ps > $outFile - cat $inFile >> $outFile - echo outFile: $outFile - outSize=`stat -c "%s" $outFile` - outSize32HexBe=`printf "%08x\n" $outSize` - echo "outSize: $outSize (0x$outSize32HexBe)" +in +runCommand "firmware-starfive-visionfive-v1" + { + nativeBuildInputs = with buildPackages; [ xxd ]; } + '' + function handle_file { + inFile=$1 + echo inFile: $inFile + outFile=$2 + inSize=`stat -c "%s" $inFile` + inSize32HexBe=`printf "%08x\n" $inSize` + inSize32HexLe=''${inSize32HexBe:6:2}''${inSize32HexBe:4:2}''${inSize32HexBe:2:2}''${inSize32HexBe:0:2} + echo "inSize: $inSize (0x$inSize32HexBe, LE:0x$inSize32HexLe)" + echo $inSize32HexLe | xxd -r -ps > $outFile + cat $inFile >> $outFile + echo outFile: $outFile + outSize=`stat -c "%s" $outFile` + outSize32HexBe=`printf "%08x\n" $outSize` + echo "outSize: $outSize (0x$outSize32HexBe)" + } - mkdir -p "$out/nix-support" - echo "file bin \"$out/opensbi_u-boot_starfive_visionfive_v1.bin\"" >> "$out/nix-support/hydra-build-products" - handle_file ${opensbi}/share/opensbi/lp64/generic/firmware/fw_payload.bin $out/opensbi_u-boot_starfive_visionfive_v1.bin -'' + mkdir -p "$out/nix-support" + echo "file bin \"$out/opensbi_u-boot_starfive_visionfive_v1.bin\"" >> "$out/nix-support/hydra-build-products" + handle_file ${opensbi}/share/opensbi/lp64/generic/firmware/fw_payload.bin $out/opensbi_u-boot_starfive_visionfive_v1.bin + '' diff --git a/starfive/visionfive/v1/linux.nix b/starfive/visionfive/v1/linux.nix index 88909099..157745ed 100644 --- a/starfive/visionfive/v1/linux.nix +++ b/starfive/visionfive/v1/linux.nix @@ -1,36 +1,44 @@ -{ lib -, callPackage -, linuxPackagesFor -, kernelPatches -, ... }: +{ + lib, + callPackage, + linuxPackagesFor, + kernelPatches, + ... +}: let modDirVersion = "6.0.0"; - linuxPkg = { fetchFromGitHub, buildLinux, ... } @ args: - buildLinux (args // { - inherit modDirVersion kernelPatches; - version = "${modDirVersion}-starfive-visionfive-v1"; + linuxPkg = + { fetchFromGitHub, buildLinux, ... }@args: + buildLinux ( + args + // { + inherit modDirVersion kernelPatches; + version = "${modDirVersion}-starfive-visionfive-v1"; - src = fetchFromGitHub { - owner = "starfive-tech"; - repo = "linux"; - rev = "cfcb617265422c0af0ae5bc9688dceba2d10b27a"; - sha256 = "sha256-EAMCOtJZ51xSLySQPaZyomfa/1Xs9kNedz04tIbELqg="; - }; + src = fetchFromGitHub { + owner = "starfive-tech"; + repo = "linux"; + rev = "cfcb617265422c0af0ae5bc9688dceba2d10b27a"; + sha256 = "sha256-EAMCOtJZ51xSLySQPaZyomfa/1Xs9kNedz04tIbELqg="; + }; - defconfig = "starfive_jh7100_fedora_defconfig"; + defconfig = "starfive_jh7100_fedora_defconfig"; - structuredExtraConfig = with lib.kernel; { - KEXEC = yes; - SERIAL_8250_DW = yes; - PINCTRL_STARFIVE = yes; - DW_AXI_DMAC_STARFIVE = yes; - PTP_1588_CLOCK = yes; - STMMAC_ETH = yes; - STMMAC_PCI = yes; - }; + structuredExtraConfig = with lib.kernel; { + KEXEC = yes; + SERIAL_8250_DW = yes; + PINCTRL_STARFIVE = yes; + DW_AXI_DMAC_STARFIVE = yes; + PTP_1588_CLOCK = yes; + STMMAC_ETH = yes; + STMMAC_PCI = yes; + }; - extraMeta.branch = "visionfive"; - } // (args.argsOverride or { })); -in lib.recurseIntoAttrs (linuxPackagesFor (callPackage linuxPkg { })) + extraMeta.branch = "visionfive"; + } + // (args.argsOverride or { }) + ); +in +lib.recurseIntoAttrs (linuxPackagesFor (callPackage linuxPkg { })) diff --git a/starfive/visionfive/v1/sd-image.nix b/starfive/visionfive/v1/sd-image.nix index 6b4acfc5..7b855c44 100644 --- a/starfive/visionfive/v1/sd-image.nix +++ b/starfive/visionfive/v1/sd-image.nix @@ -1,10 +1,16 @@ # To build, use: # nix-build "" -I nixos-config=starfive/visionfive/v1/sd-image.nix -A config.system.build.sdImage -{ config, pkgs, modulesPath, ... }: +{ + config, + pkgs, + modulesPath, + ... +}: let firmware = pkgs.callPackage ./firmware.nix { }; -in { +in +{ imports = [ "${modulesPath}/profiles/base.nix" "${modulesPath}/installer/sd-card/sd-image.nix" diff --git a/starfive/visionfive/v1/uboot.nix b/starfive/visionfive/v1/uboot.nix index 9eebeb9f..4f3d6a52 100644 --- a/starfive/visionfive/v1/uboot.nix +++ b/starfive/visionfive/v1/uboot.nix @@ -1,5 +1,6 @@ -{ fetchFromGitHub -, buildUBoot +{ + fetchFromGitHub, + buildUBoot, }: buildUBoot { @@ -13,5 +14,8 @@ buildUBoot { }; defconfig = "starfive_jh7100_visionfive_smode_defconfig"; - filesToInstall = [ "u-boot.bin" "u-boot.dtb" ]; + filesToInstall = [ + "u-boot.bin" + "u-boot.dtb" + ]; } diff --git a/starfive/visionfive/v2/firmware.nix b/starfive/visionfive/v2/firmware.nix index b6291152..54360093 100644 --- a/starfive/visionfive/v2/firmware.nix +++ b/starfive/visionfive/v2/firmware.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.hardware.visionfive2; in @@ -34,15 +39,19 @@ in config = { system.build = { - opensbi = (pkgs.callPackage ./opensbi.nix {}).overrideAttrs (f: p: { - src = if cfg.opensbi.src != null then cfg.opensbi.src else p.src; - patches = if cfg.opensbi.patches != null then cfg.opensbi.patches else (p.patches or []); - }); + opensbi = (pkgs.callPackage ./opensbi.nix { }).overrideAttrs ( + _f: p: { + src = if cfg.opensbi.src != null then cfg.opensbi.src else p.src; + patches = if cfg.opensbi.patches != null then cfg.opensbi.patches else (p.patches or [ ]); + } + ); - uboot = (pkgs.callPackage ./uboot.nix { inherit (config.system.build) opensbi; }).overrideAttrs (f: p: { - src = if cfg.uboot.src != null then cfg.uboot.src else p.src; - patches = if cfg.uboot.patches != null then cfg.uboot.patches else (p.patches or []); - }); + uboot = (pkgs.callPackage ./uboot.nix { inherit (config.system.build) opensbi; }).overrideAttrs ( + _f: p: { + src = if cfg.uboot.src != null then cfg.uboot.src else p.src; + patches = if cfg.uboot.patches != null then cfg.uboot.patches else (p.patches or [ ]); + } + ); updater-flash = pkgs.writeShellApplication { name = "visionfive2-firmware-update-flash"; diff --git a/starfive/visionfive/v2/sd-image.nix b/starfive/visionfive/v2/sd-image.nix index a14b87b2..667dc3fa 100644 --- a/starfive/visionfive/v2/sd-image.nix +++ b/starfive/visionfive/v2/sd-image.nix @@ -1,4 +1,9 @@ -{ config, pkgs, modulesPath, ... }: +{ + config, + pkgs, + modulesPath, + ... +}: { imports = [ "${modulesPath}/profiles/base.nix" @@ -7,8 +12,7 @@ ]; sdImage = { - imageName = - "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-starfive-visionfive2.img"; + imageName = "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-starfive-visionfive2.img"; # Overridden by postBuildCommands populateFirmwareCommands = ""; diff --git a/starfive/visionfive/v2/spl-tool.nix b/starfive/visionfive/v2/spl-tool.nix index cd0a77b0..a4543373 100644 --- a/starfive/visionfive/v2/spl-tool.nix +++ b/starfive/visionfive/v2/spl-tool.nix @@ -1,6 +1,6 @@ { stdenv, fetchFromGitHub }: -stdenv.mkDerivation (finalAttrs: { +stdenv.mkDerivation (_finalAttrs: { pname = "spi_tool"; version = "0x01010101"; src = fetchFromGitHub { diff --git a/starfive/visionfive/v2/uboot.nix b/starfive/visionfive/v2/uboot.nix index ef92cce3..6fe62a70 100644 --- a/starfive/visionfive/v2/uboot.nix +++ b/starfive/visionfive/v2/uboot.nix @@ -1,5 +1,6 @@ -{ buildUBoot -, opensbi +{ + buildUBoot, + opensbi, }: buildUBoot { diff --git a/supermicro/default.nix b/supermicro/default.nix index 9c5a2bb3..817f01d1 100644 --- a/supermicro/default.nix +++ b/supermicro/default.nix @@ -1,5 +1,8 @@ { pkgs, ... }: { - boot.kernelModules = [ "ipmi_devintf" "ipmi_si" ]; + boot.kernelModules = [ + "ipmi_devintf" + "ipmi_si" + ]; environment.systemPackages = [ pkgs.ipmitool ]; } diff --git a/supermicro/x10sll-f/default.nix b/supermicro/x10sll-f/default.nix index c0200510..cbba1eb8 100644 --- a/supermicro/x10sll-f/default.nix +++ b/supermicro/x10sll-f/default.nix @@ -3,7 +3,10 @@ ../. ]; - boot.kernelModules = [ "jc42" "tpm_rng" ]; + boot.kernelModules = [ + "jc42" + "tpm_rng" + ]; # services.cron.systemCronJobs = [ # # Reset 5-minute watchdog timer every minute diff --git a/system76/darp6/default.nix b/system76/darp6/default.nix index ff70ac94..b5a2560f 100644 --- a/system76/darp6/default.nix +++ b/system76/darp6/default.nix @@ -10,19 +10,24 @@ # system76-io-dkms also appears to be loaded on darp6 with Pop!_OS, and # system76-dkms does not, and in fact refuses to load. -{ config, lib, options, pkgs, ... }: +{ + config, + lib, + options, + pkgs, + ... +}: let cfg = config.hardware.system76.darp6; # Allow silencing the warning about these options if either is defined. soundSettingsDefined = - options.hardware.system76.darp6.soundVendorId.isDefined || - options.hardware.system76.darp6.soundSubsystemId.isDefined; + options.hardware.system76.darp6.soundVendorId.isDefined + || options.hardware.system76.darp6.soundSubsystemId.isDefined; # We neeed both options non-null to be able to apply the headset fixup though. soundSettingsAvailable = - soundSettingsDefined && - (cfg.soundVendorId != null && cfg.soundSubsystemId != null); + soundSettingsDefined && (cfg.soundVendorId != null && cfg.soundSubsystemId != null); in { imports = [ diff --git a/system76/galp5-1650/default.nix b/system76/galp5-1650/default.nix index c2fcf231..71820f6d 100644 --- a/system76/galp5-1650/default.nix +++ b/system76/galp5-1650/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ ../. diff --git a/system76/gaze18/default.nix b/system76/gaze18/default.nix index dd4302b8..61b3f92f 100644 --- a/system76/gaze18/default.nix +++ b/system76/gaze18/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { imports = [ ../. diff --git a/tests/build-profile.nix b/tests/build-profile.nix index 36ab88b5..3c20380d 100644 --- a/tests/build-profile.nix +++ b/tests/build-profile.nix @@ -2,20 +2,23 @@ (pkgs.nixos [ profile - ({ config, lib, ... }: { - nixpkgs.pkgs = pkgs; - boot.loader.systemd-boot.enable = !config.boot.loader.generic-extlinux-compatible.enable; - # we forcefully disable grub here just for testing purposes, even though some profiles might still use grub in the end. - boot.loader.grub.enable = false; + ( + { config, lib, ... }: + { + nixpkgs.pkgs = pkgs; + boot.loader.systemd-boot.enable = !config.boot.loader.generic-extlinux-compatible.enable; + # we forcefully disable grub here just for testing purposes, even though some profiles might still use grub in the end. + boot.loader.grub.enable = false; - # so we can have assertions that require a certain minimum kernel version, - # We use a priority of 1200 here, which is higher than the default of 1000 - boot.kernelPackages = lib.mkOverride 1200 pkgs.linuxPackages_latest; + # so we can have assertions that require a certain minimum kernel version, + # We use a priority of 1200 here, which is higher than the default of 1000 + boot.kernelPackages = lib.mkOverride 1200 pkgs.linuxPackages_latest; - fileSystems."/" = { - device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000"; - fsType = "btrfs"; - }; - system.stateVersion = config.system.nixos.release; - }) + fileSystems."/" = { + device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000"; + fsType = "btrfs"; + }; + system.stateVersion = config.system.nixos.release; + } + ) ]).config.system.build.toplevel diff --git a/tests/flake.nix b/tests/flake.nix index 91de6edf..bf20ed3a 100644 --- a/tests/flake.nix +++ b/tests/flake.nix @@ -85,10 +85,17 @@ in { _module.args.pkgs = nixpkgsUnstable; - checks = checksForNixpkgs "nixos-unstable" nixpkgsUnstable // checksForNixpkgs "nixos-stable" nixpkgsStable; + checks = + checksForNixpkgs "nixos-unstable" nixpkgsUnstable + // checksForNixpkgs "nixos-stable" nixpkgsStable; packages.run = pkgs.writeShellScriptBin "run.py" '' #!${pkgs.bash}/bin/bash - export PATH=${lib.makeBinPath [ pkgs.nix-eval-jobs pkgs.nix-eval-jobs.nix ]} + export PATH=${ + lib.makeBinPath [ + pkgs.nix-eval-jobs + pkgs.nix-eval-jobs.nix + ] + } exec ${pkgs.python3.interpreter} ${./.}/run.py --nixos-hardware "$@" ''; }; diff --git a/toshiba/swanky/default.nix b/toshiba/swanky/default.nix index 32e3b126..7557d0a9 100644 --- a/toshiba/swanky/default.nix +++ b/toshiba/swanky/default.nix @@ -17,11 +17,13 @@ in boot.kernelParams = [ "acpi_backlight=vendor" ]; # Sound requires a custom UCM config: - system.replaceRuntimeDependencies = [{ - original = pkgs.alsa-lib; + system.replaceRuntimeDependencies = [ + { + original = pkgs.alsa-lib; - replacement = pkgs.alsa-lib.overrideAttrs (_super: { - postFixup = "cp -r ${ucm}/chtmax98090 $out/share/alsa/ucm"; - }); - }]; + replacement = pkgs.alsa-lib.overrideAttrs (_super: { + postFixup = "cp -r ${ucm}/chtmax98090 $out/share/alsa/ucm"; + }); + } + ]; } diff --git a/treefmt.nix b/treefmt.nix new file mode 100644 index 00000000..7039d8b5 --- /dev/null +++ b/treefmt.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +{ + projectRootFile = "flake.nix"; + + programs = { + deadnix = { + enable = true; + no-lambda-pattern-names = true; + }; + nixfmt = { + enable = true; + package = pkgs.nixfmt-rfc-style; + }; + }; + + settings = { + on-unmatched = "info"; + }; +} diff --git a/tuxedo/infinitybook/pro14/gen9/default.nix b/tuxedo/infinitybook/pro14/gen9/default.nix index 7662c658..5dc50911 100644 --- a/tuxedo/infinitybook/pro14/gen9/default.nix +++ b/tuxedo/infinitybook/pro14/gen9/default.nix @@ -1,9 +1,11 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ imports = [ ../../. ]; # Add Motorcomm YT6801 Driver if available - boot.extraModulePackages = with config.boot; lib.lists.optional - ( kernelPackages ? yt6801 ) kernelPackages.yt6801; + boot.extraModulePackages = + with config.boot; + lib.lists.optional (kernelPackages ? yt6801) kernelPackages.yt6801; } diff --git a/tuxedo/pulse/14/gen3/default.nix b/tuxedo/pulse/14/gen3/default.nix index 52d292cf..5458ce9d 100644 --- a/tuxedo/pulse/14/gen3/default.nix +++ b/tuxedo/pulse/14/gen3/default.nix @@ -3,7 +3,8 @@ pkgs, config, ... -}: { +}: +{ imports = [ ../../../../common/cpu/amd ../../../../common/cpu/amd/pstate.nix @@ -17,8 +18,9 @@ # Kernel 6.6.35 apparently does not have this issue, # the exact version is still unknown which fixed this. boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.6.35") ( - if (config.boot.zfs.enabled) - then pkgs.zfs.latestCompatibleLinuxPackages - else pkgs.linuxPackages_latest + if (config.boot.zfs.enabled) then + pkgs.zfs.latestCompatibleLinuxPackages + else + pkgs.linuxPackages_latest ); } diff --git a/tuxedo/pulse/15/gen2/default.nix b/tuxedo/pulse/15/gen2/default.nix index 05c56055..0afd6b3b 100644 --- a/tuxedo/pulse/15/gen2/default.nix +++ b/tuxedo/pulse/15/gen2/default.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ imports = [ ../../../../common/cpu/amd ../../../../common/gpu/amd @@ -6,11 +7,16 @@ ]; services.udev.extraRules = builtins.concatStringsSep "\n" ( - ["# Properly suspend the system."] - ++ ( - map - (device: ''SUBSYSTEM=="pci", ACTION=="add", ATTR{vendor}=="0x144d", ATTR{device}=="${device}", RUN+="${pkgs.runtimeShell} -c 'echo 0 > /sys/bus/pci/devices/$kernel/d3cold_allowed'"'') - ["0xa80a" "0xa808"] + [ "# Properly suspend the system." ] + ++ (map + ( + device: + ''SUBSYSTEM=="pci", ACTION=="add", ATTR{vendor}=="0x144d", ATTR{device}=="${device}", RUN+="${pkgs.runtimeShell} -c 'echo 0 > /sys/bus/pci/devices/$kernel/d3cold_allowed'"'' + ) + [ + "0xa80a" + "0xa808" + ] ) ); }