mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	microsoft/surface: remove repos.nix file and update README
This commit is contained in:
		@@ -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
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
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.
 | 
			
		||||
In order to simplify maintenance of the Nix code, only the most-recent kernel patch-set is expected
 | 
			
		||||
to be maintained in this repo.
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
_*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
 | 
			
		||||
 | 
			
		||||
#### 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
 | 
			
		||||
 | 
			
		||||
### IPTS
 | 
			
		||||
@@ -120,3 +126,7 @@ References:
 | 
			
		||||
- https://github.com/thebitstick/surfacego-wifi
 | 
			
		||||
- 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
 | 
			
		||||
 | 
			
		||||
## 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!
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,19 @@
 | 
			
		||||
{ config, lib, pkgs, ... }:
 | 
			
		||||
 | 
			
		||||
let
 | 
			
		||||
  inherit (lib) mkDefault mkOption types;
 | 
			
		||||
  inherit (lib) fetchFromGitHub mkDefault mkOption types versions;
 | 
			
		||||
 | 
			
		||||
  shortVersion = config.microsoft-surface.kernelVersion;
 | 
			
		||||
  version = if shortVersion == "6.12" then
 | 
			
		||||
  # Set the full kernel version and hashes
 | 
			
		||||
  version =
 | 
			
		||||
    if config.microsoft-surface.kernelVersion == "lts" then
 | 
			
		||||
      "6.12.19"
 | 
			
		||||
    else if shortVersion == "6.13" then
 | 
			
		||||
    else if config.microsoft-surface.kernelVersion == "latest" then
 | 
			
		||||
      "6.13.6"
 | 
			
		||||
    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
 | 
			
		||||
      "sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY="
 | 
			
		||||
    else if shortVersion == "6.13" then
 | 
			
		||||
@@ -29,15 +29,26 @@ let
 | 
			
		||||
    else
 | 
			
		||||
      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 {
 | 
			
		||||
    inherit version;
 | 
			
		||||
    patchFn = ./kernel/${shortVersion}/patches.nix;
 | 
			
		||||
  };
 | 
			
		||||
  kernelPackages = linuxPackage {
 | 
			
		||||
    inherit version kernelPatches;
 | 
			
		||||
    sha256 = srcHash;
 | 
			
		||||
    hash = srcHash;
 | 
			
		||||
    ignoreConfigErrors=true;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
@@ -45,24 +56,24 @@ in {
 | 
			
		||||
  options.microsoft-surface.kernelVersion = mkOption {
 | 
			
		||||
    description = "Kernel Version to use (patched for MS Surface)";
 | 
			
		||||
    type = types.enum [
 | 
			
		||||
      "6.12"
 | 
			
		||||
      "6.13"
 | 
			
		||||
      "lts"
 | 
			
		||||
      "latest"
 | 
			
		||||
    ];
 | 
			
		||||
    default = "6.12";
 | 
			
		||||
    default = "lts";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = {
 | 
			
		||||
    boot = {
 | 
			
		||||
      inherit kernelPackages;
 | 
			
		||||
 | 
			
		||||
      kernelParams = mkDefault [ "mem_sleep_default=deep" ];
 | 
			
		||||
      # Seems to be required to properly enable S0ix "Modern Standby":
 | 
			
		||||
      kernelParams = mkDefault [ "mem_sleep_default=deep" ];
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    # NOTE: Check the README before enabling TLP:
 | 
			
		||||
    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 = {
 | 
			
		||||
      enableRedistributableFirmware = mkDefault true;
 | 
			
		||||
      sensor.iio.enable = mkDefault true;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
{ fetchFromGitHub, rev, hash }:
 | 
			
		||||
{
 | 
			
		||||
  linux-surface = fetchFromGitHub {
 | 
			
		||||
    owner = "linux-surface";
 | 
			
		||||
    repo = "linux-surface";
 | 
			
		||||
    rev = rev;
 | 
			
		||||
    hash = hash;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user