File tree Expand file tree Collapse file tree 28 files changed +654
-317
lines changed
microsoft/surface/common/kernel Expand file tree Collapse file tree 28 files changed +654
-317
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,11 @@ jobs:
1111 steps :
1212 - uses : actions/checkout@v5
1313 - uses : cachix/install-nix-action@v31
14- - run : cd tests && nix fmt .. -- --fail-on-change
14+ - run : nix build .#checks.x86_64-linux.formatting
1515 tests :
1616 needs : nixfmt
1717 runs-on : ubuntu-latest
1818 steps :
1919 - uses : actions/checkout@v5
2020 - uses : cachix/install-nix-action@v31
21- - run : nix run ./tests #run .
21+ - run : nix run .#run-tests
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ Link the profile in the table in README.md and in flake.nix.
4242
4343## 3. Testing
4444
45- Run ` nix run ./tests #run . ` to evaluate all hardware profiles.
45+ Run ` nix run .#run-tests ` to evaluate all hardware profiles.
4646Because profiles can only be tested with the appropriate hardware, quality
4747assurance is up to * you* .
4848
Original file line number Diff line number Diff line change 2929 "bcma"
3030 ] ;
3131 kernelPackages = lib . mkIf ( lib . versionOlder pkgs . linux . version "6.0" ) pkgs . linuxPackages_latest ;
32- extraModulePackages = [ config . boot . kernelPackages . broadcom_sta ] ;
3332 } ;
3433
3534 hardware = {
Original file line number Diff line number Diff line change 33{
44 imports = [ ../. ] ;
55
6- boot . kernelModules = [ "wl" ] ;
7- boot . extraModulePackages = [ config . boot . kernelPackages . broadcom_sta ] ;
86 boot . blacklistedKernelModules = [ "bcma" ] ;
97
108 boot = {
Original file line number Diff line number Diff line change 66 ../../../common/cpu/intel/haswell
77 ] ;
88
9- # broadcom-wl
109 hardware . enableRedistributableFirmware = lib . mkDefault true ;
11- # nixos-generate-config doesn't detect this automatically.
12- boot . extraModulePackages = with config . boot . kernelPackages ; [ broadcom_sta ] ;
13- boot . kernelModules = [ "wl" ] ;
1410}
Original file line number Diff line number Diff line change 1212 fwupd . enable = lib . mkDefault true ;
1313 thermald . enable = lib . mkDefault true ;
1414 } ;
15-
16- boot = {
17- # needs to be explicitly loaded or else bluetooth/wifi won't work.
18- kernelModules = [ "wl" ] ;
19- extraModulePackages = [ config . boot . kernelPackages . broadcom_sta ] ;
20- } ;
2115}
Original file line number Diff line number Diff line change 1313 } ;
1414
1515 boot = {
16- # needs to be explicitly loaded or else bluetooth/wifi won't work
1716 kernelModules = [
1817 "kvm-intel"
19- "wl"
2018 ] ;
21- extraModulePackages = [ config . boot . kernelPackages . broadcom_sta ] ;
2219 } ;
2320}
Original file line number Diff line number Diff line change 22 description = "nixos-hardware" ;
33
44 outputs =
5- { ... } :
5+ { self , ... } :
6+ let
7+ # Import private inputs (for development)
8+ privateInputs =
9+ ( import ./tests/flake-compat.nix {
10+ src = ./tests ;
11+ } ) . defaultNix ;
12+
13+ systems = [
14+ "aarch64-linux"
15+ "riscv64-linux"
16+ "x86_64-linux"
17+ ] ;
18+
19+ formatSystems = [
20+ "aarch64-linux"
21+ "x86_64-linux"
22+ "aarch64-darwin"
23+ ] ;
24+
25+ # Helper to iterate over systems
26+ eachSystem =
27+ f :
28+ privateInputs . nixos-unstable-small . lib . genAttrs systems (
29+ system : f privateInputs . nixos-unstable-small . legacyPackages . ${ system } system
30+ ) ;
31+
32+ eachSystemFormat =
33+ f :
34+ privateInputs . nixos-unstable-small . lib . genAttrs formatSystems (
35+ system : f privateInputs . nixos-unstable-small . legacyPackages . ${ system } system
36+ ) ;
37+ in
638 {
739
840 nixosModules =
420452 common-pc-laptop-ssd = import ./common/pc/ssd ;
421453 common-pc-ssd = import ./common/pc/ssd ;
422454 } ;
455+
456+ # Add formatter for `nix fmt`
457+ formatter = eachSystemFormat (
458+ pkgs : _system :
459+ ( privateInputs . treefmt-nix . lib . evalModule pkgs ./tests/treefmt.nix ) . config . build . wrapper
460+ ) ;
461+
462+ # Add packages
463+ packages = eachSystem (
464+ pkgs : _system : {
465+ run-tests = pkgs . callPackage ./tests/run-tests.nix {
466+ inherit self ;
467+ } ;
468+ }
469+ ) ;
470+
471+ # Add checks for `nix run .#run-tests`
472+ checks = eachSystem (
473+ pkgs : system :
474+ let
475+ treefmtEval = privateInputs . treefmt-nix . lib . evalModule pkgs ./tests/treefmt.nix ;
476+ nixosTests = import ./tests/nixos-tests.nix {
477+ inherit
478+ self
479+ privateInputs
480+ system
481+ pkgs
482+ ;
483+ } ;
484+ in
485+ pkgs . lib . optionalAttrs ( self . formatter ? ${ system } ) {
486+ formatting = treefmtEval . config . build . check self ;
487+ }
488+ // nixosTests
489+ ) ;
423490 } ;
424491}
Original file line number Diff line number Diff line change 66 ../../../common/gpu/amd
77 ] ;
88
9- boot . kernelParams =
10- [
11- # There seems to be an issue with panel self-refresh (PSR) that
12- # causes hangs for users.
13- #
14- # https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
15- # https://gitlab.freedesktop.org/drm/amd/-/issues/3647
16- "amdgpu.dcdebugmask=0x10"
17- ]
18- # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/
19- ++ lib . optionals ( lib . versionOlder config . boot . kernelPackages . kernel . version "6.8" ) [
20- "rtc_cmos.use_acpi_alarm=1"
21- ] ;
9+ boot . kernelParams = [
10+ # There seems to be an issue with panel self-refresh (PSR) that
11+ # causes hangs for users.
12+ #
13+ # https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
14+ # https://gitlab.freedesktop.org/drm/amd/-/issues/3647
15+ "amdgpu.dcdebugmask=0x10"
16+ ]
17+ # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/
18+ ++ lib . optionals ( lib . versionOlder config . boot . kernelPackages . kernel . version "6.8" ) [
19+ "rtc_cmos.use_acpi_alarm=1"
20+ ] ;
2221
2322 # AMD has better battery life with PPD over TLP:
2423 # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
Original file line number Diff line number Diff line change 99 ../../../common/cpu/intel
1010 ] ;
1111
12- boot . kernelParams =
13- [
14- # For Power consumption
15- # https://community.frame.work/t/linux-battery-life-tuning/6665/156
16- "nvme.noacpi=1"
17- ]
18- # Fixes a regression in s2idle, making it more power efficient than deep sleep
19- # Update 04/2024: It appears that s2idle-regression got fixed in newer kernel-versions (SebTM)
20- # (see: https://github.com/NixOS/nixos-hardware/pull/903#discussion_r1556096657)
21- ++ lib . lists . optional ( lib . versionOlder config . boot . kernelPackages . kernel . version "6.8" ) "acpi_osi=\" !Windows 2020\" " ;
12+ boot . kernelParams = [
13+ # For Power consumption
14+ # https://community.frame.work/t/linux-battery-life-tuning/6665/156
15+ "nvme.noacpi=1"
16+ ]
17+ # Fixes a regression in s2idle, making it more power efficient than deep sleep
18+ # Update 04/2024: It appears that s2idle-regression got fixed in newer kernel-versions (SebTM)
19+ # (see: https://github.com/NixOS/nixos-hardware/pull/903#discussion_r1556096657)
20+ ++ lib . lists . optional ( lib . versionOlder config . boot . kernelPackages . kernel . version "6.8" ) "acpi_osi=\" !Windows 2020\" " ;
2221
2322 # Requires at least 5.16 for working wi-fi and bluetooth.
2423 # https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89
You can’t perform that action at this time.
0 commit comments