Skip to content

Commit bb295c0

Browse files
committed
microsoft/surface: remove repos.nix file and update README
1 parent 9726adf commit bb295c0

File tree

3 files changed

+44
-32
lines changed

3 files changed

+44
-32
lines changed

microsoft/surface/README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# NOTE: Structure changes from 2023-01-10
2-
3-
Please read the [Deprecated Behaviour README](./OLD-BEHAVIOUR-DEPRECATION.md) to understand how some structural changes to
4-
the code might affect you!
5-
61
# Derivations for Microsoft Surface notebooks
72

83
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
3227
[linux-surface feature matrix](https://github.com/linux-surface/linux-surface/wiki/Supported-Devices-and-Features#feature-matrix)
3328
provides details on which devices are supported on which types of machine.
3429

35-
The kernel-specific derivations are under the [`common/kernel/`](./common/kernel/) sub-directory.
36-
In order to simplify maintenance of the Nix code, only the most-recent kernel patch-set is expected
37-
to be maintained in this repo.
30+
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).
3831

3932
_*NOTE:*_ Some built-in Kernel config items need to be set, that aren't set by default:
4033
- https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing
4134

35+
#### Kernel versions
36+
37+
There are multiple versions of the Surface kernel available:
38+
39+
- `lts`, which tracks the latest LTS release.
40+
- `latest`, which tracks the most recent release.
41+
42+
This repo uses `lts` by default, but you can switch it to `latest` by adding this to your configuration file:
43+
44+
```nix
45+
microsoft-surface.kernelVersion = "latest";
46+
```
47+
4248
### Support Tools
4349

4450
### IPTS
@@ -120,3 +126,7 @@ References:
120126
- https://github.com/thebitstick/surfacego-wifi
121127
- https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/ath10k
122128
- https://wireless.wiki.kernel.org/en/users/drivers/ath10k/firmware
129+
130+
## Structural changes from earlier versions (2023-01-10 and earlier)
131+
132+
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!

microsoft/surface/common/default.nix

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{ config, lib, pkgs, ... }:
22

33
let
4-
inherit (lib) mkDefault mkOption types;
4+
inherit (lib) fetchFromGitHub mkDefault mkOption types versions;
55

6-
shortVersion = config.microsoft-surface.kernelVersion;
7-
version = if shortVersion == "6.12" then
6+
# Set the full kernel version and hashes
7+
version =
8+
if config.microsoft-surface.kernelVersion == "lts" then
89
"6.12.19"
9-
else if shortVersion == "6.13" then
10+
else if config.microsoft-surface.kernelVersion == "latest" then
1011
"6.13.6"
1112
else
12-
abort "Invalid kernel version: ${shortVersion}";
13-
14-
rev = "arch-${version}-1";
13+
abort "Invalid kernel version: ${config.microsoft-surface.kernelVersion}";
1514

16-
hash =
15+
shortVersion = versions.majorMinor version;
16+
packageHash =
1717
if shortVersion == "6.12" then
1818
"sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY="
1919
else if shortVersion == "6.13" then
@@ -29,40 +29,51 @@ let
2929
else
3030
abort "Invalid kernel version: ${shortVersion}";
3131

32-
inherit (pkgs.callPackage ./kernel/linux-package.nix { repos = pkgs.callPackage ./kernel/repos.nix { rev = rev; hash = hash; }; }) linuxPackage surfacePatches;
32+
# Fetch the release from the linux-surface project
33+
rev = "arch-${version}-1";
34+
repos = pkgs.callPackage ({ fetchFromGitHub, rev, packageHash }: {
35+
linux-surface = fetchFromGitHub {
36+
owner = "linux-surface";
37+
repo = "linux-surface";
38+
rev = rev;
39+
hash = packageHash;
40+
};
41+
}) { inherit rev packageHash; };
3342

43+
# Build the kernel package
44+
inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; }) linuxPackage surfacePatches;
3445
kernelPatches = surfacePatches {
3546
inherit version;
3647
patchFn = ./kernel/${shortVersion}/patches.nix;
3748
};
3849
kernelPackages = linuxPackage {
3950
inherit version kernelPatches;
40-
sha256 = srcHash;
51+
hash = srcHash;
4152
ignoreConfigErrors=true;
4253
};
4354

4455
in {
4556
options.microsoft-surface.kernelVersion = mkOption {
4657
description = "Kernel Version to use (patched for MS Surface)";
4758
type = types.enum [
48-
"6.12"
49-
"6.13"
59+
"lts"
60+
"latest"
5061
];
51-
default = "6.12";
62+
default = "lts";
5263
};
5364

5465
config = {
5566
boot = {
5667
inherit kernelPackages;
5768

58-
kernelParams = mkDefault [ "mem_sleep_default=deep" ];
5969
# Seems to be required to properly enable S0ix "Modern Standby":
70+
kernelParams = mkDefault [ "mem_sleep_default=deep" ];
6071
};
6172

6273
# NOTE: Check the README before enabling TLP:
6374
services.tlp.enable = mkDefault false;
6475

65-
# i.e. needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364
76+
# Needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364
6677
hardware = {
6778
enableRedistributableFirmware = mkDefault true;
6879
sensor.iio.enable = mkDefault true;

microsoft/surface/common/kernel/repos.nix

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)