feat: bump all software & kernel, fix libcamera issues, load versions dynamically, 6.14 support

This commit is contained in:
adminy 2025-03-22 12:43:18 +00:00
parent 3e8100d5e9
commit c635f54fbd
7 changed files with 180 additions and 153 deletions

138
flake.lock generated
View file

@ -3,44 +3,44 @@
"libcamera-src": { "libcamera-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1725630279, "lastModified": 1739434802,
"narHash": "sha256-KH30jmHfxXq4j2CL7kv18DYECJRp9ECuWNPnqPZajPA=", "narHash": "sha256-89uo3ajxozSpM4AGVIVb5GJ70giAQeyw0duIj5PRBgo=",
"owner": "raspberrypi", "owner": "raspberrypi",
"repo": "libcamera", "repo": "libcamera",
"rev": "69a894c4adad524d3063dd027f5c4774485cf9db", "rev": "29156679717bec7cc4784aeba3548807f2c27fca",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "raspberrypi", "owner": "raspberrypi",
"ref": "v0.4.0+rpt20250213",
"repo": "libcamera", "repo": "libcamera",
"rev": "69a894c4adad524d3063dd027f5c4774485cf9db",
"type": "github" "type": "github"
} }
}, },
"libpisp-src": { "libpisp-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1724944683, "lastModified": 1740558818,
"narHash": "sha256-Fo2UJmQHS855YSSKKmGrsQnJzXog1cdpkIOO72yYAM4=", "narHash": "sha256-D2wkC6VR9MSuHfoaIo3UhgqFW2HxCo0In09gnu1yG/E=",
"owner": "raspberrypi", "owner": "raspberrypi",
"repo": "libpisp", "repo": "libpisp",
"rev": "28196ed6edcfeda88d23cc5f213d51aa6fa17bb3", "rev": "b16ebf888b5f525506d13417e6cd8808015653f6",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "raspberrypi", "owner": "raspberrypi",
"ref": "v1.0.7", "ref": "v1.2.0",
"repo": "libpisp", "repo": "libpisp",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1736061677, "lastModified": 1741332913,
"narHash": "sha256-DjkQPnkAfd7eB522PwnkGhOMuT9QVCZspDpJJYyOj60=", "narHash": "sha256-ri1e8ZliWS3Jnp9yqpKApHaOo7KBN33W8ECAKA4teAQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "cbd8ec4de4469333c82ff40d057350c30e9f7d36", "rev": "20755fa05115c84be00b04690630cb38f0a203ad",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -56,22 +56,22 @@
"libpisp-src": "libpisp-src", "libpisp-src": "libpisp-src",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"rpi-bluez-firmware-src": "rpi-bluez-firmware-src", "rpi-bluez-firmware-src": "rpi-bluez-firmware-src",
"rpi-firmware-6_14_y-src": "rpi-firmware-6_14_y-src",
"rpi-firmware-6_6_y-src": "rpi-firmware-6_6_y-src",
"rpi-firmware-nonfree-src": "rpi-firmware-nonfree-src", "rpi-firmware-nonfree-src": "rpi-firmware-nonfree-src",
"rpi-firmware-src": "rpi-firmware-src", "rpi-linux-6_14_y-src": "rpi-linux-6_14_y-src",
"rpi-linux-6_12_17-src": "rpi-linux-6_12_17-src", "rpi-linux-6_6_y-src": "rpi-linux-6_6_y-src",
"rpi-linux-6_6_78-src": "rpi-linux-6_6_78-src",
"rpi-linux-stable-src": "rpi-linux-stable-src",
"rpicam-apps-src": "rpicam-apps-src" "rpicam-apps-src": "rpicam-apps-src"
} }
}, },
"rpi-bluez-firmware-src": { "rpi-bluez-firmware-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1708969706, "lastModified": 1741017538,
"narHash": "sha256-KakKnOBeWxh0exu44beZ7cbr5ni4RA9vkWYb9sGMb8Q=", "narHash": "sha256-t+D4VUfEIov83KV4wiKp6TqXTHXGkxg/mANi4GW7QHs=",
"owner": "RPi-Distro", "owner": "RPi-Distro",
"repo": "bluez-firmware", "repo": "bluez-firmware",
"rev": "78d6a07730e2d20c035899521ab67726dc028e1c", "rev": "2bbfb8438e824f5f61dae3f6ebb367a6129a4d63",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -81,14 +81,48 @@
"type": "github" "type": "github"
} }
}, },
"rpi-firmware-6_14_y-src": {
"flake": false,
"locked": {
"lastModified": 1739975675,
"narHash": "sha256-DklG7vO4BNK660P9Rd+f8oNavojgGcldB8d2+PPhGvk=",
"owner": "raspberrypi",
"repo": "firmware",
"rev": "03a4fb56ccf125623f4f90333345e393be60b7bf",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "next",
"repo": "firmware",
"type": "github"
}
},
"rpi-firmware-6_6_y-src": {
"flake": false,
"locked": {
"lastModified": 1741190071,
"narHash": "sha256-J2Na7yGKvRDWKC+1gFEQMuaam+4vt+RsV9FjarDgvMs=",
"owner": "raspberrypi",
"repo": "firmware",
"rev": "f9ff9c8f22a148a555a2c090af9649ad84709dc4",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "stable",
"repo": "firmware",
"type": "github"
}
},
"rpi-firmware-nonfree-src": { "rpi-firmware-nonfree-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1723266537, "lastModified": 1741367244,
"narHash": "sha256-T7eTKXqY9cxEMdab8Snda4CEOrEihy5uOhA6Fy+Mhnw=", "narHash": "sha256-D1ba93e2xsOFcdTV9FXjKU1NKKBSu5ekmGwCtxdiJ8c=",
"owner": "RPi-Distro", "owner": "RPi-Distro",
"repo": "firmware-nonfree", "repo": "firmware-nonfree",
"rev": "4b356e134e8333d073bd3802d767a825adec3807", "rev": "69377e5ff9530fc27bcd5bd63198843e06491312",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -98,48 +132,31 @@
"type": "github" "type": "github"
} }
}, },
"rpi-firmware-src": { "rpi-linux-6_14_y-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1728405098, "lastModified": 1741347313,
"narHash": "sha256-4gnK0KbqFnjBmWia9Jt2gveVWftmHrprpwBqYVqE/k0=", "narHash": "sha256-f0C0sh2eKkdkD5iD05AjurpFeYiwpt3Ne2a+Jx/eJH4=",
"owner": "raspberrypi", "owner": "raspberrypi",
"repo": "firmware", "repo": "linux",
"rev": "7bbb5f80d20a2335066a8781459c9f33e5eebc64", "rev": "190bc163f8d6660e17f4994ed9c6c3a87c9fc4d3",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "raspberrypi", "owner": "raspberrypi",
"ref": "1.20241008", "ref": "rpi-6.14.y",
"repo": "firmware",
"type": "github"
}
},
"rpi-linux-6_12_17-src": {
"flake": false,
"locked": {
"lastModified": 1740765145,
"narHash": "sha256-hoCsGc4+RC/2LmxDtswLBL5ZhWlw4vSiL4Vkl39r2MU=",
"owner": "raspberrypi",
"repo": "linux",
"rev": "5985ce32e511f4e8279a841a1b06a8c7d972b386",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "rpi-6.12.y",
"repo": "linux", "repo": "linux",
"type": "github" "type": "github"
} }
}, },
"rpi-linux-6_6_78-src": { "rpi-linux-6_6_y-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1740503700, "lastModified": 1741365749,
"narHash": "sha256-Y8+ot4Yi3UKwlZK3ap15rZZ16VZDvmeFkD46+6Ku7bE=", "narHash": "sha256-7IzfI4Do2P0rlQ51URMkEyMBu4mlUCxZJGbqg4bIL70=",
"owner": "raspberrypi", "owner": "raspberrypi",
"repo": "linux", "repo": "linux",
"rev": "2e071057fded90e789c0101498e45a1778be93fe", "rev": "3c21211667e35029054b0dfebdf292e4e7d5754b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -149,36 +166,19 @@
"type": "github" "type": "github"
} }
}, },
"rpi-linux-stable-src": {
"flake": false,
"locked": {
"lastModified": 1728403745,
"narHash": "sha256-phCxkuO+jUGZkfzSrBq6yErQeO2Td+inIGHxctXbD5U=",
"owner": "raspberrypi",
"repo": "linux",
"rev": "5aeecea9f4a45248bcf564dec924965e066a7bfd",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "stable_20241008",
"repo": "linux",
"type": "github"
}
},
"rpicam-apps-src": { "rpicam-apps-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1727515047, "lastModified": 1737988296,
"narHash": "sha256-qCYGrcibOeGztxf+sd44lD6VAOGoUNwRqZDdAmcTa/U=", "narHash": "sha256-pTSHmRmGV203HjrH6MWNDEz2xLitCsILKsOYD9PgjwU=",
"owner": "raspberrypi", "owner": "raspberrypi",
"repo": "rpicam-apps", "repo": "rpicam-apps",
"rev": "a8ccf9f3cd9df49875dfb834a2b490d41d226031", "rev": "025ca84648c9b9d74711477bf94b05bec349f53d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "raspberrypi", "owner": "raspberrypi",
"ref": "v1.5.2", "ref": "v1.6.0",
"repo": "rpicam-apps", "repo": "rpicam-apps",
"type": "github" "type": "github"
} }

