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 = [ imports = [
./kernel ./kernel
./firmware/surface-go/ath10k ./firmware/surface-go/ath10k
]; ];
boot.extraModprobeConfig = lib.mkDefault '' boot.extraModprobeConfig = mkDefault ''
options i915 enable_fbc=1 enable_rc6=1 modeset=1 options i915 enable_fbc=1 enable_rc6=1 modeset=1
options snd_hda_intel power_save=1 options snd_hda_intel power_save=1
options snd_ac97_codec power_save=1 options snd_ac97_codec power_save=1
@ -15,18 +20,25 @@
boot.kernelParams = [ "mem_sleep_default=deep" ]; boot.kernelParams = [ "mem_sleep_default=deep" ];
# NOTE: Check the README before enabling TLP: # 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 # i.e. needed for wifi firmware, see https://github.com/NixOS/nixos-hardware/issues/364
hardware.enableRedistributableFirmware = lib.mkDefault true; hardware.enableRedistributableFirmware = mkDefault true;
hardware.sensor.iio.enable = lib.mkDefault true; hardware.sensor.iio.enable = mkDefault true;
environment.systemPackages = with pkgs; [ surface-control ]; environment.systemPackages = [
pkgs.surface-control
];
users.groups.surface-control = { }; users.groups.surface-control = { };
services.udev.packages = [ pkgs.surface-control ]; services.udev.packages = [
pkgs.surface-control
];
systemd.services.iptsd = { systemd.services.iptsd = {
description = "IPTSD"; description = "IPTSD";
script = "${pkgs.iptsd}/bin/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 let
repos = (pkgs.callPackage ../../../repos.nix {}); repos = (pkgs.callPackage ../../../repos.nix {});
killernetworking_firmware = repos.surface-go-ath10k-firmware_backup + "/K1535_Debian"; killernetworking_firmware = repos.surface-go-ath10k-firmware_backup + "/K1535_Debian";
in
stdenv.mkDerivation { in stdenv.mkDerivation {
pname = "microsoft-surface-go-firmware-linux-nonfree"; pname = "microsoft-surface-go-firmware-linux-nonfree";
inherit (firmwareLinuxNonfree) version; inherit (firmwareLinuxNonfree) version;
src = firmwareLinuxNonfree; src = firmwareLinuxNonfree;

View file

@ -1,21 +1,24 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (lib) mkDefault mkEnableOption mkIf;
cfg = config.hardware.microsoft-surface.firmware.surface-go-ath10k; cfg = config.hardware.microsoft-surface.firmware.surface-go-ath10k;
in
{ in {
options = { options = {
hardware.microsoft-surface.firmware.surface-go-ath10k = { 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.enableAllFirmware = true;
hardware.firmware = [ hardware.firmware = [
(pkgs.callPackage ./ath10k-replace.nix {}) (pkgs.callPackage ./ath10k-replace.nix {})
]; ];
boot.extraModprobeConfig = lib.mkDefault '' boot.extraModprobeConfig = mkDefault ''
options ath10k_core skip_otp=Y options ath10k_core skip_otp=Y
''; '';
}; };

View file

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

View file

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