Compare commits

..

80 commits
bump ... 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
Adam Stephens 87a35b80a6
fix bluetooth mac service 2024-05-15 00:03:41 -04:00
Adam Stephens 39105d4fa7
fix iso building 2024-05-14 16:25:22 -04:00
Adam Stephens e2ed1ccd08
forgejo -> woodpecker 2024-05-14 16:23:18 -04:00
Adam Stephens ebffb583a3
add ci devshell 2024-05-14 16:13:54 -04:00
Adam Stephens 33327a5708
jhovold: 6.9.0-rc7 -> 6.9.0 2024-05-14 15:58:28 -04:00
Adam Stephens 9f5d708f1a
add bluetooth mac service 2024-05-14 15:33:45 -04:00
Adam Stephens e0cc11fd56
use jhovold for iso 2024-05-14 15:33:31 -04:00
Daniel Barter dec99e46ed
- adding an iso package to the flake
- floating dtbName up into the flake so it can be referenced
  by the module and the iso
- linting with nixfmt-rfc-style
2024-05-12 23:24:31 -04:00
Adam Stephens 8e01e9917f
jhovold: 6.9.0-rc6 -> 6.9.0-rc7 2024-05-06 11:31:18 -04:00
Adam Stephens 0579c5474a
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/9126214d0a59633752a136528f5f3b9aa8565b7d?narHash=sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm%2BGpZNw%3D' (2024-04-01)
  → 'github:hercules-ci/flake-parts/e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e?narHash=sha256-yzcRNDoyVP7%2BSCNX0wmuDju1NUCt8Dz9%2BlyUXEI0dbI%3D' (2024-05-02)
• Updated input 'flake-parts/nixpkgs-lib':
    'github:NixOS/nixpkgs/d8fe5e6c92d0d190646fb9f1056741a229980089?dir=lib&narHash=sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk%3D' (2024-03-29)
  → '50eb7ecf4c.tar.gz?narHash=sha256-QBx10%2Bk6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94%3D' (2024-05-02)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/58a1abdbae3217ca6b702f03d3b35125d88a2994?narHash=sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc%3D' (2024-04-27)
  → 'github:NixOS/nixpkgs/25865a40d14b3f9cf19f19b924e2ab4069b09588?narHash=sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0%3D' (2024-05-05)
2024-05-06 11:23:15 -04:00
Adam Stephens 735b1307eb
comment out specialisation to show it's not actually required 2024-05-04 15:52:44 -04:00
Adam Stephens 0e16eff1db
document usb iso 2024-05-01 11:17:21 -04:00
Adam Stephens 0650514998
add uefi package and iso builder
thanks to https://github.com/martiert/x13s-bios
2024-05-01 10:08:29 -04:00
Adam Stephens 3fa14acfdd
jhovold: 6.9.0-rc5 -> 6.9.0-rc6 2024-04-29 11:03:55 -04:00
Adam Stephens 1ba6bb964b
flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/6143fc5eeb9c4f00163267708e26191d1e918932' (2024-04-21)
  → 'github:NixOS/nixpkgs/58a1abdbae3217ca6b702f03d3b35125d88a2994' (2024-04-27)
2024-04-29 07:43:02 -04:00
Adam Stephens 75542063f3
jhovold: 6.9.0-rc4 -> 6.9.0-rc5 2024-04-22 07:56:40 -04:00
Adam Stephens f1c48e949e
flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/cfd6b5fc90b15709b780a5a1619695a88505a176' (2024-04-12)
  → 'github:NixOS/nixpkgs/6143fc5eeb9c4f00163267708e26191d1e918932' (2024-04-21)
2024-04-22 07:42:23 -04:00
Adam Stephens 6906045816
jhovold: 6.9.0-rc2 -> 6.9.0-rc4 2024-04-15 11:01:04 -04:00
Spencer Heywood ae0a500435
added non-flake example, and binary cache example 2024-04-15 10:59:09 -04:00
Adam Stephens 6a4c0e0913
flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/d8fe5e6c92d0d190646fb9f1056741a229980089' (2024-03-29)
  → 'github:NixOS/nixpkgs/cfd6b5fc90b15709b780a5a1619695a88505a176' (2024-04-12)
