add flake srcs

This commit is contained in:
Travis Staton 2023-02-22 16:41:01 -05:00
parent 4d7687ec92
commit 5756b051fa
7 changed files with 220 additions and 193 deletions

122
flake.lock generated
View file

@ -1,24 +1,126 @@
{
"nodes": {
"nixpkgs": {
"libcamera-apps-src": {
"flake": false,
"locked": {
"lastModified": 1652182392,
"narHash": "sha256-H9Bmor+kfogrE0X7Fi5sh0gCUWDG4pnmYxedJyIT41A=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "aa2f845096f72dde4ad0c168eeec387cbd2eae04",
"lastModified": 1674645888,
"narHash": "sha256-UBTDHN0lMj02enB8im4Q+f/MCm/G2mFPP3pLImrZc5A=",
"owner": "raspberrypi",
"repo": "libcamera-apps",
"rev": "9f08463997b82c4bf60e12c4ea43577959a8ae15",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"owner": "raspberrypi",
"ref": "v1.1.1",
"repo": "libcamera-apps",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
"libcamera-apps-src": "libcamera-apps-src",
"rpi-bluez-firmware-src": "rpi-bluez-firmware-src",
"rpi-firmware-nonfree-src": "rpi-firmware-nonfree-src",
"rpi-firmware-stable-src": "rpi-firmware-stable-src",
"rpi-linux-5_15-src": "rpi-linux-5_15-src",
"rpi-linux-5_15_87-src": "rpi-linux-5_15_87-src",
"u-boot-src": "u-boot-src"
}
},
"rpi-bluez-firmware-src": {
"flake": false,
"locked": {
"lastModified": 1672928175,
"narHash": "sha256-gKGK0XzNrws5REkKg/JP6SZx3KsJduu53SfH3Dichkc=",
"owner": "RPi-Distro",
"repo": "bluez-firmware",
"rev": "9556b08ace2a1735127894642cc8ea6529c04c90",
"type": "github"
},
"original": {
"owner": "RPi-Distro",
"repo": "bluez-firmware",
"type": "github"
}
},
"rpi-firmware-nonfree-src": {
"flake": false,
"locked": {
"lastModified": 1674638139,
"narHash": "sha256-54JKmwypD7PRQdd7k6IcF7wL8ifMavEM0UwZwmA24O4=",
"owner": "RPi-Distro",
"repo": "firmware-nonfree",
"rev": "7f29411baead874b859eda53efdc2472345ea454",
"type": "github"
},
"original": {
"owner": "RPi-Distro",
"repo": "firmware-nonfree",
"type": "github"
}
},
"rpi-firmware-stable-src": {
"flake": false,
"locked": {
"lastModified": 1673003776,
"narHash": "sha256-tdaH+zZwmILNFBge2gMqtzj/1Hydj9cxhPvhw+7jTrU=",
"owner": "raspberrypi",
"repo": "firmware",
"rev": "78852e166b4cf3ebb31d051e996d54792f0994b0",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "stable",
"repo": "firmware",
"type": "github"
}
},
"rpi-linux-5_15-src": {
"flake": false,
"locked": {
"lastModified": 1675874870,
"narHash": "sha256-oy+VgoB4IdFZjGwkx88dDSpwWZj2D5t3PyXPIwDsY1Q=",
"owner": "raspberrypi",
"repo": "linux",
"rev": "14b35093ca68bf2c81bbc90aace5007142b40b40",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "rpi-5.15.y",
"repo": "linux",
"type": "github"
}
},
"rpi-linux-5_15_87-src": {
"flake": false,
"locked": {
"lastModified": 1673628667,
"narHash": "sha256-hNLVfhalmRhhRfvu2mR/qDmmGl//Ic1eqR7N1HFj2CY=",
"owner": "raspberrypi",
"repo": "linux",
"rev": "da4c8e0ffe7a868b989211045657d600be3046a1",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"repo": "linux",
"rev": "da4c8e0ffe7a868b989211045657d600be3046a1",
"type": "github"
}
},
"u-boot-src": {
"flake": false,
"locked": {
"narHash": "sha256-30fe8klLHRsEtEQ1VpYh4S+AflG5yCQYWlGmpWyFL8w=",
"type": "tarball",
"url": "https://ftp.denx.de/pub/u-boot/u-boot-2023.01.tar.bz2"
},
"original": {
"type": "tarball",
"url": "https://ftp.denx.de/pub/u-boot/u-boot-2023.01.tar.bz2"
}
}
},

View file

@ -1,10 +1,35 @@
{
description = "raspberry-pi nixos configuration";
inputs = { };
inputs = {
u-boot-src = {
flake = false;
url = "https://ftp.denx.de/pub/u-boot/u-boot-2023.01.tar.bz2";
};
rpi-linux-5_15-src = {
flake = false;
url = "github:raspberrypi/linux/rpi-5.15.y";
};
rpi-firmware-stable-src = {
flake = false;
url = "github:raspberrypi/firmware/stable";
};
rpi-firmware-nonfree-src = {
flake = false;
url = "github:RPi-Distro/firmware-nonfree";
};
rpi-bluez-firmware-src = {
flake = false;
url = "github:RPi-Distro/bluez-firmware";
};
libcamera-apps-src = {
flake = false;
url = "github:raspberrypi/libcamera-apps/v1.1.1";
};
};
outputs = { self }: {
overlay = import ./overlay;
outputs = srcs@{ self, ... }: {
overlay = import ./overlay (builtins.removeAttrs srcs [ "self" ]);
rpi = import ./rpi { overlay = self.overlay; };
};
}

View file

@ -1,7 +1,9 @@
{ u-boot-src, rpi-linux-5_15-src, rpi-firmware-stable-src
, rpi-firmware-nonfree-src, rpi-bluez-firmware-src, libcamera-apps-src }:
final: prev:
let
# The version to stick at `pkgs.rpi-kernels.latest'
latest = "v5_15_87";
latest = "v5_15_92";
# Helpers for building the `pkgs.rpi-kernels' map.
rpi-kernel = { kernel, version, fw, wireless-fw, argsOverride ? null }:
@ -31,7 +33,8 @@ in {
compressFirmwareXz = x: x;
# A recent known working version of libcamera-apps
libcamera-apps = final.callPackage ./libcamera-apps.nix { };
libcamera-apps =
final.callPackage ./libcamera-apps.nix { inherit libcamera-apps-src; };
# provide generic rpi arm64 u-boot
uboot_rpi_arm64 = prev.buildUBoot rec {
@ -39,10 +42,7 @@ in {
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "u-boot.bin" ];
version = "2023.01";
src = prev.fetchurl {
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
sha256 = "03wm651ix783s4idj223b0nm3r6jrdnrxs1ncs8s128g72nknhk9";
};
src = u-boot-src;
# In raspberry pi sbcs the firmware manipulates the device tree in
# a variety of ways before handing it off to the linux kernel. [1]
# Since we have installed u-boot in place of a linux kernel we may
@ -68,42 +68,15 @@ in {
# `pkgs.rpi-kernels.<VERSION>.{kernel,firmware,wireless-firmware}'.
#
# For example: `pkgs.rpi-kernels.v5_15_87.kernel'
rpi-kernels = rpi-kernels [
{
version = "5.15.36";
kernel = prev.fetchFromGitHub {
owner = "raspberrypi";
repo = "linux";
rev = "9af1cc301e4dffb830025207a54d0bc63bec16c7";
sha256 = "fsMTUdz1XZhPaSXpU1uBV4V4VxoZKi6cwP0QJcrCy1o=";
fetchSubmodules = true;
rpi-kernels = rpi-kernels [{
version = "5.15.92";
kernel = rpi-linux-5_15-src;
fw = rpi-firmware-stable-src;
wireless-fw = import ./raspberrypi-wireless-firmware.nix {
bluez-firmware = rpi-bluez-firmware-src;
firmware-nonfree-src = rpi-firmware-nonfree-src;
};
fw = prev.fetchFromGitHub {
owner = "raspberrypi";
repo = "firmware";
rev = "2cf8a179b3f2e6e5e5ceba4e8e544def10a49020";
sha256 = "YG1bryflbV3W62MhZ/XMSgUJXMhCl/fe86x+CT7XZ4U=";
};
wireless-fw = import ./raspberrypi-wireless-firmware/5.10.36.nix;
}
{
version = "5.15.87";
kernel = prev.fetchFromGitHub {
owner = "raspberrypi";
repo = "linux";
rev = "da4c8e0ffe7a868b989211045657d600be3046a1";
sha256 = "hNLVfhalmRhhRfvu2mR/qDmmGl//Ic1eqR7N1HFj2CY=";
fetchSubmodules = true;
};
fw = prev.fetchFromGitHub {
owner = "raspberrypi";
repo = "firmware";
rev = "78852e166b4cf3ebb31d051e996d54792f0994b0";
sha256 = "tdaH+zZwmILNFBge2gMqtzj/1Hydj9cxhPvhw+7jTrU=";
};
wireless-fw = import ./raspberrypi-wireless-firmware/5.10.87.nix;
}
] // {
}] // {
latest = final.rpi-kernels."${latest}";
};
}

View file

@ -1,17 +1,11 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, pkg-config, libjpeg, libtiff
, libpng, libcamera, libepoxy, boost, libexif }:
{ libcamera-apps-src, lib, stdenv, fetchFromGitHub, fetchpatch, cmake
, pkg-config, libjpeg, libtiff, libpng, libcamera, libepoxy, boost, libexif }:
stdenv.mkDerivation rec {
pname = "libcamera-apps";
version = "v1.1.0";
src = fetchFromGitHub {
owner = "raspberrypi";
repo = "libcamera-apps";
rev = "4fea2eed68300dcc88e89aa30da6079d10dce822";
sha256 = "T6BpC1lEZD00TBZ7SXChKh/m+vKYnVzSTLxBHIEJYn8=";
fetchSubmodules = true;
};
src = libcamera-apps-src;
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ libjpeg libtiff libcamera libepoxy boost libexif libpng ];

View file

@ -1,25 +1,11 @@
{ bluez-firmware-src, firmware-nonfree-src }:
{ lib, stdenvNoCC, fetchFromGitHub }:
stdenvNoCC.mkDerivation {
pname = "raspberrypi-wireless-firmware";
version = "2023-01-19";
srcs = [
(fetchFromGitHub {
name = "bluez-firmware";
owner = "RPi-Distro";
repo = "bluez-firmware";
rev = "9556b08ace2a1735127894642cc8ea6529c04c90";
sha256 = "gKGK0XzNrws5REkKg/JP6SZx3KsJduu53SfH3Dichkc=";
})
(fetchFromGitHub {
name = "firmware-nonfree";
owner = "RPi-Distro";
repo = "firmware-nonfree";
rev = "8e349de20c8cb5d895b3568777ec53cbb333398f";
sha256 = "45/FnaaZTEG6jLmbaXohpNpS6BEZu3DBDHqquq8ukXc=";
})
];
srcs = [ bluez-firmware-src firmware-nonfree-src ];
sourceRoot = ".";

View file

@ -1,56 +0,0 @@
{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation {
pname = "raspberrypi-wireless-firmware";
version = "2021-06-28";
srcs = [
(fetchFromGitHub {
name = "bluez-firmware";
owner = "RPi-Distro";
repo = "bluez-firmware";
rev = "e7fd166981ab4bb9a36c2d1500205a078a35714d";
sha256 = "1dkg8mzn7n4afi50ibrda2s33nw2qj52jjjdv9w560q601gms47b";
})
(fetchFromGitHub {
name = "firmware-nonfree";
owner = "RPi-Distro";
repo = "firmware-nonfree";
rev = "00de3194a96397c913786945ac0af1fd6fbec45b";
sha256 = "1xnr364dkiq6gmr21lcrj23hwc0g9y5qad8dm2maij647bgzp07r";
})
];
sourceRoot = ".";
dontBuild = true;
# Firmware blobs do not need fixing and should not be modified
dontFixup = true;
installPhase = ''
runHook preInstall
mkdir -p "$out/lib/firmware/brcm"
# Wifi firmware
for filename in firmware-nonfree/brcm/brcmfmac434??-sdio.*; do
cp "$filename" "$out/lib/firmware/brcm"
done
# Bluetooth firmware
cp bluez-firmware/broadcom/*.hcd "$out/lib/firmware/brcm"
runHook postInstall
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "0a54gyrq6jfxxvimaa4yjfiyfwf7wv58v0a32l74yrzyarr3ldby";
meta = with lib; {
description =
"Firmware for builtin Wifi/Bluetooth devices in the Raspberry Pi 3+ and Zero W";
homepage = "https://github.com/RPi-Distro/firmware-nonfree";
license = licenses.unfreeRedistributableFirmware;
platforms = platforms.linux;
maintainers = with maintainers; [ lopsided98 ];
};
}

View file

@ -9,6 +9,7 @@
};
};
config = {
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
@ -53,7 +54,8 @@
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
# when attempting to show low-voltage or overtemperature warnings.
avoid_warnings=1
'' ++ config.hardware.raspberry-pi.extra-config;
${config.hardware.raspberry-pi.extra-config}
'';
in ''
(cd ${raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
@ -82,4 +84,5 @@
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
'';
};
};
}