microsoft/surface: remove repos.nix file and update README

This commit is contained in:
Andre
2025-04-11 14:54:03 -04:00
parent 9726adf371
commit bb295c09d9
3 changed files with 44 additions and 32 deletions

View File

@@ -1,8 +1,3 @@
# NOTE: Structure changes from 2023-01-10
Please read the [Deprecated Behaviour README](./OLD-BEHAVIOUR-DEPRECATION.md) to understand how some structural changes to
the code might affect you!
# Derivations for Microsoft Surface notebooks # Derivations for Microsoft Surface notebooks
These derivatives use the patches from the [linux-surface repo](https://github.com/linux-surface/linux-surface/tree/master/patches). These derivatives use the patches from the [linux-surface repo](https://github.com/linux-surface/linux-surface/tree/master/patches).
@@ -32,13 +27,24 @@ Not all hardware is fully supported, but the
[linux-surface feature matrix](https://github.com/linux-surface/linux-surface/wiki/Supported-Devices-and-Features#feature-matrix) [linux-surface feature matrix](https://github.com/linux-surface/linux-surface/wiki/Supported-Devices-and-Features#feature-matrix)
provides details on which devices are supported on which types of machine. provides details on which devices are supported on which types of machine.
The kernel-specific derivations are under the [`common/kernel/`](./common/kernel/) sub-directory. The kernel-specific derivations are under the [`common/kernel/`](./common/kernel/) sub-directory. This directory defines patch sets for each supported kernel release (see Kernel versions below for more information).
In order to simplify maintenance of the Nix code, only the most-recent kernel patch-set is expected
to be maintained in this repo.
_*NOTE:*_ Some built-in Kernel config items need to be set, that aren't set by default: _*NOTE:*_ Some built-in Kernel config items need to be set, that aren't set by default:
- https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing - https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing
#### Kernel versions
There are multiple versions of the Surface kernel available:
- `lts`, which tracks the latest LTS release.
- `latest`, which tracks the most recent release.
This repo uses `lts` by default, but you can switch it to `latest` by adding this to your configuration file:
```nix
microsoft-surface.kernelVersion = "latest";
```
### Support Tools ### Support Tools
### IPTS ### IPTS
@@ -120,3 +126,7 @@ References:
- https://github.com/thebitstick/surfacego-wifi - https://github.com/thebitstick/surfacego-wifi
- https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/ath10k - https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/ath10k
- https://wireless.wiki.kernel.org/en/users/drivers/ath10k/firmware - https://wireless.wiki.kernel.org/en/users/drivers/ath10k/firmware
## Structural changes from earlier versions (2023-01-10 and earlier)
If you're upgrading from an older version of nixos-hardware, please read the [Deprecated Behaviour README](./OLD-BEHAVIOUR-DEPRECATION.md) to understand how some structural changes to the code might affect you!

View File

@@ -1,19 +1,19 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (lib) mkDefault mkOption types; inherit (lib) fetchFromGitHub mkDefault mkOption types versions;
shortVersion = config.microsoft-surface.kernelVersion; # Set the full kernel version and hashes
version = if shortVersion == "6.12" then version =
if config.microsoft-surface.kernelVersion == "lts" then
"6.12.19" "6.12.19"
else if shortVersion == "6.13" then else if config.microsoft-surface.kernelVersion == "latest" then
"6.13.6" "6.13.6"
else else
abort "Invalid kernel version: ${shortVersion}"; abort "Invalid kernel version: ${config.microsoft-surface.kernelVersion}";
rev = "arch-${version}-1";
hash = shortVersion = versions.majorMinor version;
packageHash =
if shortVersion == "6.12" then if shortVersion == "6.12" then
"sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY=" "sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY="
else if shortVersion == "6.13" then else if shortVersion == "6.13" then
@@ -29,15 +29,26 @@ let
else else
abort "Invalid kernel version: ${shortVersion}"; abort "Invalid kernel version: ${shortVersion}";
inherit (pkgs.callPackage ./kernel/linux-package.nix { repos = pkgs.callPackage ./kernel/repos.nix { rev = rev; hash = hash; }; }) linuxPackage surfacePatches; # Fetch the release from the linux-surface project
rev = "arch-${version}-1";
repos = pkgs.callPackage ({ fetchFromGitHub, rev, packageHash }: {
linux-surface = fetchFromGitHub {
owner = "linux-surface";
repo = "linux-surface";
rev = rev;
hash = packageHash;
};
}) { inherit rev packageHash; };
# Build the kernel package
inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; }) linuxPackage surfacePatches;
kernelPatches = surfacePatches { kernelPatches = surfacePatches {
inherit version; inherit version;
patchFn = ./kernel/${shortVersion}/patches.nix; patchFn = ./kernel/${shortVersion}/patches.nix;
}; };
kernelPackages = linuxPackage { kernelPackages = linuxPackage {
inherit version kernelPatches; inherit version kernelPatches;
sha256 = srcHash; hash = srcHash;
ignoreConfigErrors=true; ignoreConfigErrors=true;
}; };
@@ -45,24 +56,24 @@ in {
options.microsoft-surface.kernelVersion = mkOption { options.microsoft-surface.kernelVersion = mkOption {
description = "Kernel Version to use (patched for MS Surface)"; description = "Kernel Version to use (patched for MS Surface)";
type = types.enum [ type = types.enum [
"6.12" "lts"
"6.13" "latest"
]; ];
default = "6.12"; default = "lts";
}; };
config = { config = {
boot = { boot = {
inherit kernelPackages; inherit kernelPackages;
kernelParams = mkDefault [ "mem_sleep_default=deep" ];
# Seems to be required to properly enable S0ix "Modern Standby": # Seems to be required to properly enable S0ix "Modern Standby":
kernelParams = mkDefault [ "mem_sleep_default=deep" ];
}; };
# NOTE: Check the README before enabling TLP: # NOTE: Check the README before enabling TLP:
services.tlp.enable = mkDefault false; services.tlp.enable = mkDefault false;
# i.e. needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364 # Needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364
hardware = { hardware = {
enableRedistributableFirmware = mkDefault true; enableRedistributableFirmware = mkDefault true;
sensor.iio.enable = mkDefault true; sensor.iio.enable = mkDefault true;

View File

@@ -1,9 +0,0 @@
{ fetchFromGitHub, rev, hash }:
{
linux-surface = fetchFromGitHub {
owner = "linux-surface";
repo = "linux-surface";
rev = rev;
hash = hash;
};
}