Compare commits

..

30 commits
week20 ... main

Author SHA1 Message Date
Martin Wurm f6a0df91fb Merge pull request 'main' (#2) from adamcstephens/nixos-x13s:main into main
Reviewed-on: https://codeberg.org/mart-w/nixos-x13s/pulls/2
2024-11-09 12:31:25 +00:00
Adam Stephens 6218392785
mark unmaintained 2024-08-25 13:40:17 -04:00
Adam Stephens a59ae21e47
disable non-working iso image 2024-07-30 23:24:00 -04:00
Adam Stephens 14777d1f0c
finally load the gpu firmware in initrd 2024-07-30 22:25:13 -04:00
Adam Stephens 8e16dc9e6a
pd-mapper is now in-kernel 2024-07-29 22:33:01 -04:00
Adam Stephens e6d95a3a60
try out another iso builder 2024-07-29 22:29:57 -04:00
Adam Stephens 5920196f4f
jhovold: 6.10.0 -> 6.11.0-rc1 2024-07-29 14:58:57 -04:00
Adam Stephens 6e5b3caccb
flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/693bc46d169f5af9c992095736e82c3488bf7dbb' (2024-07-14)
  → 'github:NixOS/nixpkgs/b73c2221a46c13557b1b3be9c2070cc42cf01eb3' (2024-07-27)
2024-07-29 14:57:26 -04:00
Adam Stephens f1a2bace41
flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/655a58a72a6601292512670343087c2d75d859c1' (2024-07-08)
  → 'github:NixOS/nixpkgs/693bc46d169f5af9c992095736e82c3488bf7dbb' (2024-07-14)
2024-07-16 08:07:36 -04:00
Adam Stephens 79dcff6403
disable regulator_ignore_unused as it's not recommended 2024-07-16 08:07:29 -04:00
Adam Stephens 7a92ed1473
jhovold: 6.10.0-rc7 -> 6.10.0 2024-07-16 08:04:39 -04:00
Adam Stephens 07c7d73a57
jhovold: 6.10.0-rc6 -> 6.10.0-rc7 2024-07-09 14:23:37 -04:00
Adam Stephens a977573540
flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/9f4128e00b0ae8ec65918efeba59db998750ead6' (2024-07-03)
  → 'github:NixOS/nixpkgs/655a58a72a6601292512670343087c2d75d859c1' (2024-07-08)
2024-07-09 14:21:53 -04:00
Adam Stephens 4964bf1692
jhovold: 6.10.0-rc5 -> 6.10.0-rc6 2024-07-04 17:34:56 -04:00
Adam Stephens 7d66d2ca4d
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8' (2024-06-01)
  → 'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7' (2024-07-03)
• Updated input 'flake-parts/nixpkgs-lib':
    'eb9ceca17d.tar.gz?narHash=sha256-lIbdfCsf8LMFloheeE6N31%2BBMIeixqyQWbSr2vk79EQ%3D' (2024-06-01)
  → '5daf051448.tar.gz?narHash=sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI%3D' (2024-07-01)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/2893f56de08021cffd9b6b6dfc70fd9ccd51eb60' (2024-06-24)
  → 'github:NixOS/nixpkgs/9f4128e00b0ae8ec65918efeba59db998750ead6' (2024-07-03)
2024-07-04 17:33:34 -04:00
Martin Wurm 757ba49d65 Merge pull request 'main' (#1) from adamcstephens/nixos-x13s:main into main
Reviewed-on: https://codeberg.org/mart-w/nixos-x13s/pulls/1
2024-06-26 09:20:29 +00:00
Adam Stephens dccc4a2c35
flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/c7b821ba2e1e635ba5a76d299af62821cbcb09f3' (2024-06-09)
  → 'github:NixOS/nixpkgs/2893f56de08021cffd9b6b6dfc70fd9ccd51eb60' (2024-06-24)
2024-06-25 14:48:00 -04:00
Adam Stephens 4f3bbdaeca
add update script for kernel 2024-06-25 14:47:58 -04:00
Adam Stephens 4ea1f591bc
jhovold: 6.10.0-rc3 -> 6.10.0-rc5 2024-06-25 14:44:55 -04:00
Adam Stephens a95fcbdb0b
jhovold: 6.10.0-rc2 -> 6.10.0-rc3 2024-06-11 14:57:07 -04:00
Adam Stephens bece952194
flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/e8057b67ebf307f01bdcc8fba94d94f75039d1f6' (2024-06-05)
  → 'github:NixOS/nixpkgs/c7b821ba2e1e635ba5a76d299af62821cbcb09f3' (2024-06-09)
2024-06-11 14:54:49 -04:00
Adam Stephens 65b22fab10
fix: wrap build in tini 2024-06-08 11:41:56 -04:00
Adam Stephens 0cf1cf36b8
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/8dc45382d5206bd292f9c2768b8058a8fd8311d9' (2024-05-16)
  → 'github:hercules-ci/flake-parts/2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8' (2024-06-01)
• Updated input 'flake-parts/nixpkgs-lib':
    '50eb7ecf4c.tar.gz?narHash=sha256-QBx10%2Bk6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94%3D' (2024-05-02)
  → 'eb9ceca17d.tar.gz?narHash=sha256-lIbdfCsf8LMFloheeE6N31%2BBMIeixqyQWbSr2vk79EQ%3D' (2024-06-01)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/ad57eef4ef0659193044870c731987a6df5cf56b' (2024-05-29)
  → 'github:NixOS/nixpkgs/e8057b67ebf307f01bdcc8fba94d94f75039d1f6' (2024-06-05)
2024-06-08 09:36:49 -04:00
Adam Stephens bbe240e612
jhovold: 6.10.0-rc1 -> 6.10.0-rc2 2024-06-08 09:27:27 -04:00
Adam Stephens ce01289423
add camera udev rule and modem symlink 2024-05-30 11:52:04 -04:00
Adam Stephens eb0287f9c0
jhovold: 6.9.0 -> 6.10.0-rc1 2024-05-30 11:33:49 -04:00
Adam Stephens 6a1f04ae97
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e' (2024-05-02)
  → 'github:hercules-ci/flake-parts/8dc45382d5206bd292f9c2768b8058a8fd8311d9' (2024-05-16)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/2057814051972fa1453ddfb0d98badbea9b83c06' (2024-05-12)
  → 'github:NixOS/nixpkgs/ad57eef4ef0659193044870c731987a6df5cf56b' (2024-05-29)
2024-05-30 11:31:17 -04:00
Adam Stephens 3a002c5a64
fix: pd-mapper can't read zstd firmware files
nixos unstable and 24.05 switched to zstd compression for firmware
files. Roll back to the previous setup of creating a package of the
qcom firmware uncompressed, and patching pd-mapper.

closes #14
2024-05-27 12:11:12 -04:00
Adam Stephens 3e183c4b98
fix: old kernels can't load dtb 2024-05-16 22:25:10 -04:00
Adam Stephens dc4fd98195
flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/25865a40d14b3f9cf19f19b924e2ab4069b09588' (2024-05-05)
  → 'github:NixOS/nixpkgs/2057814051972fa1453ddfb0d98badbea9b83c06' (2024-05-12)
2024-05-15 09:06:39 -04:00
12 changed files with 196 additions and 166 deletions

View file

@ -11,7 +11,7 @@ steps:
- name: build
image: bash
commands:
- nix develop .#ci -c just -- build
- tini -s nix -- develop .#ci -c just -- build
- name: upload
image: bash

View file

@ -1,5 +1,8 @@
# nixos x13s
> [!CAUTION]
> This project is unmaintained.
This repository aims to provide easy, shared, support for Lenovo X13s on Linux.
The support for this machine is constantly improving in mainline kernel and upstream packages. Eventually the goal is that this repository is no longer necessary.

View file

@ -5,11 +5,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1714641030,
"narHash": "sha256-yzcRNDoyVP7+SCNX0wmuDju1NUCt8Dz9+lyUXEI0dbI=",
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github"
},
"original": {
@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1714906307,
"narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=",
"lastModified": 1722062969,
"narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "25865a40d14b3f9cf19f19b924e2ab4069b09588",
"rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3",
"type": "github"
},
"original": {
@ -36,14 +36,14 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1714640452,
"narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=",
"lastModified": 1719876945,
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
}
},
"root": {

View file

@ -28,13 +28,14 @@
pkgs.cachix
pkgs.jq
pkgs.just
(pkgs.python3.withPackages (py: [
py.PyGithub
py.packaging
]))
pkgs.pyright
];
};
};
packages = {
iso = self.nixosConfigurations.iso.config.system.build.isoImage;
};
};
flake.nixosModules.default = import ./module.nix { inherit dtbName; };
@ -44,21 +45,19 @@
system = "aarch64-linux";
modules = [
self.nixosModules.default
{
nixos-x13s.enable = true;
nixos-x13s.kernel = "jhovold"; # jhovold is default, but mainline supported
(
{ config, pkgs, ... }:
{
nixos-x13s.enable = true;
nixos-x13s.kernel = "jhovold"; # jhovold is default, but mainline supported
# install multiple kernels! note this increases eval time for each specialization
# specialisation = {
# mainline.configuration.nixos-x13s.kernel = "mainline";
# };
# allow unfree firmware
nixpkgs.config.allowUnfree = true;
# allow unfree firmware
nixpkgs.config.allowUnfree = true;
# define your fileSystems
fileSystems."/".device = "/dev/notreal";
}
# define your fileSystems
fileSystems."/".device = "/dev/notreal";
}
)
];
};
@ -68,12 +67,45 @@
self.nixosModules.default
(
{ modulesPath, config, ... }:
{
modulesPath,
config,
lib,
pkgs,
...
}:
let
dtb = "${config.boot.kernelPackages.kernel}/dtbs/qcom/${dtbName}";
image = import "${inputs.nixpkgs}/nixos/lib/make-disk-image.nix" {
inherit config lib pkgs;
name = "nixos-x13s-bootstrap";
diskSize = "auto";
format = "raw";
partitionTableType = "efi";
copyChannel = false;
};
in
{
imports = [ "${toString modulesPath}/installer/cd-dvd/iso-image.nix" ];
hardware.deviceTree = {
enable = true;
name = "qcom/${dtbName}";
};
system.build.bootstrap-image = image;
boot = {
initrd = {
systemd.enable = true;
systemd.emergencyAccess = true;
};
loader = {
grub.enable = false;
systemd-boot.enable = true;
systemd-boot.graceful = true;
};
};
nixpkgs.config.allowUnfree = true;
@ -82,16 +114,16 @@
bluetoothMac = "02:68:b3:29:da:98";
};
isoImage = {
makeEfiBootable = true;
makeUsbBootable = true;
contents = [
{
source = dtb;
target = "/x13s.dtb";
}
];
fileSystems = {
"/boot" = {
fsType = "vfat";
device = "/dev/disk/by-label/ESP";
};
"/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
autoResize = true;
};
};
}
)

