host: Use nixos-hardware

- Remove iptsd. It is packaged upstream
This commit is contained in:
PapaTutuWawa 2022-01-06 14:15:28 +01:00
parent 9c3d6b0de4
commit f72a872dff
7 changed files with 122 additions and 181 deletions

View File

@ -1,6 +1,10 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, inputs, ... }:
{
imports = with inputs.nixos-hardware.nixosModules; [
common-cpu-intel common-pc-ssd microsoft-surface
];
fileSystems = {
"/" = {
device = "/dev/disk/by-label/root";

View File

@ -1,6 +1,10 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, inputs, ... }:
{
imports = with inputs.nixos-hardware.nixosModules; [
common-cpu-amd common-gpu-amd common-pc-ssd
];
fileSystems = {
"/" = {
device = "/dev/disk/by-label/root";
@ -28,8 +32,8 @@
trackma # Custom package
anime-dl # Custom package
thunderbird
multimc-wrapped # Custom package
nwg-launchers
#multimc-wrapped # Custom package
#nwg-launchers
gnome-podcasts
cantata
newsflash
@ -55,7 +59,7 @@
};
xournalpp.enable = true;
zsh.enable = true;
plasma.enable = true;
#plasma.enable = true;
};
services = {
gamemode.enable = true;
@ -143,11 +147,14 @@
"kvm.report_ignored_msrs=N"
"fbcon=rotate:3"
"quiet"
"nopti"
"nospectre_v2"
"nospec"
"clocksource=tsc"
"tsc=reliable"
];
#extraModulePackages = [ pkgs.linuxPackages_xanmod.vendor-reset ];
extraModulePackages = [ pkgs.linuxPackages_zen.vendor-reset ];
#extraModulePackages = [ pkgs.linuxPackages.vendor-reset ];
# NOTE: A regression appears to have happend between 5.10 and 5.12

View File

@ -112,6 +112,96 @@ in {
jack.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
/*
config.pipewire = {
"context.modules" = [
{
name = "libpipewire-module-rtkit";
args = {};
flags = [ "ifexists" "nofail" ];
}
{ name = "libpipewire-module-protocol-native"; }
{ name = "libpipewire-module-client-node"; }
{ name = "libpipewire-module-adapter"; }
{ name = "libpipewire-module-metadata"; }
{
name = "libpipewire-module-filter-chain";
args = {
"node.name" = "effect_output.virtual-surround-7.1-hesuvi";
"node.description" = "Virtual Surround Sink";
"media.name" = "Virtual Surround Sink";
"filter.graph" = {
nodes = [
{ type = "builtin"; label = "copy"; name = "copyFL"; }
{ type = "builtin"; label = "copy"; name = "copyFR"; }
{ type = "builtin"; label = "copy"; name = "copyFC"; }
{ type = "builtin"; label = "copy"; name = "copyRL"; }
{ type = "builtin"; label = "copy"; name = "copyRR"; }
{ type = "builtin"; label = "copy"; name = "copySL"; }
{ type = "builtin"; label = "copy"; name = "copySR"; }
{ type = "builtin"; label = "copy"; name = "copyLFE"; }
{ type = "builtin"; label = "convolver"; name = "convFL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 0; }; }
{ type = "builtin"; label = "convolver"; name = "convFL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 1; }; }
{ type = "builtin"; label = "convolver"; name = "convSL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 2; }; }
{ type = "builtin"; label = "convolver"; name = "convSL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 3; }; }
{ type = "builtin"; label = "convolver"; name = "convRL_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 4; }; }
{ type = "builtin"; label = "convolver"; name = "convRL_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 5; }; }
{ type = "builtin"; label = "convolver"; name = "convFC_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
{ type = "builtin"; label = "convolver"; name = "convFR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 7; }; }
{ type = "builtin"; label = "convolver"; name = "convFR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 8; }; }
{ type = "builtin"; label = "convolver"; name = "convSR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 9; }; }
{ type = "builtin"; label = "convolver"; name = "convSR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 10; }; }
{ type = "builtin"; label = "convolver"; name = "convRR_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 11; }; }
{ type = "builtin"; label = "convolver"; name = "convRR_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 12; }; }
{ type = "builtin"; label = "convolver"; name = "convFC_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
{ type = "builtin"; label = "convolver"; name = "convLFE_L"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 6; }; }
{ type = "builtin"; label = "convolver"; name = "convLFE_R"; config = { filename = "hrir_hesuvi/hrir.wav"; channel = 13; }; }
{ type = "builtin"; label = "mixer"; name = "mixL"; }
{ type = "builtin"; label = "mixer"; name = "mixR"; }
];
links = let
linkInput = channel: [
{ output = "copy${channel}:Out"; input = "conv${channel}_L:In"; }
{ output = "copy${channel}:Out"; input = "conv${channel}_R:In"; }
];
linkOutput = channel: n: [
{ output = "conv${channel}_L:Out"; input = "mix_L:In ${builtins.toString n}"; }
{ output = "conv${channel}_R:Out"; input = "mix_R:In ${builtins.toString n}"; }
];
in (builtins.concatMap (channel: linkInput channel) [ "FL" "SL" "RL" "FC" "FR" "SR" "RR" "LFE" ])
++ [
(linkOutput "FL" 1)
(linkOutput "SL" 2)
(linkOutput "RL" 3)
(linkOutput "FC" 4)
(linkOutput "FR" 5)
(linkOutput "SR" 6)
(linkOutput "RR" 7)
(linkOutput "LFE" 8)
];
inputs = builtins.map (channel: "copy${channel}:In") [ "FL" "SL" "RL" "FC" "FR" "SR" "RR" "LFE" ];
outputs = [ "mixL:Out" "mixR:Out" ];
};
"capture.props" = {
"media.class" = "Audio/Sink";
"audio.channels" = 8;
"audio.position" = [ "FL" "FR" "FC" "LFE" "RL" "RR" "SL" "SR" ];
};
"playback.props" = {
"node.passive" = true;
"audio.channels" = 2;
"audio.positions" = [ "FL" "FR" ];
};
};
}
];
};
*/
};
# On desktop: Monitor keyboards, mice, ...
@ -171,6 +261,7 @@ in {
};
boot = {
cleanTmpDir = true;
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;

View File

@ -1,17 +1,6 @@
{ config, lib, pkgs, ... }:
let
fetchurl = pkgs.fetchurl;
commit = "a602640f4334990828e07cf78bc78217b4e7901e";
kernelVersion = "5.15";
mkPatch = name: sha256: {
name = name;
patch = fetchurl {
inherit sha256;
url = "https://raw.githubusercontent.com/linux-surface/linux-surface/${commit}/patches/${kernelVersion}/${name}.patch";
};
};
cfg = config.ptw.hardware.surface;
in {
options.ptw.hardware.surface = {
@ -59,101 +48,26 @@ in {
};
boot = {
kernelPackages = pkgs.linuxPackages_5_15;
kernelPatches = [
(mkPatch "0001-surface3-oemb" "0id92a1g9ghvw2wf05ad3j4i294m118rvb23rywvm04wcasgav4a")
(mkPatch "0002-mwifiex" "091380bv1gmbzh9ldcnhdw64g8m5lz0akync7r0lazcm6fjcwnxa")
(mkPatch "0003-ath10k" "1hy22n8mdw743gnh82asnyjiivx9hz95a6svf6lr2pkdz5dl48ra")
(mkPatch "0004-ipts" "0c192h414wp0zgcm78q79wcavrzah33k94vb1cjzfl6y53agzjam")
(mkPatch "0005-surface-sam" "1awffwlp6wz0i0kb4xd7zy7y7syggzc04ay53nxjhn54n8djlb1r")
(mkPatch "0006-surface-sam-over-hid" "1nf9wy57hqr28f2lqk9vjvk0fkm9vs3j8nq4f8izhdqmazl8bbak")
(mkPatch "0007-surface-gpe" "0a77haazdsmv4kr76cfng829cgd4zrzvbn3pf1rl67vbl6il9wli")
(mkPatch "0008-surface-button" "1ja9n1iia3p6cjifds95cv684w8cr2kibj19k7fm8bm58achia6f")
(mkPatch "0009-surface-typecover" "0dmcsilqcqzr3rdc8lpq857pjgkj9agmns8g1nrax9h0rfh9gl3m")
#(mkPatch "0010-cameras" "1clvd09qbl3cjmxmpjvnfq4f9csqarzk13ahz3s69hq401a2a83m")
(mkPatch "0011-amd-gpio" "0552k7d9hajafryvjvlxbaxbxkqmhjmk4i3hxbpdb3czz7i9cyzj") # TODO: Maybe drop
(mkPatch "0012-misc-fixes" "16fslvys2zjp8fpysig51cchikskzpvjww9w4nk3wsz6yh1xdm0f")
{
name = "surface-config";
patch = null;
# Options from https://github.com/linux-surface/linux-surface/blob/master/configs/surface-5.13.config
extraConfig = ''
#
# Surface Aggregator Module
#
SURFACE_AGGREGATOR m
SURFACE_AGGREGATOR_ERROR_INJECTION n
SURFACE_AGGREGATOR_BUS y
SURFACE_AGGREGATOR_CDEV m
SURFACE_AGGREGATOR_REGISTRY m
SURFACE_ACPI_NOTIFY m
SURFACE_DTX m
SURFACE_PLATFORM_PROFILE m
SURFACE_HID m
SURFACE_KBD m
BATTERY_SURFACE m
CHARGER_SURFACE m
#
# Surface Hotplug
#
SURFACE_HOTPLUG m
#
# IPTS touchscreen
#
# This only enables the user interface for IPTS data.
# For the touchscreen to work, you need to install iptsd.
#
MISC_IPTS m
#
# Cameras: IPU3
#
#VIDEO_IPU3_IMGU m
VIDEO_IPU3_CIO2 m
CIO2_BRIDGE y
#INTEL_SKL_INT3472 m
#
# Cameras: Sensor drivers
#
#VIDEO_OV5693 m
VIDEO_OV8865 m
#
# ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7
#
APDS9960 m
#
# Other Drivers
#
INPUT_SOC_BUTTON_ARRAY m
SURFACE_3_BUTTON m
SURFACE_3_POWER_OPREGION m
SURFACE_PRO3_BUTTON m
SURFACE_GPE m
SURFACE_BOOK1_DGPU_SWITCH m
#
# Other
#
# Prevent a non-fatal "kernel oops" at boot crashing udev
# (https://github.com/linux-surface/linux-surface/issues/61#issuecomment-579298172)
PINCTRL_INTEL y
PINCTRL_SUNRISEPOINT y
# Required for reading battery data
# (https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing)
SERIAL_DEV_BUS y
SERIAL_DEV_CTRL_TTYPORT y
MFD_INTEL_LPSS_PCI y
INTEL_IDMA64 y
'';
#
# Other
#
# Prevent a non-fatal "kernel oops" at boot crashing udev
# (https://github.com/linux-surface/linux-surface/issues/61#issuecomment-579298172)
PINCTRL_INTEL y
PINCTRL_SUNRISEPOINT y
# Required for reading battery data
# (https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing)
SERIAL_DEV_BUS y
SERIAL_DEV_CTRL_TTYPORT y
MFD_INTEL_LPSS_PCI y
INTEL_IDMA64 y
'';
}
];
};

View File

@ -54,7 +54,6 @@ key-mapper = prev.callPackage ./tools/games/key-mapper {};
sddm-sugar-dark = prev.callPackage ./sddm-sugar-dark {};
iptsd = prev.callPackage ./tools/daemons/iptsd {};
surface-control = prev.callPackage ./tools/system/surface-control {};
trackma = prev.callPackage ./tools/video/trackma {};

View File

@ -1,42 +0,0 @@
{
stdenv, lib
, fetchFromGitHub
, meson, cmake, ninja, pkg-config
, inih, systemd
}:
stdenv.mkDerivation rec {
pname = "iptsd";
version = "0.4";
src = fetchFromGitHub {
owner = "linux-surface";
repo = pname;
rev = "v${version}";
sha256 = "0bh7rr37yck82g41dw2xcfkmyp1ncd27n1slb8xlknp7vs9f10qa";
};
mesonFlags = [
"-Dsample_config=false"
"-Ddebug_tool=false"
];
patches = [
./meson.patch
];
postPatch = ''
sed -e "s|@UDEVRULESDIR@|$out/lib/udev/rules.d/|" --in-place meson.build
'';
nativeBuildInputs = [ meson cmake ninja pkg-config ];
buildInputs = [ inih systemd ];
meta = with lib; {
homepage = "https://github.com/linux-surface/iptsd";
description = "Userspace daemon for Intel Precise Touch & Stylus";
license = licenses.gpl2;
maintainers = [];
platforms = platforms.linux;
};
}

View File

@ -1,32 +0,0 @@
diff --git a/meson.build b/meson.build
index b74a177..ca41ba3 100644
--- a/meson.build
+++ b/meson.build
@@ -104,18 +104,19 @@ configure_file(
service_manager = get_option('service_manager')
if service_manager.contains('systemd')
systemd = dependency('systemd')
- unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+ #unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
udev = dependency('udev')
- udevdir = udev.get_pkgconfig_variable('udevdir')
- rulesdir = join_paths(udevdir, 'rules.d')
+ #udevdir = udev.get_pkgconfig_variable('udevdir')
+ #udevdir = '@UDEVDIR@';
+ #rulesdir = join_paths('@UDEVDIR@', 'rules.d')
- install_data(
- join_paths(meson.current_build_dir(), 'iptsd.service'),
- install_dir: unitdir
- )
+########install_data(
+######## join_paths(meson.current_build_dir(), 'iptsd.service'),
+######## install_dir: unitdir
+########)
- install_data('etc/udev/50-ipts.rules', install_dir: rulesdir)
+ install_data('etc/udev/50-ipts.rules', install_dir: '@UDEVRULESDIR@')
endif
if service_manager.contains('openrc')