Merge pull request #186 from khumba/system76

This commit is contained in:
Jörg Thalheim 2021-03-23 09:57:23 +00:00 committed by GitHub
commit 758bc63af2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 114 additions and 0 deletions

View File

@ -5,3 +5,4 @@ lenovo/thinkpad/x230 @makefu @yegortimoshenko
lenovo/thinkpad/x250 @Mic92
pcengines/apu @yegortimoshenko
purism/librem/13v3 @yegortimoshenko
system76/darp6 @khumba

View File

@ -139,6 +139,8 @@ See code for all available configurations.
| [Purism Librem 15v3][] | `<nixos-hardware/purism/librem/15v3>` |
| Supermicro A1SRi-2758F | `<nixos-hardware/supermicro/a1sri-2758f>` |
| Supermicro X10SLL-F | `<nixos-hardware/supermicro/x10sll-f>` |
| [System76 (generic)][] | `<nixos-hardware/system76>` |
| [System76 Darter Pro 6][] | `<nixos-hardware/system76/darp6>` |
| [Toshiba Chromebook 2 `swanky`][] | `<nixos-hardware/toshiba/swanky>` |
| [Tuxedo InfinityBook v4][] | `<nixos-hardware/tuxedo/infinitybook/v4>` |
@ -168,6 +170,8 @@ See code for all available configurations.
[MSI GS60 2QE]: msi/gs60
[Raspberry Pi 2]: raspberry-pi/2
[Samsung Series 9 NP900X3C]: samsung/np900x3c
[System76 (generic)]: system76
[System76 Darter Pro 6]: system76/darp6
[Purism Librem 13v3]: purism/librem/13v3
[Purism Librem 15v5]: purism/librem/15v5
[Toshiba Chromebook 2 `swanky`]: toshiba/swanky

View File

@ -69,6 +69,8 @@
pcengines-apu = import ./pcengines/apu;
raspberry-pi-2 = import ./raspberry-pi/2;
samsung-np900x3c = import ./samsung/np900x3c;
system76 = import ./system76;
system76-darp6 = import ./system76/darp6;
purism-librem-13v3 = import ./purism/librem/13v3;
purism-librem-15v3 = import ./purism/librem/15v3;
supermicro-a1sri-2758f = import ./supermicro/a1sri-2758f;

View File

@ -0,0 +1,97 @@
# Hardware profile for the Darter Pro 6 laptop by System76.
#
# https://system76.com/laptops/darter
#
# Regarding kernel modules, darp6 needs system76-acpi-dkms, not system76-dkms:
#
# [1] https://github.com/pop-os/system76-dkms/issues/39
# jackpot51> system76-acpi-dkms is the correct driver to use on the darp6
#
# system76-io-dkms also appears to be loaded on darp6 with Pop!_OS, and
# system76-dkms does not, and in fact refuses to load.
{ config, lib, options, pkgs, ... }:
let
cfg = config.hardware.system76.darp6;
# Allow silencing the warning about these options if either is defined.
soundSettingsDefined =
options.hardware.system76.darp6.soundVendorId.isDefined ||
options.hardware.system76.darp6.soundSubsystemId.isDefined;
# We neeed both options non-null to be able to apply the headset fixup though.
soundSettingsAvailable =
soundSettingsDefined &&
(cfg.soundVendorId != null && cfg.soundSubsystemId != null);
in
{
imports = [
../.
../../common/pc/laptop
../../common/pc/laptop/ssd
];
options.hardware.system76.darp6 = {
soundVendorId = lib.mkOption {
type = with lib.types; nullOr (strMatching "0x[0-9a-f]{8}");
description = ''
The vendor ID of the sound card PCI device, for applying the headset fixup.
This should be set to the value of the following file on your Darter Pro:
/sys/class/sound/hwC0D0/vendor_id
If this option has the default null value, then the headset fixup will
not be applied.
'';
};
soundSubsystemId = lib.mkOption {
type = with lib.types; nullOr (strMatching "0x[0-9a-f]{8}");
description = ''
The subsystem ID of the sound card PCI device, for applying the headset fixup.
This should be set to the value of the following file on your Darter Pro:
/sys/class/sound/hwC0D0/subsystem_id
If this option has the default null value, then the headset fixup will
not be applied.
'';
};
};
config = lib.mkMerge [
{
warnings = lib.optional (!soundSettingsDefined) ''
For full Darter Pro support, set the options:
- hardware.system76.darp76.soundVendorId
- hardware.system76.darp76.soundSubsystemId
You can copy these values directly from:
- /sys/class/sound/hwC0D0/vendor_id
- /sys/class/sound/hwC0D0/subsystem_id
The headset audio fixup will not be applied without these values.
Set these options to null to silence this warning.
'';
}
# Apply the headset fixup patch from system76-driver, if the necessary
# options have been provided.
#
# See occurrences of "darp" in:
# https://github.com/pop-os/system76-driver/blob/master/system76driver/actions.py
# https://github.com/pop-os/system76-driver/blob/master/system76driver/products.py
(lib.mkIf soundSettingsAvailable {
boot.extraModprobeConfig = ''
options snd-hda-intel model=headset-mode-no-hp-mic patch=system76-audio-patch
'';
hardware.firmware = [
(pkgs.writeTextFile {
name = "system76-audio-patch";
destination = "/lib/firmware/system76-audio-patch";
text = ''
[codec]
${cfg.soundVendorId} ${cfg.soundSubsystemId} 0
[pincfg]
0x1a 0x01a1913c
'';
})
];
})
];
}

10
system76/default.nix Normal file
View File

@ -0,0 +1,10 @@
# Implementation of support for general System76 hardware.
#
# https://system76.com/
{ config, lib, ... }:
{
imports = [ ../common/pc ];
hardware.system76.enableAll = lib.mkDefault true;
}