2024-04-15 10:57:48 -04:00
Adam Stephens 4c5a5bf78c
jhovold: 6.9.0-rc1 -> 6.9.0-rc2 2024-04-02 11:57:32 -04:00
Adam Stephens 842b0f524f
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2' (2024-03-01)
  → 'github:hercules-ci/flake-parts/9126214d0a59633752a136528f5f3b9aa8565b7d' (2024-04-01)
• Updated input 'flake-parts/nixpkgs-lib':
    'github:NixOS/nixpkgs/1536926ef5621b09bba54035ae2bb6d806d72ac8?dir=lib' (2024-02-29)
  → 'github:NixOS/nixpkgs/d8fe5e6c92d0d190646fb9f1056741a229980089?dir=lib' (2024-03-29)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/c75037bbf9093a2acb617804ee46320d6d1fea5a' (2024-03-16)
  → 'github:NixOS/nixpkgs/d8fe5e6c92d0d190646fb9f1056741a229980089' (2024-03-29)
2024-04-02 11:54:22 -04:00
Adam Stephens 49425949b0
cleanup unused sources 2024-03-26 20:33:43 -04:00
Adam Stephens 4555a9c05b
jhovold: 6.8.0 -> 6.9.0-rc1 2024-03-25 12:07:59 -04:00
Adam Stephens ee7b43ab91
drop steev completely 2024-03-19 10:18:36 -04:00
Adam Stephens f32f7cee7e
drop jhovold 6.7, fix steev 6.8 2024-03-19 09:16:26 -04:00
Adam Stephens 3caedab939
bump steev 6.8 2024-03-19 08:58:10 -04:00
Adam Stephens 1cf7ff1e98
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/b253292d9c0a5ead9bc98c4e9a26c6312e27d69f' (2024-02-01)
  → 'github:hercules-ci/flake-parts/f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2' (2024-03-01)
• Updated input 'flake-parts/nixpkgs-lib':
    'github:NixOS/nixpkgs/97b17f32362e475016f942bbdfda4a4a72a8a652?dir=lib' (2024-01-29)
  → 'github:NixOS/nixpkgs/1536926ef5621b09bba54035ae2bb6d806d72ac8?dir=lib' (2024-02-29)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8' (2024-02-11)
  → 'github:NixOS/nixpkgs/c75037bbf9093a2acb617804ee46320d6d1fea5a' (2024-03-16)
