turny: fix SPI/GPIO config for newer kernels
Build Images / build (push) Successful in 1m46s
Check / check (push) Failing after 2m57s

- Add complete config.txt settings with u-boot boot lines + spi=on
- Override sdImage.populateFirmwareCommands to use configtxt module output
- Mount firmware partition and add activation script to sync config.txt
- Load spi_bcm2835 and bcm2835_gpiomem kernel modules
- Add udev rule for gpiomem subsystem (not just gpio)
- Relax ProtectKernelTunables so service can access GPIO
- Update turny flake input to rppal-based CS pin fix
This commit is contained in:
Joakim Repomaa
2026-07-05 02:10:40 +03:00
parent 0e664c51f5
commit 4a7aabb0f3
65 changed files with 1336 additions and 500 deletions
+80
View File
@@ -0,0 +1,80 @@
{
pkgs,
lib,
}:
let
version = "4.9.9";
src = pkgs.fetchFromGitHub {
owner = "kreuzberg-dev";
repo = "kreuzberg";
rev = "v${version}";
hash = "sha256-eu0qjyxoRiDLHsBLPPPAqb/DKVaPzqgP/4hHPjgOBoM=";
};
in
pkgs.rustPlatform.buildRustPackage {
pname = "kreuzberg-cli";
inherit version src;
cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
inherit src;
hash = "sha256-j1tmjQ7KQQAMz3QxhQGTGracMqqdcaX/+74lpUfU/kE=";
};
buildFeatures = [ "all" ];
doCheck = false;
nativeBuildInputs = [
pkgs.cmake
pkgs.makeWrapper
pkgs.pkg-config
];
buildInputs = [
pkgs.pdfium-binaries
pkgs.openssl
pkgs.onnxruntime
pkgs.tesseract
pkgs.leptonica
];
dontUseCmakeConfigure = true;
env = {
KREUZBERG_PDFIUM_PREBUILT = pkgs.pdfium-binaries;
ORT_LIB_PATH = "${pkgs.onnxruntime}/lib";
ORT_PREFER_DYNAMIC_LINK = "1";
};
postPatch = ''
substituteInPlace crates/kreuzberg/Cargo.toml \
--replace 'kreuzberg-tesseract = { path = "../kreuzberg-tesseract", version = "4.9.9", optional = true }' \
'kreuzberg-tesseract = { path = "../kreuzberg-tesseract", version = "4.9.9", optional = true, default-features = false, features = ["dynamic-linking"] }'
for f in crates/kreuzberg-tesseract/src/*.rs; do
substituteInPlace "$f" \
--replace 'any(feature = "build-tesseract", feature = "build-tesseract-wasm")' \
'any(feature = "build-tesseract", feature = "build-tesseract-wasm", feature = "dynamic-linking")'
done
'';
postFixup = ''
wrapProgram $out/bin/kreuzberg \
--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [
pkgs.tesseract
pkgs.onnxruntime
]
} \
--set TESSDATA_PREFIX ${pkgs.tesseract}/share
ln -s kreuzberg $out/bin/kreuzberg-cli
'';
meta = {
description = "High-performance document intelligence CLI with a Rust core";
homepage = "https://github.com/kreuzberg-dev/kreuzberg";
license = lib.licenses.unfree;
platforms = [ "x86_64-linux" ];
mainProgram = "kreuzberg";
};
}