chore: format repo using treefmt-nix and nixfmt-rfc-style

This commit is contained in:
Andre 2025-06-04 12:11:03 -04:00
parent fc7c471412
commit 51e51e6014
266 changed files with 3721 additions and 2733 deletions

View file

@ -5,8 +5,7 @@
"hid_apple.iso_layout=0" "hid_apple.iso_layout=0"
]; ];
hardware.facetimehd.enable = lib.mkDefault hardware.facetimehd.enable = lib.mkDefault (config.nixpkgs.config.allowUnfree or false);
(config.nixpkgs.config.allowUnfree or false);
services.mbpfan.enable = lib.mkDefault true; services.mbpfan.enable = lib.mkDefault true;
} }

View file

@ -3,7 +3,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
../. ../.
../../../common/cpu/intel/kaby-lake ../../../common/cpu/intel/kaby-lake
@ -14,7 +15,12 @@
# apple smc (TODO: check spi) # apple smc (TODO: check spi)
boot = { 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" ]; kernelParams = [ "intel_iommu=on" ];
kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.0") pkgs.linuxPackages_latest; kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.0") pkgs.linuxPackages_latest;
}; };

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
imports = [ imports = [

View file

@ -18,7 +18,6 @@ in
services.udev.extraRules = services.udev.extraRules =
# Disable XHC1 wakeup signal to avoid resume getting triggered some time # Disable XHC1 wakeup signal to avoid resume getting triggered some time
# after suspend. Reboot required for this to take effect. # after suspend. Reboot required for this to take effect.
lib.optionalString lib.optionalString (lib.versionAtLeast kernelPackages.kernel.version "3.13")
(lib.versionAtLeast kernelPackages.kernel.version "3.13")
''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"''; ''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"'';
} }

View file

