Merge pull request 'main' (#1) from adamcstephens/nixos-x13s:main into main

Reviewed-on: https://codeberg.org/mart-w/nixos-x13s/pulls/1
This commit is contained in:
Martin Wurm 2024-06-26 09:20:29 +00:00
commit 757ba49d65
9 changed files with 128 additions and 22 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

@ -5,11 +5,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1714641030,
"narHash": "sha256-yzcRNDoyVP7+SCNX0wmuDju1NUCt8Dz9+lyUXEI0dbI=",
"lastModified": 1717285511,
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e",
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
"type": "github"
},
"original": {
@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1715534503,
"narHash": "sha256-5ZSVkFadZbFP1THataCaSf0JH2cAH3S29hU9rrxTEqk=",
"lastModified": 1719254875,
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2057814051972fa1453ddfb0d98badbea9b83c06",
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
"type": "github"
},
"original": {
@ -36,14 +36,14 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1714640452,
"narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=",
"lastModified": 1717284937,
"narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
}
},
"root": {

View file

@ -28,6 +28,11 @@
pkgs.cachix
pkgs.jq
pkgs.just
(pkgs.python3.withPackages (py: [
py.PyGithub
py.packaging
]))
pkgs.pyright
];
};
};

View file

@ -2,6 +2,7 @@
{
config,
lib,
options,
pkgs,
...
}:
@ -40,7 +41,14 @@ in
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.efibootmgr ];
environment.systemPackages = [
pkgs.efibootmgr
(x13sPackages.uncompressed-firmware.override {
firmwareFilesList = lib.flatten options.hardware.firmware.definitions;
})
];
environment.pathsToLink = [ "/share/uncompressed-firmware" ];
hardware.enableAllFirmware = true;
hardware.firmware = [ x13sPackages."x13s/extra-firmware" ];
@ -104,6 +112,14 @@ in
};
};
# 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 +135,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.10-rc5",
"revision": "fb34a1d838d061d9e2199656b832bb2ebc2dc5e3",
"url": "https://github.com/jhovold/linux/archive/fb34a1d838d061d9e2199656b832bb2ebc2dc5e3.tar.gz",
"hash": "07gsf26954qi9lspbzlc4xsan4vbiyzbfnpwbwyaxcqfibzfg6vg"
}
},
"version": 3

View file

@ -15,11 +15,9 @@ 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.10.0-rc5";
defconfig = "johan_defconfig";
};
@ -27,4 +25,6 @@ rec {
qrtr = pkgs.callPackage ./qrtr { };
"x13s/extra-firmware" = pkgs.callPackage ./extra-firmware.nix { };
uncompressed-firmware = pkgs.callPackage ./uncompressed-firmware.nix { };
}

View file

@ -4,10 +4,10 @@ index 65c4b80..669d9a0 100644
+++ 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/"
+#define FIRMWARE_BASE "/run/current-system/sw/share/uncompressed-firmware/"
#else
#define FIRMWARE_BASE "/vendor/firmware/"
#endif

View file

@ -0,0 +1,24 @@
{
runCommand,
buildEnv,
firmwareFilesList ? [ ],
}:
runCommand "qcom-modem-uncompressed-firmware-share"
{
firmwareFiles = buildEnv {
name = "qcom-modem-uncompressed-firmware";
paths = firmwareFilesList;
pathsToLink = [
"/lib/firmware/rmtfs"
"/lib/firmware/qcom"
];
};
}
''
PS4=" $ "
(
set -x
mkdir -p $out/share/
ln -s $firmwareFiles/lib/firmware/ $out/share/uncompressed-firmware
)
''

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}"])