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"
];
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;
}

View file

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

View file

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

View file

@ -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"'';
}

View file

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

View file

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

View file

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

View file

@ -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 {
(
if lib.versionAtLeast nixosVersion "25.05" then
{
services.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
} else {
}
else
{
hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
})
}
)
(lib.mkIf t2Cfg.enableIGPU {
# Enable the iGPU by default if present

View file

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

View file

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

View file

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

View file

@ -13,4 +13,4 @@
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};
}
}

View file

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

View file

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

View file

@ -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,9 +35,9 @@ 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"
) // {
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\"";
};
@ -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.

View file

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

View file

@ -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";

View file

@ -1,4 +1,4 @@
{lib, ...}:
{ lib, ... }:
{
imports = [
../shared.nix

View file

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

View file

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

View file

@ -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,9 +36,9 @@ 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"
) // {
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\"";
};
@ -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.

View file

@ -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"
];
}

View file

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

View file

@ -8,21 +8,11 @@ in
imports = [ ./. ];
boot = lib.mkMerge [
(lib.mkIf
(
(lib.versionAtLeast kver "5.17")
&& (lib.versionOlder kver "6.1")
)
{
(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")
)
{
(lib.mkIf ((lib.versionAtLeast kver "6.1") && (lib.versionOlder kver "6.3")) {
kernelParams = [ "amd_pstate=passive" ];
})
(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
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" ])
];

View file

@ -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"
];
}

View file

@ -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"
];
}

View file

@ -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 {
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;

View file

@ -1,4 +1,4 @@
{lib, config, ...}:
{ lib, config, ... }:
let
nvidiaPackage = config.hardware.nvidia.package;
in

View file

@ -1,4 +1,4 @@
{lib, config, ...}:
{ lib, config, ... }:
let
nvidiaPackage = config.hardware.nvidia.package;
in

View file

@ -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"
];
}

View file

