mirror of
https://github.com/nix-community/raspberry-pi-nix.git
synced 2025-11-08 11:36:04 +01:00
move libcamera stuff into a separate overlay
This commit is contained in:
parent
2e2c5b13fb
commit
9c35dd99cf
6 changed files with 51 additions and 30 deletions
10
flake.nix
10
flake.nix
|
|
@ -37,7 +37,13 @@
|
|||
};
|
||||
|
||||
outputs = srcs@{ self, ... }: {
|
||||
overlay = import ./overlay (builtins.removeAttrs srcs [ "self" ]);
|
||||
nixosModules.raspberry-pi = import ./rpi { overlay = self.overlay; };
|
||||
overlays = {
|
||||
core = import ./overlays (builtins.removeAttrs srcs [ "self" ]);
|
||||
libcamera = import ./overlays/libcamera.nix (builtins.removeAttrs srcs [ "self" ]);
|
||||
};
|
||||
nixosModules.raspberry-pi = import ./rpi {
|
||||
core-overlay = self.overlays.core;
|
||||
libcamera-overlay = self.overlays.libcamera;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
, rpi-firmware-src
|
||||
, rpi-firmware-nonfree-src
|
||||
, rpi-bluez-firmware-src
|
||||
, libcamera-apps-src
|
||||
, libcamera-src
|
||||
, libpisp-src
|
||||
, ...
|
||||
}:
|
||||
final: prev:
|
||||
let
|
||||
|
|
@ -40,29 +38,6 @@ in
|
|||
# the path expected by raspberry pi firmware/device tree
|
||||
compressFirmwareXz = x: x;
|
||||
|
||||
# A recent known working version of libcamera-apps
|
||||
libcamera-apps =
|
||||
final.callPackage ./libcamera-apps.nix { inherit libcamera-apps-src; };
|
||||
|
||||
libpisp = final.stdenv.mkDerivation {
|
||||
name = "libpisp";
|
||||
version = "1.0.3";
|
||||
src = libpisp-src;
|
||||
nativeBuildInputs = with final; [ pkg-config meson ninja ];
|
||||
buildInputs = with final; [ nlohmann_json boost ];
|
||||
# Meson is no longer able to pick up Boost automatically.
|
||||
# https://github.com/NixOS/nixpkgs/issues/86131
|
||||
BOOST_INCLUDEDIR = "${prev.lib.getDev final.boost}/include";
|
||||
BOOST_LIBRARYDIR = "${prev.lib.getLib final.boost}/lib";
|
||||
};
|
||||
|
||||
libcamera = prev.libcamera.overrideAttrs (old: {
|
||||
version = "0.1.0";
|
||||
src = libcamera-src;
|
||||
buildInputs = old.buildInputs ++ (with final; [ libpisp ]);
|
||||
patches = [ ];
|
||||
});
|
||||
|
||||
# provide generic rpi arm64 u-boot
|
||||
uboot_rpi_arm64 = prev.buildUBoot rec {
|
||||
defconfig = "rpi_arm64_defconfig";
|
||||
30
overlays/libcamera.nix
Normal file
30
overlays/libcamera.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ libcamera-apps-src
|
||||
, libcamera-src
|
||||
, libpisp-src
|
||||
, ...
|
||||
}:
|
||||
final: prev:
|
||||
{
|
||||
# A recent known working version of libcamera-apps
|
||||
libcamera-apps =
|
||||
final.callPackage ./libcamera-apps.nix { inherit libcamera-apps-src; };
|
||||
|
||||
libpisp = final.stdenv.mkDerivation {
|
||||
name = "libpisp";
|
||||
version = "1.0.3";
|
||||
src = libpisp-src;
|
||||
nativeBuildInputs = with final; [ pkg-config meson ninja ];
|
||||
buildInputs = with final; [ nlohmann_json boost ];
|
||||
# Meson is no longer able to pick up Boost automatically.
|
||||
# https://github.com/NixOS/nixpkgs/issues/86131
|
||||
BOOST_INCLUDEDIR = "${prev.lib.getDev final.boost}/include";
|
||||
BOOST_LIBRARYDIR = "${prev.lib.getLib final.boost}/lib";
|
||||
};
|
||||
|
||||
libcamera = prev.libcamera.overrideAttrs (old: {
|
||||
version = "0.1.0";
|
||||
src = libcamera-src;
|
||||
buildInputs = old.buildInputs ++ (with final; [ libpisp ]);
|
||||
patches = [ ];
|
||||
});
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
{ overlay }:
|
||||
{ core-overlay, libcamera-overlay }:
|
||||
{ lib, pkgs, config, ... }:
|
||||
|
||||
{
|
||||
|
|
@ -12,6 +12,12 @@
|
|||
type = types.bool;
|
||||
};
|
||||
};
|
||||
libcamera-overlay = {
|
||||
enable = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -171,7 +177,11 @@
|
|||
};
|
||||
};
|
||||
|
||||
nixpkgs = { overlays = [ overlay ]; };
|
||||
nixpkgs = {
|
||||
overlays = [ core-overlay ]
|
||||
++ (if config.raspberry-pi-nix.libcamera-overlay.enable
|
||||
then [ libcamera-overlay ] else [ ]);
|
||||
};
|
||||
boot = {
|
||||
initrd.availableKernelModules = [
|
||||
"usbhid"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue