Files
nixpkgs/pkgs/misc/barebox/default.nix
Ben Siraphob 062d2b697e pkgs: fix typos in applications, data, desktops, games and misc
Assisted-by: Claude Code (claude-opus-5)
2026-08-02 11:15:27 -07:00

122 lines
2.3 KiB
Nix

{
stdenv,
lib,
fetchurl,
bison,
dtc,
flex,
libusb1,
lzop,
openssl,
pkg-config,
buildPackages,
lz4,
}:
let
defaultVersion = "2026.06.1";
defaultSrc = fetchurl {
url = "https://www.barebox.org/download/barebox-${defaultVersion}.tar.bz2";
sha256 = "sha256-h1KzdSgZ7EqvhIodBt8FJCpklUUl+xW2zwezw91+vX8=";
};
buildBarebox = lib.makeOverridable (
{
version ? null,
src ? null,
filesToInstall,
installDir ? "$out",
defconfig,
extraMeta ? { },
...
}@args:
stdenv.mkDerivation (finalAttrs: {
pname = "barebox-${defconfig}";
strictDeps = true;
version = if version == null then defaultVersion else version;
src = if src == null then defaultSrc else src;
postPatch = ''
patchShebangs scripts
'';
nativeBuildInputs = [
bison
dtc
flex
lz4
lzop
openssl
pkg-config
];
buildInputs = [
libusb1
lzop
openssl
];
depsBuildBuild = [ buildPackages.stdenv.cc ];
hardeningDisable = [ "all" ];
makeFlags = [
"DTC=dtc"
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
];
configurePhase = ''
runHook preConfigure
make ${defconfig}
runHook postConfigure
'';
installPhase = ''
runHook preInstall
mkdir -p ${installDir}
cp ${lib.concatStringsSep " " filesToInstall} ${installDir}
runHook postInstall
'';
enableParallelBuilding = true;
__structuredAttrs = true;
dontStrip = true;
meta =
with lib;
{
homepage = "https://www.barebox.org";
description = "Swiss Army Knife for bare metal";
license = licenses.gpl2Only;
maintainers = with maintainers; [ emantor ];
}
// extraMeta;
})
// removeAttrs args [ "extraMeta" ]
);
in
{
inherit buildBarebox;
bareboxTools = buildBarebox {
defconfig = "hosttools_defconfig";
installDir = "$out/bin";
extraMeta.platforms = lib.platforms.linux;
filesToInstall = [
"scripts/bareboximd"
"scripts/imx/imx-usb-loader"
"scripts/omap4_usbboot"
"scripts/omap3-usb-loader"
"scripts/kwboot"
"scripts/rk-usb-loader"
];
};
}