Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- run: cd tests && nix fmt .. -- --fail-on-change
- run: nix build .#checks.x86_64-linux.formatting
tests:
needs: nixfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- run: nix run ./tests#run .
- run: nix run .#run-tests
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Link the profile in the table in README.md and in flake.nix.

## 3. Testing

Run `nix run ./tests#run .` to evaluate all hardware profiles.
Run `nix run .#run-tests` to evaluate all hardware profiles.
Because profiles can only be tested with the appropriate hardware, quality
assurance is up to *you*.

Expand Down
22 changes: 1 addition & 21 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 64 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,35 @@
description = "nixos-hardware";

outputs =
{ ... }:
{ self, ... }:
let
# Import private inputs (for development)
privateInputs =
(import ./tests/flake-compat.nix {
src = ./tests;
}).defaultNix;

systems = [
"aarch64-linux"
"riscv64-linux"
"x86_64-linux"
];

formatSystems = [ "aarch64-linux" "x86_64-linux" ];

# Helper to iterate over systems
eachSystem =
f:
privateInputs.nixos-unstable-small.lib.genAttrs systems (
system: f privateInputs.nixos-unstable-small.legacyPackages.${system} system
);

eachSystemFormat =
f:
privateInputs.nixos-unstable-small.lib.genAttrs formatSystems (
system: f privateInputs.nixos-unstable-small.legacyPackages.${system} system
);
in
{

nixosModules =
Expand Down Expand Up @@ -395,5 +423,40 @@
common-pc-laptop-ssd = import ./common/pc/ssd;
common-pc-ssd = import ./common/pc/ssd;
};

# Add formatter for `nix fmt`
formatter = eachSystemFormat (
pkgs: _system:
(privateInputs.treefmt-nix.lib.evalModule pkgs ./tests/treefmt.nix).config.build.wrapper
);

# Add packages
packages = eachSystem (
pkgs: _system: {
run-tests = pkgs.callPackage ./tests/run-tests.nix {
inherit self;
};
}
);

# Add checks for `nix run .#run-tests`
checks = eachSystem (
pkgs: system:
let
treefmtEval = privateInputs.treefmt-nix.lib.evalModule pkgs ./tests/treefmt.nix;
nixosTests = import ./tests/nixos-tests.nix {
inherit
self
privateInputs
system
pkgs
;
};
in
pkgs.lib.optionalAttrs (self.formatter ? system) {
formatting = treefmtEval.config.build.check self;
}
// nixosTests
);
};
}
25 changes: 12 additions & 13 deletions framework/13-inch/common/amd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@
../../../common/gpu/amd
];

boot.kernelParams =
[
# There seems to be an issue with panel self-refresh (PSR) that
# causes hangs for users.
#
# https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
# https://gitlab.freedesktop.org/drm/amd/-/issues/3647
"amdgpu.dcdebugmask=0x10"
]
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/[email protected]/
++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [
"rtc_cmos.use_acpi_alarm=1"
];
boot.kernelParams = [
# There seems to be an issue with panel self-refresh (PSR) that
# causes hangs for users.
#
# https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
# https://gitlab.freedesktop.org/drm/amd/-/issues/3647
"amdgpu.dcdebugmask=0x10"
]
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/[email protected]/
++ 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
Expand Down
19 changes: 9 additions & 10 deletions framework/13-inch/common/intel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
../../../common/cpu/intel
];

boot.kernelParams =
[
# For Power consumption
# https://community.frame.work/t/linux-battery-life-tuning/6665/156
"nvme.noacpi=1"
]
# Fixes a regression in s2idle, making it more power efficient than deep sleep
# Update 04/2024: It appears that s2idle-regression got fixed in newer kernel-versions (SebTM)
# (see: https://github.com/NixOS/nixos-hardware/pull/903#discussion_r1556096657)
++ lib.lists.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") "acpi_osi=\"!Windows 2020\"";
boot.kernelParams = [
# For Power consumption
# https://community.frame.work/t/linux-battery-life-tuning/6665/156
"nvme.noacpi=1"
]
# Fixes a regression in s2idle, making it more power efficient than deep sleep
# Update 04/2024: It appears that s2idle-regression got fixed in newer kernel-versions (SebTM)
# (see: https://github.com/NixOS/nixos-hardware/pull/903#discussion_r1556096657)
++ lib.lists.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") "acpi_osi=\"!Windows 2020\"";

# Requires at least 5.16 for working wi-fi and bluetooth.
# https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89
Expand Down
25 changes: 12 additions & 13 deletions framework/16-inch/common/amd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@
../../../common/gpu/amd
];

boot.kernelParams =
[
# There seems to be an issue with panel self-refresh (PSR) that
# causes hangs for users.
#
# https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
# https://gitlab.freedesktop.org/drm/amd/-/issues/3647
"amdgpu.dcdebugmask=0x10"
]
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/[email protected]/
++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [
"rtc_cmos.use_acpi_alarm=1"
];
boot.kernelParams = [
# There seems to be an issue with panel self-refresh (PSR) that
# causes hangs for users.
#
# https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
# https://gitlab.freedesktop.org/drm/amd/-/issues/3647
"amdgpu.dcdebugmask=0x10"
]
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/[email protected]/
++ 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
Expand Down
15 changes: 7 additions & 8 deletions lenovo/legion/15ach6h/nvidia/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +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 =
{
nvidia.prime.offload.enable = false;
}
// lib.optionalAttrs (options ? amdgpu.opencl.enable) {
# introduced in https://github.com/NixOS/nixpkgs/pull/319865
amdgpu.opencl.enable = lib.mkDefault false;
};
hardware = {
nvidia.prime.offload.enable = false;
}
// lib.optionalAttrs (options ? amdgpu.opencl.enable) {
# introduced in https://github.com/NixOS/nixpkgs/pull/319865
amdgpu.opencl.enable = lib.mkDefault false;
};
}
15 changes: 7 additions & 8 deletions lenovo/legion/16ach6h/nvidia/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +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 =
{
nvidia.prime.offload.enable = false;
}
// lib.optionalAttrs (options ? amdgpu.opencl.enable) {
# introduced in https://github.com/NixOS/nixpkgs/pull/319865
amdgpu.opencl.enable = lib.mkDefault false;
};
hardware = {
nvidia.prime.offload.enable = false;
}
// lib.optionalAttrs (options ? amdgpu.opencl.enable) {
# introduced in https://github.com/NixOS/nixpkgs/pull/319865
amdgpu.opencl.enable = lib.mkDefault false;
};
}
15 changes: 7 additions & 8 deletions lenovo/legion/16achg6/nvidia/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
{
imports = [ ../hybrid ];
services.xserver.videoDrivers = [ "nvidia" ];
hardware =
{
nvidia.prime.offload.enable = false;
}
// lib.optionalAttrs (options ? amdgpu.opencl.enable) {
# introduced in https://github.com/NixOS/nixpkgs/pull/319865
amdgpu.opencl.enable = lib.mkDefault false;
};
hardware = {
nvidia.prime.offload.enable = false;
}
// lib.optionalAttrs (options ? amdgpu.opencl.enable) {
# introduced in https://github.com/NixOS/nixpkgs/pull/319865
amdgpu.opencl.enable = lib.mkDefault false;
};
}
7 changes: 4 additions & 3 deletions lenovo/thinkpad/p14s/amd/gen2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

# amdgpu.backlight=0 makes the backlight work
# acpi_backlight=none allows the backlight save/load systemd service to work on older kernel versions
boot.kernelParams =
[ "amdgpu.backlight=0" ]
++ lib.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.1.6") "acpi_backlight=none";
boot.kernelParams = [
"amdgpu.backlight=0"
]
++ lib.optional (lib.versionOlder config.boot.kernelPackages.kernel.version "6.1.6") "acpi_backlight=none";

# For mainline support of rtw89 wireless networking
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") pkgs.linuxPackages_latest;
Expand Down
25 changes: 12 additions & 13 deletions microsoft/surface/common/kernel/linux-package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,18 @@ let
let
inherit (builtins) removeAttrs;

args' =
{
inherit
src
version
modDirVersion
kernelPatches
;
}
// removeAttrs args [
"url"
"sha256"
];
args' = {
inherit
src
version
modDirVersion
kernelPatches
;
}
// removeAttrs args [
"url"
"sha256"
];
linuxPackage = buildLinux args';
linuxPackages' = recurseIntoAttrs (linuxPackagesFor linuxPackage);
in
Expand Down
29 changes: 14 additions & 15 deletions nxp/common/bsp/imx-firmware.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,20 @@ pkgs.stdenv.mkDerivation rec {
${firmwareSeco} --auto-accept --force
'';

filesToInstall =
[
"firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/dpfw.bin"
"firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/hdmi?xfw.bin"
]
++ pkgs.lib.optional (targetBoard == "imx8qm") (
"imx-sc-firmware-${fwScVersion}/mx8qm-mek-scfw-tcm.bin"
+ " "
+ "imx-seco-${fwSecoVersion}/firmware/seco/mx8qmb0-ahab-container.img"
)
++ pkgs.lib.optional (targetBoard == "imx8qxp") (
"imx-sc-firmware-${fwScVersion}/mx8qx-mek-scfw-tcm.bin"
+ " "
+ "imx-seco-${fwSecoVersion}/firmware/seco/mx8qxc0-ahab-container.img"
);
filesToInstall = [
"firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/dpfw.bin"
"firmware-imx-${fwHdmiVersion}/firmware/hdmi/cadence/hdmi?xfw.bin"
]
++ pkgs.lib.optional (targetBoard == "imx8qm") (
"imx-sc-firmware-${fwScVersion}/mx8qm-mek-scfw-tcm.bin"
+ " "
+ "imx-seco-${fwSecoVersion}/firmware/seco/mx8qmb0-ahab-container.img"
)
++ pkgs.lib.optional (targetBoard == "imx8qxp") (
"imx-sc-firmware-${fwScVersion}/mx8qx-mek-scfw-tcm.bin"
+ " "
+ "imx-seco-${fwSecoVersion}/firmware/seco/mx8qxc0-ahab-container.img"
);

installPhase = ''
mkdir -p $out
Expand Down
3 changes: 2 additions & 1 deletion pine64/star64/linux-5.15.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ let
};
}
{ patch = ./irq-desc-to-data.patch; }
] ++ kernelPatches;
]
++ kernelPatches;

structuredExtraConfig = with lib.kernel; {
# A ton of stuff just does not build. We disable it all.
Expand Down
Loading
Loading