@ -1,4 +1,9 @@
{ lib, pkgs, modulesPath, ... }: {
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ imports = [

View file

@ -3,7 +3,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
../. ../.
../../../common/cpu/intel/kaby-lake ../../../common/cpu/intel/kaby-lake
@ -15,7 +16,12 @@
# https://www.kernelconfig.io/config_keyboard_applespi # https://www.kernelconfig.io/config_keyboard_applespi
boot = { 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" ]; kernelParams = [ "intel_iommu=on" ];
kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.0") pkgs.linuxPackages_latest; kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.0") pkgs.linuxPackages_latest;
}; };

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
imports = [ imports = [

View file

@ -25,7 +25,7 @@ let
overrideAudioFiles = overrideAudioFiles =
package: pluginsPath: package: pluginsPath:
package.overrideAttrs ( package.overrideAttrs (
new: old: { _new: old: {
preConfigurePhases = old.preConfigurePhases or [ ] ++ [ "postPatchPhase" ]; preConfigurePhases = old.preConfigurePhases or [ ] ++ [ "postPatchPhase" ];
postPatchPhase = '' postPatchPhase = ''
cp -r ${audioFiles}/files/{profile-sets,paths} ${pluginsPath}/alsa/mixer/ cp -r ${audioFiles}/files/{profile-sets,paths} ${pluginsPath}/alsa/mixer/
@ -106,11 +106,16 @@ in
powerManagement.enable = true; powerManagement.enable = true;
} }
(if lib.versionAtLeast nixosVersion "25.05" then { (
if lib.versionAtLeast nixosVersion "25.05" then
{
services.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/"; services.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
} else { }
else
{
hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/"; hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
}) }
)
(lib.mkIf t2Cfg.enableIGPU { (lib.mkIf t2Cfg.enableIGPU {
# Enable the iGPU by default if present # Enable the iGPU by default if present

View file

@ -11,5 +11,7 @@
# 6.5 adds many fixes and improvements for the Ally # 6.5 adds many fixes and improvements for the Ally
# This includes for example performance, audio and bluetooth # 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
);
} }

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
p = pkgs.writeScriptBin "charge-upto" '' p = pkgs.writeScriptBin "charge-upto" ''
echo ''${0:-100} > /sys/class/power_supply/BAT?/charge_control_end_threshold echo ''${0:-100} > /sys/class/power_supply/BAT?/charge_control_end_threshold
@ -22,8 +27,14 @@ in
config = { config = {
environment.systemPackages = lib.mkIf cfg.enableChargeUptoScript [ p ]; environment.systemPackages = lib.mkIf cfg.enableChargeUptoScript [ p ];
systemd.services.battery-charge-threshold = { systemd.services.battery-charge-threshold = {
wantedBy = [ "local-fs.target" "suspend.target" ]; wantedBy = [
after = [ "local-fs.target" "suspend.target" ]; "local-fs.target"
"suspend.target"
];
after = [
"local-fs.target"
"suspend.target"
];
description = "Set the battery charge threshold to ${toString cfg.chargeUpto}%"; description = "Set the battery charge threshold to ${toString cfg.chargeUpto}%";
startLimitBurst = 5; startLimitBurst = 5;
startLimitIntervalSec = 1; startLimitIntervalSec = 1;

View file

@ -3,7 +3,8 @@
pkgs, pkgs,
config, config,
... ...
}: { }:
{
imports = [ imports = [
../../common/cpu/amd ../../common/cpu/amd
../../common/cpu/amd/raphael/igpu.nix ../../common/cpu/amd/raphael/igpu.nix
@ -20,7 +21,9 @@
# The bottom 2 parts are taken from the framework 16-inch laptops configurations. # 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/ # 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: # AMD has better battery life with PPD over TLP:
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13

View file

@ -1,4 +1,5 @@
{ config, {
config,
lib, lib,
... ...
}: }:
@ -7,15 +8,22 @@ let
inherit (lib) mkEnableOption mkIf mkMerge; inherit (lib) mkEnableOption mkIf mkMerge;
cfg = config.hardware.asus.flow.gv302x; cfg = config.hardware.asus.flow.gv302x;
in { in
{
imports = [ imports = [
../shared.nix ../shared.nix
]; ];
options.hardware.asus.flow.gv302x.amdgpu = { options.hardware.asus.flow.gv302x.amdgpu = {
recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = false; }; recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // {
sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = true; }; default = false;
psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { default = true; }; };
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 [ config = mkMerge [

View file

@ -1,4 +1,5 @@
{ lib, {
lib,
pkgs, pkgs,
config, config,
... ...
@ -7,7 +8,8 @@
let let
inherit (lib) mkDefault; inherit (lib) mkDefault;
in { in
{
imports = [ imports = [
../shared.nix ../shared.nix
## "prime.nix" loads this, aleady: ## "prime.nix" loads this, aleady:
@ -23,8 +25,6 @@ in {
blacklistedKernelModules = [ "nouveau" ]; blacklistedKernelModules = [ "nouveau" ];
}; };
hardware = { hardware = {
## Enable the Nvidia card, as well as Prime and Offload: ## Enable the Nvidia card, as well as Prime and Offload:
amdgpu.initrd.enable = mkDefault true; amdgpu.initrd.enable = mkDefault true;

View file

@ -1,14 +1,23 @@
{ config, {
config,
pkgs, pkgs,
lib, lib,
... ...
}: }:
let let
inherit (lib) mkDefault mkEnableOption mkIf mkMerge version versionAtLeast versionOlder; inherit (lib)
mkDefault
mkEnableOption
mkIf
mkMerge
version
versionAtLeast
;
cfg = config.hardware.asus.flow.gv302x; cfg = config.hardware.asus.flow.gv302x;
in { in
{
imports = [ imports = [
../../../common/cpu/amd ../../../common/cpu/amd
@ -26,9 +35,9 @@ in {
# enables it for kernel 6.9.x onwards. # enables it for kernel 6.9.x onwards.
# #
# Note: the device name is "ASUS N-KEY Device". # Note: the device name is "ASUS N-KEY Device".
keyboard.autosuspend.enable = ( keyboard.autosuspend.enable =
mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Flow GV302X" (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"; default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9";
defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\""; defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\"";
}; };

View file

@ -1,8 +1,7 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
imports = imports = [
[
../../common/cpu/intel ../../common/cpu/intel
../../common/gpu/nvidia ../../common/gpu/nvidia
../../common/gpu/nvidia/prime.nix ../../common/gpu/nvidia/prime.nix
@ -11,13 +10,11 @@
../battery.nix ../battery.nix
]; ];
hardware.nvidia = hardware.nvidia = {
{
modesetting.enable = lib.mkDefault true; modesetting.enable = lib.mkDefault true;
open = lib.mkIf (lib.versionAtLeast config.hardware.nvidia.package.version "555") true; open = lib.mkIf (lib.versionAtLeast config.hardware.nvidia.package.version "555") true;
prime = prime = {
{
intelBusId = "PCI:0:2:0"; intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0"; nvidiaBusId = "PCI:1:0:0";
}; };

View file

@ -20,7 +20,9 @@
options snd-hda-intel patch=hda-jack-retask.fw options snd-hda-intel patch=hda-jack-retask.fw
''; '';
# before 5.12 it would interpret every keystroke as the power button # 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 = { hardware.nvidia.prime = {
amdgpuBusId = "PCI:5:0:0"; amdgpuBusId = "PCI:5:0:0";

View file

@ -1,4 +1,5 @@
{ config, {
config,
lib, lib,
... ...
}: }:
@ -7,15 +8,22 @@ let
inherit (lib) mkEnableOption mkIf mkMerge; inherit (lib) mkEnableOption mkIf mkMerge;
cfg = config.hardware.asus.zephyrus.ga402x; cfg = config.hardware.asus.zephyrus.ga402x;
in { in
{
imports = [ imports = [
../shared.nix ../shared.nix
]; ];
options.hardware.asus.zephyrus.ga402x.amdgpu = { options.hardware.asus.zephyrus.ga402x.amdgpu = {
recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = false; }; recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // {
sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = true; }; default = false;
psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { default = true; }; };
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 [ config = mkMerge [

View file

@ -1,4 +1,5 @@
{ lib, {
lib,
pkgs, pkgs,
... ...
}: }:
@ -6,7 +7,8 @@
let let
inherit (lib) mkDefault; inherit (lib) mkDefault;
in { in
{
imports = [ imports = [
../shared.nix ../shared.nix
## "prime.nix" loads this, aleady: ## "prime.nix" loads this, aleady:

View file

@ -1,14 +1,24 @@
{ config, {
config,
pkgs, pkgs,
lib, lib,
... ...
}: }:
let 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; cfg = config.hardware.asus.zephyrus.ga402x;
in { in
{
imports = [ imports = [
../../../common/cpu/amd ../../../common/cpu/amd
@ -26,9 +36,9 @@ in {
# enables it for kernel 6.9.x onwards. # enables it for kernel 6.9.x onwards.
# #
# Note: the device name is "ASUS N-KEY Device". # Note: the device name is "ASUS N-KEY Device".
keyboard.autosuspend.enable = ( keyboard.autosuspend.enable =
mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Zephyrus GA402X" (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"; default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9";
defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\""; defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\"";
}; };

View file

@ -1,4 +1,5 @@
{ ... }: { { ... }:
{
imports = [ imports = [
../../common/cpu/intel ../../common/cpu/intel
../../common/pc/laptop ../../common/pc/laptop
@ -6,6 +7,8 @@
../../common/hidpi.nix ../../common/hidpi.nix
]; ];
# Fixes the display being rotated 90 degrees. # Fixes the display being rotated 90 degrees.
boot.kernelParams = boot.kernelParams = [
[ "fbcon=rotate:1" "video=DSI-1:panel_orientation=right_side_up" ]; "fbcon=rotate:1"
"video=DSI-1:panel_orientation=right_side_up"
];
} }

View file

@ -1,6 +1,5 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
hardware.cpu.amd.updateMicrocode = hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View file

@ -8,21 +8,11 @@ in
imports = [ ./. ]; imports = [ ./. ];
boot = lib.mkMerge [ boot = lib.mkMerge [
(lib.mkIf (lib.mkIf ((lib.versionAtLeast kver "5.17") && (lib.versionOlder kver "6.1")) {
(
(lib.versionAtLeast kver "5.17")
&& (lib.versionOlder kver "6.1")
)
{
kernelParams = [ "initcall_blacklist=acpi_cpufreq_init" ]; kernelParams = [ "initcall_blacklist=acpi_cpufreq_init" ];
kernelModules = [ "amd-pstate" ]; kernelModules = [ "amd-pstate" ];
}) })
(lib.mkIf (lib.mkIf ((lib.versionAtLeast kver "6.1") && (lib.versionOlder kver "6.3")) {
(
(lib.versionAtLeast kver "6.1")
&& (lib.versionOlder kver "6.3")
)
{
kernelParams = [ "amd_pstate=passive" ]; kernelParams = [ "amd_pstate=passive" ];
}) })
(lib.mkIf (lib.versionAtLeast kver "6.3") { (lib.mkIf (lib.versionAtLeast kver "6.3") {

View file

@ -6,9 +6,18 @@
# Backward-compat for 24.05, can be removed after we drop 24.05 support # Backward-compat for 24.05, can be removed after we drop 24.05 support
imports = lib.optionals (lib.versionOlder lib.version "24.11pre") [ imports = lib.optionals (lib.versionOlder lib.version "24.11pre") [
(lib.mkAliasOptionModule [ "hardware" "graphics" "enable" ] [ "hardware" "opengl" "enable" ]) (lib.mkAliasOptionModule [ "hardware" "graphics" "enable" ] [ "hardware" "opengl" "enable" ])
(lib.mkAliasOptionModule [ "hardware" "graphics" "extraPackages" ] [ "hardware" "opengl" "extraPackages" ]) (lib.mkAliasOptionModule
(lib.mkAliasOptionModule [ "hardware" "graphics" "extraPackages32" ] [ "hardware" "opengl" "extraPackages32" ]) [ "hardware" "graphics" "extraPackages" ]
(lib.mkAliasOptionModule [ "hardware" "graphics" "enable32Bit" ] [ "hardware" "opengl" "driSupport32Bit" ]) [ "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" "package" ] [ "hardware" "opengl" "package" ])
(lib.mkAliasOptionModule [ "hardware" "graphics" "package32" ] [ "hardware" "opengl" "package32" ]) (lib.mkAliasOptionModule [ "hardware" "graphics" "package32" ] [ "hardware" "opengl" "package32" ])
]; ];

View file

@ -1,5 +1,8 @@
{ {
imports = [ ../. ]; imports = [ ../. ];
# Explicitly set amdgpu support in place of radeon # 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"
];
} }

View file

@ -1,5 +1,8 @@
{ {
imports = [ ../. ]; imports = [ ../. ];
# Explicitly set amdgpu support in place of radeon # 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"
];
} }

View file

@ -45,11 +45,15 @@
intel-vaapi-driver = (pkgs.intel-vaapi-driver or pkgs.vaapiIntel).override { intel-vaapi-driver = (pkgs.intel-vaapi-driver or pkgs.vaapiIntel).override {
enableHybridCodec = cfg.enableHybridCodec; enableHybridCodec = cfg.enableHybridCodec;
}; };
intel-vaapi-driver-32 = (pkgs.driversi686Linux.intel-vaapi-driver or pkgs.driversi686Linux.vaapiIntel).override { intel-vaapi-driver-32 =
(pkgs.driversi686Linux.intel-vaapi-driver or pkgs.driversi686Linux.vaapiIntel).override
{
enableHybridCodec = cfg.enableHybridCodec; 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; intel-ocl = pkgs.intel-ocl;
useIntelMediaDriver = cfg.vaapiDriver == "intel-media-driver" || cfg.vaapiDriver == null; useIntelMediaDriver = cfg.vaapiDriver == "intel-media-driver" || cfg.vaapiDriver == null;

View file

@ -22,5 +22,10 @@
# Remove NVIDIA VGA/3D controller devices # 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" 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"
];
} }

View file

@ -6,6 +6,8 @@
# Gnome 40 introduced a new way of managing power, without tlp. # Gnome 40 introduced a new way of managing power, without tlp.
# However, these 2 services clash when enabled simultaneously. # However, these 2 services clash when enabled simultaneously.
# https://github.com/NixOS/nixos-hardware/issues/260 # https://github.com/NixOS/nixos-hardware/issues/260
services.tlp.enable = lib.mkDefault ((lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") services.tlp.enable = lib.mkDefault (
|| !config.services.power-profiles-daemon.enable); (lib.versionOlder (lib.versions.majorMinor lib.version) "21.05")
|| !config.services.power-profiles-daemon.enable
);
} }

View file

@ -16,7 +16,10 @@
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
description = "reload touchpad driver"; description = "reload touchpad driver";
# must run at boot (and not too early), and after suspend # 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 # prevent running before suspend
after = [ "post-resume.target" ]; after = [ "post-resume.target" ];
}; };
@ -24,7 +27,6 @@
# so that post-resume.service exists # so that post-resume.service exists
powerManagement.enable = true; powerManagement.enable = true;
# fix suspend # fix suspend
# https://bbs.archlinux.org/viewtopic.php?id=266108 says linux >= 5.12 required # 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; boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") pkgs.linuxPackages_latest;

View file

@ -11,7 +11,10 @@ with lib;
]; ];
# TSC is unstable # TSC is unstable
boot.kernelParams = [ "notsc" "trace_clock=local" ]; boot.kernelParams = [
"notsc"
"trace_clock=local"
];
hardware.enableRedistributableFirmware = mkDefault true; hardware.enableRedistributableFirmware = mkDefault true;
} }

View file

@ -12,7 +12,10 @@
boot = { boot = {
# Kernel Panic on suspend fix, taken from ArchLinux wiki. # 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 # Audio Mute LED
extraModprobeConfig = '' extraModprobeConfig = ''
options snd-hda-intel model=mute-led-gpio options snd-hda-intel model=mute-led-gpio

View file

@ -4,7 +4,9 @@
../../../common/gpu/nvidia/ada-lovelace ../../../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 = { hardware.nvidia.prime = {
intelBusId = "PCI:0:2:0"; intelBusId = "PCI:0:2:0";

View file

@ -2,7 +2,8 @@
config, config,
lib, lib,
... ...
}: { }:
{
imports = [ imports = [
../../../common/cpu/intel/kaby-lake ../../../common/cpu/intel/kaby-lake
../../../common/pc/laptop ../../../common/pc/laptop
@ -11,7 +12,13 @@
]; ];
hardware.enableRedistributableFirmware = lib.mkDefault true; 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 = { boot = {
kernelModules = [ "kvm-intel" ]; kernelModules = [ "kvm-intel" ];

View file

@ -3,7 +3,8 @@
let let
inherit (lib) mkDefault; inherit (lib) mkDefault;
in { in
{
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
../../../common/pc/laptop ../../../common/pc/laptop

View file

@ -1,16 +1,18 @@
{ lib, pkgs, ... }: { { lib, pkgs, ... }:
{
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
../../../common/pc/laptop ../../../common/pc/laptop
../../../common/pc/ssd ../../../common/pc/ssd
]; ];
# Includes the Wi-Fi and Bluetooth firmware for the QCA6390. # Includes the Wi-Fi and Bluetooth firmware for the QCA6390.
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
# Requires at least 5.12 for working wi-fi and bluetooth. # 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. # Touchpad goes over i2c.
# Without this we get errors in dmesg on boot and hangs when shutting down. # Without this we get errors in dmesg on boot and hangs when shutting down.

View file

@ -2,7 +2,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
../../../common/pc/laptop ../../../common/pc/laptop

View file

@ -7,6 +7,9 @@
# Required to allow the touchpad to work # Required to allow the touchpad to work
boot.kernelParams = [ "i8042.nopnp=1" ]; boot.kernelParams = [ "i8042.nopnp=1" ];
boot.blacklistedKernelModules = [ "i2c_hid" "i2c_hid_acpi" ]; boot.blacklistedKernelModules = [
"i2c_hid"
"i2c_hid_acpi"
];
boot.kernelModules = [ "synaptics_i2c" ]; boot.kernelModules = [ "synaptics_i2c" ];
} }

View file

@ -14,7 +14,10 @@
boot = { boot = {
# needs to be explicitly loaded or else bluetooth/wifi won't work # 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 ]; extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
}; };
} }

View file

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }:
{
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
../../../common/pc/laptop ../../../common/pc/laptop

View file

@ -1,4 +1,5 @@
{ lib, pkgs, ... }: { { lib, pkgs, ... }:
{
imports = [ imports = [
../../../../common/gpu/nvidia/prime.nix ../../../../common/gpu/nvidia/prime.nix
../../../../common/gpu/nvidia/ampere ../../../../common/gpu/nvidia/ampere
@ -11,7 +12,10 @@
graphics = { graphics = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
enable32Bit = 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 = { nvidia = {
prime = { prime = {

View file

@ -9,7 +9,6 @@
../../../../common/gpu/nvidia/pascal ../../../../common/gpu/nvidia/pascal
]; ];
# This runs only nvidia, great for games or heavy use of render applications # This runs only nvidia, great for games or heavy use of render applications
##### disable intel, run nvidia only and as default ##### disable intel, run nvidia only and as default

View file

@ -6,7 +6,6 @@
../shared.nix ../shared.nix
]; ];
# This runs only nvidia, great for games or heavy use of render applications # This runs only nvidia, great for games or heavy use of render applications
##### disable intel, run nvidia only and as default ##### disable intel, run nvidia only and as default

View file

@ -10,7 +10,8 @@
# This will save you money and possibly your life! # This will save you money and possibly your life!
services.thermald.enable = lib.mkDefault true; services.thermald.enable = lib.mkDefault true;
boot.kernelPatches = [{ boot.kernelPatches = [
{
name = "enable-soundwire-drivers"; name = "enable-soundwire-drivers";
patch = null; patch = null;
extraConfig = '' extraConfig = ''
@ -18,9 +19,8 @@
SND_SOC_INTEL_SOUNDWIRE_SOF_MACH m SND_SOC_INTEL_SOUNDWIRE_SOF_MACH m
SND_SOC_RT1308 m SND_SOC_RT1308 m
''; '';
}]; }
];
boot.kernelPackages =
lib.mkIf (lib.versionOlder pkgs.linux.version "5.11") boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.11") pkgs.linuxPackages_latest;
pkgs.linuxPackages_latest;
} }

View file

@ -1,4 +1,5 @@
{ lib, pkgs, ... }: { { lib, pkgs, ... }:
{
imports = [ imports = [
../../../../common/cpu/intel ../../../../common/cpu/intel
../../../../common/pc/laptop ../../../../common/pc/laptop
@ -9,5 +10,7 @@
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
# Requires at least 5.12 for working sound # 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
);
} }

View file

@ -1,4 +1,9 @@
{config, lib, pkgs, ...}: {
config,
lib,
pkgs,
...
}:
let let
inherit (lib) mkIf mkOption types; inherit (lib) mkIf mkOption types;
@ -23,7 +28,8 @@ let
}; };
cfg = config.services.sleep-resume.bluetooth; cfg = config.services.sleep-resume.bluetooth;
in { in
{
options = { options = {
services.sleep-resume.bluetooth = { services.sleep-resume.bluetooth = {
enable = mkOption { enable = mkOption {

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
inherit (lib) mkIf mkOption types; inherit (lib) mkIf mkOption types;
@ -22,7 +27,8 @@ let
}; };
cfg = config.services.sleep-resume.i2c-designware; cfg = config.services.sleep-resume.i2c-designware;
in { in
{
options = { options = {
services.sleep-resume.i2c-designware = { services.sleep-resume.i2c-designware = {
enable = mkOption { enable = mkOption {
@ -37,6 +43,3 @@ in {
powerManagement.resumeCommands = "${reloadDesignware}/bin/reload-i2c-designware.sh"; powerManagement.resumeCommands = "${reloadDesignware}/bin/reload-i2c-designware.sh";
}; };
} }

62
flake.lock generated Normal file
View file

@ -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
}

View file

@ -1,7 +1,35 @@
{ {
description = "nixos-hardware"; description = "nixos-hardware";
outputs = _: { 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 = nixosModules =
let let
deprecated = deprecated =
@ -59,9 +87,7 @@
beagleboard-pocketbeagle = import ./beagleboard/pocketbeagle; beagleboard-pocketbeagle = import ./beagleboard/pocketbeagle;
chuwi-minibook-x = import ./chuwi/minibook-x; chuwi-minibook-x = import ./chuwi/minibook-x;
deciso-dec = import ./deciso/dec; deciso-dec = import ./deciso/dec;
dell-e7240 = dell-e7240 = deprecated "1326" "dell-e7240" (import ./dell/e7240);
deprecated "1326" "dell-e7240"
(import ./dell/e7240);
dell-g3-3779 = import ./dell/g3/3779; dell-g3-3779 = import ./dell/g3/3779;
dell-g3-3579 = import ./dell/g3/3579; dell-g3-3579 = import ./dell/g3/3579;
dell-inspiron-14-5420 = import ./dell/inspiron/14-5420; dell-inspiron-14-5420 = import ./dell/inspiron/14-5420;

View file

@ -9,7 +9,14 @@
../../../common/pc/ssd ../../../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.kernelModules = [ "kvm-intel" ];
boot.kernelParams = [ boot.kernelParams = [
"tpm_tis.interrupts=0" # Upstream bug: https://bugzilla.kernel.org/show_bug.cgi?id=204121 "tpm_tis.interrupts=0" # Upstream bug: https://bugzilla.kernel.org/show_bug.cgi?id=204121

View file

@ -1,4 +1,5 @@
{ lib, pkgs, ...}: { { lib, pkgs, ... }:
{
imports = [ imports = [
../common ../common
../common/intel.nix ../common/intel.nix
@ -6,7 +7,10 @@
# Requires at least 5.16 for working wi-fi and bluetooth. # 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 # 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";
} }

View file

@ -9,7 +9,8 @@
{ {
hardware.intelgpu.loadInInitrd = lib.versionOlder config.boot.kernelPackages.kernel.version "6.2"; hardware.intelgpu.loadInInitrd = lib.versionOlder config.boot.kernelPackages.kernel.version "6.2";
# same as 13th gen framework 13-inch # 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 # 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") { (lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.2") {

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
cfg = config.hardware.framework.amd-7040; cfg = config.hardware.framework.amd-7040;
@ -27,12 +32,15 @@ in
config = { config = {
# Workaround applied upstream in Linux >=6.7 (on BIOS 03.03) # Workaround applied upstream in Linux >=6.7 (on BIOS 03.03)
# https://github.com/torvalds/linux/commit/a55bdad5dfd1efd4ed9ffe518897a21ca8e4e193 # https://github.com/torvalds/linux/commit/a55bdad5dfd1efd4ed9ffe518897a21ca8e4e193
services.udev.extraRules = lib.mkIf (lib.versionOlder config.boot.kernelPackages.kernel.version "6.7" && cfg.preventWakeOnAC) '' 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: # 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 # 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" 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";
}; };
} }

View file

@ -1,9 +1,15 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
imports = [ imports = [
../common ../common
../common/amd.nix ../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";
} }

View file

@ -1,4 +1,5 @@
{ lib, config, ... }: { { lib, config, ... }:
{
imports = [ imports = [
../../../common/cpu/amd ../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix ../../../common/cpu/amd/pstate.nix
@ -15,7 +16,9 @@
"amdgpu.dcdebugmask=0x10" "amdgpu.dcdebugmask=0x10"
] ]
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ # 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: # AMD has better battery life with PPD over TLP:
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
cfg = config.hardware.framework.laptop13.audioEnhancement; cfg = config.hardware.framework.laptop13.audioEnhancement;
in in
@ -51,7 +56,8 @@ in
}; };
}; };
config = lib.mkIf cfg.enable (let config = lib.mkIf cfg.enable (
let
outputName = cfg.rawDeviceName; outputName = cfg.rawDeviceName;
prettyName = "Framework Speakers"; prettyName = "Framework Speakers";
@ -373,10 +379,12 @@ in
bankstown-lv2 bankstown-lv2
]; ];
}; };
in { in
{
services.pipewire.wireplumber.configPackages = [ configPackage ]; services.pipewire.wireplumber.configPackages = [ configPackage ];
# Pipewire is needed for this. # Pipewire is needed for this.
services.pipewire.enable = lib.mkDefault true; services.pipewire.enable = lib.mkDefault true;
}); }
);
} }

View file

@ -1,9 +1,16 @@
{ config, lib, pkgs, ... }: { {
config,
lib,
pkgs,
...
}:
{
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
]; ];
boot.kernelParams = [ boot.kernelParams =
[
# For Power consumption # For Power consumption
# https://community.frame.work/t/linux-battery-life-tuning/6665/156 # https://community.frame.work/t/linux-battery-life-tuning/6665/156
"nvme.noacpi=1" "nvme.noacpi=1"
@ -15,7 +22,9 @@
# Requires at least 5.16 for working wi-fi and bluetooth. # 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 # 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. # Module is not used for Framework EC but causes boot time error log.
boot.blacklistedKernelModules = [ "cros-usbpd-charger" ]; boot.blacklistedKernelModules = [ "cros-usbpd-charger" ];

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
imports = [ imports = [
@ -8,7 +13,9 @@
# Need at least 6.9 to make suspend properly # Need at least 6.9 to make suspend properly
# Specifically this patch: https://github.com/torvalds/linux/commit/073237281a508ac80ec025872ad7de50cfb5a28a # 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 # Intel NPU Driver
# https://discourse.nixos.org/t/new-installation-on-asus-zenbook-ux5406-intel-vpu-firmware-error-2/58732/2 # https://discourse.nixos.org/t/new-installation-on-asus-zenbook-ux5406-intel-vpu-firmware-error-2/58732/2

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
imports = [ imports = [

View file

@ -1,4 +1,5 @@
{ lib, config, ... }: { { lib, config, ... }:
{
imports = [ imports = [
../../../common/cpu/amd ../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix ../../../common/cpu/amd/pstate.nix
@ -15,7 +16,9 @@
"amdgpu.dcdebugmask=0x10" "amdgpu.dcdebugmask=0x10"
] ]
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ # 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: # AMD has better battery life with PPD over TLP:
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13

View file

@ -10,7 +10,12 @@
pkgs, pkgs,
... ...
# TODO: drop this if linux 6.11 goes EOL # TODO: drop this if linux 6.11 goes EOL
}: lib.mkIf ((config.boot.kernelPackages.kernelAtLeast "6.11") && (config.boot.kernelPackages.kernelOlder "6.12")) { }:
lib.mkIf
(
(config.boot.kernelPackages.kernelAtLeast "6.11") && (config.boot.kernelPackages.kernelOlder "6.12")
)
{
systemd.services = { systemd.services = {
bluetooth-rfkill-suspend = { bluetooth-rfkill-suspend = {
description = "Soft block Bluetooth on suspend/hibernate"; description = "Soft block Bluetooth on suspend/hibernate";
@ -22,17 +27,29 @@
ExecStartPost = "${pkgs.coreutils}/bin/sleep 3"; ExecStartPost = "${pkgs.coreutils}/bin/sleep 3";
RemainAfterExit = true; RemainAfterExit = true;
}; };
wantedBy = ["suspend.target" "hibernate.target" "suspend-then-hibernate.target"]; wantedBy = [
"suspend.target"
"hibernate.target"
"suspend-then-hibernate.target"
];
}; };
bluetooth-rfkill-resume = { bluetooth-rfkill-resume = {
description = "Unblock Bluetooth on resume"; description = "Unblock Bluetooth on resume";
after = ["suspend.target" "hibernate.target" "suspend-then-hibernate.target"]; after = [
"suspend.target"
"hibernate.target"
"suspend-then-hibernate.target"
];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${pkgs.util-linux}/bin/rfkill unblock bluetooth"; 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"
];
}; };
}; };
} }

View file

@ -1,3 +1,4 @@
{ pkgs, ... }: { { pkgs, ... }:
{
environment.systemPackages = [ pkgs.framework-tool ]; environment.systemPackages = [ pkgs.framework-tool ];
} }

View file

@ -1,25 +1,31 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
kernel_version_compatible = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.10"; kernel_version_compatible = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.10";
in { in
options.hardware.framework.enableKmod = (lib.mkEnableOption {
"Enable the community created Framework kernel module that allows interacting with the embedded controller from sysfs." 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 # enable by default on NixOS >= 24.05 and kernel >= 6.10
default = lib.and default = lib.and (lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.05") kernel_version_compatible;
(lib.versionAtLeast (lib.versions.majorMinor lib.version) "24.05")
kernel_version_compatible;
defaultText = "enabled by default on NixOS >= 24.05 and kernel >= 6.10"; defaultText = "enabled by default on NixOS >= 24.05 and kernel >= 6.10";
}; };
config.boot = lib.mkIf config.hardware.framework.enableKmod { config.boot = lib.mkIf config.hardware.framework.enableKmod {
extraModulePackages = with config.boot.kernelPackages; [ extraModulePackages = with config.boot.kernelPackages; [
framework-laptop-kmod framework-laptop-kmod
]; ];
# https://github.com/DHowett/framework-laptop-kmod?tab=readme-ov-file#usage # 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 # add required patch if enabled on kernel <6.10
kernelPatches = lib.mkIf (!kernel_version_compatible) [ kernelPatches = lib.mkIf (!kernel_version_compatible) [
@ -28,12 +34,19 @@ in {
msgid = "20240403004713.130365-1-dustin@howett.net"; msgid = "20240403004713.130365-1-dustin@howett.net";
version = "3"; version = "3";
hash = "sha256-aQSyys8CMzlj9EdNhg8vtp76fg1qEwUVeJL0E+8w5HU="; hash = "sha256-aQSyys8CMzlj9EdNhg8vtp76fg1qEwUVeJL0E+8w5HU=";
patch = pkgs.runCommandLocal "patch-${msgid}" { patch =
nativeBuildInputs = with pkgs; [ b4 git cacert ]; pkgs.runCommandLocal "patch-${msgid}"
{
nativeBuildInputs = with pkgs; [
b4
git
cacert
];
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
outputHash = hash; outputHash = hash;
} '' }
''
export HOME="$TMP" export HOME="$TMP"
PYTHONHASHSEED=0 ${pkgs.b4}/bin/b4 -n am -C -T -v ${version} -o- "${msgid}" > "$out" PYTHONHASHSEED=0 ${pkgs.b4}/bin/b4 -n am -C -T -v ${version} -o- "${msgid}" > "$out"
''; '';

View file

@ -14,13 +14,17 @@
hardware.enableRedistributableFirmware = lib.mkDefault true; hardware.enableRedistributableFirmware = lib.mkDefault true;
# Fix for not detecting the M.2 NVMe SSD. Will cause recompilation. # 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.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.10") (
boot.kernelPatches = lib.mkDefault [{ lib.mkDefault pkgs.linuxPackages_latest
);
boot.kernelPatches = lib.mkDefault [
{
name = "pcie-rockchip-config.patch"; name = "pcie-rockchip-config.patch";
patch = null; patch = null;
extraConfig = '' extraConfig = ''
PHY_ROCKCHIP_PCIE y PHY_ROCKCHIP_PCIE y
PCIE_ROCKCHIP_HOST y PCIE_ROCKCHIP_HOST y
''; '';
}]; }
];
} }

View file

@ -1,5 +1,6 @@
{ lib {
, ... lib,
...
}: }:
{ {

View file

@ -1,22 +1,22 @@
/* /*
* `gmktec-nucbox-g3-plus`: `gmktec-nucbox-g3-plus`:
*
* Product page: Product page:
* <https://www.gmktec.com/products/nucbox-g3-plus-enhanced-performance-mini-pc-with-intel-n150-processor> <https://www.gmktec.com/products/nucbox-g3-plus-enhanced-performance-mini-pc-with-intel-n150-processor>
*
* This profile just configures the Intel This profile just configures the Intel
* Twin Lake N150 CPU and integrated Twin Lake N150 CPU and integrated
* graphics for this mini-PC. fstrim is also graphics for this mini-PC. fstrim is also
* enabled for the SSD. That's all this seemed enabled for the SSD. That's all this seemed
* to need to function properly. As is now to need to function properly. As is now
* expected from Intel NUC systems, it provides expected from Intel NUC systems, it provides
* a solid "out-of-the-box" experience. No a solid "out-of-the-box" experience. No
* special quirks are apparent. special quirks are apparent.
*
* We import the Alder Lake modules since Twin We import the Alder Lake modules since Twin
* Lake is just a refreshed version of the Lake is just a refreshed version of the
* Alder Lake-N series. Re-using those seems Alder Lake-N series. Re-using those seems
* to be fine for this purpose. to be fine for this purpose.
*/ */
{ {
imports = [ imports = [

View file

@ -1,5 +1,6 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let inherit (lib) mkDefault mkIf; let
inherit (lib) mkDefault mkIf;
in in
{ {
imports = [ imports = [
@ -10,18 +11,29 @@ in
]; ];
# Necessary kernel modules # 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 # 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 boot.initrd.kernelModules = [ "i915" ]; # Early loading so the passphrase prompt appears on external displays
hardware.graphics.extraPackages = with pkgs; [ hardware.graphics.extraPackages = with pkgs; [
intel-media-driver intel-media-driver
(if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then vaapiIntel else intel-vaapi-driver) (
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
vaapiIntel
else
intel-vaapi-driver
)
]; ];
boot.kernelParams = [ boot.kernelParams = [
# The GPD Pocket3 uses a tablet OLED display, that is mounted rotated 90° counter-clockwise # 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" "fbcon=rotate:1"
"video=DSI-1:panel_orientation=right_side_up"
]; ];
fonts.fontconfig = { fonts.fontconfig = {

View file

@ -1,5 +1,6 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let inherit (lib) mkIf mkDefault; let
inherit (lib) mkIf mkDefault;
in in
{ {
imports = [ imports = [
@ -17,7 +18,8 @@ in
kernelParams = [ kernelParams = [
# The GPD Pocket 4 uses a tablet LTPS display, that is mounted rotated 90° counter-clockwise # 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"
]; ];
}; };

View file

@ -10,8 +10,10 @@
"video=eDP-1:panel_orientation=right_side_up" "video=eDP-1:panel_orientation=right_side_up"
]; ];
services.tlp.enable = lib.mkDefault ((lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") services.tlp.enable = lib.mkDefault (
|| !config.services.power-profiles-daemon.enable); (lib.versionOlder (lib.versions.majorMinor lib.version) "21.05")
|| !config.services.power-profiles-daemon.enable
);
# Required for grub to properly display the boot menu. # Required for grub to properly display the boot menu.
boot.loader.grub.gfxmodeEfi = lib.mkDefault "720x1280x32"; boot.loader.grub.gfxmodeEfi = lib.mkDefault "720x1280x32";

View file

@ -12,6 +12,10 @@ with lib;
hardware.sensor.iio.bmi260.enable = lib.mkDefault true; hardware.sensor.iio.bmi260.enable = lib.mkDefault true;
#see README #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; hardware.sensor.iio.enable = mkIf config.hardware.sensor.iio.bmi260.enable true;
} }

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; with lib;
let let
cfg = config.hardware.gpd.ppt; cfg = config.hardware.gpd.ppt;

View file

@ -5,9 +5,6 @@
... ...
}: }:
with lib; with lib;
let
cfg = config.hardware.gpd.ppt;
in
{ {
imports = [ imports = [
../../common/pc/laptop ../../common/pc/laptop

View file

@ -4,25 +4,31 @@
# Based on the config from https://www.armbian.com/odroid-hc4/ # Based on the config from https://www.armbian.com/odroid-hc4/
hardware.fancontrol = { hardware.fancontrol = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
config = let config =
let
# According to https://www.armbian.com/odroid-hc4/ the FCFANS line should be removed on kernel 5.15. # According to https://www.armbian.com/odroid-hc4/ the FCFANS line should be removed on kernel 5.15.
kernelVersion = config.boot.kernelPackages.kernel.version; kernelVersion = config.boot.kernelPackages.kernel.version;
needFcFans = lib.versions.majorMinor kernelVersion != "5.15"; needFcFans = lib.versions.majorMinor kernelVersion != "5.15";
in lib.mkDefault ('' in
lib.mkDefault (
''
INTERVAL=10 INTERVAL=10
DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon2=devices/platform/pwm-fan DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon2=devices/platform/pwm-fan
DEVNAME=hwmon0=cpu_thermal hwmon2=pwmfan DEVNAME=hwmon0=cpu_thermal hwmon2=pwmfan
FCTEMPS=hwmon2/pwm1=hwmon0/temp1_input FCTEMPS=hwmon2/pwm1=hwmon0/temp1_input
'' + lib.optionalString needFcFans '' ''
+ lib.optionalString needFcFans ''
FCFANS= hwmon2/pwm1=hwmon2/fan1_input FCFANS= hwmon2/pwm1=hwmon2/fan1_input
'' + '' ''
+ ''
MINTEMP=hwmon2/pwm1=50 MINTEMP=hwmon2/pwm1=50
MAXTEMP=hwmon2/pwm1=60 MAXTEMP=hwmon2/pwm1=60
MINSTART=hwmon2/pwm1=20 MINSTART=hwmon2/pwm1=20
MINSTOP=hwmon2/pwm1=28 MINSTOP=hwmon2/pwm1=28
MINPWM=hwmon2/pwm1=0 MINPWM=hwmon2/pwm1=0
MAXPWM=hwmon2/pwm1=255 MAXPWM=hwmon2/pwm1=255
''); ''
);
}; };
# Linux 5.15 sometimes crash under heavy network usage # Linux 5.15 sometimes crash under heavy network usage

View file

@ -1,8 +1,7 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
{ {
imports = imports = [
[
../../../../common/cpu/amd ../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix ../../../../common/cpu/amd/pstate.nix
../../../../common/gpu/amd ../../../../common/gpu/amd
@ -12,7 +11,9 @@
hardware.enableRedistributableFirmware = lib.mkDefault true; hardware.enableRedistributableFirmware = lib.mkDefault true;
boot.kernelModules = [ "synaptics_usb" ]; 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, # disable Scatter/Gather APU recently enabled by default,
# which results in white screen after display reconfiguration # which results in white screen after display reconfiguration

View file

@ -1,8 +1,7 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
{ {
imports = imports = [
[
../../../../common/cpu/amd ../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix ../../../../common/cpu/amd/pstate.nix
../../../../common/gpu/amd ../../../../common/gpu/amd
@ -12,7 +11,9 @@
hardware.enableRedistributableFirmware = lib.mkDefault true; hardware.enableRedistributableFirmware = lib.mkDefault true;
boot.kernelModules = [ "synaptics_usb" ]; 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, # disable Scatter/Gather APU recently enabled by default,
# which results in white screen after display reconfiguration # which results in white screen after display reconfiguration

View file

@ -1,8 +1,7 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
{ {
imports = imports = [
[
../../../../common/cpu/amd ../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix ../../../../common/cpu/amd/pstate.nix
../../../../common/gpu/amd ../../../../common/gpu/amd
@ -12,7 +11,9 @@
hardware.enableRedistributableFirmware = lib.mkDefault true; hardware.enableRedistributableFirmware = lib.mkDefault true;
boot.kernelModules = [ "synaptics_usb" ]; 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, # disable Scatter/Gather APU recently enabled by default,
# which results in white screen after display reconfiguration # which results in white screen after display reconfiguration

View file

@ -3,7 +3,8 @@
pkgs, pkgs,
config, config,
... ...
}: { }:
{
imports = [ imports = [
../../common/cpu/intel/comet-lake ../../common/cpu/intel/comet-lake
../../common/gpu/nvidia ../../common/gpu/nvidia

View file

@ -19,7 +19,11 @@
services.udev.packages = [ services.udev.packages = [
# Fan control # Fan control
(pkgs.callPackage ( (pkgs.callPackage (
{ stdenv, lib, coreutils }: {
stdenv,
lib,
coreutils,
}:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "helios4-udev-fancontrol"; name = "helios4-udev-fancontrol";

View file

@ -14,6 +14,7 @@
# What if somebody installs both plasma AND another DE? # 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 # 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 (
services.displayManager.defaultSession = lib.mkIf config.services.xserver.desktopManager.plasma6.enable (lib.mkDefault "plasmax11"); lib.mkDefault "plasmax11"
);
} }

View file

@ -10,9 +10,11 @@
# remove all packages for amd igpu. I only removed amdgpu from # remove all packages for amd igpu. I only removed amdgpu from
# services.xserver.videoDrivers by overriding. This is because the specialization # services.xserver.videoDrivers by overriding. This is because the specialization
# of nix cannot implement such an operation as canceling an import. # of nix cannot implement such an operation as canceling an import.
hardware = { hardware =
{
nvidia.prime.offload.enable = false; nvidia.prime.offload.enable = false;
} // lib.optionalAttrs (options ? amdgpu.opencl.enable) { }
// lib.optionalAttrs (options ? amdgpu.opencl.enable) {
# introduced in https://github.com/NixOS/nixpkgs/pull/319865 # introduced in https://github.com/NixOS/nixpkgs/pull/319865
amdgpu.opencl.enable = lib.mkDefault false; amdgpu.opencl.enable = lib.mkDefault false;
}; };

View file

@ -10,9 +10,11 @@
# remove all packages for amd igpu. I only removed amdgpu from # remove all packages for amd igpu. I only removed amdgpu from
# services.xserver.videoDrivers by overriding. This is because the specialization # services.xserver.videoDrivers by overriding. This is because the specialization
# of nix cannot implement such an operation as canceling an import. # of nix cannot implement such an operation as canceling an import.
hardware = { hardware =
{
nvidia.prime.offload.enable = false; nvidia.prime.offload.enable = false;
} // lib.optionalAttrs (options ? amdgpu.opencl.enable) { }
// lib.optionalAttrs (options ? amdgpu.opencl.enable) {
# introduced in https://github.com/NixOS/nixpkgs/pull/319865 # introduced in https://github.com/NixOS/nixpkgs/pull/319865
amdgpu.opencl.enable = lib.mkDefault false; amdgpu.opencl.enable = lib.mkDefault false;
}; };

View file

@ -3,9 +3,11 @@
{ {
imports = [ ../hybrid ]; imports = [ ../hybrid ];
services.xserver.videoDrivers = [ "nvidia" ]; services.xserver.videoDrivers = [ "nvidia" ];
hardware = { hardware =
{
nvidia.prime.offload.enable = false; nvidia.prime.offload.enable = false;
} // lib.optionalAttrs (options ? amdgpu.opencl.enable) { }
// lib.optionalAttrs (options ? amdgpu.opencl.enable) {
# introduced in https://github.com/NixOS/nixpkgs/pull/319865 # introduced in https://github.com/NixOS/nixpkgs/pull/319865
amdgpu.opencl.enable = lib.mkDefault false; amdgpu.opencl.enable = lib.mkDefault false;
}; };

View file

@ -2,7 +2,8 @@
config, config,
lib, lib,
... ...
}: { }:
{
imports = [ imports = [
../../../../common/cpu/amd ../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix ../../../../common/cpu/amd/pstate.nix

View file

@ -1,5 +1,6 @@
# This will enable only the integrated AMD GPU, while disabling the dedicated Nvidia GPU # This will enable only the integrated AMD GPU, while disabling the dedicated Nvidia GPU
{...}: { { ... }:
{
imports = [ imports = [
../../../../common/cpu/amd ../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix ../../../../common/cpu/amd/pstate.nix

View file

@ -1,9 +1,18 @@
# Patch sourced from https://github.com/christian-bendiksen/kernel-6.8.0-63.16ARHA7.fc40 # 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 { pkgs.stdenv.mkDerivation {
pname = "lenovo-16ARHA7-speaker-fix-module"; pname = "lenovo-16ARHA7-speaker-fix-module";
inherit (kernel) src version postPatch nativeBuildInputs; inherit (kernel)
src
version
postPatch
nativeBuildInputs
;
kernel_dev = kernel.dev; kernel_dev = kernel.dev;
kernelVersion = kernel.modDirVersion; kernelVersion = kernel.modDirVersion;

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
lenovo-speaker-fix = pkgs.callPackage ./audio/lenovo-16ARHA7_speaker-fix.nix { 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. # 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 # √(2560² + 1600²) px / 16 in ≃ 189 dpi
services.xserver.dpi = 189; services.xserver.dpi = 189;

View file

@ -2,7 +2,8 @@
lib, lib,
config, config,
... ...
}: { }:
{
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/prime.nix
@ -13,7 +14,10 @@
]; ];
boot.initrd.kernelModules = [ "nvidia" ]; boot.initrd.kernelModules = [ "nvidia" ];
boot.extraModulePackages = [config.boot.kernelPackages.lenovo-legion-module config.boot.kernelPackages.nvidia_x11]; boot.extraModulePackages = [
config.boot.kernelPackages.lenovo-legion-module
config.boot.kernelPackages.nvidia_x11
];
hardware = { hardware = {
nvidia = { nvidia = {

View file

@ -2,7 +2,8 @@
lib, lib,
config, config,
... ...
}: { }:
{
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/prime.nix

View file

@ -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
} }

View file

@ -1,7 +1,7 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
{ {
# This can be removed when the default kernel is at least version 5.11 due to sof module # This can be removed when the default kernel is at least version 5.11 due to sof module
boot.kernelPackages = lib.mkIf boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.11") (
(lib.versionOlder pkgs.linux.version "5.11") lib.mkDefault pkgs.linuxPackages_latest
(lib.mkDefault pkgs.linuxPackages_latest); );
} }

View file

@ -1,4 +1,9 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
{ {
imports = [ imports = [
../. ../.
@ -9,7 +14,9 @@
# amdgpu.backlight=0 makes the backlight work # amdgpu.backlight=0 makes the backlight work
# acpi_backlight=none allows the backlight save/load systemd service to work on older kernel versions # 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 # For mainline support of rtw89 wireless networking
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") pkgs.linuxPackages_latest; boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") pkgs.linuxPackages_latest;

View file

@ -1,4 +1,9 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
{ {
imports = [ imports = [
../. ../.

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
# P14s is a rebadged T14 with slight internal differences. # P14s is a rebadged T14 with slight internal differences.
@ -14,7 +19,9 @@
# "vendor" setting, in this case the thinkpad_acpi driver. # "vendor" setting, in this case the thinkpad_acpi driver.
# See https://hansdegoede.livejournal.com/27130.html # See https://hansdegoede.livejournal.com/27130.html
# See https://lore.kernel.org/linux-acpi/20221105145258.12700-1-hdegoede@redhat.com/ # 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 # see https://github.com/NixOS/nixpkgs/issues/69289
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.2") pkgs.linuxPackages_latest; boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.2") pkgs.linuxPackages_latest;

View file

@ -1,4 +1,5 @@
{lib, ...}: { { lib, ... }:
{
imports = [ imports = [
../. ../.
../../../../../common/cpu/intel/raptor-lake ../../../../../common/cpu/intel/raptor-lake

View file

@ -1,4 +1,5 @@
{ lib, config, ... }: { { lib, config, ... }:
{
imports = [ imports = [
../. ../.
../../../common/cpu/intel/whiskey-lake ../../../common/cpu/intel/whiskey-lake

View file

@ -1,4 +1,5 @@
{ lib, config, ... }: { { lib, config, ... }:
{
imports = [ imports = [
../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/prime.nix
../../../common/gpu/nvidia/maxwell ../../../common/gpu/nvidia/maxwell
@ -19,14 +20,12 @@
hardware.enableAllFirmware = lib.mkDefault true; hardware.enableAllFirmware = lib.mkDefault true;
# fix suspend/resume screen corruption in sync mode # fix suspend/resume screen corruption in sync mode
hardware.nvidia.powerManagement = hardware.nvidia.powerManagement = lib.mkIf config.hardware.nvidia.prime.sync.enable {
lib.mkIf config.hardware.nvidia.prime.sync.enable {
enable = lib.mkDefault true; enable = lib.mkDefault true;
}; };
# fix screen tearing in sync mode # fix screen tearing in sync mode
hardware.nvidia.modesetting = hardware.nvidia.modesetting = lib.mkIf config.hardware.nvidia.prime.sync.enable {
lib.mkIf config.hardware.nvidia.prime.sync.enable {
enable = lib.mkDefault true; enable = lib.mkDefault true;
}; };

View file

@ -1,4 +1,5 @@
{ config, lib, ... }: { { config, lib, ... }:
{
imports = [ imports = [
../../../common/gpu/24.05-compat.nix ../../../common/gpu/24.05-compat.nix
../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/prime.nix
@ -25,14 +26,12 @@
hardware.enableAllFirmware = lib.mkDefault true; hardware.enableAllFirmware = lib.mkDefault true;
# fix suspend/resume screen corruption in sync mode # fix suspend/resume screen corruption in sync mode
hardware.nvidia.powerManagement = hardware.nvidia.powerManagement = lib.mkIf config.hardware.nvidia.prime.sync.enable {
lib.mkIf config.hardware.nvidia.prime.sync.enable {
enable = lib.mkDefault true; enable = lib.mkDefault true;
}; };
# fix screen tearing in sync mode # fix screen tearing in sync mode
hardware.nvidia.modesetting = hardware.nvidia.modesetting = lib.mkIf config.hardware.nvidia.prime.sync.enable {
lib.mkIf config.hardware.nvidia.prime.sync.enable {
enable = lib.mkDefault true; enable = lib.mkDefault true;
}; };

View file

@ -1,4 +1,5 @@
{ lib, config, ... }: { { lib, config, ... }:
{
imports = [ imports = [
../../../common/gpu/24.05-compat.nix ../../../common/gpu/24.05-compat.nix
../../../common/gpu/nvidia/prime.nix ../../../common/gpu/nvidia/prime.nix
@ -26,14 +27,12 @@
hardware.enableAllFirmware = lib.mkDefault true; hardware.enableAllFirmware = lib.mkDefault true;
# fix suspend/resume screen corruption in sync mode # fix suspend/resume screen corruption in sync mode
hardware.nvidia.powerManagement = hardware.nvidia.powerManagement = lib.mkIf config.hardware.nvidia.prime.sync.enable {
lib.mkIf config.hardware.nvidia.prime.sync.enable {
enable = lib.mkDefault true; enable = lib.mkDefault true;
}; };
# fix screen tearing in sync mode # fix screen tearing in sync mode
hardware.nvidia.modesetting = hardware.nvidia.modesetting = lib.mkIf config.hardware.nvidia.prime.sync.enable {
lib.mkIf config.hardware.nvidia.prime.sync.enable {
enable = lib.mkDefault true; enable = lib.mkDefault true;
}; };

View file

@ -1,4 +1,9 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
{ {
imports = [ imports = [

View file

@ -1,4 +1,9 @@
{ lib, pkgs, config, ... }: {
lib,
pkgs,
config,
...
}:
{ {
imports = [ imports = [

View file

@ -28,7 +28,10 @@
"i915.i915_enable_rc6=1" "i915.i915_enable_rc6=1"
]; ];
blacklistedKernelModules = [ blacklistedKernelModules = [
"sierra_net" "cdc_mbim" "cdc_ncm" "btusb" "sierra_net"
"cdc_mbim"
"cdc_ncm"
"btusb"
]; ];
}; };
} }

Some files were not shown because too many files have changed in this diff Show more