@ -1,4 +1,4 @@
{lib, ...}:
{ lib, ... }:
{
imports = [ ../. ];

View file

@ -1,4 +1,4 @@
{lib, ...}:
{ lib, ... }:
{
imports = [ ../. ];

View file

@ -1,4 +1,4 @@
{lib, ...}:
{ lib, ... }:
{
imports = [ ../. ];

View file

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

View file

@ -1,4 +1,4 @@
{lib, config, ...}:
{ lib, config, ... }:
let
nvidiaPackage = config.hardware.nvidia.package;
in

View file

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

View file

@ -1,3 +1,3 @@
# This file is necessary so nix-env -qa does not break,
# when nixos-hardware is used as a channel
{}
{ }

View file

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

View file

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

View file

@ -12,7 +12,10 @@
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

View file

@ -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";

View file

@ -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 = {

View file

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

View file

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

View file

@ -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 <username>`
@ -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" ];
}

View file

@ -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" ];
}

View file

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

View file

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

View file

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

View file

@ -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 = {

View file

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

View file

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

View file

@ -10,7 +10,8 @@
# This will save you money and possibly your life!
services.thermald.enable = lib.mkDefault true;
boot.kernelPatches = [{
boot.kernelPatches = [
{
name = "enable-soundwire-drivers";
patch = null;
extraConfig = ''
@ -18,9 +19,8 @@
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;
}

View file

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

View file

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

View file

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

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";
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 =
let
deprecated =
@ -59,9 +87,7 @@
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-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;

View file

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

View file

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

View file

@ -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") {

View file

@ -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) ''
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";
};
}

View file

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

View file

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

View file

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

View file

@ -1,9 +1,16 @@
{ config, lib, pkgs, ... }: {
{
config,
lib,
pkgs,
...
}:
{
imports = [
../../../common/cpu/intel
];
boot.kernelParams = [
boot.kernelParams =
[
# For Power consumption
# https://community.frame.work/t/linux-battery-life-tuning/6665/156
"nvme.noacpi=1"
@ -15,7 +22,9 @@
# 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" ];

View file

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

View file

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

View file

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

View file

@ -10,11 +10,16 @@
pkgs,
...
# 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 = {
bluetooth-rfkill-suspend = {
description = "Soft block Bluetooth on suspend/hibernate";
before = ["sleep.target"];
before = [ "sleep.target" ];
unitConfig.StopWhenUnneeded = true;
serviceConfig = {
Type = "oneshot";
@ -22,17 +27,29 @@
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"];
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"
];
};
};
}
}

View file

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

View file

@ -1,25 +1,31 @@
{ 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."
) // {
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;
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; [
framework-laptop-kmod
];
# 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,12 +34,19 @@ 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 ];
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"
'';

View file

@ -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 [{
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
'';
}];
}
];
}

View file

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

View file

@ -1,23 +1,23 @@
/*
* `gmktec-nucbox-g3-plus`:
*
* Product page:
* <https://www.gmktec.com/products/nucbox-g3-plus-enhanced-performance-mini-pc-with-intel-n150-processor>
*
* 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:
<https://www.gmktec.com/products/nucbox-g3-plus-enhanced-performance-mini-pc-with-intel-n150-processor>
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

View file

@ -1,5 +1,6 @@
{ lib, pkgs, ... }:
let inherit (lib) mkDefault mkIf;
let
inherit (lib) mkDefault mkIf;
in
{
imports = [
@ -10,18 +11,29 @@ in
];
# 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)
(
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"
"fbcon=rotate:1"
"video=DSI-1:panel_orientation=right_side_up"
];
fonts.fontconfig = {

View file

@ -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"
];
};

View file

@ -1,4 +1,4 @@
{ config, lib, ...}:
{ config, lib, ... }:
{
imports = [
../../common/cpu/intel
@ -10,8 +10,10 @@
"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";

View file

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

View file

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

View file

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

View file

@ -4,25 +4,31 @@
# Based on the config from https://www.armbian.com/odroid-hc4/
hardware.fancontrol = {
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.
kernelVersion = config.boot.kernelPackages.kernel.version;
needFcFans = lib.versions.majorMinor kernelVersion != "5.15";
in lib.mkDefault (''
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 ''
''
+ 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

View file

@ -1,8 +1,7 @@
{ pkgs, lib, ... }:
{
imports =
[
imports = [
../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix
../../../../common/gpu/amd
@ -12,7 +11,9 @@
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

View file

@ -1,8 +1,7 @@
{ pkgs, lib, ... }:
{
imports =
[
imports = [
../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix
../../../../common/gpu/amd
@ -12,7 +11,9 @@
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

View file

@ -1,8 +1,7 @@
{ pkgs, lib, ... }:
{
imports =
[
imports = [
../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix
../../../../common/gpu/amd
@ -12,7 +11,9 @@
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

View file

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

View file

@ -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;
};
}
) {})
) { })
];
}

View file

@ -11,6 +11,6 @@ final: _prev: {
rev = "v${version}";
sha256 = "sha256-QxrTPcx0n0NWUJ990EuIWyOBtknW/fHDRcrYP0yQzTo=";
};
patches = [];
patches = [ ];
};
}

View file

@ -14,6 +14,7 @@
# 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"
);
}

View file

@ -10,9 +10,11 @@
# 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 = {
hardware =
{
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
amdgpu.opencl.enable = lib.mkDefault false;
};

View file

@ -10,9 +10,11 @@
# 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 = {
hardware =
{
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
amdgpu.opencl.enable = lib.mkDefault false;
};

View file

@ -3,9 +3,11 @@
{
imports = [ ../hybrid ];
services.xserver.videoDrivers = [ "nvidia" ];
hardware = {
hardware =
{
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
amdgpu.opencl.enable = lib.mkDefault false;
};

View file

@ -14,7 +14,7 @@
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" ];
})
];

View file

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

View file

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

View file

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

View file

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

View file

@ -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 = {

View file

@ -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 = {

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