This commit is contained in:
mjallen18
2025-12-23 21:04:21 -06:00
parent 8f08f24761
commit d981fb20c2
68 changed files with 957 additions and 543 deletions

View File

@@ -0,0 +1,99 @@
{
lib,
fetchFromGitHub,
ffmpeg,
ffmpegVariant ? "small",
withVoutEgl ? false,
libepoxy,
withV4l2Request ? true,
udev,
systemd,
withVoutDrm ? true,
stdenv ? null,
}:
let
extraVersion = "rpi";
# https://github.com/jc-kynesim/rpi-ffmpeg/tree/test/7.1.2/main
ffmpegVersion = "7.1.2";
rpiFfmpegSrc = fetchFromGitHub {
owner = "jc-kynesim";
repo = "rpi-ffmpeg";
# rev = "test/${ffmpegVersion}/main"; # this branch is being forced-push to
rev = "de943d66dab18e89fc10c74459bea1d787edc49d";
hash = "sha256-Qbgos7uzYXF5E557kR2EXhX9eJRmO0LVmSE2NOpEZY0=";
};
in
(ffmpeg.overrideAttrs (old: {
pname = old.pname + "-rpi";
doCheck = false; # disabled because `imgutils` test fails
# see also
# https://github.com/jc-kynesim/rpi-ffmpeg/blob/release/4.4/rpi_import_1/pi-util/conf_native.sh#L85
configureFlags =
old.configureFlags
++ [
"--extra-version=${extraVersion}"
"--enable-logging"
"--enable-asm"
]
++ [
"--disable-mmal"
"--enable-neon"
]
++ [
"--enable-sand"
]
++ lib.optionals withVoutEgl [
"--enable-epoxy"
"--enable-vout-egl" # rpi
]
++ lib.optionals withVoutDrm [
# when withV4l2
"--enable-vout-drm" # rpi
]
++ lib.optionals withV4l2Request [
"--enable-v4l2-request"
"--enable-libudev"
];
buildInputs =
old.buildInputs
++ lib.optionals withVoutEgl [
libepoxy.dev
]
++ lib.optionals withV4l2Request [
udev
systemd
];
})).override
{
version = ffmpegVersion;
source = rpiFfmpegSrc;
hash = rpiFfmpegSrc.hash;
# version = ffmpegVersion + "-rpi";
# source = rpiFfmpegSrc;
# hash = rpiFfmpegSrc.hash;
inherit ffmpegVariant;
withStripping = true;
withDocumentation = false;
withHtmlDoc = false;
withManPages = false;
# withV4l2 = true; # default on linux
# withDrm = true; # default on linux
withXlib = withVoutEgl; # for libepoxy
withVaapi = false;
# !!! keep this enabled, because some applications may need it
# for example, vlc 3.0.20: fails with 'undefined reference to
# `av_vdpau_get_surface_parameters'' otherwise
withVdpau = true;
}
# > configure flags: --disable-static --prefix=/nix/store/hksqdxfkpspl4bqhvzq88v46c5zlf1c9-ffmpeg-4.4-rpi --target_os=linux --arch=aarch64 --pkg-config=pkg-config --enable-gpl --enable-version3 --disable-nonfree --disable-static --enable-shared --enable-pic --disable-thumb --disable-small --enable-runtime-cpudetect --disable-gray --enable-swscale-alpha --enable-hardcoded-tables --enable-safe-bitstream-reader --enable-pthreads --disable-w32threads --disable-os2threads --enable-network --enable-pixelutils --datadir=/nix/store/k9hkfl02wlmms2czv8a56c3sfk0c1947-ffmpeg-4.4-rpi-data/share/ffmpeg --enable-ffmpeg --enable-ffplay --enable-ffprobe --bindir=/nix/store/xmgl25z6yh1166ykgf3srqhihdzx45ng-ffmpeg-4.4-rpi-bin/bin --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avresample --enable-avutil --enable-postproc --enable-swresample --enable-swscale --libdir=/nix/store/sgxz7wifxfi3yk2706fjfn1ja418lz4l-ffmpeg-4.4-rpi-lib/lib --incdir=/nix/store/4i8zcixbngr553ajfsg7qxasy372j18s-ffmpeg-4.4-rpi-dev/include --disable-doc --disable-htmlpages --disable-manpages --enable-podpages --enable-txtpages --enable-alsa --disable-libaom --enable-libass --disable-libbluray --disable-libbs2b --enable-bzlib --disable-libcaca --disable-libcelt --disable-chromaprint --disable-cuda --disable-cuda-llvm --enable-libdav1d --disable-libdc1394 --enable-libdrm --disable-libfdk-aac --disable-libflite --enable-fontconfig --enable-libfontconfig --enable-libfreetype --disable-frei0r --disable-libfribidi --disable-libgme --enable-gnutls --disable-libgsm --enable-iconv --disable-libjack --disable-ladspa --enable-lzma --disable-libmfx --disable-libmodplug --enable-libmp3lame --disable-libmysofa --enable-cuvid --enable-nvdec --enable-nvenc --disable-openal --disable-opencl --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-opengl --disable-libopenh264 --disable-libopenjpeg --disable-libopenmpt --enable-libopus --enable-libpulse --disable-librav1e --disable-librtmp --disable-libsmbclient --enable-sdl2 --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --disable-librsvg --disable-libsvtav1 --disable-libtensorflow --enable-libtheora --enable-libv4l2 --enable-v4l2-m2m --disable-vaapi --disable-vdpau --disable-libvidstab --disable-libvmaf --disable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-vulkan --disable-libwebp --enable-libx264 --enable-libx265 --disable-libxavs --disable-libxcb --disable-libxcb-shape --disable-libxcb-shm --disable-libxcb-xfixes --enable-xlib --disable-libxml2 --enable-libxvid --enable-libzimg --enable-zlib --disable-libzmq --disable-debug --enable-optimizations --disable-extra-warnings --enable-stripping --extra-version=rpi --enable-logging --enable-asm --disable-mmal --enable-neon --disable-thumb --enable-sand --enable-epoxy --enable-vout-egl --enable-vout-drm --enable-v4l2-request --enable-libudev
# > ERROR: v4l2-request requires libudev

View File

@@ -0,0 +1,47 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
}:
stdenv.mkDerivation (_finalAttrs: {
pname = "libraspberrypi";
version = "unstable-2024-12-23";
src = fetchFromGitHub {
owner = "raspberrypi";
repo = "userland";
rev = "a54a0dbb2b8dcf9bafdddfc9a9374fb51d97e976";
hash = "sha256-Edca6nkykdXKFF5MGq6LeKirMLHTZBCbFWvHTNHMWJ4=";
};
nativeBuildInputs = [
cmake
pkg-config
];
cmakeFlags = [
# -DARM64=ON disables all targets that only build on 32-bit ARM; this allows
# the package to build on aarch64 and other architectures
"-DARM64=${if stdenv.hostPlatform.isAarch32 then "OFF" else "ON"}"
"-DVMCS_INSTALL_PREFIX=${placeholder "out"}"
(lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10")
];
meta = with lib; {
description = "ARM side libraries for interfacing to Raspberry Pi GPU (deprecated as of 27.08.2025)";
homepage = "https://github.com/raspberrypi/userland";
license = licenses.bsd3;
platforms = [
"armv6l-linux"
"armv7l-linux"
"aarch64-linux"
"x86_64-linux"
];
maintainers = with maintainers; [
dezgeg
tkerber
];
};
})

View File

@@ -0,0 +1,39 @@
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/libraries/libraspberrypi/default.nix#L28
# because libraspberrypi is outdated and deprecated
{
lib,
stdenv,
fetchFromGitHub,
cmake,
dtc,
}:
stdenv.mkDerivation (_finalAttrs: {
pname = "raspberrypi-utils";
version = "unstable-2025-11-19";
src = fetchFromGitHub {
owner = "raspberrypi";
repo = "utils";
rev = "6e0779b1c552976e0da2374c0325a8c9c77b6010";
hash = "sha256-gzcQdchmYZ8NSGDnozUK3JgEQAO5b7GCOzQeRL0nDM8";
};
buildInputs = [
dtc # dtmerge depends on libfdt
];
nativeBuildInputs = [ cmake ];
meta = with lib; {
description = "A collection of scripts and simple applications for Raspberry Pi hardware";
homepage = "https://github.com/raspberrypi/utils";
license = licenses.bsd3;
platforms = [
"armv6l-linux"
"armv7l-linux"
"aarch64-linux"
];
maintainers = with maintainers; [ kazenyuk ];
};
})

View File

@@ -0,0 +1,88 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
bash,
gnugrep,
coreutils,
withCpuGovernorConfig ? false,
}:
stdenvNoCC.mkDerivation (_finalAttrs: {
pname = "raspberrypi-udev-rules";
version = "20251028";
# https://github.com/RPi-Distro/raspberrypi-sys-mods/tree/pios/trixie
src = fetchFromGitHub {
owner = "RPi-Distro";
repo = "raspberrypi-sys-mods";
rev = "147bccd7db1a32468fac69a89a05d6b93c6f1796";
hash = "sha256-+PWf3fy14Pb51ee8BueCnLR6OnUD3Htgd6r1321crhk=";
};
installPhase = ''
mkdir -p $out/lib/udev/rules.d
mkdir -p $out/lib/tmpfiles.d
# Note: Installing only explicitly listed rules
rules_usr_lib_src=usr/lib/udev/rules.d
declare -a rules_usr_lib=(
10-vc.rules
# disable until i know what to do with /usr/lib/raspberrypi-sys-mods/i2cprobe
# is it even still needed?
# 15-i2c-modprobe.rules
60-backlight.rules
60-dma-heap.rules
60-gpiochip4.rules
60-i2c-aliases.rules
${if withCpuGovernorConfig then "60-ondemand-governor.rules" else ""}
60-pico.rules
60-piolib.rules
61-drm.rules
70-microbit.rules
# doesn't seem to provide any value on nixos
# 80-noobs.rules
99-com.rules
)
tmpfiles_usr_lib_src=usr/lib/tmpfiles.d
declare -a tmpfiles_usr_lib=(
${if withCpuGovernorConfig then "raspberrypi-sys-mods-ondemand-governor.conf" else ""}
sys-kernel-debug.conf
)
for i in "''${rules_usr_lib[@]}"; do
install -vD "$rules_usr_lib_src/$i" $out/lib/udev/rules.d
done
for i in "''${tmpfiles_usr_lib[@]}"; do
install -vD "$tmpfiles_usr_lib_src/$i" $out/lib/tmpfiles.d
done
'';
fixupPhase = ''
for i in $out/{etc,lib}/udev/rules.d/*.rules; do
substituteInPlace $i \
--replace-quiet \"/bin/sh \"${bash}/bin/sh \
--replace-quiet \"/bin/grep \"${lib.getExe gnugrep} \
--replace-quiet \"/bin/chgrp \"${coreutils}/bin/chgrp \
--replace-quiet \"/bin/chmod \"${coreutils}/bin/chmod \
--replace-quiet /usr/bin/test ${coreutils}/bin/test
done
'';
meta = with lib; {
description = "A collection of Raspberry Pi-sourced system configuration files and associated scripts";
homepage = "https://github.com/RPi-Distro/raspberrypi-sys-mods/";
# https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/master/debian/copyright
license = licenses.bsd3;
platforms = platforms.all;
# buildable by all, but will make sense only on these, obviously
# platforms = [ "aarch64-linux" "armv7l-linux" "armv6l-linux" ];
};
})