Compare commits

..

No commits in common. "main" and "bump" have entirely different histories.
main ... bump

18 changed files with 265 additions and 459 deletions

View file

@ -0,0 +1,37 @@
on:
pull_request:
push:
jobs:
kernel:
runs-on: local/aarch64-linux
steps:
- uses: actions/checkout@v4
- name: set home
run: |
echo "HOME=$PWD" >> "$GITHUB_ENV"
- name: build all
run: |
OUTPUT=$(nix build --print-out-paths .#x13s/linux .#x13s/alsa-ucm-conf .#pd-mapper .#x13s/extra-firmware)
echo $OUTPUT
echo "$OUTPUT" > build.out
- name: upload to cachix
run: |
cachix push nixos-x13s $(cat build.out)
env:
CACHIX_AUTH_TOKEN: '${{ secrets.CACHIX_TOKEN_X13S }}'
- name: upload to attic
run: |
attic login --set-default $ATTIC_CACHE $ATTIC_ENDPOINT $ATTIC_TOKEN
attic use $ATTIC_CACHE
attic push $ATTIC_CACHE $(cat build.out)
env:
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
ATTIC_CACHE: ${{ vars.ATTIC_CACHE }}
ATTIC_TOKEN: ${{ secrets.ATTIC_KEY }}

1
.gitignore vendored
View file

@ -1,2 +1 @@
.secret.envrc .secret.envrc
result

View file

@ -1,25 +0,0 @@
labels:
type: local
system: aarch64-linux
steps:
- name: find-targets
image: bash
commands:
- nix develop .#ci -c just -- find-targets
- name: build
image: bash
commands:
- tini -s nix -- develop .#ci -c just -- build
- name: upload
image: bash
commands:
- nix develop .#ci -c just -- push
environment:
CACHIX_AUTH_TOKEN:
from_secret: CACHIX_AUTH_TOKEN
when:
- event: push

View file

@ -1,8 +1,5 @@
# nixos x13s # nixos x13s
> [!CAUTION]
> This project is unmaintained.
This repository aims to provide easy, shared, support for Lenovo X13s on Linux. 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. 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.
@ -13,20 +10,7 @@ A binary cache is provided through Cachix so you can avoid re-building the kerne
https://app.cachix.org/cache/nixos-x13s https://app.cachix.org/cache/nixos-x13s
Ensure you are not overriding the nixpkgs input when consuming this flake, or you may not be able to take advantages of this cache. Ensure you are not overriding the nixpkgs input when consuming this flake, or you may not be able to take advantags of this cache.
NixOS configuration example:
```nix
nix.settings = {
substituters = [
"https://nixos-x13s.cachix.org"
];
trusted-public-keys = [
"nixos-x13s.cachix.org-1:SzroHbidolBD3Sf6UusXp12YZ+a5ynWv0RtYF0btFos="
];
};
```
## Add with a flake ## Add with a flake
@ -46,13 +30,6 @@ NixOS configuration example:
inputs.nixos-x13s.nixosModules.default inputs.nixos-x13s.nixosModules.default
{ {
nixos-x13s.enable = true; 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 = {
# note that activation of each specialization is required to copy the dtb to the EFI, and thus boot
mainline.configuration.nixos-x13s.kernel = "mainline";
};
# allow unfree firmware # allow unfree firmware
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
@ -68,31 +45,4 @@ NixOS configuration example:
## Add using not a flake ## Add using not a flake
Clone the repository: Not documented, but feel free to submit a PR.
```
git clone https://codeberg.org/adamcstephens/nixos-x13s /etc/nixos/nixos-x13s
```
Then reference the module in your `configuration.nix` and use the module as documented in the flake example above:
```nix
imports =
[
./nixos-x13s/module.nix
];
nixos-x13s.enable = true;
...
```
## UEFI Update ISO
This repository provides a package which can output the USB UEFI Update ISO. This will be updated as Lenovo releases new versions.
```
nix build .#uefi-usbiso
dd if=result/usbdisk-*.iso of=/path/to/usb/disk
```
Reboot, select USB drive from F12 boot menu, follow wizard.

View file

@ -5,11 +5,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1719994518, "lastModified": 1706830856,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1722062969, "lastModified": 1707689078,
"narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=", "narHash": "sha256-UUGmRa84ZJHpGZ1WZEBEUOzaPOWG8LZ0yPg1pdDF/yM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3", "rev": "f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -36,14 +36,20 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1719876945, "dir": "lib",
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", "lastModified": 1706550542,
"type": "tarball", "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" "owner": "NixOS",
"repo": "nixpkgs",
"rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
"type": "github"
}, },
"original": { "original": {
"type": "tarball", "dir": "lib",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" "owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
} }
}, },
"root": { "root": {

115
flake.nix
View file

@ -5,10 +5,7 @@
}; };
outputs = outputs =
inputs@{ flake-parts, self, ... }: inputs@{ flake-parts, ... }:
let
dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb";
in
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ ./packages/part.nix ]; imports = [ ./packages/part.nix ];
@ -20,115 +17,9 @@
perSystem = perSystem =
{ pkgs, ... }: { pkgs, ... }:
{ {
devShells = rec { devShells.default = pkgs.mkShellNoCC { packages = [ pkgs.npins ]; };
default = pkgs.mkShellNoCC { packages = [ pkgs.npins ] ++ ci.nativeBuildInputs; };
ci = pkgs.mkShellNoCC {
packages = [
pkgs.cachix
pkgs.jq
pkgs.just
(pkgs.python3.withPackages (py: [
py.PyGithub
py.packaging
]))
pkgs.pyright
];
};
};
}; };
flake.nixosModules.default = import ./module.nix { inherit dtbName; }; flake.nixosModules.default = import ./module.nix;
flake.nixosConfigurations = {
example = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
self.nixosModules.default
(
{ config, pkgs, ... }:
{
nixos-x13s.enable = true;
nixos-x13s.kernel = "jhovold"; # jhovold is default, but mainline supported
# allow unfree firmware
nixpkgs.config.allowUnfree = true;
# define your fileSystems
fileSystems."/".device = "/dev/notreal";
}
)
];
};
iso = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
self.nixosModules.default
(
{
modulesPath,
config,
lib,
pkgs,
...
}:
let
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
{
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;
nixos-x13s = {
enable = true;
bluetoothMac = "02:68:b3:29:da:98";
};
fileSystems = {
"/boot" = {
fsType = "vfat";
device = "/dev/disk/by-label/ESP";
};
"/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
autoResize = true;
};
};
}
)
];
};
};
}; };
} }

