nixpkgs/pkgs/misc/barebox/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

106 lines
1.9 KiB
Nix

{
stdenv,
lib,
fetchurl,
bison,
dtc,
flex,
libusb1,
lzop,
openssl,
pkg-config,
buildPackages,
}:
let
buildBarebox =
{
filesToInstall,
installDir ? "$out",
defconfig,
extraMeta ? { },
...
}@args:
stdenv.mkDerivation rec {
pname = "barebox-${defconfig}";
version = "2020.12.0";
src = fetchurl {
url = "https://www.barebox.org/download/barebox-${version}.tar.bz2";
sha256 = "06vsd95ihaa2nywpqy6k0c7xwk2pzws4yvbp328yd2pfiigachrv";
};
postPatch = ''
patchShebangs scripts
'';
nativeBuildInputs = [
bison
dtc
flex
openssl
libusb1
lzop
pkg-config
];
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;
dontStrip = true;
meta =
with lib;
{
homepage = "https://www.barebox.org";
description = "Swiss Army Knive 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"
];
};
}