2024-03-19 08:51:49 -04:00
Adam Stephens c7bc267ff0
bump jhovold 6.8 2024-03-18 12:34:48 -04:00
Adam Stephens 154322b7d8
add note about activating multi-dtbs 2024-03-11 14:13:34 -04:00
Adam Stephens c194c94c16
jhovold: 6.8.0-rc7 -> 6.8.0 2024-03-11 13:08:19 -04:00
Adam Stephens bebc446709
add multi-dtb support, so we can actually test multiple kernels 2024-03-07 11:19:25 -05:00
Adam Stephens 4d55c26648
fix versions 2024-03-05 10:16:28 -05:00
Adam Stephens 77678eec48
linux-steev: 6.7.5 -> 6.7.7 2024-03-04 15:59:04 -05:00
Adam Stephens a01539f76d
linux-jhovold: 6.8.0-rc6 -> 6.8.0-rc7 2024-03-04 15:56:27 -05:00
Adam Stephens 9de88c1a96
linux-firmware: fixes in 20240220 which is in nixpkgs 2024-02-28 11:46:23 -05:00
Adam Stephens 8bc8de7068
alsa-ucm-conf: fixes in 1.2.11 which is in nixpkgs 2024-02-28 11:45:37 -05:00
Adam Stephens d51db7b3b4
linux-jhovold: 6.8.0-rc5 -> 6.8.0-rc6 2024-02-28 11:43:28 -05:00
Adam Stephens 1b2d40b8ca
build all packages 2024-02-26 10:11:29 -05:00
Stefan Junker 4a423f366d feat(kernel): add jhovold_6_7 variant 2024-02-25 11:30:25 +01:00
Adam Stephens adf1dd9e91
add example nios configurations 2024-02-20 14:06:40 -05:00
Adam Stephens 0653faf396
stop pushing to attic 2024-02-20 14:04:31 -05:00
Adam Stephens 86eeb6c1b9
don't quite building if one package fails 2024-02-20 10:27:39 -05:00
Adam Stephens 579b5bcca7
fix steev building 2024-02-20 10:25:09 -05:00
Adam Stephens 484e22bf03
fix mainline kernel 2024-02-20 08:55:19 -05:00
Adam Stephens 5a4384c71b
enable kernel selection support 2024-02-20 08:46:25 -05:00
Adam Stephens b05262f882
remove shmbridge patch, unstable url 2024-02-20 07:39:42 -05:00
Adam Stephens 7e752729c1
chore: 6.8.0-rc4 -> 6.8.0-rc5 2024-02-19 11:49:03 -05:00
Adam Stephens 5f7a170cd1
fix: shm bridge sha 2024-02-16 17:46:13 -05:00
Adam Stephens baa17c8f4d
fix: avoid blanking during initrd before msm is loaded 2024-02-14 09:49:08 -05:00
18 changed files with 459 additions and 265 deletions

View file

@ -1,37 +0,0 @@
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 +1,2 @@
.secret.envrc
result

25
.woodpecker/build.yaml Normal file
View file

@ -0,0 +1,25 @@
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,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.
@ -10,7 +13,20 @@ A binary cache is provided through Cachix so you can avoid re-building the kerne
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 advantags of this cache.
Ensure you are not overriding the nixpkgs input when consuming this flake, or you may not be able to take advantages 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
@ -30,6 +46,13 @@ Ensure you are not overriding the nixpkgs input when consuming this flake, or yo
inputs.nixos-x13s.nixosModules.default
{
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
nixpkgs.config.allowUnfree = true;
@ -45,4 +68,31 @@ Ensure you are not overriding the nixpkgs input when consuming this flake, or yo
## Add using not a flake
Not documented, but feel free to submit a PR.
Clone the repository:
```
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"
},
"locked": {
"lastModified": 1706830856,
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github"
},
"original": {
@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1707689078,
"narHash": "sha256-UUGmRa84ZJHpGZ1WZEBEUOzaPOWG8LZ0yPg1pdDF/yM=",
"lastModified": 1722062969,
"narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8",
"rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3",
"type": "github"
},
"original": {
@ -36,20 +36,14 @@
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1706550542,
"narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
"type": "github"
"lastModified": 1719876945,
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
}
},
"root": {

115
flake.nix
View file

@ -5,7 +5,10 @@
};
outputs =
inputs@{ flake-parts, ... }:
inputs@{ flake-parts, self, ... }:
let
dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb";
in
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ ./packages/part.nix ];
@ -17,9 +20,115 @@
perSystem =
{ pkgs, ... }:
{
devShells.default = pkgs.mkShellNoCC { packages = [ pkgs.npins ]; };
devShells = rec {
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;
flake.nixosModules.default = import ./module.nix { inherit dtbName; };
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;
};
};
}
)
];
};
};
};
}

12
justfile Normal file
View file

@ -0,0 +1,12 @@
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,6 +1,8 @@
{ dtbName }:
{
config,
lib,
options,
pkgs,
...
}:
@ -9,11 +11,30 @@ let
x13sPackages = import ./packages/default.nix { inherit lib pkgs; };
dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb";
linuxPackages_x13s = pkgs.linuxPackagesFor x13sPackages."x13s/linux";
linuxPackages_x13s =
if cfg.kernel == "mainline" then
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}";
dtbEfiPath = "dtbs/x13s.dtb";
alsa-ucm-conf-env.ALSA_CONFIG_UCM2 = "${x13sPackages."x13s/alsa-ucm-conf"}/share/alsa/ucm2";
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 = {
@ -21,50 +42,56 @@ in
bluetoothMac = lib.mkOption {
type = lib.types.str;
description = "mac address to set on boot";
description = "Bluetooth 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 {
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";
};
};
environment.sessionVariables = alsa-ucm-conf-env;
systemd.user.services.pipewire.environment = alsa-ucm-conf-env;
systemd.user.services.wireplumber.environment = alsa-ucm-conf-env;
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 = {
"${dtbName}" = dtb;
"${dtbEfiPath}" = dtb;
};
kernelPackages = linuxPackages_x13s;
kernelParams = [
# needed to boot
"dtb=${dtbName}"
"dtb=${dtbEfiPath}"
# 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"
# "regulator_ignore_unused" # allows for > 30 sec to load msm, at the potential cost of power
];
initrd = {
@ -88,34 +115,25 @@ 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: {
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
zfs = super.zfs.overrideAttrs (_: { meta.platforms = [ ]; });
zfs = super.zfs.overrideAttrs (_: {
meta.platforms = [ ];
});
# allow missing modules
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
@ -125,17 +143,21 @@ in
# default is performance
powerManagement.cpuFreqGovernor = "ondemand";
systemd.services.bluetooth = {
# 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" ];
requiredBy = [ "bluetooth.service" ];
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";
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.util-linux}/bin/script -q -c '${pkgs.bluez}/bin/btmgmt --index 0 public-addr ${cfg.bluetoothMac}'";
};
};
};

View file

@ -1,30 +1,16 @@
{
"pins": {
"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": {
"linux-jhovold": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "jhovold",
"repo": "linux"
},
"branch": "wip/sc8280xp-v6.8-rc4",
"revision": "e6afa0380b4915646a07306d706f6337f40fef90",
"url": "https://github.com/jhovold/linux/archive/e6afa0380b4915646a07306d706f6337f40fef90.tar.gz",
"hash": "0jb546y44pjgs2g9mv8074gmffw9r42p13zvnn9va5qmzjr6ahk1"
"branch": "wip/sc8280xp-6.11-rc1",
"revision": "9c6b81022b9c277d65c68e25f4cfd52f33ef8f28",
"url": "https://github.com/jhovold/linux/archive/9c6b81022b9c277d65c68e25f4cfd52f33ef8f28.tar.gz",
"hash": "13c6r67iy8y750f8zpals4l941lshxx3w3ar1ss9dizsqjsghdsr"
}
},
"version": 3

View file

@ -3,49 +3,34 @@ let
sources = import ../npins;
linux_x13s_pkg =
{ buildLinux, ... }@args:
let
version = "6.8.0-rc4";
modDirVersion = "${version}";
in
{ version, buildLinux, ... }@args:
buildLinux (
args
// {
inherit version modDirVersion;
modDirVersion = version;
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;
};
}
];
kernelPatches = (args.kernelPatches or [ ]) ++ [ ];
extraMeta.branch = lib.versions.majorMinor version;
}
);
in
rec {
"x13s/linux" = pkgs.callPackage linux_x13s_pkg { defconfig = "johan_defconfig"; };
"x13s/alsa-ucm-conf" = pkgs.alsa-ucm-conf.overrideAttrs (
_: {
version = sources.alsa-ucm-conf.version;
src = sources.alsa-ucm-conf;
patches = [ ];
}
);
{
linux_jhovold = pkgs.callPackage linux_x13s_pkg {
src = sources.linux-jhovold;
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,5 +1,14 @@
{ 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" (
{ pkgs, ... }: import ./default.nix { inherit lib pkgs; }
);

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;
};
}

50
packages/uefi-usbiso.nix Normal file
View file

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

29
packages/uefi.nix Normal file
View file

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

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