View file

@ -1,12 +0,0 @@
all:
just -l
find-targets:
nix eval .#packages.aarch64-linux --apply 'builtins.attrNames' --json | jq '. | map(".#" + .) | join(" ")' -r > targets
build:
nix build --print-out-paths --keep-going $(cat targets) > outputs
cat outputs
push:
cachix -- push nixos-x13s $(cat outputs)

View file

@ -1,8 +1,6 @@
{ dtbName }:
{ {
config, config,
lib, lib,
options,
pkgs, pkgs,
... ...
}: }:
@ -11,30 +9,11 @@ let
x13sPackages = import ./packages/default.nix { inherit lib pkgs; }; x13sPackages = import ./packages/default.nix { inherit lib pkgs; };
linuxPackages_x13s = dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb";
if cfg.kernel == "mainline" then linuxPackages_x13s = pkgs.linuxPackagesFor x13sPackages."x13s/linux";
pkgs.linuxPackages_latest
else
pkgs.linuxPackagesFor (
if cfg.kernel == "jhovold" then x13sPackages.linux_jhovold else throw "Unsupported kernel"
);
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}"; dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}";
dtbEfiPath = "dtbs/x13s.dtb";
modulesClosure = pkgs.makeModulesClosure { alsa-ucm-conf-env.ALSA_CONFIG_UCM2 = "${x13sPackages."x13s/alsa-ucm-conf"}/share/alsa/ucm2";
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 in
{ {
options.nixos-x13s = { options.nixos-x13s = {
@ -42,56 +21,50 @@ in
bluetoothMac = lib.mkOption { bluetoothMac = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "Bluetooth MAC address to set on boot"; description = "mac address to set on boot";
};
kernel = lib.mkOption {
type = lib.types.enum [
"jhovold"
"mainline"
];
description = "Which patched kernel to use. jhovold is the latest RC or release with some x13s specific patches, and mainline is nixos latest";
default = "jhovold";
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [
{
assertion = false;
message = "adamcstephens/nixos-x13s is no longer maintained";
}
];
environment.systemPackages = [ pkgs.efibootmgr ]; environment.systemPackages = [ pkgs.efibootmgr ];
hardware.enableAllFirmware = true; hardware.enableAllFirmware = true;
hardware.firmware = lib.mkBefore [ x13sPackages.graphics-firmware ]; hardware.firmware = [ x13sPackages."x13s/extra-firmware" ];
systemd.services.pd-mapper = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${lib.getExe x13sPackages.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;
boot = { boot = {
initrd.systemd.enable = true;
initrd.systemd.contents = {
"/lib".source = lib.mkForce "${modulesWithExtra}/lib";
};
loader.efi.canTouchEfiVariables = true; loader.efi.canTouchEfiVariables = true;
loader.systemd-boot.enable = lib.mkDefault true; loader.systemd-boot.enable = lib.mkDefault true;
loader.systemd-boot.extraFiles = { loader.systemd-boot.extraFiles = {
"${dtbEfiPath}" = dtb; "${dtbName}" = dtb;
}; };
kernelPackages = linuxPackages_x13s; kernelPackages = linuxPackages_x13s;
kernelParams = [ kernelParams = [
# needed to boot # needed to boot
"dtb=${dtbEfiPath}" "dtb=${dtbName}"
# jhovold recommended # jhovold recommended
"efi=noruntime" "efi=noruntime"
"clk_ignore_unused" "clk_ignore_unused"
"pd_ignore_unused" "pd_ignore_unused"
"arm64.nopauth" "arm64.nopauth"
# "regulator_ignore_unused" # allows for > 30 sec to load msm, at the potential cost of power
# blacklist graphics in initrd so the firmware can load from disk
"rd.driver.blacklist=msm"
]; ];
initrd = { initrd = {
@ -115,25 +88,34 @@ in
"dispcc_sc8280xp" "dispcc_sc8280xp"
"phy_qcom_edp" "phy_qcom_edp"
"panel-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 = [ nixpkgs.overlays = [
(_: super: { (_: super: {
linux-firmware =
let
source = {
revision = "5217b76bed90ae86d5f3fe9a5f4e2301868cdd02";
sourceHash = "sha256-Te5AioCoN2LuUwxuxjoarpihaZQ1uO/FRfVrkNVGwEQ=";
outputHash = "sha256-F1f4gcGU3ATnDEFoHipS25qqBD8XsKfrCDzaFbNWgXI=";
};
in
super.linux-firmware.overrideAttrs (
_: {
version = "20240205-unstable";
src = pkgs.fetchzip {
url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-${source.revision}.tar.gz";
hash = source.sourceHash;
};
outputHash = source.outputHash;
}
);
# don't try and use zfs # don't try and use zfs
zfs = super.zfs.overrideAttrs (_: { zfs = super.zfs.overrideAttrs (_: { meta.platforms = [ ]; });
meta.platforms = [ ];
});
# allow missing modules # allow missing modules
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; }); makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
@ -143,21 +125,17 @@ in
# default is performance # default is performance
powerManagement.cpuFreqGovernor = "ondemand"; powerManagement.cpuFreqGovernor = "ondemand";
# https://github.com/jhovold/linux/wiki/X13s#camera systemd.services.bluetooth = {
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" ];
requiredBy = [ "bluetooth.service" ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; # disabled because btmgmt call hangs
RemainAfterExit = true; # ExecStartPre = [
ExecStart = "${pkgs.util-linux}/bin/script -q -c '${pkgs.bluez}/bin/btmgmt --index 0 public-addr ${cfg.bluetoothMac}'"; # ""
# "${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";
}; };
}; };
}; };

View file

@ -1,16 +1,30 @@
{ {
"pins": { "pins": {
"linux-jhovold": { "alsa-ucm-conf": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "alsa-project",
"repo": "alsa-ucm-conf"
},
"pre_releases": false,
"version_upper_bound": null,
"version": "v1.2.11",
"revision": "c40b8cc795c8fe4c83582857d5e317f18a4c065e",
"url": "https://api.github.com/repos/alsa-project/alsa-ucm-conf/tarball/v1.2.11",
"hash": "1jcn0x6bbg69p1ygxnh1zn33sd9lpbll4bnhvkzw1fjpmw7igjkz"
},
"linux": {
"type": "Git", "type": "Git",
"repository": { "repository": {
"type": "GitHub", "type": "GitHub",
"owner": "jhovold", "owner": "jhovold",
"repo": "linux" "repo": "linux"
}, },
"branch": "wip/sc8280xp-6.11-rc1", "branch": "wip/sc8280xp-v6.8-rc4",
"revision": "9c6b81022b9c277d65c68e25f4cfd52f33ef8f28", "revision": "e6afa0380b4915646a07306d706f6337f40fef90",
"url": "https://github.com/jhovold/linux/archive/9c6b81022b9c277d65c68e25f4cfd52f33ef8f28.tar.gz", "url": "https://github.com/jhovold/linux/archive/e6afa0380b4915646a07306d706f6337f40fef90.tar.gz",
"hash": "13c6r67iy8y750f8zpals4l941lshxx3w3ar1ss9dizsqjsghdsr" "hash": "0jb546y44pjgs2g9mv8074gmffw9r42p13zvnn9va5qmzjr6ahk1"
} }
}, },
"version": 3 "version": 3

View file

@ -3,34 +3,49 @@ let
sources = import ../npins; sources = import ../npins;
linux_x13s_pkg = linux_x13s_pkg =
{ version, buildLinux, ... }@args: { buildLinux, ... }@args:
let
version = "6.8.0-rc4";
modDirVersion = "${version}";
in
buildLinux ( buildLinux (
args args
// { // {
modDirVersion = version; inherit version modDirVersion;
kernelPatches = (args.kernelPatches or [ ]) ++ [ ]; src = sources.linux;
kernelPatches = (args.kernelPatches or [ ]) ++ [
{
# fix resets when reading EFI vars
name = "qcom-shm-bridge-tz";
patch = (
pkgs.fetchurl {
url = "https://lore.kernel.org/lkml/20240205182810.58382-1-brgl@bgdev.pl/t.mbox.gz";
hash = "sha256-apwfO/bhVd8jzsHpOPFQXshzdwfg5Zcelf2vCDtlCtI=";
}
);
extraStructuredConfig = {
QCOM_TZMEM_MODE_SHMBRIDGE = lib.kernel.yes;
};
}
];
extraMeta.branch = lib.versions.majorMinor version; extraMeta.branch = lib.versions.majorMinor version;
} }
); );
in in
{ rec {
linux_jhovold = pkgs.callPackage linux_x13s_pkg { "x13s/linux" = pkgs.callPackage linux_x13s_pkg { defconfig = "johan_defconfig"; };
src = sources.linux-jhovold; "x13s/alsa-ucm-conf" = pkgs.alsa-ucm-conf.overrideAttrs (
version = "6.11.0-rc1"; _: {
defconfig = "johan_defconfig"; version = sources.alsa-ucm-conf.version;
}; src = sources.alsa-ucm-conf;
patches = [ ];
}
);
graphics-firmware = pd-mapper = pkgs.callPackage ./pd-mapper { inherit qrtr; };
let qrtr = pkgs.callPackage ./qrtr { };
gpu-src = pkgs.fetchurl {
url = "https://download.lenovo.com/pccbbs/mobiles/n3hdr20w.exe"; "x13s/extra-firmware" = pkgs.callPackage ./extra-firmware.nix { };
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

@ -0,0 +1,21 @@
{ 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,14 +1,5 @@
{ lib, withSystem, ... }: { lib, withSystem, ... }:
{ {
perSystem =
{ pkgs, ... }:
{
packages = rec {
uefi = pkgs.callPackage ./uefi.nix { };
uefi-usbiso = pkgs.callPackage ./uefi-usbiso.nix { inherit uefi; };
};
};
flake.packages.aarch64-linux = withSystem "aarch64-linux" ( flake.packages.aarch64-linux = withSystem "aarch64-linux" (
{ pkgs, ... }: import ./default.nix { inherit lib pkgs; } { pkgs, ... }: import ./default.nix { inherit lib pkgs; }
); );

View file

@ -0,0 +1,36 @@
{
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

@ -0,0 +1,13 @@
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

26
packages/qrtr/default.nix Normal file
View file

@ -0,0 +1,26 @@
{
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;
};
}

View file

@ -1,50 +0,0 @@
{
stdenv,
parted,
util-linux,
dosfstools,
mtools,
uefi,
}:
stdenv.mkDerivation rec {
name = "usbdisk";
version = uefi.version;
src = ./.;
nativeBuildInputs = [
parted
util-linux
dosfstools
mtools
];
doUnpack = false;
buildPhase = ''
img=${name}-${version}.iso
gap=8
blocks=$(du -B 512 --summarize --apparent-size ${uefi} | awk '{ print $1 }')
blocks=$(( 2 * blocks ))
size=$(( 512 * blocks + gap * 1024 * 1024 + 34*512))
truncate -s $size $img
sfdisk $img <<EOF
label: gpt
start=''${gap}M, size=$blocks, type=uefi
EOF
eval $(partx $img -o START,SECTORS --nr 1 --pairs)
truncate -s $(( SECTORS * 512 )) part.img
mkfs.vfat part.img
mcopy -spvm -i ./part.img ${uefi}/EFI "::/EFI"
mcopy -spvm -i ./part.img ${uefi}/Flash "::/Flash"
dd conv=notrunc if=part.img of=$img seek=$START count=$SECTORS
rm -fr part.img
'';
installPhase = ''
mkdir $out
mv ${name}-${version}.iso $out/
'';
}

View file

@ -1,29 +0,0 @@
{
stdenv,
fetchurl,
innoextract,
}:
stdenv.mkDerivation {
name = "uefi";
version = "1.60";
src = fetchurl {
url = "https://download.lenovo.com/pccbbs/mobiles/n3huj19w.exe";
hash = "sha256-ZSjkvbMb0e9CoL2OYo3Aioyz3or1YkOX/BdOOeAuL7I=";
};
nativeBuildInputs = [ innoextract ];
unpackPhase = ''
innoextract $src
'';
doBuild = false;
installPhase = ''
mkdir --parent $out/{EFI/Boot,Flash}
cp code\$GetExtractPath\$/Rfs/Usb/Bootaa64.efi $out/EFI/Boot/
cp -r code\$GetExtractPath\$/Rfs/Fw/* $out/Flash/
'';
}

View file

@ -1,55 +0,0 @@
#!/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}"])