View file

@ -3,21 +3,21 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
rpi-linux-stable-src = { rpi-linux-6_6_y-src = {
flake = false;
url = "github:raspberrypi/linux/stable_20241008";
};
rpi-linux-6_6_78-src = {
flake = false; flake = false;
url = "github:raspberrypi/linux/rpi-6.6.y"; url = "github:raspberrypi/linux/rpi-6.6.y";
}; };
rpi-linux-6_12_17-src = { rpi-linux-6_14_y-src = {
flake = false; flake = false;
url = "github:raspberrypi/linux/rpi-6.12.y"; url = "github:raspberrypi/linux/rpi-6.14.y";
}; };
rpi-firmware-src = { rpi-firmware-6_6_y-src = {
flake = false; flake = false;
url = "github:raspberrypi/firmware/1.20241008"; url = "github:raspberrypi/firmware/stable";
};
rpi-firmware-6_14_y-src = {
flake = false;
url = "github:raspberrypi/firmware/next";
}; };
rpi-firmware-nonfree-src = { rpi-firmware-nonfree-src = {
flake = false; flake = false;
@ -29,15 +29,15 @@
}; };
rpicam-apps-src = { rpicam-apps-src = {
flake = false; flake = false;
url = "github:raspberrypi/rpicam-apps/v1.5.2"; url = "github:raspberrypi/rpicam-apps/v1.6.0";
}; };
libcamera-src = { libcamera-src = {
flake = false; flake = false;
url = "github:raspberrypi/libcamera/69a894c4adad524d3063dd027f5c4774485cf9db"; # v0.3.1+rpt20240906 url = "github:raspberrypi/libcamera/v0.4.0+rpt20250213";
}; };
libpisp-src = { libpisp-src = {
flake = false; flake = false;
url = "github:raspberrypi/libpisp/v1.0.7"; url = "github:raspberrypi/libpisp/v1.2.0";
}; };
}; };
@ -47,15 +47,18 @@
system = "aarch64-linux"; system = "aarch64-linux";
overlays = with self.overlays; [ core libcamera ]; overlays = with self.overlays; [ core libcamera ];
}; };
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
lib = srcs.nixpkgs.lib;
inputs = lib.recursiveUpdate (builtins.removeAttrs srcs [ "self" ]) { inherit lock; };
in in
{ {
overlays = { overlays = {
core = import ./overlays (builtins.removeAttrs srcs [ "self" ]); core = import ./overlays inputs;
libcamera = import ./overlays/libcamera.nix (builtins.removeAttrs srcs [ "self" ]); libcamera = import ./overlays/libcamera.nix inputs;
}; };
nixosModules = { nixosModules = {
raspberry-pi = import ./rpi { raspberry-pi = import ./rpi {
inherit pinned; inherit pinned inputs;
core-overlay = self.overlays.core; core-overlay = self.overlays.core;
libcamera-overlay = self.overlays.libcamera; libcamera-overlay = self.overlays.libcamera;
}; };
@ -82,7 +85,6 @@
in in
{ {
example-sd-image = self.nixosConfigurations.rpi-example.config.system.build.sdImage; example-sd-image = self.nixosConfigurations.rpi-example.config.system.build.sdImage;
firmware = pinned.raspberrypifw;
libcamera = pinned.libcamera; libcamera = pinned.libcamera;
wireless-firmware = pinned.raspberrypiWirelessFirmware; wireless-firmware = pinned.raspberrypiWirelessFirmware;
uboot-rpi-arm64 = pinned.uboot-rpi-arm64; uboot-rpi-arm64 = pinned.uboot-rpi-arm64;

View file

@ -1,7 +1,8 @@
{ rpi-linux-stable-src { lock
, rpi-linux-6_6_78-src , rpi-linux-6_6_y-src
, rpi-linux-6_12_17-src , rpi-linux-6_14_y-src
, rpi-firmware-src , rpi-firmware-6_6_y-src
, rpi-firmware-6_14_y-src
, rpi-firmware-nonfree-src , rpi-firmware-nonfree-src
, rpi-bluez-firmware-src , rpi-bluez-firmware-src
, ... , ...
@ -9,20 +10,15 @@
final: prev: final: prev:
let let
versions = { versions = {
v6_6_51.src = rpi-linux-stable-src; v6_6_78 = {
v6_6_78.src = rpi-linux-6_6_78-src; src = rpi-linux-6_6_y-src;
v6_12_17 = { firmware = rpi-firmware-6_6_y-src;
src = rpi-linux-6_12_17-src;
patches = [
{
name = "remove-readme-target.patch";
patch = final.fetchpatch {
url = "https://github.com/raspberrypi/linux/commit/3c0fd51d184f1748b83d28e1113265425c19bcb5.patch";
hash = "sha256-v7uZOmPCUp2i7NGVgjqnQYe6dEBD+aATuP/oRs9jfuk=";
};
}
];
}; };
v6_14_0-rc7 = {
src = rpi-linux-6_14_y-src;
firmware = rpi-firmware-6_14_y-src;
};
}; };
boards = [ "bcm2711" "bcm2712" ]; boards = [ "bcm2711" "bcm2712" ];
@ -33,44 +29,48 @@ let
version-slug = builtins.replaceStrings [ "v" "_" ] [ "" "." ] version; version-slug = builtins.replaceStrings [ "v" "_" ] [ "" "." ] version;
in in
{ {
"${version}"."${board}" = (final.buildLinux { "${version}"."${board}" = {
modDirVersion = version-slug; kernel = (final.buildLinux {
version = version-slug; modDirVersion = version-slug;
pname = "linux-rpi"; version = version-slug;
src = kernel.src; pname = "linux-rpi";
defconfig = "${board}_defconfig"; src = kernel.src;
structuredExtraConfig = with final.lib.kernel; { defconfig = "${board}_defconfig";
# The perl script to generate kernel options sets unspecified structuredExtraConfig = with final.lib.kernel; {
# parameters to `m` if possible [1]. This results in the # The perl script to generate kernel options sets unspecified
# unspecified config option KUNIT [2] getting set to `m` which # parameters to `m` if possible [1]. This results in the
# causes DRM_VC4_KUNIT_TEST [3] to get set to `y`. # unspecified config option KUNIT [2] getting set to `m` which
# # causes DRM_VC4_KUNIT_TEST [3] to get set to `y`.
# This vc4 unit test fails on boot due to a null pointer #
# exception with the existing config. I'm not sure why, but in # This vc4 unit test fails on boot due to a null pointer
# any case, the DRM_VC4_KUNIT_TEST config option itself states # exception with the existing config. I'm not sure why, but in
# that it is only useful for kernel developers working on the # any case, the DRM_VC4_KUNIT_TEST config option itself states
# vc4 driver. So, I feel no need to deviate from the standard # that it is only useful for kernel developers working on the
# rpi kernel and attempt to successfully enable this test and # vc4 driver. So, I feel no need to deviate from the standard
# other unit tests because the nixos perl script has this # rpi kernel and attempt to successfully enable this test and
# sloppy "default to m" behavior. So, I set KUNIT to `n`. # other unit tests because the nixos perl script has this
# # sloppy "default to m" behavior. So, I set KUNIT to `n`.
# [1] https://github.com/NixOS/nixpkgs/blob/85bcb95aa83be667e562e781e9d186c57a07d757/pkgs/os-specific/linux/kernel/generate-config.pl#L1-L10 #
# [2] https://github.com/raspberrypi/linux/blob/1.20230405/lib/kunit/Kconfig#L5-L14 # [1] https://github.com/NixOS/nixpkgs/blob/85bcb95aa83be667e562e781e9d186c57a07d757/pkgs/os-specific/linux/kernel/generate-config.pl#L1-L10
# [3] https://github.com/raspberrypi/linux/blob/bb63dc31e48948bc2649357758c7a152210109c4/drivers/gpu/drm/vc4/Kconfig#L38-L52 # [2] https://github.com/raspberrypi/linux/blob/1.20230405/lib/kunit/Kconfig#L5-L14
KUNIT = no; # [3] https://github.com/raspberrypi/linux/blob/bb63dc31e48948bc2649357758c7a152210109c4/drivers/gpu/drm/vc4/Kconfig#L38-L52
}; KUNIT = no;
features.efiBootStub = false; HID_LENOVO = no;
kernelPatches = };
if kernel ? "patches" then kernel.patches else [ ]; features.efiBootStub = false;
ignoreConfigErrors = true; kernelPatches =
}).overrideAttrs if kernel ? "patches" then kernel.patches else [ ];
(oldAttrs: { }).overrideAttrs
postConfigure = '' (oldAttrs: {
# The v7 defconfig has this set to '-v7' which screws up our modDirVersion. postConfigure = ''
sed -i $buildRoot/.config -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/' # The v7 defconfig has this set to '-v7' which screws up our modDirVersion.
sed -i $buildRoot/include/config/auto.conf -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/' sed -i $buildRoot/.config -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
''; sed -i $buildRoot/include/config/auto.conf -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
}); '';
});
firmware = prev.raspberrypifw.overrideAttrs (oldfw: { src = kernel.firmware; });
};
}; };
rpi-kernels = builtins.foldl' rpi-kernels = builtins.foldl'
(b: a: final.lib.recursiveUpdate b (rpi-kernel a)) (b: a: final.lib.recursiveUpdate b (rpi-kernel a))
@ -108,13 +108,12 @@ in
} }
) )
{ }; { };
raspberrypifw = prev.raspberrypifw.overrideAttrs (oldfw: { src = rpi-firmware-src; });
} // { } // {
# rpi kernels and firmware are available at # rpi kernels and firmware are available at
# `pkgs.rpi-kernels.<VERSION>.<BOARD>'. # `pkgs.rpi-kernels.<VERSION>.<BOARD>'.
# #
# For example: `pkgs.rpi-kernels.v6_6_78.bcm2712' # Check all available versions/boards with: nix flake show
rpi-kernels = rpi-kernels ( rpi-kernels = rpi-kernels (
final.lib.cartesianProduct final.lib.cartesianProduct
{ board = boards; version = (builtins.attrNames versions); } { board = boards; version = (builtins.attrNames versions); }

View file

@ -1,6 +1,7 @@
{ rpicam-apps-src { rpicam-apps-src
, libcamera-src , libcamera-src
, libpisp-src , libpisp-src
, lock
, ... , ...
}: }:
final: prev: { final: prev: {
@ -10,7 +11,7 @@ final: prev: {
libpisp = final.stdenv.mkDerivation { libpisp = final.stdenv.mkDerivation {
name = "libpisp"; name = "libpisp";
version = "1.0.7"; version = lock.nodes.libpisp-src.original.ref;
src = libpisp-src; src = libpisp-src;
nativeBuildInputs = with final; [ pkg-config meson ninja ]; nativeBuildInputs = with final; [ pkg-config meson ninja ];
buildInputs = with final; [ nlohmann_json boost ]; buildInputs = with final; [ nlohmann_json boost ];
@ -18,10 +19,15 @@ final: prev: {
# https://github.com/NixOS/nixpkgs/issues/86131 # https://github.com/NixOS/nixpkgs/issues/86131
BOOST_INCLUDEDIR = "${prev.lib.getDev final.boost}/include"; BOOST_INCLUDEDIR = "${prev.lib.getDev final.boost}/include";
BOOST_LIBRARYDIR = "${prev.lib.getLib final.boost}/lib"; BOOST_LIBRARYDIR = "${prev.lib.getLib final.boost}/lib";
# Copy image filters into lib
postInstall = ''
mkdir -p $out/lib/libpisp/backend
cp src/libpisp/backend/*.json $out/lib/libpisp/backend
'';
}; };
libcamera = prev.libcamera.overrideAttrs (old: { libcamera = prev.libcamera.overrideAttrs (old: {
version = "0.3.1"; version = lock.nodes.libcamera-src.original.ref;
src = libcamera-src; src = libcamera-src;
buildInputs = old.buildInputs ++ (with final; [ buildInputs = old.buildInputs ++ (with final; [
libpisp libpisp
@ -50,8 +56,12 @@ final: prev: {
"-Dlc-compliance=disabled" "-Dlc-compliance=disabled"
"-Dcam=disabled" "-Dcam=disabled"
"-Dqcam=disabled" "-Dqcam=disabled"
"-Ddocumentation=enabled" "-Ddocumentation=disabled"
"-Dpycamera=enabled" "-Dpycamera=enabled"
]; ];
# Issue introduced recently
# https://github.com/raspberrypi/libcamera/issues/226
CXXFLAGS = "-Wno-sign-compare -Wno-stringop-truncation";
}); });
} }

View file

@ -6,7 +6,7 @@ stdenv.mkDerivation {
src = rpicam-apps-src; src = rpicam-apps-src;
nativeBuildInputs = with pkgs; [ meson pkg-config ]; nativeBuildInputs = with pkgs; [ meson pkg-config makeWrapper ];
buildInputs = with pkgs; [ libjpeg libtiff libcamera libepoxy boost libexif libpng ffmpeg libdrm ninja ]; buildInputs = with pkgs; [ libjpeg libtiff libcamera libepoxy boost libexif libpng ffmpeg libdrm ninja ];
mesonFlags = [ mesonFlags = [
"-Denable_qt=disabled" "-Denable_qt=disabled"
@ -21,6 +21,17 @@ stdenv.mkDerivation {
BOOST_INCLUDEDIR = "${lib.getDev pkgs.boost}/include"; BOOST_INCLUDEDIR = "${lib.getDev pkgs.boost}/include";
BOOST_LIBRARYDIR = "${lib.getLib pkgs.boost}/lib"; BOOST_LIBRARYDIR = "${lib.getLib pkgs.boost}/lib";
postFixup = let
wrap = "wrapProgram $out/bin/rpicam";
ipa-var = "--set LIBCAMERA_IPA_PROXY_PATH ${pkgs.libcamera}/libexec/libcamera";
in ''
${wrap}-hello ${ipa-var}
${wrap}-raw ${ipa-var}
${wrap}-vid ${ipa-var}
${wrap}-jpeg ${ipa-var}
${wrap}-still ${ipa-var}
'';
meta = with lib; { meta = with lib; {
description = "Userland tools interfacing with Raspberry Pi cameras"; description = "Userland tools interfacing with Raspberry Pi cameras";
homepage = "https://github.com/raspberrypi/libcamera-apps"; homepage = "https://github.com/raspberrypi/libcamera-apps";

View file

@ -1,4 +1,4 @@
{ pinned, core-overlay, libcamera-overlay }: { pinned, core-overlay, libcamera-overlay, ... }:
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
let let
@ -7,6 +7,10 @@ let
board = cfg.board; board = cfg.board;
kernel = config.system.build.kernel; kernel = config.system.build.kernel;
initrd = "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"; initrd = "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}";
kernel-with-firmware = pkgs.rpi-kernels."${version}"."${board}";
kernel-pkg = kernel-with-firmware.kernel;
firmware-pkg = kernel-with-firmware.firmware;
in in
{ {
imports = [ ./config.nix ./i2c.nix ]; imports = [ ./config.nix ./i2c.nix ];
@ -14,7 +18,7 @@ in
options = with lib; { options = with lib; {
raspberry-pi-nix = { raspberry-pi-nix = {
kernel-version = mkOption { kernel-version = mkOption {
default = "v6_6_51"; default = builtins.elemAt (attrNames pkgs.rpi-kernels) 0;
type = types.str; type = types.str;
description = "Kernel version to build."; description = "Kernel version to build.";
}; };
@ -121,7 +125,7 @@ in
TMPFILE="$TARGET_FIRMWARE_DIR/tmp" TMPFILE="$TARGET_FIRMWARE_DIR/tmp"
KERNEL="${kernel}/${config.system.boot.loader.kernelFile}" KERNEL="${kernel}/${config.system.boot.loader.kernelFile}"
SHOULD_UBOOT=${if cfg.uboot.enable then "1" else "0"} SHOULD_UBOOT=${if cfg.uboot.enable then "1" else "0"}
SRC_FIRMWARE_DIR="${pkgs.raspberrypifw}/share/raspberrypi/boot" SRC_FIRMWARE_DIR="${firmware-pkg}/share/raspberrypi/boot"
STARTFILES=("$SRC_FIRMWARE_DIR"/start*.elf) STARTFILES=("$SRC_FIRMWARE_DIR"/start*.elf)
DTBS=("$SRC_FIRMWARE_DIR"/*.dtb) DTBS=("$SRC_FIRMWARE_DIR"/*.dtb)
BOOTCODE="$SRC_FIRMWARE_DIR/bootcode.bin" BOOTCODE="$SRC_FIRMWARE_DIR/bootcode.bin"
@ -195,7 +199,7 @@ in
mv -T "$TMPFILE" "$TARGET_OVERLAYS_DIR/$(basename "$SRC")" mv -T "$TMPFILE" "$TARGET_OVERLAYS_DIR/$(basename "$SRC")"
done done
echo "${ echo "${
builtins.toString pkgs.raspberrypifw builtins.toString firmware-pkg
}" > "$STATE_DIRECTORY/firmware-version" }" > "$STATE_DIRECTORY/firmware-version"
rm "$STATE_DIRECTORY/firmware-migration-in-progress" rm "$STATE_DIRECTORY/firmware-migration-in-progress"
} }
@ -227,7 +231,7 @@ in
fi fi
if [[ -f "$STATE_DIRECTORY/firmware-migration-in-progress" || ! -f "$STATE_DIRECTORY/firmware-version" || $(< "$STATE_DIRECTORY/firmware-version") != ${ if [[ -f "$STATE_DIRECTORY/firmware-migration-in-progress" || ! -f "$STATE_DIRECTORY/firmware-version" || $(< "$STATE_DIRECTORY/firmware-version") != ${
builtins.toString pkgs.raspberrypifw builtins.toString firmware-pkg
} ]]; then } ]]; then
migrate_firmware migrate_firmware
fi fi
@ -349,7 +353,7 @@ in
"reset-raspberrypi" # required for vl805 firmware to load "reset-raspberrypi" # required for vl805 firmware to load
]; ];
}; };
kernelPackages = pkgs.linuxPackagesFor pkgs.rpi-kernels."${version}"."${board}"; kernelPackages = pkgs.linuxPackagesFor kernel-pkg;
loader = { loader = {
grub.enable = lib.mkDefault false; grub.enable = lib.mkDefault false;
initScript.enable = !cfg.uboot.enable; initScript.enable = !cfg.uboot.enable;

View file

@ -32,6 +32,7 @@
board = cfg.board; board = cfg.board;
kernel = "${config.system.build.kernel}/${config.system.boot.loader.kernelFile}"; kernel = "${config.system.build.kernel}/${config.system.boot.loader.kernelFile}";
initrd = "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"; initrd = "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}";
firmware = pkgs.rpi-kernels."${version}"."${board}".firmware;
populate-kernel = populate-kernel =
if cfg.uboot.enable if cfg.uboot.enable
then '' then ''
@ -46,7 +47,7 @@
{ {
populateFirmwareCommands = '' populateFirmwareCommands = ''
${populate-kernel} ${populate-kernel}
cp -r ${pkgs.raspberrypifw}/share/raspberrypi/boot/{start*.elf,*.dtb,bootcode.bin,fixup*.dat,overlays} firmware cp -r ${firmware}/share/raspberrypi/boot/{start*.elf,*.dtb,bootcode.bin,fixup*.dat,overlays} firmware
cp ${config.hardware.raspberry-pi.config-output} firmware/config.txt cp ${config.hardware.raspberry-pi.config-output} firmware/config.txt
''; '';
populateRootCommands = populateRootCommands =