View file

@ -2,6 +2,7 @@
{
config,
lib,
options,
pkgs,
...
}:
@ -18,7 +19,22 @@ let
if cfg.kernel == "jhovold" then x13sPackages.linux_jhovold else throw "Unsupported kernel"
);
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}";
dtbEfiPath = "dtbs/${cfg.kernel}/${config.boot.kernelPackages.kernel.version}/${dtbName}";
dtbEfiPath = "dtbs/x13s.dtb";
modulesClosure = pkgs.makeModulesClosure {
rootModules = config.boot.initrd.availableKernelModules ++ config.boot.initrd.kernelModules;
kernel = config.system.modulesTree;
firmware = config.hardware.firmware;
allowMissing = false;
};
modulesWithExtra = pkgs.symlinkJoin {
name = "modules-closure";
paths = [
modulesClosure
x13sPackages.graphics-firmware
];
};
in
{
options.nixos-x13s = {
@ -40,21 +56,24 @@ in
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = false;
message = "adamcstephens/nixos-x13s is no longer maintained";
}
];
environment.systemPackages = [ pkgs.efibootmgr ];
hardware.enableAllFirmware = true;
hardware.firmware = [ x13sPackages."x13s/extra-firmware" ];
systemd.services.pd-mapper = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${lib.getExe x13sPackages.pd-mapper}";
Restart = "always";
};
};
hardware.firmware = lib.mkBefore [ x13sPackages.graphics-firmware ];
boot = {
initrd.systemd.enable = true;
initrd.systemd.contents = {
"/lib".source = lib.mkForce "${modulesWithExtra}/lib";
};
loader.efi.canTouchEfiVariables = true;
loader.systemd-boot.enable = lib.mkDefault true;
loader.systemd-boot.extraFiles = {
@ -71,11 +90,8 @@ in
"efi=noruntime"
"clk_ignore_unused"
"pd_ignore_unused"
"regulator_ignore_unused"
"arm64.nopauth"
# blacklist graphics in initrd so the firmware can load from disk
"rd.driver.blacklist=msm"
# "regulator_ignore_unused" # allows for > 30 sec to load msm, at the potential cost of power
];
initrd = {
@ -99,11 +115,19 @@ in
"dispcc_sc8280xp"
"phy_qcom_edp"
"panel-edp"
# "msm"
"msm"
];
};
};
# https://github.com/jhovold/linux/wiki/X13s#modem
networking.networkmanager.fccUnlockScripts = [
{
id = "105b:e0c3";
path = "${pkgs.modemmanager}/share/ModemManager/fcc-unlock.available.d/105b";
}
];
nixpkgs.overlays = [
(_: super: {
# don't try and use zfs
@ -119,6 +143,12 @@ in
# default is performance
powerManagement.cpuFreqGovernor = "ondemand";
# https://github.com/jhovold/linux/wiki/X13s#camera
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="dma_heap", KERNEL=="linux,cma", GROUP="video", MODE="0660"
ACTION=="add", SUBSYSTEM=="dma_heap", KERNEL=="system", GROUP="video", MODE="0660"
'';
systemd.services.bluetooth-x13s-mac = {
wantedBy = [ "multi-user.target" ];
before = [ "bluetooth.service" ];

View file

@ -7,10 +7,10 @@
"owner": "jhovold",
"repo": "linux"
},
"branch": "wip/sc8280xp-6.9",
"revision": "357c0f0c7ad2d7d95a3200b6cfd7bef43299de04",
"url": "https://github.com/jhovold/linux/archive/357c0f0c7ad2d7d95a3200b6cfd7bef43299de04.tar.gz",
"hash": "1n6cv149rafgk7wkb8cjixy6car4zq0dhhz39b7gjnzr599mqwxn"
"branch": "wip/sc8280xp-6.11-rc1",
"revision": "9c6b81022b9c277d65c68e25f4cfd52f33ef8f28",
"url": "https://github.com/jhovold/linux/archive/9c6b81022b9c277d65c68e25f4cfd52f33ef8f28.tar.gz",
"hash": "13c6r67iy8y750f8zpals4l941lshxx3w3ar1ss9dizsqjsghdsr"
}
},
"version": 3

View file

@ -14,17 +14,23 @@ let
}
);
in
rec {
linux_jhovold = linux_jhovold_6_9;
linux_jhovold_6_9 = pkgs.callPackage linux_x13s_pkg {
{
linux_jhovold = pkgs.callPackage linux_x13s_pkg {
src = sources.linux-jhovold;
version = "6.9.0";
version = "6.11.0-rc1";
defconfig = "johan_defconfig";
};
pd-mapper = pkgs.callPackage ./pd-mapper { inherit qrtr; };
qrtr = pkgs.callPackage ./qrtr { };
"x13s/extra-firmware" = pkgs.callPackage ./extra-firmware.nix { };
graphics-firmware =
let
gpu-src = pkgs.fetchurl {
url = "https://download.lenovo.com/pccbbs/mobiles/n3hdr20w.exe";
hash = "sha256-Jwyl9uKOnjpwfHd+VaGHjYs9x8cUuRdFCERuXqaJwEY=";
};
in
pkgs.runCommand "graphics-firmware" { } ''
mkdir -vp "$out/lib/firmware/qcom/sc8280xp/LENOVO/21BX"
${lib.getExe pkgs.innoextract} ${gpu-src}
cp -v code\$GetExtractPath\$/*/*.mbn "$out/lib/firmware/qcom/sc8280xp/LENOVO/21BX/"
'';
}

View file

@ -1,21 +0,0 @@
{ stdenvNoCC, fetchFromGitHub }:
stdenvNoCC.mkDerivation {
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/
'';
}

View file

@ -1,36 +0,0 @@
{
stdenv,
lib,
fetchFromGitHub,
qrtr,
xz,
}:
stdenv.mkDerivation {
pname = "pd-mapper";
version = "unstable-2023-09-01";
buildInputs = [
qrtr
xz
];
src = fetchFromGitHub {
owner = "andersson";
repo = "pd-mapper";
rev = "10997ba7c43a3787a40b6b1b161408033e716374";
hash = "sha256-qGrYNoPCxtdpTdbkSmB39+6/pSXml96Aul8b9opF9Lc=";
};
patches = [ ./pd-mapper-firmware-path.diff ];
installFlags = [ "prefix=$(out)" ];
meta = with lib; {
description = "Qualcomm PD mapper";
homepage = "https://github.com/andersson/pd-mapper";
license = licenses.bsd3;
mainProgram = "pd-mapper";
platforms = platforms.aarch64;
};
}

View file

@ -1,13 +0,0 @@
diff --git a/pd-mapper.c b/pd-mapper.c
index 65c4b80..669d9a0 100644
--- a/pd-mapper.c
+++ b/pd-mapper.c
@@ -194,7 +194,7 @@ static int pd_load_map(const char *file)
}
#ifndef ANDROID
-#define FIRMWARE_BASE "/lib/firmware/"
+#define FIRMWARE_BASE "/run/current-system/firmware/"
#else
#define FIRMWARE_BASE "/vendor/firmware/"
#endif

View file

@ -1,26 +0,0 @@
{
stdenv,
lib,
fetchFromGitHub,
}:
stdenv.mkDerivation {
pname = "qrtr";
version = "unstable-2023-01-17";
src = fetchFromGitHub {
owner = "andersson";
repo = "qrtr";
rev = "d0d471c96e7d112fac6f48bd11f9e8ce209c04d2";
hash = "sha256-KF0gCBRw3BDJdK1s+dYhHkokVTHwRFO58ho0IwHPehc=";
};
installFlags = [ "prefix=$(out)" ];
meta = with lib; {
description = "QMI IDL compiler";
homepage = "https://github.com/andersson/qrtr";
license = licenses.bsd3;
platforms = platforms.aarch64;
};
}

55
update.py Executable file
View file

@ -0,0 +1,55 @@
#!/usr/bin/env python3
from github import Github
import sys
import re
from packaging.version import Version
from subprocess import run
latest_version: str = "0"
latest_branch: str = ""
previous_version: str = ""
with Github() as gh:
for branch in gh.get_user("jhovold").get_repo("linux").get_branches():
v = re.match("wip/sc8280xp-((v?6.[0-9]+)(-rc[0-9]+)?)", branch.name)
if v != None and Version(v.group(1)) > Version(latest_version):
# add .0 to version
latest_version = f"{v.group(2)}.0{v.group(3) or ''}"
latest_branch = v.group(0)
print("branch: " + latest_branch)
print("latest: " + latest_version)
with open("packages/default.nix", "r") as f:
lines = f.readlines()
for line in lines:
v = re.match(r'^\s*version = "(6[.0-9-rc]+)";.*$', line)
if v != None:
previous_version = v.group(1)
print("previous: " + previous_version)
if previous_version == latest_version:
print("No update found, exiting.")
sys.exit(1)
with open("packages/default.nix", "w") as f:
for line in lines:
f.write(
re.sub(
r'^(\s*version = ")6[.0-9-rc]+(";.*$)',
rf"\g<1>{latest_version}\2",
line,
)
)
run(
f"npins add --name linux-jhovold github --branch {latest_branch} jhovold linux".split(
" "
)
)
run("git add npins/ packages/default.nix".split(" "))
run(["git", "commit", "-m", f"jhovold: {previous_version} -> {latest_version}"])