This commit is contained in:
mexisme 2022-12-05 16:01:37 +13:00
parent b01a6d58df
commit f99c9d5b1f
5 changed files with 36 additions and 21 deletions

View File

@ -1,10 +1,15 @@
{ config, lib, pkgs, ... }: {
{ config, lib, pkgs, ... }:
let
inherit (lib) mkDefault;
in {
imports = [
./kernel
./firmware/surface-go/ath10k
];
boot.extraModprobeConfig = lib.mkDefault ''
boot.extraModprobeConfig = mkDefault ''
options i915 enable_fbc=1 enable_rc6=1 modeset=1
options snd_hda_intel power_save=1
options snd_ac97_codec power_save=1
@ -15,18 +20,25 @@
boot.kernelParams = [ "mem_sleep_default=deep" ];
# NOTE: Check the README before enabling TLP:
services.tlp.enable = lib.mkDefault false;
services.tlp.enable = mkDefault false;
# i.e. needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364
hardware.enableRedistributableFirmware = lib.mkDefault true;
hardware.sensor.iio.enable = lib.mkDefault true;
hardware.enableRedistributableFirmware = mkDefault true;
hardware.sensor.iio.enable = mkDefault true;
environment.systemPackages = with pkgs; [ surface-control ];
environment.systemPackages = [
pkgs.surface-control
];
users.groups.surface-control = { };
services.udev.packages = [ pkgs.surface-control ];
services.udev.packages = [
pkgs.surface-control
];
systemd.services.iptsd = {
description = "IPTSD";
script = "${pkgs.iptsd}/bin/iptsd";
wantedBy = [ "multi-user.target" ];
wantedBy = [
"multi-user.target"
];
};
}

View File

@ -1,9 +1,10 @@
{stdenv, lib, pkgs, firmwareLinuxNonfree, ...}:
{ stdenv, lib, pkgs, firmwareLinuxNonfree, ... }:
let
repos = (pkgs.callPackage ../../../repos.nix {});
killernetworking_firmware = repos.surface-go-ath10k-firmware_backup + "/K1535_Debian";
in
stdenv.mkDerivation {
in stdenv.mkDerivation {
pname = "microsoft-surface-go-firmware-linux-nonfree";
inherit (firmwareLinuxNonfree) version;
src = firmwareLinuxNonfree;

View File

@ -1,21 +1,24 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkDefault mkEnableOption mkIf;
cfg = config.hardware.microsoft-surface.firmware.surface-go-ath10k;
in
{
in {
options = {
hardware.microsoft-surface.firmware.surface-go-ath10k = {
replace = lib.mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.'';
replace = mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.'';
};
};
config = lib.mkIf cfg.replace {
config = mkIf cfg.replace {
hardware.enableAllFirmware = true;
hardware.firmware = [
(pkgs.callPackage ./ath10k-replace.nix {})
];
boot.extraModprobeConfig = lib.mkDefault ''
boot.extraModprobeConfig = mkDefault ''
options ath10k_core skip_otp=Y
'';
};

View File

@ -1,7 +1,4 @@
{ lib,
fetchurl,
repos,
}:
{ lib, fetchurl, repos,}:
let
inherit (lib) kernel;

View File

@ -1,4 +1,6 @@
{ fetchFromGitHub, fetchurl }: {
{ fetchFromGitHub, fetchurl }:
{
linux-surface = fetchFromGitHub {
owner = "linux-surface";
repo = "linux-surface";