WIP: x13s: install to nvme, refactor into module
This commit is contained in:
parent
40416bd4de
commit
a083c05b27
28 changed files with 1361 additions and 737 deletions
|
@ -1,8 +1,8 @@
|
|||
{ repoFlake
|
||||
, nodeFlake
|
||||
, pkgs
|
||||
, lib
|
||||
, config
|
||||
, nodeFlake
|
||||
, nodeName
|
||||
, localDomainName
|
||||
, system
|
||||
|
@ -16,8 +16,15 @@
|
|||
./disko.nix
|
||||
|
||||
../../profiles/common/user.nix
|
||||
../../profiles/common/pkg.nix
|
||||
|
||||
|
||||
{
|
||||
# nixpkgs.config.allowUnsupportedSystem = true;
|
||||
|
||||
# flake registry
|
||||
nix.registry.nixpkgs.flake = nodeFlake.inputs.nixpkgs;
|
||||
|
||||
nix.nixPath = [
|
||||
"nixpkgs=${pkgs.path}"
|
||||
];
|
||||
|
@ -43,6 +50,11 @@
|
|||
sops.defaultSopsFile = ../../../../secrets/${nodeName}/secrets.yaml;
|
||||
sops.defaultSopsFormat = "yaml";
|
||||
}
|
||||
|
||||
nodeFlake.inputs.home-manager.nixosModules.home-manager
|
||||
|
||||
../../snippets/sway-desktop.nix
|
||||
../../snippets/radicale.nix
|
||||
];
|
||||
|
||||
hardware.thinkpad-x13s = {
|
||||
|
@ -57,8 +69,8 @@
|
|||
|
||||
firewall.enable = true;
|
||||
|
||||
useNetworkd = true;
|
||||
networkmanager.enable = false;
|
||||
# useNetworkd = true;
|
||||
networkmanager.enable = true;
|
||||
};
|
||||
|
||||
system.stateVersion = "23.11";
|
||||
|
@ -74,4 +86,21 @@
|
|||
pkgs.git
|
||||
pkgs.git-crypt
|
||||
];
|
||||
|
||||
home-manager.users.steveej = _: {
|
||||
imports = [
|
||||
../../../home-manager/configuration/graphical-fullblown.nix
|
||||
|
||||
(_: {
|
||||
programs.chromium.extensions = [
|
||||
# can define host-specific extensions here
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
home.sessionVariables = { };
|
||||
|
||||
home.packages = with pkgs; [
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
{
|
||||
system ? "aarch64-linux",
|
||||
nodeName,
|
||||
repoFlake,
|
||||
nodeFlake,
|
||||
localDomainName ? "internal",
|
||||
...
|
||||
{ system ? "aarch64-linux"
|
||||
, nodeName
|
||||
, repoFlake
|
||||
, nodeFlake
|
||||
, localDomainName ? "internal"
|
||||
, ...
|
||||
}: {
|
||||
meta.nodeSpecialArgs.${nodeName} = {
|
||||
inherit repoFlake nodeName nodeFlake system;
|
||||
|
@ -16,18 +15,22 @@
|
|||
|
||||
meta.nodeNixpkgs.${nodeName} =
|
||||
import nodeFlake.inputs.nixpkgs.outPath
|
||||
{
|
||||
inherit system;
|
||||
};
|
||||
{
|
||||
inherit system;
|
||||
};
|
||||
|
||||
${nodeName} = {
|
||||
|
||||
deployment.targetHost = "${nodeName}.${localDomainName}";
|
||||
deployment.replaceUnknownProfiles = true;
|
||||
deployment.allowLocalDeployment = true;
|
||||
|
||||
# nixpkgs.pkgs = nodeFlake.inputs.nixpkgs.legacyPackages.${system};
|
||||
|
||||
imports = [
|
||||
./configuration.nix
|
||||
(repoFlake + "/nix/os/devices/${nodeName}/configuration.nix")
|
||||
|
||||
nodeFlake.inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
|
||||
networking.hostName = nodeName;
|
||||
|
|
70
nix/os/devices/steveej-x13s-rmvbl/flake.lock
generated
70
nix/os/devices/steveej-x13s-rmvbl/flake.lock
generated
|
@ -57,11 +57,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705540973,
|
||||
"narHash": "sha256-kNt/qAEy7ueV7NKbVc8YMHWiQAAgrir02MROYNI8fV0=",
|
||||
"lastModified": 1705890365,
|
||||
"narHash": "sha256-MObB+fipA/2Ai3uMuNouxcwz0cqvELPpJ+hfnhSaUeA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "0033adc6e3f1ed076f3ed1c637ef1dfe6bef6733",
|
||||
"rev": "9fcdf3375e01e2938a49df103af9fd21bd0f89d9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -84,6 +84,27 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705659542,
|
||||
"narHash": "sha256-WA3xVfAk1AYmFdwghT7mt/erYpsU6JPu9mdTEP/e9HQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "10cd9c53115061aa6a0a90aad0b0dde6a999cdb9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-23.11",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"linux_x13s": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -119,11 +140,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1705641746,
|
||||
"narHash": "sha256-D6c2aH8HQbWc7ZWSV0BUpFpd94ImFyCP8jFIsKQ4Slg=",
|
||||
"lastModified": 1705774713,
|
||||
"narHash": "sha256-j6ADaDH9XiumUzkTPlFyCBcoWYhO83lfgiSqEJF2zcs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d2003f2223cbb8cd95134e4a0541beea215c1073",
|
||||
"rev": "1b64fc1287991a9cce717a01c1973ef86cb1af0b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -133,6 +154,38 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2211": {
|
||||
"locked": {
|
||||
"lastModified": 1688392541,
|
||||
"narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-22.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable-small": {
|
||||
"locked": {
|
||||
"lastModified": 1705891108,
|
||||
"narHash": "sha256-PQ0Df5BzByg+0gPE1goa9WYVXSoEP6gtjblrbYC8WOI=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "8cccce637e19577815de54c5ecc3132dff965aee",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"adamcstephens_stop-export": "adamcstephens_stop-export",
|
||||
|
@ -140,9 +193,12 @@
|
|||
"brainwart_x13s-nixos": "brainwart_x13s-nixos",
|
||||
"disko": "disko",
|
||||
"get-flake": "get-flake",
|
||||
"home-manager": "home-manager",
|
||||
"linux_x13s": "linux_x13s",
|
||||
"mobile-nixos": "mobile-nixos",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-2211": "nixpkgs-2211",
|
||||
"nixpkgs-unstable-small": "nixpkgs-unstable-small"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
{
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
|
||||
# requires for home-manager modules
|
||||
nixpkgs-unstable-small.url = "github:nixos/nixpkgs/nixos-unstable-small";
|
||||
nixpkgs-2211.url = "github:nixos/nixpkgs/nixos-22.11";
|
||||
|
||||
get-flake.url = "github:ursi/get-flake";
|
||||
|
||||
disko.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -10,24 +14,9 @@
|
|||
mobile-nixos.url = "github:NixOS/mobile-nixos";
|
||||
mobile-nixos.flake = false;
|
||||
|
||||
# see https://github.com/jhovold/linux/wiki/X13s for status updates
|
||||
linux_x13s.url = "github:jhovold/linux/wip/sc8280xp-v6.7";
|
||||
linux_x13s.flake = false;
|
||||
|
||||
brainwart_x13s-nixos = {
|
||||
url = "github:BrainWart/x13s-nixos/flake";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
adamcstephens_stop-export = {
|
||||
flake = false;
|
||||
url = "git+https://codeberg.org/adamcstephens/stop-export.git";
|
||||
};
|
||||
|
||||
|
||||
alsa-ucm-conf = {
|
||||
flake = false;
|
||||
url = "github:alsa-project/alsa-ucm-conf/master";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-23.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -60,11 +49,6 @@
|
|||
self.nixosModules.hardware-x13s
|
||||
|
||||
./configuration.nix
|
||||
|
||||
# flake registry
|
||||
{
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
}
|
||||
]
|
||||
++ extraModules;
|
||||
}
|
||||
|
@ -85,247 +69,5 @@
|
|||
];
|
||||
};
|
||||
};
|
||||
|
||||
nixosModules.hardware-x13s = { pkgs, config, lib, options, ... }:
|
||||
let
|
||||
# TODO: introduce options for these
|
||||
kernelPdMapper = true;
|
||||
cfg = config.hardware.thinkpad-x13s;
|
||||
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 =
|
||||
let
|
||||
inherit (config.boot.loader) efi;
|
||||
kp = [
|
||||
{
|
||||
name = "x13s-cfg";
|
||||
patch = null;
|
||||
extraStructuredConfig = with lib.kernel; {
|
||||
EFI_ARMSTUB_DTB_LOADER = lib.mkForce yes;
|
||||
OF_OVERLAY = lib.mkForce yes;
|
||||
BTRFS_FS = lib.mkForce yes;
|
||||
BTRFS_FS_POSIX_ACL = lib.mkForce yes;
|
||||
MEDIA_CONTROLLER = lib.mkForce yes;
|
||||
SND_USB_AUDIO_USE_MEDIA_CONTROLLER = lib.mkForce yes;
|
||||
SND_USB = lib.mkForce yes;
|
||||
SND_USB_AUDIO = lib.mkForce module;
|
||||
USB_XHCI_PCI = lib.mkForce module;
|
||||
NO_HZ_FULL = lib.mkForce yes;
|
||||
HZ_100 = lib.mkForce yes;
|
||||
HZ_250 = lib.mkForce no;
|
||||
DRM_AMDGPU = lib.mkForce no;
|
||||
DRM_NOUVEAU = lib.mkForce no;
|
||||
QCOM_TSENS = lib.mkForce yes;
|
||||
NVMEM_QCOM_QFPROM = lib.mkForce yes;
|
||||
ARM_QCOM_CPUFREQ_NVMEM = lib.mkForce yes;
|
||||
VIRTIO_PCI = lib.mkForce module;
|
||||
# forthcoming kernel work: QCOM_PD_MAPPER = lib.mkForce module;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
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
|
||||
linux_x13s_pkg = { buildLinux, ... } @ args:
|
||||
buildLinux (args // rec {
|
||||
version = "6.7.0";
|
||||
modDirVersion = lib.versions.pad 3 version;
|
||||
extraMeta.branch = lib.versions.majorMinor version;
|
||||
|
||||
src = self.inputs.linux_x13s;
|
||||
kernelPatches = (args.kernelPatches or [ ]) ++ kp;
|
||||
} // (args.argsOverride or { }));
|
||||
|
||||
# we add additional configuration on top of te normal configuration above
|
||||
# using the extraStructuredConfig option on the kernel patch
|
||||
linux_x13s = pkgs.callPackage linux_x13s_pkg {
|
||||
defconfig = "johan_defconfig";
|
||||
};
|
||||
|
||||
linuxPackages_x13s = pkgs.linuxPackagesFor linux_x13s;
|
||||
dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb";
|
||||
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}";
|
||||
|
||||
x13s_alsa-ucm-conf = pkgs.alsa-ucm-conf.overrideAttrs (prev: {
|
||||
src = self.inputs.alsa-ucm-conf;
|
||||
});
|
||||
alsa-ucm-conf-env.ALSA_CONFIG_UCM2 = "${x13s_alsa-ucm-conf}/share/alsa/ucm2";
|
||||
|
||||
in
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(final: prev:
|
||||
{
|
||||
x13s_extra-firmware = pkgs.callPackage
|
||||
"${self.inputs.adamcstephens_stop-export}/hardware/x13s/extra-firmware.nix"
|
||||
{ };
|
||||
|
||||
inherit qrtr pd-mapper;
|
||||
}
|
||||
)
|
||||
];
|
||||
|
||||
# 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 = {
|
||||
loader.systemd-boot.enable = true;
|
||||
loader.systemd-boot.extraFiles = {
|
||||
"${dtbName}" = dtb;
|
||||
};
|
||||
loader.efi.canTouchEfiVariables = false;
|
||||
loader.efi.efiSysMountPoint = "/boot";
|
||||
|
||||
blacklistedKernelModules = [ "wwan" ];
|
||||
|
||||
kernelPackages = linuxPackages_x13s;
|
||||
|
||||
kernelParams = [
|
||||
"dtb=${dtbName}"
|
||||
|
||||
"boot.shell_on_fail"
|
||||
|
||||
# jhovold recommended
|
||||
"efi=noruntime"
|
||||
"clk_ignore_unused"
|
||||
"pd_ignore_unused"
|
||||
"arm64.nopauth"
|
||||
|
||||
# blacklist graphics in initrd so the firmware can load from disk
|
||||
"rd.driver.blacklist=msm"
|
||||
];
|
||||
|
||||
initrd = {
|
||||
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 = [
|
||||
"i2c_hid"
|
||||
"i2c_hid_of"
|
||||
"i2c_qcom_geni"
|
||||
"leds_qcom_lpg"
|
||||
"pwm_bl"
|
||||
"qrtr"
|
||||
"pmic_glink_altmode"
|
||||
"gpio_sbu_mux"
|
||||
"phy_qcom_qmp_combo"
|
||||
"panel_edp"
|
||||
# "msm"
|
||||
"phy_qcom_edp"
|
||||
"i2c_core"
|
||||
"i2c_hid"
|
||||
"i2c_hid_of"
|
||||
"i2c_qcom_geni"
|
||||
"pcie_qcom"
|
||||
"phy_qcom_qmp_combo"
|
||||
"phy_qcom_qmp_pcie"
|
||||
"phy_qcom_qmp_usb"
|
||||
"phy_qcom_snps_femto_v2"
|
||||
"phy_qcom_usb_hs"
|
||||
"nvme"
|
||||
|
||||
"usbcore"
|
||||
"xhci_hcd"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"uas"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# default is performance
|
||||
powerManagement.cpuFreqGovernor = "ondemand";
|
||||
|
||||
hardware.enableAllFirmware = true;
|
||||
hardware.firmware = [
|
||||
# pkgs.linux-firmware
|
||||
|
||||
pkgs.x13s_extra-firmware
|
||||
];
|
||||
|
||||
systemd.services.pd-mapper = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${lib.getExe pd-mapper}";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
|
||||
environment.sessionVariables = alsa-ucm-conf-env;
|
||||
systemd.user.services.pipewire.environment = alsa-ucm-conf-env;
|
||||
systemd.user.services.wireplumber.environment = alsa-ucm-conf-env;
|
||||
|
||||
systemd.services.bluetooth = {
|
||||
serviceConfig = {
|
||||
# disabled because btmgmt call hangs
|
||||
ExecStartPre = [
|
||||
""
|
||||
"${pkgs.util-linux}/bin/rfkill block bluetooth"
|
||||
"${pkgs.bluez5-experimental}/bin/btmgmt public-addr ${cfg.bluetoothMac}"
|
||||
"${pkgs.util-linux}/bin/rfkill unblock bluetooth"
|
||||
];
|
||||
RestartSec = 5;
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue