x13s: fiddle with modules because of screen blanking issues
This commit is contained in:
parent
5af42df5a9
commit
2ff952b3a3
3 changed files with 118 additions and 78 deletions
|
@ -45,6 +45,13 @@
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
hardware.thinkpad-x13s = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# TODO: use hardware address
|
||||||
|
bluetoothMac = "65:9e:7a:8b:86:28";
|
||||||
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = nodeName;
|
hostName = nodeName;
|
||||||
|
|
||||||
|
@ -59,8 +66,12 @@
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
|
pkgs.sshfs
|
||||||
pkgs.util-linux
|
pkgs.util-linux
|
||||||
pkgs.coreutils
|
pkgs.coreutils
|
||||||
pkgs.vim
|
pkgs.vim
|
||||||
|
|
||||||
|
pkgs.git
|
||||||
|
pkgs.git-crypt
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
14
nix/os/devices/steveej-x13s-rmvbl/flake.lock
generated
14
nix/os/devices/steveej-x13s-rmvbl/flake.lock
generated
|
@ -1,13 +1,13 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"acamcstephens_stop-export": {
|
"adamcstephens_stop-export": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1705858695,
|
"lastModified": 1705876512,
|
||||||
"narHash": "sha256-iTIwMsw/cjacCkSzzCwb+nEkpOK/PoPenPHOysWCBSk=",
|
"narHash": "sha256-nvBqLyi8dMQf3xnROwEcUv4iqV55Mr8S8OGYepu14i4=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "8b61e53b83caf55bd374f4ce2b20f1e8012ce2ec",
|
"rev": "388684db5b529bbd6f3e948cf175df089eb09766",
|
||||||
"revCount": 13,
|
"revCount": 14,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://codeberg.org/adamcstephens/stop-export.git"
|
"url": "https://codeberg.org/adamcstephens/stop-export.git"
|
||||||
},
|
},
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "alsa-project",
|
"owner": "alsa-project",
|
||||||
|
"ref": "master",
|
||||||
"repo": "alsa-ucm-conf",
|
"repo": "alsa-ucm-conf",
|
||||||
"rev": "e87dde51d68950537f92af955ad0633437cc419a",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"acamcstephens_stop-export": "acamcstephens_stop-export",
|
"adamcstephens_stop-export": "adamcstephens_stop-export",
|
||||||
"alsa-ucm-conf": "alsa-ucm-conf",
|
"alsa-ucm-conf": "alsa-ucm-conf",
|
||||||
"brainwart_x13s-nixos": "brainwart_x13s-nixos",
|
"brainwart_x13s-nixos": "brainwart_x13s-nixos",
|
||||||
"disko": "disko",
|
"disko": "disko",
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
acamcstephens_stop-export = {
|
adamcstephens_stop-export = {
|
||||||
flake = false;
|
flake = false;
|
||||||
url = "git+https://codeberg.org/adamcstephens/stop-export.git";
|
url = "git+https://codeberg.org/adamcstephens/stop-export.git";
|
||||||
};
|
};
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
alsa-ucm-conf = {
|
alsa-ucm-conf = {
|
||||||
flake = false;
|
flake = false;
|
||||||
url = "github:alsa-project/alsa-ucm-conf/e87dde51d68950537f92af955ad0633437cc419a";
|
url = "github:alsa-project/alsa-ucm-conf/master";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,8 +90,24 @@
|
||||||
let
|
let
|
||||||
# TODO: introduce options for these
|
# TODO: introduce options for these
|
||||||
kernelPdMapper = true;
|
kernelPdMapper = true;
|
||||||
|
cfg = config.hardware.thinkpad-x13s;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
options.hardware.thinkpad-x13s = {
|
||||||
|
# TODO: respect this
|
||||||
|
enable = lib.mkEnableOption "x13s hardware support";
|
||||||
|
|
||||||
|
bluetoothMac = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "mac address to set on boot";
|
||||||
|
};
|
||||||
|
|
||||||
|
bluetoothMacAddr = lib.mkOption {
|
||||||
|
default = "00:00:00:00:00";
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
config =
|
config =
|
||||||
let
|
let
|
||||||
inherit (config.boot.loader) efi;
|
inherit (config.boot.loader) efi;
|
||||||
|
@ -117,13 +133,18 @@
|
||||||
QCOM_TSENS = lib.mkForce yes;
|
QCOM_TSENS = lib.mkForce yes;
|
||||||
NVMEM_QCOM_QFPROM = lib.mkForce yes;
|
NVMEM_QCOM_QFPROM = lib.mkForce yes;
|
||||||
ARM_QCOM_CPUFREQ_NVMEM = lib.mkForce yes;
|
ARM_QCOM_CPUFREQ_NVMEM = lib.mkForce yes;
|
||||||
} // lib.optionalAttrs kernelPdMapper {
|
VIRTIO_PCI = lib.mkForce module;
|
||||||
QCOM_PD_MAPPER = lib.mkForce yes;
|
# forthcoming kernel work: QCOM_PD_MAPPER = lib.mkForce module;
|
||||||
QRTR = lib.mkForce yes;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
qrtr = pkgs.callPackage "${self.inputs.adamcstephens_stop-export}/hardware/x13s/qrtr/qrtr.nix" { };
|
||||||
|
pd-mapper = pkgs.callPackage "${self.inputs.adamcstephens_stop-export}/hardware/x13s/qrtr/pd-mapper.nix" {
|
||||||
|
inherit qrtr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
# We can't quite move to mainline linux
|
# We can't quite move to mainline linux
|
||||||
linux_x13s_pkg = { buildLinux, ... } @ args:
|
linux_x13s_pkg = { buildLinux, ... } @ args:
|
||||||
buildLinux (args // rec {
|
buildLinux (args // rec {
|
||||||
|
@ -142,48 +163,43 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
linuxPackages_x13s = pkgs.linuxPackagesFor linux_x13s;
|
linuxPackages_x13s = pkgs.linuxPackagesFor linux_x13s;
|
||||||
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/sc8280xp-lenovo-thinkpad-x13s.dtb";
|
dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb";
|
||||||
|
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}";
|
||||||
|
|
||||||
dtbName = "x13s63rc4.dtb";
|
x13s_alsa-ucm-conf = pkgs.alsa-ucm-conf.overrideAttrs (prev: {
|
||||||
|
src = self.inputs.alsa-ucm-conf;
|
||||||
x13_firmware = { stdenvNoCC, fetchFromGitHub }:
|
});
|
||||||
stdenvNoCC.mkDerivation {
|
alsa-ucm-conf-env.ALSA_CONFIG_UCM2 = "${x13s_alsa-ucm-conf}/share/alsa/ucm2";
|
||||||
pname = "x13s-extra-firmware";
|
|
||||||
version = "1.0.0";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "ironrobin";
|
|
||||||
repo = "x13s-alarm";
|
|
||||||
rev = "efa51c3b519f75b3983aef67855b1561d9828771";
|
|
||||||
sha256 = "sha256-weETbWXz9aL2pDQDKk7fkb1ecQH0qrhUYDs2E5EiJcI=";
|
|
||||||
};
|
|
||||||
|
|
||||||
dontFixup = true;
|
|
||||||
dontBuild = true;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/lib/firmware/qcom/sc8280xp/LENOVO/21BX
|
|
||||||
cp x13s-firmware/qcvss8280.mbn $out/lib/firmware/qcom/sc8280xp/LENOVO/21BX/
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(final: prev:
|
(final: prev:
|
||||||
{
|
{
|
||||||
qrtr = final.callPackage "${self.inputs.acamcstephens_stop-export}/hardware/x13s/qrtr/qrtr.nix" { };
|
x13s_extra-firmware = pkgs.callPackage
|
||||||
pd-mapper = final.callPackage "${self.inputs.acamcstephens_stop-export}/hardware/x13s/qrtr/pd-mapper.nix" {
|
"${self.inputs.adamcstephens_stop-export}/hardware/x13s/extra-firmware.nix"
|
||||||
inherit (final) qrtr;
|
{ };
|
||||||
};
|
|
||||||
|
|
||||||
x13s_alsa-ucm-conf = prev.alsa-ucm-conf.overrideAttrs (prev: {
|
inherit qrtr pd-mapper;
|
||||||
src = self.inputs.alsa-ucm-conf;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# ensure the x13s' dtb file is in the boot partition
|
||||||
|
# TODO:: is this needed for the VT display somehow?
|
||||||
|
system.activationScripts.x13s-dtb = ''
|
||||||
|
in_package="${dtb}"
|
||||||
|
esp_tool_folder="${efi.efiSysMountPoint}/"
|
||||||
|
in_esp="''${esp_tool_folder}${dtbName}"
|
||||||
|
>&2 echo "Ensuring $in_esp in EFI System Partition"
|
||||||
|
if ! ${pkgs.diffutils}/bin/cmp --silent "$in_package" "$in_esp"; then
|
||||||
|
>&2 echo "Copying $in_package -> $in_esp"
|
||||||
|
mkdir -p "$esp_tool_folder"
|
||||||
|
cp "$in_package" "$in_esp"
|
||||||
|
sync
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
loader.systemd-boot.enable = true;
|
loader.systemd-boot.enable = true;
|
||||||
loader.systemd-boot.extraFiles = {
|
loader.systemd-boot.extraFiles = {
|
||||||
|
@ -213,6 +229,31 @@
|
||||||
|
|
||||||
initrd = {
|
initrd = {
|
||||||
includeDefaultModules = false;
|
includeDefaultModules = false;
|
||||||
|
|
||||||
|
# kernelModules = [
|
||||||
|
# "nvme"
|
||||||
|
# "phy_qcom_qmp_pcie"
|
||||||
|
# "pcie_qcom"
|
||||||
|
|
||||||
|
# "i2c_core"
|
||||||
|
# "i2c_hid"
|
||||||
|
# "i2c_hid_of"
|
||||||
|
# "i2c_qcom_geni"
|
||||||
|
|
||||||
|
# "leds_qcom_lpg"
|
||||||
|
# "pwm_bl"
|
||||||
|
# "qrtr"
|
||||||
|
# "pmic_glink_altmode"
|
||||||
|
# "gpio_sbu_mux"
|
||||||
|
# "phy_qcom_qmp_combo"
|
||||||
|
# "gpucc_sc8280xp"
|
||||||
|
# "dispcc_sc8280xp"
|
||||||
|
# "phy_qcom_edp"
|
||||||
|
# "panel_edp"
|
||||||
|
# # "msm"
|
||||||
|
|
||||||
|
# ];
|
||||||
|
|
||||||
availableKernelModules = [
|
availableKernelModules = [
|
||||||
"i2c_hid"
|
"i2c_hid"
|
||||||
"i2c_hid_of"
|
"i2c_hid_of"
|
||||||
|
@ -223,26 +264,25 @@
|
||||||
"pmic_glink_altmode"
|
"pmic_glink_altmode"
|
||||||
"gpio_sbu_mux"
|
"gpio_sbu_mux"
|
||||||
"phy_qcom_qmp_combo"
|
"phy_qcom_qmp_combo"
|
||||||
"panel-edp"
|
"panel_edp"
|
||||||
"msm"
|
# "msm"
|
||||||
"phy_qcom_edp"
|
"phy_qcom_edp"
|
||||||
"i2c-core"
|
"i2c_core"
|
||||||
"i2c-hid"
|
"i2c_hid"
|
||||||
"i2c-hid-of"
|
"i2c_hid_of"
|
||||||
"i2c-qcom-geni"
|
"i2c_qcom_geni"
|
||||||
"pcie-qcom"
|
"pcie_qcom"
|
||||||
"phy-qcom-qmp-combo"
|
"phy_qcom_qmp_combo"
|
||||||
"phy-qcom-qmp-pcie"
|
"phy_qcom_qmp_pcie"
|
||||||
"phy-qcom-qmp-usb"
|
"phy_qcom_qmp_usb"
|
||||||
"phy-qcom-snps-femto-v2"
|
"phy_qcom_snps_femto_v2"
|
||||||
"phy-qcom-usb-hs"
|
"phy_qcom_usb_hs"
|
||||||
"nvme"
|
"nvme"
|
||||||
|
|
||||||
"usbcore"
|
"usbcore"
|
||||||
"xhci_hcd"
|
"xhci_hcd"
|
||||||
"usbhid"
|
"usbhid"
|
||||||
"usb_storage"
|
"usb_storage"
|
||||||
# "xhci_pci"
|
|
||||||
"uas"
|
"uas"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -254,44 +294,33 @@
|
||||||
|
|
||||||
hardware.enableAllFirmware = true;
|
hardware.enableAllFirmware = true;
|
||||||
hardware.firmware = [
|
hardware.firmware = [
|
||||||
pkgs.linux-firmware
|
# pkgs.linux-firmware
|
||||||
|
|
||||||
(pkgs.callPackage x13_firmware { })
|
pkgs.x13s_extra-firmware
|
||||||
(pkgs.callPackage "${self.inputs.brainwart_x13s-nixos}/pkgs/x13s-firmware.nix" { })
|
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services.pd-mapper = {
|
systemd.services.pd-mapper = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${lib.getExe pkgs.pd-mapper}";
|
ExecStart = "${lib.getExe pd-mapper}";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# bind mount over existing alsa-ucm-conf
|
environment.sessionVariables = alsa-ucm-conf-env;
|
||||||
# this is just config, but is in the critical path for lots of packages
|
systemd.user.services.pipewire.environment = alsa-ucm-conf-env;
|
||||||
# systemd.services.x13s-alsa-conf = {
|
systemd.user.services.wireplumber.environment = alsa-ucm-conf-env;
|
||||||
# wantedBy = [ "multi-user.target" ];
|
|
||||||
|
|
||||||
# serviceConfig = {
|
|
||||||
# Type = "oneshot";
|
|
||||||
# RemainAfterExit = true;
|
|
||||||
|
|
||||||
# ExecStart = "${pkgs.util-linux.mount}/bin/mount -o bind ${pkgs.x13s_alsa-ucm-conf}/share/alsa ${pkgs.alsa-ucm-conf}/share/alsa";
|
|
||||||
# ExecStop = "${pkgs.util-linux.mount}/bin/umount ${pkgs.alsa-ucm-conf}/share/alsa";
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
|
|
||||||
systemd.services.bluetooth = {
|
systemd.services.bluetooth = {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
# disabled because btmgmt call hangs
|
# disabled because btmgmt call hangs
|
||||||
# ExecStartPre = [
|
ExecStartPre = [
|
||||||
# ""
|
""
|
||||||
# "${pkgs.util-linux}/bin/rfkill block bluetooth"
|
"${pkgs.util-linux}/bin/rfkill block bluetooth"
|
||||||
# "${pkgs.bluez5-experimental}/bin/btmgmt public-addr ${cfg.bluetoothMac}"
|
"${pkgs.bluez5-experimental}/bin/btmgmt public-addr ${cfg.bluetoothMac}"
|
||||||
# "${pkgs.util-linux}/bin/rfkill unblock bluetooth"
|
"${pkgs.util-linux}/bin/rfkill unblock bluetooth"
|
||||||
# ];
|
];
|
||||||
RestartSec = 5;
|
RestartSec = 5;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue