push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
{
lib,
stdenv,
fetchFromGitHub,
alsa-lib,
cmake,
pkg-config,
glib,
tracingSupport ? true,
logToStderr ? true,
}:
let
oz = x: if x then "1" else "0";
in
stdenv.mkDerivation rec {
pname = "apulse";
version = "0.1.14";
src = fetchFromGitHub {
owner = "i-rinat";
repo = pname;
rev = "v${version}";
sha256 = "sha256-SWvQvS9QBOevOSRpjY3XpyhzWoHAkXzkk8Mh4ovltNI=";
};
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
alsa-lib
glib
];
cmakeFlags = [
"-DWITH_TRACE=${oz tracingSupport}"
"-DLOG_TO_STDERR=${oz logToStderr}"
];
meta = with lib; {
description = "PulseAudio emulation for ALSA";
homepage = "https://github.com/i-rinat/apulse";
license = licenses.mit;
platforms = platforms.linux;
maintainers = [ maintainers.jagajaga ];
mainProgram = "apulse";
};
}

View File

@@ -0,0 +1,91 @@
{
stdenv,
apulse,
libpulseaudio,
pkg-config,
intltool,
}:
stdenv.mkDerivation {
pname = "libpressureaudio";
version = apulse.version;
src = libpulseaudio.src;
nativeBuildInputs = [
pkg-config
intltool
];
dontConfigure = true;
dontBuild = true;
installPhase = ''
echo "Copying libraries from apulse."
mkdir -p $out/lib
ls ${apulse}/lib/apulse $out/lib
cp -a ${apulse}/lib/apulse/* $out/lib/
echo "Copying headers from pulseaudio."
mkdir -p $out/include/pulse
cp -a src/pulse/*.h $out/include/pulse
echo "Generating custom pkgconfig definitions."
mkdir -p $out/lib/pkgconfig
for a in libpulse.pc libpulse-simple.pc libpulse-mainloop-glib.pc ; do
cat > $out/lib/pkgconfig/$a << EOF
prefix=$out
libdir=$out/lib
includedir=$out/include
EOF
done
cat >> $out/lib/pkgconfig/libpulse.pc << EOF
Name: libpulse
Description: PulseAudio Client Interface
Version: ${libpulseaudio.version}-rebootstrapped
Libs: -L$out/lib -lpulse
Cflags: -I$out/include -D_REENTRANT
EOF
cat >> $out/lib/pkgconfig/libpulse-simple.pc << EOF
Name: libpulse-simple
Description: PulseAudio Simplified Synchronous Client Interface
Version: ${libpulseaudio.version}-rebootstrapped
Libs: -L$out/lib -lpulse-simple
Cflags: -I$out/include -D_REENTRANT
Requires: libpulse
EOF
cat >> $out/lib/pkgconfig/libpulse-mainloop-glib.pc << EOF
Name: libpulse-mainloop-glib
Description: PulseAudio GLib 2.0 Main Loop Wrapper
Version: ${libpulseaudio.version}-rebootstrapped
Libs: -L$out/lib -lpulse-mainloop-glib
Cflags: -I$out/include -D_REENTRANT
Requires: libpulse glib-2.0
EOF
'';
meta = apulse.meta // {
description = "Libpulse without any sound daemons over pure ALSA";
longDescription = ''
apulse (${apulse.meta.homepage}) implements most of libpulse
API over pure ALSA in 5% LOC of the original PulseAudio.
But apulse is made to be used as a wrapper that substitutes its
replacement libs into LD_LIBRARY_PATH. The problem with that is
that you still have to link against the original libpulse.
pressureaudio (http://git.r-36.net/pressureaudio/) wraps apulse
with everything you need to replace libpulse completely.
This derivation is a reimplementation of pressureaudio in pure
nix.
You can simply override libpulse with this and most
packages would just work.
'';
};
}

View File

@@ -0,0 +1,209 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchFromGitLab,
openssl,
pkgsCross,
buildPackages,
# Warning: this blob (hdcp.bin) runs on the main CPU (not the GPU) at
# privilege level EL3, which is above both the kernel and the
# hypervisor.
#
# This parameter applies only to platforms which are believed to use
# hdcp.bin. On all other platforms, or if unfreeIncludeHDCPBlob=false,
# hdcp.bin will be deleted before building.
unfreeIncludeHDCPBlob ? true,
}:
let
buildArmTrustedFirmware = lib.makeOverridable (
{
filesToInstall,
installDir ? "$out",
platform ? null,
platformCanUseHDCPBlob ? false, # set this to true if the platform is able to use hdcp.bin
extraMakeFlags ? [ ],
extraMeta ? { },
...
}@args:
# delete hdcp.bin if either: the platform is thought to
# not need it or unfreeIncludeHDCPBlob is false
let
deleteHDCPBlobBeforeBuild = !platformCanUseHDCPBlob || !unfreeIncludeHDCPBlob;
in
stdenv.mkDerivation (
rec {
pname = "arm-trusted-firmware${lib.optionalString (platform != null) "-${platform}"}";
version = "2.13.0";
src = fetchFromGitHub {
owner = "ARM-software";
repo = "arm-trusted-firmware";
tag = "v${version}";
hash = "sha256-rxm5RCjT/MyMCTxiEC8jQeFMrCggrb2DRbs/qDPXb20=";
};
patches = lib.optionals deleteHDCPBlobBeforeBuild [
# this is a rebased version of https://gitlab.com/vicencb/kevinboot/-/blob/master/atf.patch
./remove-hdcp-blob.patch
];
postPatch = lib.optionalString deleteHDCPBlobBeforeBuild ''
rm plat/rockchip/rk3399/drivers/dp/hdcp.bin
'';
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [
pkgsCross.arm-embedded.stdenv.cc # For Cortex-M0 firmware in RK3399
openssl # For fiptool
];
# Make the new toolchain guessing (from 2.11+) happy
# https://github.com/ARM-software/arm-trusted-firmware/blob/4ec2948fe3f65dba2f19e691e702f7de2949179c/make_helpers/toolchains/rk3399-m0.mk#L21-L22
rk3399-m0-oc = "${pkgsCross.arm-embedded.stdenv.cc.targetPrefix}objcopy";
buildInputs = [ openssl ];
makeFlags = [
"HOSTCC=$(CC_FOR_BUILD)"
"M0_CROSS_COMPILE=${pkgsCross.arm-embedded.stdenv.cc.targetPrefix}"
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
# Make the new toolchain guessing (from 2.11+) happy
"CC=${stdenv.cc.targetPrefix}cc"
"LD=${stdenv.cc.targetPrefix}cc"
"AS=${stdenv.cc.targetPrefix}cc"
"OC=${stdenv.cc.targetPrefix}objcopy"
"OD=${stdenv.cc.targetPrefix}objdump"
# Passing OpenSSL path according to docs/design/trusted-board-boot-build.rst
"OPENSSL_DIR=${openssl}"
]
++ (lib.optional (platform != null) "PLAT=${platform}")
++ extraMakeFlags;
installPhase = ''
runHook preInstall
mkdir -p ${installDir}
cp ${lib.concatStringsSep " " filesToInstall} ${installDir}
runHook postInstall
'';
hardeningDisable = [ "all" ];
dontStrip = true;
# breaks secondary CPU bringup on at least RK3588, maybe others
env.NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";
meta =
with lib;
{
homepage = "https://github.com/ARM-software/arm-trusted-firmware";
description = "Reference implementation of secure world software for ARMv8-A";
license = [
licenses.bsd3
]
++ lib.optionals (!deleteHDCPBlobBeforeBuild) [ licenses.unfreeRedistributable ];
maintainers = with maintainers; [ lopsided98 ];
}
// extraMeta;
}
// removeAttrs args [ "extraMeta" ]
)
);
in
{
inherit buildArmTrustedFirmware;
armTrustedFirmwareTools = buildArmTrustedFirmware {
# Normally, arm-trusted-firmware builds the build tools for buildPlatform
# using CC_FOR_BUILD (or as it calls it HOSTCC). Since want to build them
# for the hostPlatform here, we trick it by overriding the HOSTCC setting
# and, to be safe, remove CC_FOR_BUILD from the environment.
depsBuildBuild = [ ];
extraMakeFlags = [
"HOSTCC=${stdenv.cc.targetPrefix}gcc"
"fiptool"
"certtool"
];
filesToInstall = [
"tools/fiptool/fiptool"
"tools/cert_create/cert_create"
];
postInstall = ''
mkdir -p "$out/bin"
find "$out" -type f -executable -exec mv -t "$out/bin" {} +
'';
};
armTrustedFirmwareAllwinner = buildArmTrustedFirmware rec {
platform = "sun50i_a64";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "build/${platform}/release/bl31.bin" ];
};
armTrustedFirmwareAllwinnerH616 = buildArmTrustedFirmware rec {
platform = "sun50i_h616";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "build/${platform}/release/bl31.bin" ];
};
armTrustedFirmwareAllwinnerH6 = buildArmTrustedFirmware rec {
platform = "sun50i_h6";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "build/${platform}/release/bl31.bin" ];
};
armTrustedFirmwareQemu = buildArmTrustedFirmware rec {
platform = "qemu";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [
"build/${platform}/release/bl1.bin"
"build/${platform}/release/bl2.bin"
"build/${platform}/release/bl31.bin"
];
};
armTrustedFirmwareRK3328 = buildArmTrustedFirmware rec {
extraMakeFlags = [ "bl31" ];
platform = "rk3328";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf" ];
};
armTrustedFirmwareRK3399 = buildArmTrustedFirmware rec {
extraMakeFlags = [ "bl31" ];
platform = "rk3399";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf" ];
platformCanUseHDCPBlob = true;
};
armTrustedFirmwareRK3568 = buildArmTrustedFirmware rec {
extraMakeFlags = [ "bl31" ];
platform = "rk3568";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf" ];
};
armTrustedFirmwareRK3588 = buildArmTrustedFirmware rec {
extraMakeFlags = [ "bl31" ];
platform = "rk3588";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf" ];
};
armTrustedFirmwareS905 = buildArmTrustedFirmware rec {
extraMakeFlags = [ "bl31" ];
platform = "gxbb";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "build/${platform}/release/bl31.bin" ];
};
}

View File

@@ -0,0 +1,47 @@
diff --git a/plat/rockchip/rk3399/drivers/dp/cdn_dp.c b/plat/rockchip/rk3399/drivers/dp/cdn_dp.c
index a8773f4f6..8e28c4830 100644
--- a/plat/rockchip/rk3399/drivers/dp/cdn_dp.c
+++ b/plat/rockchip/rk3399/drivers/dp/cdn_dp.c
@@ -13,17 +13,6 @@
#include <cdn_dp.h>
-__asm__(
- ".pushsection .text.hdcp_handler, \"ax\", %progbits\n"
- ".global hdcp_handler\n"
- ".balign 4\n"
- "hdcp_handler:\n"
- ".incbin \"" HDCPFW "\"\n"
- ".type hdcp_handler, %function\n"
- ".size hdcp_handler, .- hdcp_handler\n"
- ".popsection\n"
-);
-
static uint64_t *hdcp_key_pdata;
static struct cdn_dp_hdcp_key_1x key;
@@ -38,7 +27,7 @@ uint64_t dp_hdcp_ctrl(uint64_t type)
return 0;
case HDCP_KEY_DATA_START_DECRYPT:
if (hdcp_key_pdata == (uint64_t *)(&key + 1))
- return hdcp_handler(&key);
+ return PSCI_E_DISABLED;
else
return PSCI_E_INVALID_PARAMS;
assert(0); /* Unreachable */
diff --git a/plat/rockchip/rk3399/platform.mk b/plat/rockchip/rk3399/platform.mk
index a658fb286..5edb6a25b 100644
--- a/plat/rockchip/rk3399/platform.mk
+++ b/plat/rockchip/rk3399/platform.mk
@@ -88,11 +88,6 @@ $(eval $(call add_define_val,RK3399M0PMUFW,\"$(RK3399M0PMUFW)\"))
ifdef PLAT_RK_DP_HDCP
BL31_SOURCES += ${RK_PLAT_SOC}/drivers/dp/cdn_dp.c
-HDCPFW=${RK_PLAT_SOC}/drivers/dp/hdcp.bin
-$(eval $(call add_define_val,HDCPFW,\"$(HDCPFW)\"))
-
-${BUILD_PLAT}/bl31/cdn_dp.o: CCACHE_EXTRAFILES=$(HDCPFW)
-${RK_PLAT_SOC}/drivers/dp/cdn_dp.c: $(HDCPFW)
endif
# CCACHE_EXTRAFILES is needed because ccache doesn't handle .incbin

View File

@@ -0,0 +1,35 @@
{
lib,
buildPythonApplication,
fetchFromGitHub,
i3ipc,
importlib-metadata,
}:
buildPythonApplication rec {
pname = "autotiling";
version = "1.9.3";
format = "setuptools";
src = fetchFromGitHub {
owner = "nwg-piotr";
repo = pname;
tag = "v${version}";
hash = "sha256-k+UiAGMB/fJiE+C737yGdyTpER1ciZrMkZezkcn/4yk=";
};
propagatedBuildInputs = [
i3ipc
importlib-metadata
];
doCheck = false;
meta = with lib; {
homepage = "https://github.com/nwg-piotr/autotiling";
description = "Script for sway and i3 to automatically switch the horizontal / vertical window split orientation";
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ artturin ];
mainProgram = "autotiling";
};
}

View File

@@ -0,0 +1,109 @@
{
lib,
stdenv,
fetchurl,
cups,
perl,
ghostscript,
which,
makeWrapper,
}:
/*
[Setup instructions](http://support.brother.com/g/s/id/linux/en/instruction_prn1a.html).
URI example
~ `lpd://BRW0080927AFBCE/binary_p1`
Logging
-------
`/tmp/br_lpdfilter_ml1.log` when `$ENV{LPD_DEBUG} > 0` in `filter_BrGenML1`
which is activated automatically when `DEBUG > 0` in `brother_lpdwrapper_BrGenML1`
from the cups wrapper.
Issues
------
- filter_BrGenML1 ln 196 `my $GHOST_SCRIPT=`which gs`;`
`GHOST_SCRIPT` is empty resulting in an empty `/tmp/br_lpdfilter_ml1_gsout.dat` file.
See `/tmp/br_lpdfilter_ml1.log` for the executed command.
Notes
-----
- The `setupPrintcap` has totally no use in our context.
*/
let
myPatchElf = file: ''
patchelf --set-interpreter \
${stdenv.cc.libc}/lib/ld-linux${lib.optionalString stdenv.hostPlatform.is64bit "-x86-64"}.so.2 \
${file}
'';
in
stdenv.mkDerivation rec {
pname = "brgenml1lpr";
version = "3.1.0-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf101123/brgenml1lpr-${version}.i386.deb";
sha256 = "0zdvjnrjrz9sba0k525linxp55lr4cyivfhqbkq1c11br2nvy09f";
};
unpackPhase = ''
ar x $src
tar xfvz data.tar.gz
'';
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
perl
stdenv.cc.libc
ghostscript
which
];
dontBuild = true;
patchPhase = ''
INFDIR=opt/brother/Printers/BrGenML1/inf
LPDDIR=opt/brother/Printers/BrGenML1/lpd
# Setup max debug log by default.
substituteInPlace $LPDDIR/filter_BrGenML1 \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/BrGenML1\"; #" \
--replace "PRINTER =~" "PRINTER = \"BrGenML1\"; #"
${myPatchElf "$INFDIR/braddprinter"}
${myPatchElf "$LPDDIR/brprintconflsr3"}
${myPatchElf "$LPDDIR/rawtobr3"}
'';
installPhase = ''
INFDIR=opt/brother/Printers/BrGenML1/inf
LPDDIR=opt/brother/Printers/BrGenML1/lpd
mkdir -p $out/$INFDIR
cp -rp $INFDIR/* $out/$INFDIR
mkdir -p $out/$LPDDIR
cp -rp $LPDDIR/* $out/$LPDDIR
wrapProgram $out/$LPDDIR/filter_BrGenML1 \
--prefix PATH ":" "${ghostscript}/bin" \
--prefix PATH ":" "${which}/bin"
'';
dontPatchELF = true;
meta = {
description = "Brother BrGenML1 LPR driver";
homepage = "http://www.brother.com";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
platforms = lib.platforms.linux;
license = lib.licenses.unfreeRedistributable;
maintainers = with lib.maintainers; [ jraygauthier ];
};
}

View File

@@ -0,0 +1,127 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
gnugrep,
which,
gawk,
}:
let
version = "1.1.3";
model = "dcp375cw";
in
{
driver = stdenv.mkDerivation {
pname = "${model}-lpr";
inherit version;
src = fetchurl {
url = "https://download.brother.com/welcome/dlf005427/dcp375cwlpr-${version}-1.i386.deb";
sha256 = "6daf0144b5802ea8da394ca14db0e6f0200d4049545649283791f899b7f7bd26";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
buildInputs = [
cups
ghostscript
a2ps
gawk
];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
substituteInPlace $out/opt/brother/Printers/${model}/lpd/filter${model} \
--replace /opt "$out/opt"
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/opt/brother/Printers/${model}/lpd/br${model}filter
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/${model}/lpd/filter${model} $out/lib/cups/filter/brlpdwrapper${model}
wrapProgram $out/opt/brother/Printers/${model}/lpd/filter${model} \
--prefix PATH ":" ${
lib.makeBinPath [
gawk
ghostscript
a2ps
file
gnused
gnugrep
coreutils
which
]
}
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother ${model} printer driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_all&os=128";
maintainers = with maintainers; [ marcovergueira ];
};
};
cupswrapper = stdenv.mkDerivation {
pname = "${model}-cupswrapper";
inherit version;
src = fetchurl {
url = "https://download.brother.com/welcome/dlf005429/dcp375cwcupswrapper-${version}-1.i386.deb";
sha256 = "9a255728b595d2667b2caf9d0d332b677e1a6829a3ec1ed6d4e900a44069cf2d";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
buildInputs = [
cups
ghostscript
a2ps
gawk
];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
for f in $out/opt/brother/Printers/${model}/cupswrapper/cupswrapper${model}; do
wrapProgram $f --prefix PATH : ${
lib.makeBinPath [
coreutils
ghostscript
gnugrep
gnused
]
}
done
mkdir -p $out/share/cups/model
ln -s $out/opt/brother/Printers/${model}/cupswrapper/brother_${model}_printer_en.ppd $out/share/cups/model/
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother ${model} printer CUPS wrapper driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_all&os=128";
maintainers = with maintainers; [ marcovergueira ];
};
};
}

View File

@@ -0,0 +1,127 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
gnugrep,
which,
gawk,
}:
let
version = "1.1.2";
model = "dcp9020cdw";
in
{
driver = stdenv.mkDerivation {
pname = "${model}-lpr";
inherit version;
src = fetchurl {
url = "https://download.brother.com/welcome/dlf100441/dcp9020cdwlpr-${version}-1.i386.deb";
sha256 = "1z6nma489s0a0b0a8wyg38yxanz4k99dg29fyjs4jlprsvmwk56y";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
buildInputs = [
cups
ghostscript
a2ps
gawk
];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
substituteInPlace $out/opt/brother/Printers/${model}/lpd/filter${model} \
--replace /opt "$out/opt"
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/opt/brother/Printers/${model}/lpd/br${model}filter
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/${model}/lpd/filter${model} $out/lib/cups/filter/brother_lpdwrapper_${model}
wrapProgram $out/opt/brother/Printers/${model}/lpd/filter${model} \
--prefix PATH ":" ${
lib.makeBinPath [
gawk
ghostscript
a2ps
file
gnused
gnugrep
coreutils
which
]
}
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother ${model} printer driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_eu&os=128";
maintainers = with maintainers; [ pshirshov ];
};
};
cupswrapper = stdenv.mkDerivation {
pname = "${model}-cupswrapper";
inherit version;
src = fetchurl {
url = "https://download.brother.com/welcome/dlf100443/dcp9020cdwcupswrapper-${version}-1.i386.deb";
sha256 = "04yqm1qv9p4hgp1p6mqq4siygl4056s6flv6kqln8mvmcr8zaq1s";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
buildInputs = [
cups
ghostscript
a2ps
gawk
];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
for f in $out/opt/brother/Printers/${model}/cupswrapper/cupswrapper${model}; do
wrapProgram $f --prefix PATH : ${
lib.makeBinPath [
coreutils
ghostscript
gnugrep
gnused
]
}
done
mkdir -p $out/share/cups/model
ln -s $out/opt/brother/Printers/${model}/cupswrapper/brother_${model}_printer_en.ppd $out/share/cups/model/
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother ${model} printer CUPS wrapper driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=gb&lang=en&prod=${model}_eu&os=128";
maintainers = with maintainers; [ pshirshov ];
};
};
}

View File

@@ -0,0 +1,116 @@
{
pkgsi686Linux,
stdenv,
fetchurl,
dpkg,
makeWrapper,
coreutils,
ghostscript,
gnugrep,
gnused,
which,
perl,
lib,
}:
let
model = "mfcl3770cdw";
version = "1.0.2-0";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf103935/${model}pdrv-${version}.i386.deb";
sha256 = "09fhbzhpjymhkwxqyxzv24b06ybmajr6872yp7pri39595mhrvay";
};
reldir = "opt/brother/Printers/${model}/";
in
rec {
driver = pkgsi686Linux.stdenv.mkDerivation rec {
inherit src version;
name = "${model}drv-${version}";
nativeBuildInputs = [
dpkg
makeWrapper
];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
dir="$out/${reldir}"
substituteInPlace $dir/lpd/filter_${model} \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$dir\"; #" \
--replace "PRINTER =~" "PRINTER = \"${model}\"; #"
wrapProgram $dir/lpd/filter_${model} \
--prefix PATH : ${
lib.makeBinPath [
coreutils
ghostscript
gnugrep
gnused
which
]
}
# need to use i686 glibc here, these are 32bit proprietary binaries
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
$dir/lpd/brmfcl3770cdwfilter
'';
meta = {
description = "Brother ${lib.strings.toUpper model} driver";
homepage = "http://www.brother.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = [
"x86_64-linux"
"i686-linux"
];
maintainers = [ lib.maintainers.steveej ];
};
};
cupswrapper = stdenv.mkDerivation rec {
inherit version src;
name = "${model}cupswrapper-${version}";
nativeBuildInputs = [
dpkg
makeWrapper
];
unpackPhase = "dpkg-deb -x $src $out";
installPhase = ''
basedir=${driver}/${reldir}
dir=$out/${reldir}
substituteInPlace $dir/cupswrapper/brother_lpdwrapper_${model} \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "basedir =~" "basedir = \"$basedir\"; #" \
--replace "PRINTER =~" "PRINTER = \"${model}\"; #"
wrapProgram $dir/cupswrapper/brother_lpdwrapper_${model} \
--prefix PATH : ${
lib.makeBinPath [
coreutils
gnugrep
gnused
]
}
mkdir -p $out/lib/cups/filter
mkdir -p $out/share/cups/model
ln $dir/cupswrapper/brother_lpdwrapper_${model} $out/lib/cups/filter
ln $dir/cupswrapper/brother_${model}_printer_en.ppd $out/share/cups/model
'';
meta = {
description = "Brother ${lib.strings.toUpper model} CUPS wrapper driver";
homepage = "http://www.brother.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.gpl2Plus;
platforms = [
"x86_64-linux"
"i686-linux"
];
maintainers = [ lib.maintainers.steveej ];
};
};
}

View File

@@ -0,0 +1,145 @@
{
stdenv,
lib,
fetchzip,
autoconf,
automake,
libtool,
cups,
popt,
libtiff,
libpng,
ghostscript,
}:
/*
this derivation is basically just a transcription of the rpm .spec
file included in the tarball
*/
stdenv.mkDerivation {
pname = "cnijfilter";
/*
important note about versions: cnijfilter packages seem to use
versions in a non-standard way. the version indicates which
printers are supported in the package. so this package should
not be "upgraded" in the usual way.
instead, if you want to include another version supporting your
printer, you should try to abstract out the common things (which
should be pretty much everything except the version and the 'pr'
and 'pr_id' values to loop over).
*/
version = "2.80";
src = fetchzip {
url = "http://gdlp01.c-wss.com/gds/1/0100000841/01/cnijfilter-common-2.80-1.tar.gz";
sha256 = "06s9nl155yxmx56056y22kz1p5b2sb5fhr3gf4ddlczjkd1xch53";
};
nativeBuildInputs = [
autoconf
automake
];
buildInputs = [
libtool
cups
popt
libtiff
libpng
ghostscript
];
env.NIX_CFLAGS_COMPILE = " -std=gnu90";
patches = [
./patches/missing-include.patch
./patches/libpng15.patch
];
postPatch = ''
sed -i "s|/usr/lib/cups/backend|$out/lib/cups/backend|" backend/src/Makefile.am;
sed -i "s|/usr|$out|" backend/src/cnij_backend_common.c;
sed -i "s|/usr/bin|${ghostscript}/bin|" pstocanonij/filter/pstocanonij.c;
sed -i "s|/usr/local|$out|" libs/bjexec/bjexec.c;
'';
configurePhase = ''
cd libs
./autogen.sh --prefix=$out;
cd ../cngpij
./autogen.sh --prefix=$out --enable-progpath=$out/bin;
cd ../pstocanonij
./autogen.sh --prefix=$out --enable-progpath=$out/bin;
cd ../backend
./autogen.sh --prefix=$out;
cd ..;
'';
preInstall = ''
mkdir -p $out/bin $out/lib/cups/filter $out/share/cups/model;
'';
postInstall = ''
for pr in mp140 mp210 ip3500 mp520 ip4500 mp610; do
cd ppd;
./autogen.sh --prefix=$out --program-suffix=$pr
make clean;
make;
make install;
cd ../cnijfilter;
./autogen.sh --prefix=$out --program-suffix=$pr --enable-libpath=/var/lib/cups/path/lib/bjlib --enable-binpath=$out/bin;
make clean;
make;
make install;
cd ..;
done;
mkdir -p $out/lib/bjlib;
for pr_id in 315 316 319 328 326 327; do
install -c -m 755 $pr_id/database/* $out/lib/bjlib;
install -c -s -m 755 $pr_id/libs_bin/*.so.* $out/lib;
done;
pushd $out/lib;
for so_file in *.so.*; do
ln -s $so_file ''${so_file/.so.*/}.so;
patchelf --set-rpath $out/lib $so_file;
done;
popd;
'';
/*
the tarball includes some pre-built shared libraries. we run
'patchelf --set-rpath' on them just a few lines above, so that
they can find each other. but that's not quite enough. some of
those libraries load each other in non-standard ways -- they
don't list each other in the DT_NEEDED section. so, if the
standard 'patchelf --shrink-rpath' (from
pkgs/development/tools/misc/patchelf/setup-hook.sh) is run on
them, it undoes the --set-rpath. this prevents that.
*/
dontPatchELF = true;
# fortify hardening makes the filter crash
# https://github.com/NixOS/nixpkgs/issues/276125
hardeningDisable = [ "fortify3" ];
meta = with lib; {
description = "Canon InkJet printer drivers for the iP5400, MP520, MP210, MP140, iP3500, and MP610 series. (MP520 drivers also work for MX700.)";
homepage = "http://support-asia.canon-asia.com/content/EN/0100084101.html";
sourceProvenance = with sourceTypes; [
fromSource
binaryNativeCode
];
license = licenses.unfree;
platforms = platforms.linux;
maintainers = with maintainers; [ jerith666 ];
};
}

View File

@@ -0,0 +1,23 @@
diff -aur cnijfilter-source-3.20-1/cnijfilter/src/bjfimage.c cnijfilter-source-3.20-1.new/cnijfilter/src/bjfimage.c
--- cnijfilter-source-3.20-1/cnijfilter/src/bjfimage.c 2009-03-26 06:11:05.000000000 +0100
+++ cnijfilter-source-3.20-1.new/cnijfilter/src/bjfimage.c 2012-02-10 09:33:52.512334139 +0100
@@ -1520,8 +1520,8 @@
short tmpformat;
short retbyte = 0;
short bpp = 3;
- long width = 0;
- long length = 0;
+ png_uint_32 width = 0;
+ png_uint_32 length = 0;
long rstep = 0;
long RasterLength = 0;
long i;
@@ -1574,7 +1574,7 @@
goto onErr;
}
- if (setjmp (png_p->jmpbuf))
+ if (setjmp (png_jmpbuf(png_p)))
{
png_destroy_read_struct(&png_p, &info_p, (png_infopp)NULL);
goto onErr;

View File

@@ -0,0 +1,20 @@
--- a/backend/src/cnij_backend_common.c 2008-09-01 10:05:44.000000000 +0200
+++ b/backend/src/cnij_backend_common.c 2012-05-06 17:38:40.000000000 +0200
@@ -39,6 +39,7 @@
// CUPS Header
#include <cups/cups.h>
#include <cups/ipp.h>
+#include <cups/ppd.h>
// Header file for CANON
#include "cnij_backend_common.h"
--- a/cngpijmon/src/bjcupsmon_cups.c 2008-09-02 12:28:24.000000000 +0200
+++ b/cngpijmon/src/bjcupsmon_cups.c 2012-05-06 17:39:20.000000000 +0200
@@ -21,6 +21,7 @@
/*** Includes ***/
#include <cups/cups.h>
#include <cups/language.h>
+#include <cups/ppd.h>
#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>

View File

@@ -0,0 +1,117 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
gawk,
}:
let
version = "3.0.1-1";
cupsdeb = fetchurl {
url = "http://download.brother.com/welcome/dlf100421/hl1110cupswrapper-${version}.i386.deb";
sha256 = "a87880f4ece764a724411b5b24d15d1b912f6ffc6ecbfd9fac4cd5eda13d2eb7";
};
srcdir = "hl1110cupswrapper-GPL_src-${version}";
cupssrc = fetchurl {
url = "http://download.brother.com/welcome/dlf100422/${srcdir}.tar.gz";
sha256 = "be1dce6a4608cb253b0b382db30bf5885da46b010e8eb595b15c435e2487761c";
};
lprdeb = fetchurl {
url = "http://download.brother.com/welcome/dlf100419/hl1110lpr-${version}.i386.deb";
sha256 = "5af241782a0d500d7f47e06ea43d61127f4019b5b1c6e68b4c1cb4521a742c22";
};
in
stdenv.mkDerivation {
pname = "cups-brother-hl1110";
inherit version;
srcs = [
lprdeb
cupssrc
cupsdeb
];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
ghostscript
dpkg
a2ps
];
unpackPhase = ''
tar -xvf ${cupssrc}
'';
buildPhase = ''
gcc -Wall ${srcdir}/brcupsconfig/brcupsconfig.c -o brcupsconfig4
'';
installPhase = ''
# install lpr
dpkg-deb -x ${lprdeb} $out
substituteInPlace $out/opt/brother/Printers/HL1110/lpd/filter_HL1110 \
--replace /opt "$out/opt" \
sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/HL1110/lpd/psconvert2
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1110/lpd/brprintconflsr3
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1110/lpd/rawtobr3
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1110/inf/braddprinter
wrapProgram $out/opt/brother/Printers/HL1110/lpd/psconvert2 \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
wrapProgram $out/opt/brother/Printers/HL1110/lpd/filter_HL1110 \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
a2ps
file
gnused
coreutils
]
}
dpkg-deb -x ${cupsdeb} $out
substituteInPlace $out/opt/brother/Printers/HL1110/cupswrapper/brother_lpdwrapper_HL1110 --replace /opt "$out/opt"
mkdir -p $out/lib/cups/filter
ln -s $out/opt/brother/Printers/HL1110/cupswrapper/brother_lpdwrapper_HL1110 $out/lib/cups/filter/brother_lpdwrapper_HL1110
ln -s $out/opt/brother/Printers/HL1110/cupswrapper/brother-HL1110-cups-en.ppd $out/lib/cups/filter/brother-HL1110-cups-en.ppd
cp brcupsconfig4 $out/opt/brother/Printers/HL1110/cupswrapper/
ln -s $out/opt/brother/Printers/HL1110/cupswrapper/brcupsconfig4 $out/lib/cups/filter/brcupsconfig4
wrapProgram $out/opt/brother/Printers/HL1110/cupswrapper/brother_lpdwrapper_HL1110 \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
'';
meta = {
homepage = "http://www.brother.com/";
description = "Brother HL1110 printer driver";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
downloadPage = "http://support.brother.com/g/b/downloadlist.aspx?c=eu_ot&lang=en&prod=hl1110_us_eu_as&os=128#SelectLanguageType-561_0_1";
};
}

View File

@@ -0,0 +1,106 @@
{
lib,
stdenv,
pkgsi686Linux,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
gawk,
}:
let
version = "3.0.1-1";
cupsdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf101546/hl1210wcupswrapper-${version}.i386.deb";
sha256 = "0395mnw6c7qpjgjch9in5q9p2fjdqvz9bwfwp6q1hzhs08ryk7w0";
};
lprdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf101547/hl1210wlpr-${version}.i386.deb";
sha256 = "1sl3g2cd4a2gygryrr27ax3qaa65cbirz3kzskd8afkwqpmjyv7j";
};
in
stdenv.mkDerivation {
pname = "cups-brother-hl1210W";
inherit version;
srcs = [
lprdeb
cupsdeb
];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
ghostscript
dpkg
a2ps
];
dontUnpack = true;
installPhase = ''
# install lpr
dpkg-deb -x ${lprdeb} $out
substituteInPlace $out/opt/brother/Printers/HL1210W/lpd/filter_HL1210W \
--replace /opt "$out/opt"
sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/HL1210W/lpd/psconvert2
patchelf --set-interpreter ${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1210W/lpd/brprintconflsr3
patchelf --set-interpreter ${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1210W/lpd/rawtobr3
patchelf --set-interpreter ${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 $out/opt/brother/Printers/HL1210W/inf/braddprinter
wrapProgram $out/opt/brother/Printers/HL1210W/lpd/psconvert2 \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
wrapProgram $out/opt/brother/Printers/HL1210W/lpd/filter_HL1210W \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
a2ps
file
gnused
coreutils
]
}
# install cups
dpkg-deb -x ${cupsdeb} $out
substituteInPlace $out/opt/brother/Printers/HL1210W/cupswrapper/brother_lpdwrapper_HL1210W --replace /opt "$out/opt"
mkdir -p $out/lib/cups/filter $out/share/cups/model
ln -s $out/opt/brother/Printers/HL1210W/cupswrapper/brother_lpdwrapper_HL1210W $out/lib/cups/filter/brother_lpdwrapper_HL1210W
ln -s $out/opt/brother/Printers/HL1210W/cupswrapper/brother-HL1210W-cups-en.ppd $out/share/cups/model/
# cp brcupsconfig4 $out/opt/brother/Printers/HL1110/cupswrapper/
ln -s $out/opt/brother/Printers/HL1210W/cupswrapper/brcupsconfig4 $out/lib/cups/filter/brcupsconfig4
wrapProgram $out/opt/brother/Printers/HL1210W/cupswrapper/brother_lpdwrapper_HL1210W \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
'';
meta = {
homepage = "http://www.brother.com/";
description = "Brother HL1210W printer driver";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=nz&lang=en&prod=hl1210w_eu_as&os=128";
};
}

View File

@@ -0,0 +1,122 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
coreutils,
perl,
gnugrep,
which,
debugLvl ? "0",
}:
let
version = "3.2.0-1";
lprdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf102692/hl2260dlpr-${version}.i386.deb";
hash = "sha256-R+cM2SKc/MP6keo3PUrKXPC6a2dEQQdBunrpNtAHlH0=";
};
cupsdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf102693/hl2260dcupswrapper-${version}.i386.deb";
hash = "sha256-k6+ulZVoFTpEY6WJ9TO9Rzp2c4dwPqL3NY5/XYJpvOc=";
};
in
stdenv.mkDerivation {
pname = "cups-brother-hl2260d";
inherit version;
nativeBuildInputs = [
makeWrapper
dpkg
];
buildInputs = [
cups
ghostscript
perl
];
dontPatchELF = true;
dontBuild = true;
unpackPhase = ''
mkdir -p $out
dpkg-deb -x ${cupsdeb} $out
dpkg-deb -x ${lprdeb} $out
'';
patchPhase = ''
# Patch lpr
INFDIR=$out/opt/brother/Printers/HL2260D/inf
LPDDIR=$out/opt/brother/Printers/HL2260D/lpd
substituteInPlace $LPDDIR/filter_HL2260D \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/HL2260D\"; #" \
--replace "PRINTER =~" "PRINTER = \"HL2260D\"; #"
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$INFDIR/braddprinter
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$LPDDIR/brprintconflsr3
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$LPDDIR/rawtobr3
# Patch cupswrapper
WRAPPER=$out/opt/brother/Printers/HL2260D/cupswrapper/brother_lpdwrapper_HL2260D
PAPER_CFG=$out/opt/brother/Printers/HL2260D/cupswrapper/paperconfigml1
substituteInPlace $WRAPPER \
--replace "basedir =~" "basedir = \"$out/opt/brother/Printers/HL2260D\"; #" \
--replace "PRINTER =~" "PRINTER = \"HL2260D\"; #" \
--replace "\$DEBUG=0;" "\$DEBUG=${debugLvl};"
substituteInPlace $WRAPPER \
--replace "\`cp " "\`cp -p " \
--replace "\$TEMPRC\`" "\$TEMPRC; chmod a+rw \$TEMPRC\`" \
--replace "\`mv " "\`cp -p "
# This config script make this assumption that the *.ppd are found in a global location `/etc/cups/ppd`.
substituteInPlace $PAPER_CFG \
--replace "/etc/cups/ppd" "$out/share/cups/model"
'';
installPhase = ''
mkdir -p $out/share/cups/model
ln -s $out/opt/brother/Printers/HL2260D/cupswrapper/brother-HL2260D-cups-en.ppd $out/share/cups/model
mkdir -p $out/lib/cups/filter/
makeWrapper \
$out/opt/brother/Printers/HL2260D/cupswrapper/brother_lpdwrapper_HL2260D \
$out/lib/cups/filter/brother_lpdwrapper_HL2260D \
--prefix PATH : ${
lib.makeBinPath [
coreutils
gnugrep
gnused
]
}
wrapProgram $out/opt/brother/Printers/HL2260D/lpd/filter_HL2260D \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
which
]
}
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother HL-2260D printer driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [
"x86_64-linux"
"i686-linux"
];
downloadPage = "https://support.brother.com/g/b/downloadtop.aspx?c=cn_ot&lang=en&prod=hl2260d_cn";
maintainers = with maintainers; [ u2x1 ];
};
}

View File

@@ -0,0 +1,120 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
gawk,
}:
let
version = "1.1.4-0";
cupsdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf007070/hl3140cwcupswrapper-${version}.i386.deb";
sha256 = "a76281828ca6ee86c63034673577fadcf5f24e8ed003213bdbb6bf47a7aced6f";
};
srcdir = "hl3140cw_cupswrapper_GPL_source_${version}";
cupssrc = fetchurl {
url = "https://download.brother.com/welcome/dlf006740/${srcdir}.tar.gz";
sha256 = "1wp85rbvbar6rqqkaffymxjpls6jx9m9230dlrpqwy5akiaxf0rl";
};
lprdeb = fetchurl {
url = "https://support.brother.com/g/b/files/dlf/dlf007068/hl3140cwlpr-1.1.2-1.i386.deb";
sha256 = "601f392b52ed7080f71b780181823bb8f6abfd0591146b452ba1f23e21f9f865";
};
in
stdenv.mkDerivation {
pname = "cups-brother-hl3140cw";
inherit version;
nativeBuildInputs = [
makeWrapper
dpkg
];
buildInputs = [
cups
ghostscript
a2ps
];
unpackPhase = ''
tar -xvf ${cupssrc}
'';
buildPhase = ''
gcc -Wall ${srcdir}/brcupsconfig/brcupsconfig.c -o brcupsconfpt1
'';
installPhase = ''
# install lpr
dpkg-deb -x ${lprdeb} $out
substituteInPlace $out/opt/brother/Printers/hl3140cw/lpd/filterhl3140cw \
--replace /opt "$out/opt"
substituteInPlace $out/opt/brother/Printers/hl3140cw/inf/setupPrintcapij \
--replace /opt "$out/opt"
sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/hl3140cw/lpd/psconvertij2
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/hl3140cw/lpd/brhl3140cwfilter
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/usr/bin/brprintconf_hl3140cw
wrapProgram $out/opt/brother/Printers/hl3140cw/lpd/psconvertij2 \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
wrapProgram $out/opt/brother/Printers/hl3140cw/lpd/filterhl3140cw \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
a2ps
file
gnused
coreutils
]
}
dpkg-deb -x ${cupsdeb} $out
substituteInPlace $out/opt/brother/Printers/hl3140cw/cupswrapper/cupswrapperhl3140cw \
--replace /opt "$out/opt"
mkdir -p $out/lib/cups/filter
ln -s $out/opt/brother/Printers/hl3140cw/cupswrapper/cupswrapperhl3140cw $out/lib/cups/filter/cupswrapperhl3140cw
ln -s $out/opt/brother/Printers/hl3140cw/cupswrapper/brother_hl3140cw_printer_en.ppd $out/lib/cups/filter/brother_hl3140cw_printer_en.ppd
cp brcupsconfpt1 $out/opt/brother/Printers/hl3140cw/cupswrapper/
ln -s $out/opt/brother/Printers/hl3140cw/cupswrapper/brcupsconfpt1 $out/lib/cups/filter/brcupsconfpt1
ln -s $out/opt/brother/Printers/hl3140cw/lpd/filterhl3140cw $out/lib/cups/filter/brother_lpdwrapper_hl3140cw
wrapProgram $out/opt/brother/Printers/hl3140cw/cupswrapper/cupswrapperhl3140cw \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
'';
meta = {
homepage = "http://www.brother.com/";
description = "Brother hl3140cw printer driver";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=eu_ot&lang=en&prod=hl3140cw_us_eu&os=128";
};
}

View File

@@ -0,0 +1,105 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
gnused,
makeWrapper,
ghostscript,
file,
a2ps,
coreutils,
perl,
gnugrep,
which,
}:
let
version = "3.2.0-1";
lprdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf101912/hll2340dlpr-${version}.i386.deb";
sha256 = "c0ae98b49b462cd8fbef445550f2177ce9d8bf627c904e182daa8cbaf8781e50";
};
cupsdeb = fetchurl {
url = "https://download.brother.com/welcome/dlf101913/hll2340dcupswrapper-${version}.i386.deb";
sha256 = "8aa24a6a825e3a4d5b51778cb46fe63032ec5a731ace22f9ef2b0ffcc2033cc9";
};
in
stdenv.mkDerivation {
pname = "cups-brother-hll2340dw";
inherit version;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
ghostscript
dpkg
a2ps
];
dontUnpack = true;
installPhase = ''
mkdir -p $out
dpkg-deb -x ${cupsdeb} $out
dpkg-deb -x ${lprdeb} $out
substituteInPlace $out/opt/brother/Printers/HLL2340D/lpd/filter_HLL2340D \
--replace /opt "$out/opt" \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/HLL2340D/\"; #" \
--replace "PRINTER =~" "PRINTER = \"HLL2340D\"; #"
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/opt/brother/Printers/HLL2340D/lpd/brprintconflsr3
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/opt/brother/Printers/HLL2340D/lpd/rawtobr3
for f in \
$out/opt/brother/Printers/HLL2340D/cupswrapper/brother_lpdwrapper_HLL2340D \
$out/opt/brother/Printers/HLL2340D/cupswrapper/paperconfigml1 \
; do
wrapProgram $f \
--prefix PATH : ${
lib.makeBinPath [
coreutils
ghostscript
gnugrep
gnused
]
}
done
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/HLL2340D/lpd/filter_HLL2340D $out/lib/cups/filter/brother_lpdwrapper_HLL2340D
mkdir -p $out/share/cups/model
ln -s $out/opt/brother/Printers/HLL2340D/cupswrapper/brother-HLL2340D-cups-en.ppd $out/share/cups/model/
wrapProgram $out/opt/brother/Printers/HLL2340D/lpd/filter_HLL2340D \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
a2ps
file
gnused
gnugrep
coreutils
which
]
}
'';
meta = with lib; {
homepage = "http://www.brother.com/";
description = "Brother hl-l2340dw printer driver";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = platforms.linux;
downloadPage = "https://support.brother.com/g/b/downloadlist.aspx?c=us&lang=es&prod=hll2340dw_us_eu_as&os=128&flang=English";
maintainers = [ maintainers.qknight ];
};
}

View File

@@ -0,0 +1,97 @@
{
stdenv,
lib,
fetchurl,
perl,
gnused,
dpkg,
makeWrapper,
autoPatchelfHook,
libredirect,
}:
stdenv.mkDerivation rec {
pname = "cups-brother-hll3230cdw";
version = "1.0.2";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf103925/hll3230cdwpdrv-${version}-0.i386.deb";
sha256 = "9d49abc584bf22bc381510618a34107ead6ab14562b51831fefd6009947aa5a9";
};
nativeBuildInputs = [
dpkg
makeWrapper
autoPatchelfHook
];
buildInputs = [
perl
gnused
libredirect
];
unpackPhase = "dpkg-deb -x $src .";
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -pr opt "$out"
cp -pr usr/bin "$out/bin"
rm "$out/opt/brother/Printers/hll3230cdw/cupswrapper/cupswrapperhll3230cdw"
mkdir -p "$out/lib/cups/filter" "$out/share/cups/model"
ln -s "$out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_lpdwrapper_hll3230cdw" \
"$out/lib/cups/filter/brother_lpdwrapper_hll3230cdw"
ln -s "$out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_hll3230cdw_printer_en.ppd" \
"$out/share/cups/model/brother_hll3230cdw_printer_en.ppd"
runHook postInstall
'';
# Fix global references and replace auto discovery mechanism
# with hardcoded values.
#
# The configuration binary 'brprintconf_hll3230cdw' and lpd filter
# 'brhll3230cdwfilter' has hardcoded /opt format strings. There isn't
# sufficient space in the binaries to substitute a path in the store, so use
# libredirect to get it to see the correct path. The configuration binary
# also uses this format string to print configuration locations. Here the
# wrapper output is processed to point into the correct location in the
# store.
postFixup = ''
substituteInPlace $out/opt/brother/Printers/hll3230cdw/lpd/filter_hll3230cdw \
--replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/hll3230cdw/\"; #" \
--replace "PRINTER =~" "PRINTER = \"hll3230cdw\"; #"
substituteInPlace $out/opt/brother/Printers/hll3230cdw/cupswrapper/brother_lpdwrapper_hll3230cdw \
--replace "PRINTER =~" "PRINTER = \"hll3230cdw\"; #" \
--replace "my \$basedir = \`readlink \$0\`" "my \$basedir = \"$out/opt/brother/Printers/hll3230cdw/\""
wrapProgram $out/bin/brprintconf_hll3230cdw \
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS /opt=$out/opt
wrapProgram $out/opt/brother/Printers/hll3230cdw/lpd/brhll3230cdwfilter \
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS /opt=$out/opt
substituteInPlace $out/bin/brprintconf_hll3230cdw \
--replace \"\$"@"\" \"\$"@\" | LD_PRELOAD= ${gnused}/bin/sed -E '/^(function list :|resource file :).*/{s#/opt#$out/opt#}'"
'';
meta = with lib; {
description = "Brother HL-L3230CDW printer driver";
license = licenses.unfree;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; [ aplund ];
platforms = [
"x86_64-linux"
"i686-linux"
];
homepage = "http://www.brother.com/";
downloadPage = "https://support.brother.com/g/b/downloadend.aspx?c=us&lang=en&prod=hll3230cdw_us_eu_as&os=128&dlid=dlf103925_000&flang=4&type3=10283";
};
}

View File

@@ -0,0 +1,78 @@
{
lib,
stdenv,
fetchurl,
cups,
dpkg,
ghostscript,
a2ps,
coreutils,
gnused,
gawk,
file,
makeWrapper,
}:
stdenv.mkDerivation rec {
pname = "mfcj470dw-cupswrapper";
version = "3.0.0-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf006843/mfcj470dwlpr-${version}.i386.deb";
sha256 = "7202dd895d38d50bb767080f2995ed350eed99bc2b7871452c3c915c8eefc30a";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
ghostscript
dpkg
a2ps
];
dontUnpack = true;
installPhase = ''
dpkg-deb -x $src $out
substituteInPlace $out/opt/brother/Printers/mfcj470dw/lpd/filtermfcj470dw \
--replace /opt "$out/opt" \
sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/mfcj470dw/lpd/psconvertij2
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/opt/brother/Printers/mfcj470dw/lpd/brmfcj470dwfilter
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/mfcj470dw/lpd/filtermfcj470dw $out/lib/cups/filter/brother_lpdwrapper_mfcj470dw
wrapProgram $out/opt/brother/Printers/mfcj470dw/lpd/psconvertij2 \
--prefix PATH ":" ${
lib.makeBinPath [
gnused
coreutils
gawk
]
}
wrapProgram $out/opt/brother/Printers/mfcj470dw/lpd/filtermfcj470dw \
--prefix PATH ":" ${
lib.makeBinPath [
ghostscript
a2ps
file
gnused
coreutils
]
}
'';
meta = {
homepage = "http://www.brother.com/";
description = "Brother MFC-J470DW LPR driver";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
downloadPage = "http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=mfcj470dw_us_eu_as&os=128";
maintainers = [ lib.maintainers.yochai ];
};
}

View File

@@ -0,0 +1,125 @@
{
lib,
stdenv,
fetchurl,
pkgsi686Linux,
dpkg,
makeWrapper,
coreutils,
gnused,
gawk,
file,
cups,
util-linux,
xxd,
runtimeShell,
ghostscript,
a2ps,
}:
# Why:
# The executable "brprintconf_mfcj6510dw" binary is looking for "/opt/brother/Printers/%s/inf/br%sfunc" and "/opt/brother/Printers/%s/inf/br%src".
# Whereby, %s is printf(3) string substitution for stdin's arg0 (the command's own filename) from the 10th char forwards, as a runtime dependency.
# e.g. Say the filename is "0123456789ABCDE", the runtime will be looking for /opt/brother/Printers/ABCDE/inf/brABCDEfunc.
# Presumably, the binary was designed to be deployed under the filename "printconf_mfcj6510dw", whereby it will search for "/opt/brother/Printers/mfcj6510dw/inf/brmfcj6510dwfunc".
# For NixOS, we want to change the string to the store path of brmfcj6510dwfunc and brmfcj6510dwrc but we're faced with two complications:
# 1. Too little room to specify the nix store path. We can't even take advantage of %s by renaming the file to the store path hash since the variable is too short and can't contain the whole hash.
# 2. The binary needs the directory it's running from to be r/w.
# What:
# As such, we strip the path and substitution altogether, leaving only "brmfcj6510dwfunc" and "brmfcj6510dwrc", while filling the leftovers with nulls.
# Fully null terminating the cstrings is necessary to keep the array the same size and preventing overflows.
# We then use a shell script to link and execute the binary, func and rc files in a temporary directory.
# How:
# In the package, we dump the raw binary as a string of search-able hex values using hexdump. We execute the substitution with sed. We then convert the hex values back to binary form using xxd.
# We also write a shell script that invoked "mktemp -d" to produce a r/w temporary directory and link what we need in the temporary directory.
# Result:
# The user can run brprintconf_mfcj6510dw in the shell.
stdenv.mkDerivation rec {
pname = "mfcj6510dwlpr";
version = "3.0.0-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf006614/mfcj6510dwlpr-${version}.i386.deb";
sha256 = "1ccvx393pqavsgzd8igrzlin5jrsf01d3acyvwqd1d0yz5jgqy6d";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
cups
ghostscript
dpkg
a2ps
];
dontUnpack = true;
brprintconf_mfcj6510dw_script = ''
#!${runtimeShell}
cd $(mktemp -d)
ln -s @out@/usr/bin/brprintconf_mfcj6510dw_patched brprintconf_mfcj6510dw_patched
ln -s @out@/opt/brother/Printers/mfcj6510dw/inf/brmfcj6510dwfunc brmfcj6510dwfunc
ln -s @out@/opt/brother/Printers/mfcj6510dw/inf/brmfcj6510dwrc brmfcj6510dwrc
./brprintconf_mfcj6510dw_patched "$@"
'';
installPhase = ''
dpkg-deb -x $src $out
substituteInPlace $out/opt/brother/Printers/mfcj6510dw/lpd/filtermfcj6510dw \
--replace /opt "$out/opt"
substituteInPlace $out/opt/brother/Printers/mfcj6510dw/lpd/psconvertij2 \
--replace "GHOST_SCRIPT=`which gs`" "GHOST_SCRIPT=${ghostscript}/bin/gs"
substituteInPlace $out/opt/brother/Printers/mfcj6510dw/inf/setupPrintcapij \
--replace "/opt/brother/Printers" "$out/opt/brother/Printers" \
--replace "printcap.local" "printcap"
patchelf --set-interpreter ${pkgsi686Linux.stdenv.cc.libc.out}/lib/ld-linux.so.2 \
--set-rpath $out/opt/brother/Printers/mfcj6510dw/inf:$out/opt/brother/Printers/mfcj6510dw/lpd \
$out/opt/brother/Printers/mfcj6510dw/lpd/brmfcj6510dwfilter
patchelf --set-interpreter ${pkgsi686Linux.stdenv.cc.libc.out}/lib/ld-linux.so.2 $out/usr/bin/brprintconf_mfcj6510dw
#stripping the hardcoded path.
${util-linux}/bin/hexdump -ve '1/1 "%.2X"' $out/usr/bin/brprintconf_mfcj6510dw | \
sed 's.2F6F70742F62726F746865722F5072696E746572732F25732F696E662F6272257366756E63.62726d66636a36353130647766756e63000000000000000000000000000000000000000000.' | \
sed 's.2F6F70742F62726F746865722F5072696E746572732F25732F696E662F627225737263.62726D66636A3635313064777263000000000000000000000000000000000000000000.' | \
${xxd}/bin/xxd -r -p > $out/usr/bin/brprintconf_mfcj6510dw_patched
chmod +x $out/usr/bin/brprintconf_mfcj6510dw_patched
#executing from current dir. segfaults if it's not r\w.
mkdir -p $out/bin
echo -n "$brprintconf_mfcj6510dw_script" > $out/bin/brprintconf_mfcj6510dw
chmod +x $out/bin/brprintconf_mfcj6510dw
substituteInPlace $out/bin/brprintconf_mfcj6510dw --replace @out@ $out
mkdir -p $out/lib/cups/filter/
ln -s $out/opt/brother/Printers/mfcj6510dw/lpd/filtermfcj6510dw $out/lib/cups/filter/brother_lpdwrapper_mfcj6510dw
wrapProgram $out/opt/brother/Printers/mfcj6510dw/lpd/psconvertij2 \
--prefix PATH ":" ${
lib.makeBinPath [
coreutils
gnused
gawk
]
}
wrapProgram $out/opt/brother/Printers/mfcj6510dw/lpd/filtermfcj6510dw \
--prefix PATH ":" ${
lib.makeBinPath [
coreutils
gnused
file
ghostscript
a2ps
]
}
'';
meta = with lib; {
description = "Brother MFC-J6510DW LPR driver";
downloadPage = "http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=mfcj6510dw_all&os=128";
homepage = "http://www.brother.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = with licenses; unfree;
maintainers = with maintainers; [ ramkromberg ];
platforms = with platforms; linux;
};
}

View File

@@ -0,0 +1,66 @@
{
lib,
stdenv,
coreutils,
dpkg,
fetchurl,
ghostscript,
gnugrep,
gnused,
makeWrapper,
perl,
which,
}:
stdenv.mkDerivation rec {
pname = "mfcl2700dnlpr";
version = "3.2.0-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf102085/${pname}-${version}.i386.deb";
sha256 = "170qdzxlqikzvv2wphvfb37m19mn13az4aj88md87ka3rl5knk4m";
};
nativeBuildInputs = [
dpkg
makeWrapper
];
dontUnpack = true;
installPhase = ''
dpkg-deb -x $src $out
dir=$out/opt/brother/Printers/MFCL2700DN
substituteInPlace $dir/lpd/filter_MFCL2700DN \
--replace /usr/bin/perl ${perl}/bin/perl \
--replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$dir\"; #" \
--replace "PRINTER =~" "PRINTER = \"MFCL2700DN\"; #"
wrapProgram $dir/lpd/filter_MFCL2700DN \
--prefix PATH : ${
lib.makeBinPath [
coreutils
ghostscript
gnugrep
gnused
which
]
}
interpreter=$(cat $NIX_CC/nix-support/dynamic-linker)
patchelf --set-interpreter "$interpreter" $dir/inf/braddprinter
patchelf --set-interpreter "$interpreter" $dir/lpd/brprintconflsr3
patchelf --set-interpreter "$interpreter" $dir/lpd/rawtobr3
'';
meta = {
description = "Brother MFC-L2700DN LPR driver";
homepage = "http://www.brother.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
maintainers = [ lib.maintainers.tv ];
platforms = [ "i686-linux" ];
};
}

View File

@@ -0,0 +1,108 @@
{
lib,
stdenv,
fetchurl,
cups,
libusb-compat-0_1,
libxml2,
}:
let
arch = if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64" else "i386";
in
stdenv.mkDerivation (finalAttrs: {
pname = "samsung-unified-linux-driver";
version = "1.00.37";
src = fetchurl {
sha256 = "0r66l9zp0p1qgakh4j08hynwsr4lsgq5yrpxyr0x4ldvl0z2b1bb";
url = "http://www.bchemnet.com/suldr/driver/UnifiedLinuxDriver-${finalAttrs.version}.tar.gz";
};
buildInputs = [
cups
libusb-compat-0_1
libxml2
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -R ${arch}/{gettext,pstosecps,rastertospl,smfpnetdiscovery,usbresetter} $out/bin
mkdir -p $out/etc/sane.d/dll.d/
install -m644 noarch/etc/smfp.conf $out/etc/sane.d
echo smfp >> $out/etc/sane.d/dll.d/smfp-scanner.conf
mkdir -p $out/lib
install -m755 ${arch}/libscmssc.so* $out/lib
mkdir -p $out/lib/cups/backend
ln -s $out/bin/smfpnetdiscovery $out/lib/cups/backend
mkdir -p $out/lib/cups/filter
ln -s $out/bin/{pstosecps,rastertospl} $out/lib/cups/filter
ln -s $ghostscript/bin/gs $out/lib/cups/filter
mkdir -p $out/lib/sane
install -m755 ${arch}/libsane-smfp.so* $out/lib/sane
ln -s libsane-smfp.so.1.0.1 $out/lib/sane/libsane-smfp.so.1
ln -s libsane-smfp.so.1 $out/lib/sane/libsane-smfp.so
mkdir -p $out/lib/udev/rules.d
(
OEM_FILE=noarch/oem.conf
INSTALL_LOG_FILE=/dev/null
. noarch/scripting_utils
. noarch/package_utils
. noarch/scanner-script.pkg
fill_full_template noarch/etc/smfp.rules.in $out/lib/udev/rules.d/60_smfp_samsung.rules
chmod -x $out/lib/udev/rules.d/60_smfp_samsung.rules
)
mkdir -p $out/share
cp -R noarch/share/* $out/share
gzip -9 $out/share/ppd/*.ppd
rm -r $out/share/locale/*/*/install.mo
mkdir -p $out/share/cups
cd $out/share/cups
ln -s ../ppd .
ln -s ppd model
runHook postInstall
'';
preFixup = ''
for bin in "$out/bin/"*; do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$bin"
patchelf --set-rpath "$out/lib:${lib.getLib cups}/lib" "$bin"
done
patchelf --set-rpath "$out/lib:${lib.getLib cups}/lib" "$out/lib/libscmssc.so"
patchelf --set-rpath "$out/lib:${libxml2.out}/lib:${libusb-compat-0_1.out}/lib" "$out/lib/sane/libsane-smfp.so.1.0.1"
ln -s ${lib.getLib stdenv.cc.cc}/lib/libstdc++.so.6 $out/lib/
'';
# all binaries are already stripped
dontStrip = true;
# we did this in prefixup already
dontPatchELF = true;
meta = {
description = "Unified Linux Driver for Samsung printers and scanners";
homepage = "http://www.bchemnet.com/suldr";
downloadPage = "http://www.bchemnet.com/suldr/driver/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
# Tested on linux-x86_64. Might work on linux-i386.
# Probably won't work on anything else.
platforms = lib.platforms.linux;
};
})

View File

@@ -0,0 +1,103 @@
# Tested on linux-x86_64. Might work on linux-i386. Probably won't work on anything else.
# To use this driver in NixOS, add it to printing.drivers in configuration.nix.
# configuration.nix might look like this when you're done:
# { pkgs, ... }: {
# printing = {
# enable = true;
# drivers = [ pkgs.samsung-unified-linux-driver_4_01_17 ];
# };
# (more stuff)
# }
# (This advice was tested on the 1st November 2016.)
{
lib,
stdenv,
cups,
libusb-compat-0_1,
fetchurl,
patchPpdFilesHook,
}:
# Do not bump lightly! Visit <http://www.bchemnet.com/suldr/supported.html>
# to see what will break when upgrading. Consider a new versioned attribute.
let
installationPath = if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64" else "i386";
appendPath = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "64";
libPath =
lib.makeLibraryPath [
cups
libusb-compat-0_1
]
+ ":$out/lib:${lib.getLib stdenv.cc.cc}/lib";
in
stdenv.mkDerivation (finalAttrs: {
pname = "samsung-unified-linux-driver";
version = "4.01.17";
src = fetchurl {
url = "http://www.bchemnet.com/suldr/driver/UnifiedLinuxDriver-${finalAttrs.version}.tar.gz";
sha256 = "1vv3pzvqpg1dq3xjr8161x2yp3v7ca75vil56ranhw5pkjwq66x0";
};
nativeBuildInputs = [ patchPpdFilesHook ];
dontPatchELF = true;
dontStrip = true;
installPhase = ''
runHook preInstall
cd Linux/${installationPath}
mkdir -p $out/lib/cups/{backend,filter}
install -Dm755 mfp $out/lib/cups/backend/
install -Dm755 pstosecps pstospl pstosplc rastertospl rastertosplc $out/lib/cups/filter/
install -Dm755 libscmssc.so $out/lib/
GLOBIGNORE=*.so
for exe in $out/lib/cups/**/*; do
echo "Patching $exe"
patchelf \
--set-rpath ${libPath} \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$exe
done
unset GLOBIGNORE
install -v at_root/usr/lib${appendPath}/libmfp.so.1.0.1 $out/lib
cd $out/lib
ln -s -f libmfp.so.1.0.1 libmfp.so.1
ln -s -f libmfp.so.1 libmfp.so
for lib in $out/lib/*.so; do
echo "Patching $lib"
patchelf \
--set-rpath ${libPath} \
$lib
done
mkdir -p $out/share/cups/model/samsung
cd -
cd ../noarch/at_opt/share/ppd
cp -r ./* $out/share/cups/model/samsung
runHook postInstall
'';
ppdFileCommands = [
"pstosecps"
"pstospl"
"pstosplc"
"rastertospl"
];
meta = {
description = "Samsung's Linux printing drivers; includes binaries without source code";
homepage = "http://www.samsung.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ joko ];
};
})

View File

@@ -0,0 +1,2 @@
[*]
insert_final_newline = unset

View File

@@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2006, Ivan Sagalaev.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,47 @@
This file was generated with pkgs/misc/documentation-highlighter/update.sh
# Highlight.js CDN Assets
[![install size](https://packagephobia.now.sh/badge?p=highlight.js)](https://packagephobia.now.sh/result?p=highlight.js)
**This package contains only the CDN build assets of highlight.js.**
This may be what you want if you'd like to install the pre-built distributable highlight.js client-side assets via NPM. If you're wanting to use highlight.js mainly on the server-side you likely want the [highlight.js][1] package instead.
To access these files via CDN:<br>
https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/
**If you just want a single .js file with the common languages built-in:
<https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js>**
---
## Highlight.js
Highlight.js is a syntax highlighter written in JavaScript. It works in
the browser as well as on the server. It works with pretty much any
markup, doesnt depend on any framework, and has automatic language
detection.
If you'd like to read the full README:<br>
<https://github.com/highlightjs/highlight.js/blob/main/README.md>
## License
Highlight.js is released under the BSD License. See [LICENSE][7] file
for details.
## Links
The official site for the library is at <https://highlightjs.org/>.
The Github project may be found at: <https://github.com/highlightjs/highlight.js>
Further in-depth documentation for the API and other topics is at
<http://highlightjs.readthedocs.io/>.
A list of the Core Team and contributors can be found in the [CONTRIBUTORS.md][8] file.
[1]: https://www.npmjs.com/package/highlight.js
[7]: https://github.com/highlightjs/highlight.js/blob/main/LICENSE
[8]: https://github.com/highlightjs/highlight.js/blob/main/CONTRIBUTORS.md

View File

@@ -0,0 +1,26 @@
{ lib, runCommand }:
runCommand "documentation-highlighter"
{
meta = {
description = "Highlight.js sources for the Nix Ecosystem's documentation";
homepage = "https://highlightjs.org";
license = lib.licenses.bsd3;
platforms = lib.platforms.all;
maintainers = [ lib.maintainers.grahamc ];
};
src = lib.sources.cleanSourceWith {
src = ./.;
filter =
path: type:
lib.elem (baseNameOf path) [
"highlight.pack.js"
"LICENSE"
"loader.js"
"mono-blue.css"
"README.md"
];
};
}
''
cp -r "$src" "$out"
''

View File

@@ -0,0 +1,345 @@
/*!
Highlight.js v11.9.0 (git: b7ec4bfafc)
(c) 2006-2023 undefined and other contributors
License: BSD-3-Clause
*/
var hljs=function(){"use strict";function e(t){
return t instanceof Map?t.clear=t.delete=t.set=()=>{
throw Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=()=>{
throw Error("set is read-only")
}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach((n=>{
const i=t[n],s=typeof i;"object"!==s&&"function"!==s||Object.isFrozen(i)||e(i)
})),t}class t{constructor(e){
void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}
ignoreMatch(){this.isMatchIgnored=!0}}function n(e){
return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")
}function i(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t]
;return t.forEach((e=>{for(const t in e)n[t]=e[t]})),n}const s=e=>!!e.scope
;class o{constructor(e,t){
this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){
this.buffer+=n(e)}openNode(e){if(!s(e))return;const t=((e,{prefix:t})=>{
if(e.startsWith("language:"))return e.replace("language:","language-")
;if(e.includes(".")){const n=e.split(".")
;return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")
}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}
closeNode(e){s(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){
this.buffer+=`<span class="${e}">`}}const r=(e={})=>{const t={children:[]}
;return Object.assign(t,e),t};class a{constructor(){
this.rootNode=r(),this.stack=[this.rootNode]}get top(){
return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){
this.top.children.push(e)}openNode(e){const t=r({scope:e})
;this.add(t),this.stack.push(t)}closeNode(){
if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){
for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}
walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){
return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),
t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){
"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{
a._collapse(e)})))}}class c extends a{constructor(e){super(),this.options=e}
addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){
this.closeNode()}__addSublanguage(e,t){const n=e.root
;t&&(n.scope="language:"+t),this.add(n)}toHTML(){
return new o(this,this.options).value()}finalize(){
return this.closeAllNodes(),!0}}function l(e){
return e?"string"==typeof e?e:e.source:null}function g(e){return h("(?=",e,")")}
function u(e){return h("(?:",e,")*")}function d(e){return h("(?:",e,")?")}
function h(...e){return e.map((e=>l(e))).join("")}function f(...e){const t=(e=>{
const t=e[e.length-1]
;return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}
})(e);return"("+(t.capture?"":"?:")+e.map((e=>l(e))).join("|")+")"}
function p(e){return RegExp(e.toString()+"|").exec("").length-1}
const b=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./
;function m(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n
;let i=l(e),s="";for(;i.length>0;){const e=b.exec(i);if(!e){s+=i;break}
s+=i.substring(0,e.index),
i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?s+="\\"+(Number(e[1])+t):(s+=e[0],
"("===e[0]&&n++)}return s})).map((e=>`(${e})`)).join(t)}
const E="[a-zA-Z]\\w*",x="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",y="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",_="\\b(0b[01]+)",O={
begin:"\\\\[\\s\\S]",relevance:0},v={scope:"string",begin:"'",end:"'",
illegal:"\\n",contains:[O]},k={scope:"string",begin:'"',end:'"',illegal:"\\n",
contains:[O]},N=(e,t,n={})=>{const s=i({scope:"comment",begin:e,end:t,
contains:[]},n);s.contains.push({scope:"doctag",
begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0})
;const o=f("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/)
;return s.contains.push({begin:h(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s
},S=N("//","$"),M=N("/\\*","\\*/"),R=N("#","$");var j=Object.freeze({
__proto__:null,APOS_STRING_MODE:v,BACKSLASH_ESCAPE:O,BINARY_NUMBER_MODE:{
scope:"number",begin:_,relevance:0},BINARY_NUMBER_RE:_,COMMENT:N,
C_BLOCK_COMMENT_MODE:M,C_LINE_COMMENT_MODE:S,C_NUMBER_MODE:{scope:"number",
begin:y,relevance:0},C_NUMBER_RE:y,END_SAME_AS_BEGIN:e=>Object.assign(e,{
"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{
t.data._beginMatch!==e[1]&&t.ignoreMatch()}}),HASH_COMMENT_MODE:R,IDENT_RE:E,
MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*"+x,relevance:0},
NUMBER_MODE:{scope:"number",begin:w,relevance:0},NUMBER_RE:w,
PHRASAL_WORDS_MODE:{
begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
},QUOTE_STRING_MODE:k,REGEXP_MODE:{scope:"regexp",begin:/\/(?=[^/\n]*\/)/,
end:/\/[gimuy]*/,contains:[O,{begin:/\[/,end:/\]/,relevance:0,contains:[O]}]},
RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",
SHEBANG:(e={})=>{const t=/^#![ ]*\//
;return e.binary&&(e.begin=h(t,/.*\b/,e.binary,/\b.*/)),i({scope:"meta",begin:t,
end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},
TITLE_MODE:{scope:"title",begin:E,relevance:0},UNDERSCORE_IDENT_RE:x,
UNDERSCORE_TITLE_MODE:{scope:"title",begin:x,relevance:0}});function A(e,t){
"."===e.input[e.index-1]&&t.ignoreMatch()}function I(e,t){
void 0!==e.className&&(e.scope=e.className,delete e.className)}function T(e,t){
t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",
e.__beforeBegin=A,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,
void 0===e.relevance&&(e.relevance=0))}function L(e,t){
Array.isArray(e.illegal)&&(e.illegal=f(...e.illegal))}function B(e,t){
if(e.match){
if(e.begin||e.end)throw Error("begin & end are not supported with match")
;e.begin=e.match,delete e.match}}function P(e,t){
void 0===e.relevance&&(e.relevance=1)}const D=(e,t)=>{if(!e.beforeMatch)return
;if(e.starts)throw Error("beforeMatch cannot be used with starts")
;const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t]
})),e.keywords=n.keywords,e.begin=h(n.beforeMatch,g(n.begin)),e.starts={
relevance:0,contains:[Object.assign(n,{endsParent:!0})]
},e.relevance=0,delete n.beforeMatch
},H=["of","and","for","in","not","or","if","then","parent","list","value"],C="keyword"
;function $(e,t,n=C){const i=Object.create(null)
;return"string"==typeof e?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach((n=>{
Object.assign(i,$(e[n],t,n))})),i;function s(e,n){
t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((t=>{const n=t.split("|")
;i[n[0]]=[e,U(n[0],n[1])]}))}}function U(e,t){
return t?Number(t):(e=>H.includes(e.toLowerCase()))(e)?0:1}const z={},W=e=>{
console.error(e)},X=(e,...t)=>{console.log("WARN: "+e,...t)},G=(e,t)=>{
z[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),z[`${e}/${t}`]=!0)
},K=Error();function F(e,t,{key:n}){let i=0;const s=e[n],o={},r={}
;for(let e=1;e<=t.length;e++)r[e+i]=s[e],o[e+i]=!0,i+=p(t[e-1])
;e[n]=r,e[n]._emit=o,e[n]._multi=!0}function Z(e){(e=>{
e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,
delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={
_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope
}),(e=>{if(Array.isArray(e.begin)){
if(e.skip||e.excludeBegin||e.returnBegin)throw W("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),
K
;if("object"!=typeof e.beginScope||null===e.beginScope)throw W("beginScope must be object"),
K;F(e,e.begin,{key:"beginScope"}),e.begin=m(e.begin,{joinWith:""})}})(e),(e=>{
if(Array.isArray(e.end)){
if(e.skip||e.excludeEnd||e.returnEnd)throw W("skip, excludeEnd, returnEnd not compatible with endScope: {}"),
K
;if("object"!=typeof e.endScope||null===e.endScope)throw W("endScope must be object"),
K;F(e,e.end,{key:"endScope"}),e.end=m(e.end,{joinWith:""})}})(e)}function V(e){
function t(t,n){
return RegExp(l(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))
}class n{constructor(){
this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}
addRule(e,t){
t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),
this.matchAt+=p(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null)
;const e=this.regexes.map((e=>e[1]));this.matcherRe=t(m(e,{joinWith:"|"
}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex
;const t=this.matcherRe.exec(e);if(!t)return null
;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),i=this.matchIndexes[n]
;return t.splice(0,n),Object.assign(t,i)}}class s{constructor(){
this.rules=[],this.multiRegexes=[],
this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){
if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n
;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))),
t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){
return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){
this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){
const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex
;let n=t.exec(e)
;if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{
const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}
return n&&(this.regexIndex+=n.position+1,
this.regexIndex===this.count&&this.considerAll()),n}}
if(e.compilerExtensions||(e.compilerExtensions=[]),
e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.")
;return e.classNameAliases=i(e.classNameAliases||{}),function n(o,r){const a=o
;if(o.isCompiled)return a
;[I,B,Z,D].forEach((e=>e(o,r))),e.compilerExtensions.forEach((e=>e(o,r))),
o.__beforeBegin=null,[T,L,P].forEach((e=>e(o,r))),o.isCompiled=!0;let c=null
;return"object"==typeof o.keywords&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),
c=o.keywords.$pattern,
delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=$(o.keywords,e.case_insensitive)),
a.keywordPatternRe=t(c,!0),
r&&(o.begin||(o.begin=/\B|\b/),a.beginRe=t(a.begin),o.end||o.endsWithParent||(o.end=/\B|\b/),
o.end&&(a.endRe=t(a.end)),
a.terminatorEnd=l(a.end)||"",o.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(o.end?"|":"")+r.terminatorEnd)),
o.illegal&&(a.illegalRe=t(o.illegal)),
o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>i(e,{
variants:null},t)))),e.cachedVariants?e.cachedVariants:q(e)?i(e,{
starts:e.starts?i(e.starts):null
}):Object.isFrozen(e)?i(e):e))("self"===e?o:e)))),o.contains.forEach((e=>{n(e,a)
})),o.starts&&n(o.starts,r),a.matcher=(e=>{const t=new s
;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"
}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"
}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(a),a}(e)}function q(e){
return!!e&&(e.endsWithParent||q(e.starts))}class J extends Error{
constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}
const Y=n,Q=i,ee=Symbol("nomatch"),te=n=>{
const i=Object.create(null),s=Object.create(null),o=[];let r=!0
;const a="Could not find the language '{}', did you forget to load/include a language module?",l={
disableAutodetect:!0,name:"Plain text",contains:[]};let p={
ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,
languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",
cssSelector:"pre code",languages:null,__emitter:c};function b(e){
return p.noHighlightRe.test(e)}function m(e,t,n){let i="",s=""
;"object"==typeof t?(i=e,
n=t.ignoreIllegals,s=t.language):(G("10.7.0","highlight(lang, code, ...args) has been deprecated."),
G("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),
s=e,i=t),void 0===n&&(n=!0);const o={code:i,language:s};N("before:highlight",o)
;const r=o.result?o.result:E(o.language,o.code,n)
;return r.code=o.code,N("after:highlight",r),r}function E(e,n,s,o){
const c=Object.create(null);function l(){if(!N.keywords)return void M.addText(R)
;let e=0;N.keywordPatternRe.lastIndex=0;let t=N.keywordPatternRe.exec(R),n=""
;for(;t;){n+=R.substring(e,t.index)
;const s=_.case_insensitive?t[0].toLowerCase():t[0],o=(i=s,N.keywords[i]);if(o){
const[e,i]=o
;if(M.addText(n),n="",c[s]=(c[s]||0)+1,c[s]<=7&&(j+=i),e.startsWith("_"))n+=t[0];else{
const n=_.classNameAliases[e]||e;u(t[0],n)}}else n+=t[0]
;e=N.keywordPatternRe.lastIndex,t=N.keywordPatternRe.exec(R)}var i
;n+=R.substring(e),M.addText(n)}function g(){null!=N.subLanguage?(()=>{
if(""===R)return;let e=null;if("string"==typeof N.subLanguage){
if(!i[N.subLanguage])return void M.addText(R)
;e=E(N.subLanguage,R,!0,S[N.subLanguage]),S[N.subLanguage]=e._top
}else e=x(R,N.subLanguage.length?N.subLanguage:null)
;N.relevance>0&&(j+=e.relevance),M.__addSublanguage(e._emitter,e.language)
})():l(),R=""}function u(e,t){
""!==e&&(M.startScope(t),M.addText(e),M.endScope())}function d(e,t){let n=1
;const i=t.length-1;for(;n<=i;){if(!e._emit[n]){n++;continue}
const i=_.classNameAliases[e[n]]||e[n],s=t[n];i?u(s,i):(R=s,l(),R=""),n++}}
function h(e,t){
return e.scope&&"string"==typeof e.scope&&M.openNode(_.classNameAliases[e.scope]||e.scope),
e.beginScope&&(e.beginScope._wrap?(u(R,_.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),
R=""):e.beginScope._multi&&(d(e.beginScope,t),R="")),N=Object.create(e,{parent:{
value:N}}),N}function f(e,n,i){let s=((e,t)=>{const n=e&&e.exec(t)
;return n&&0===n.index})(e.endRe,i);if(s){if(e["on:end"]){const i=new t(e)
;e["on:end"](n,i),i.isMatchIgnored&&(s=!1)}if(s){
for(;e.endsParent&&e.parent;)e=e.parent;return e}}
if(e.endsWithParent)return f(e.parent,n,i)}function b(e){
return 0===N.matcher.regexIndex?(R+=e[0],1):(T=!0,0)}function m(e){
const t=e[0],i=n.substring(e.index),s=f(N,e,i);if(!s)return ee;const o=N
;N.endScope&&N.endScope._wrap?(g(),
u(t,N.endScope._wrap)):N.endScope&&N.endScope._multi?(g(),
d(N.endScope,e)):o.skip?R+=t:(o.returnEnd||o.excludeEnd||(R+=t),
g(),o.excludeEnd&&(R=t));do{
N.scope&&M.closeNode(),N.skip||N.subLanguage||(j+=N.relevance),N=N.parent
}while(N!==s.parent);return s.starts&&h(s.starts,e),o.returnEnd?0:t.length}
let w={};function y(i,o){const a=o&&o[0];if(R+=i,null==a)return g(),0
;if("begin"===w.type&&"end"===o.type&&w.index===o.index&&""===a){
if(R+=n.slice(o.index,o.index+1),!r){const t=Error(`0 width match regex (${e})`)
;throw t.languageName=e,t.badRule=w.rule,t}return 1}
if(w=o,"begin"===o.type)return(e=>{
const n=e[0],i=e.rule,s=new t(i),o=[i.__beforeBegin,i["on:begin"]]
;for(const t of o)if(t&&(t(e,s),s.isMatchIgnored))return b(n)
;return i.skip?R+=n:(i.excludeBegin&&(R+=n),
g(),i.returnBegin||i.excludeBegin||(R=n)),h(i,e),i.returnBegin?0:n.length})(o)
;if("illegal"===o.type&&!s){
const e=Error('Illegal lexeme "'+a+'" for mode "'+(N.scope||"<unnamed>")+'"')
;throw e.mode=N,e}if("end"===o.type){const e=m(o);if(e!==ee)return e}
if("illegal"===o.type&&""===a)return 1
;if(I>1e5&&I>3*o.index)throw Error("potential infinite loop, way more iterations than matches")
;return R+=a,a.length}const _=O(e)
;if(!_)throw W(a.replace("{}",e)),Error('Unknown language: "'+e+'"')
;const v=V(_);let k="",N=o||v;const S={},M=new p.__emitter(p);(()=>{const e=[]
;for(let t=N;t!==_;t=t.parent)t.scope&&e.unshift(t.scope)
;e.forEach((e=>M.openNode(e)))})();let R="",j=0,A=0,I=0,T=!1;try{
if(_.__emitTokens)_.__emitTokens(n,M);else{for(N.matcher.considerAll();;){
I++,T?T=!1:N.matcher.considerAll(),N.matcher.lastIndex=A
;const e=N.matcher.exec(n);if(!e)break;const t=y(n.substring(A,e.index),e)
;A=e.index+t}y(n.substring(A))}return M.finalize(),k=M.toHTML(),{language:e,
value:k,relevance:j,illegal:!1,_emitter:M,_top:N}}catch(t){
if(t.message&&t.message.includes("Illegal"))return{language:e,value:Y(n),
illegal:!0,relevance:0,_illegalBy:{message:t.message,index:A,
context:n.slice(A-100,A+100),mode:t.mode,resultSoFar:k},_emitter:M};if(r)return{
language:e,value:Y(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:N}
;throw t}}function x(e,t){t=t||p.languages||Object.keys(i);const n=(e=>{
const t={value:Y(e),illegal:!1,relevance:0,_top:l,_emitter:new p.__emitter(p)}
;return t._emitter.addText(e),t})(e),s=t.filter(O).filter(k).map((t=>E(t,e,!1)))
;s.unshift(n);const o=s.sort(((e,t)=>{
if(e.relevance!==t.relevance)return t.relevance-e.relevance
;if(e.language&&t.language){if(O(e.language).supersetOf===t.language)return 1
;if(O(t.language).supersetOf===e.language)return-1}return 0})),[r,a]=o,c=r
;return c.secondBest=a,c}function w(e){let t=null;const n=(e=>{
let t=e.className+" ";t+=e.parentNode?e.parentNode.className:""
;const n=p.languageDetectRe.exec(t);if(n){const t=O(n[1])
;return t||(X(a.replace("{}",n[1])),
X("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}
return t.split(/\s+/).find((e=>b(e)||O(e)))})(e);if(b(n))return
;if(N("before:highlightElement",{el:e,language:n
}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e)
;if(e.children.length>0&&(p.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),
console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),
console.warn("The element with unescaped HTML:"),
console.warn(e)),p.throwUnescapedHTML))throw new J("One of your code blocks includes unescaped HTML.",e.innerHTML)
;t=e;const i=t.textContent,o=n?m(i,{language:n,ignoreIllegals:!0}):x(i)
;e.innerHTML=o.value,e.dataset.highlighted="yes",((e,t,n)=>{const i=t&&s[t]||n
;e.classList.add("hljs"),e.classList.add("language-"+i)
})(e,n,o.language),e.result={language:o.language,re:o.relevance,
relevance:o.relevance},o.secondBest&&(e.secondBest={
language:o.secondBest.language,relevance:o.secondBest.relevance
}),N("after:highlightElement",{el:e,result:o,text:i})}let y=!1;function _(){
"loading"!==document.readyState?document.querySelectorAll(p.cssSelector).forEach(w):y=!0
}function O(e){return e=(e||"").toLowerCase(),i[e]||i[s[e]]}
function v(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{
s[e.toLowerCase()]=t}))}function k(e){const t=O(e)
;return t&&!t.disableAutodetect}function N(e,t){const n=e;o.forEach((e=>{
e[n]&&e[n](t)}))}
"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{
y&&_()}),!1),Object.assign(n,{highlight:m,highlightAuto:x,highlightAll:_,
highlightElement:w,
highlightBlock:e=>(G("10.7.0","highlightBlock will be removed entirely in v12.0"),
G("10.7.0","Please use highlightElement now."),w(e)),configure:e=>{p=Q(p,e)},
initHighlighting:()=>{
_(),G("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},
initHighlightingOnLoad:()=>{
_(),G("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")
},registerLanguage:(e,t)=>{let s=null;try{s=t(n)}catch(t){
if(W("Language definition for '{}' could not be registered.".replace("{}",e)),
!r)throw t;W(t),s=l}
s.name||(s.name=e),i[e]=s,s.rawDefinition=t.bind(null,n),s.aliases&&v(s.aliases,{
languageName:e})},unregisterLanguage:e=>{delete i[e]
;for(const t of Object.keys(s))s[t]===e&&delete s[t]},
listLanguages:()=>Object.keys(i),getLanguage:O,registerAliases:v,
autoDetection:k,inherit:Q,addPlugin:e=>{(e=>{
e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{
e["before:highlightBlock"](Object.assign({block:t.el},t))
}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{
e["after:highlightBlock"](Object.assign({block:t.el},t))})})(e),o.push(e)},
removePlugin:e=>{const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}),n.debugMode=()=>{
r=!1},n.safeMode=()=>{r=!0},n.versionString="11.9.0",n.regex={concat:h,
lookahead:g,either:f,optional:d,anyNumberOfTimes:u}
;for(const t in j)"object"==typeof j[t]&&e(j[t]);return Object.assign(n,j),n
},ne=te({});return ne.newInstance=()=>te({}),ne}()
;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);/*! `bash` grammar compiled for Highlight.js 11.9.0 */
(()=>{var e=(()=>{"use strict";return e=>{const s=e.regex,t={},n={begin:/\$\{/,
end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{
className:"variable",variants:[{
begin:s.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});const a={
className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]
},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),c={
begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,
end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,
contains:[e.BACKSLASH_ESCAPE,t,a]};a.contains.push(o);const r={begin:/\$?\(\(/,
end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t]
},l=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10
}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,
contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{
name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,
keyword:["if","then","else","elif","fi","for","while","until","in","do","done","case","esac","function","select"],
literal:["true","false"],
built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"]
},contains:[l,e.SHEBANG(),m,r,i,c,{match:/(\/[a-z._-]+)+/},o,{match:/\\"/},{
className:"string",begin:/'/,end:/'/},{match:/\\'/},t]}}})()
;hljs.registerLanguage("bash",e)})();/*! `nix` grammar compiled for Highlight.js 11.9.0 */
(()=>{var e=(()=>{"use strict";return e=>{const n={
keyword:["rec","with","let","in","inherit","assert","if","else","then"],
literal:["true","false","or","and","null"],
built_in:["import","abort","baseNameOf","dirOf","isNull","builtins","map","removeAttrs","throw","toString","derivation"]
},s={className:"subst",begin:/\$\{/,end:/\}/,keywords:n},a={className:"string",
contains:[{className:"char.escape",begin:/''\$/},s],variants:[{begin:"''",
end:"''"},{begin:'"',end:'"'}]
},i=[e.NUMBER_MODE,e.HASH_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,{
begin:/[a-zA-Z0-9-_]+(\s*=)/,returnBegin:!0,relevance:0,contains:[{
className:"attr",begin:/\S+/,relevance:.2}]}];return s.contains=i,{name:"Nix",
aliases:["nixos"],keywords:n,contains:i}}})();hljs.registerLanguage("nix",e)
})();/*! `shell` grammar compiled for Highlight.js 11.9.0 */
(()=>{var s=(()=>{"use strict";return s=>({name:"Shell Session",
aliases:["console","shellsession"],contains:[{className:"meta.prompt",
begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,
subLanguage:"bash"}}]})})();hljs.registerLanguage("shell",s)})();

View File

@@ -0,0 +1,6 @@
/* This file is NOT part of highlight.js */
document.addEventListener('DOMContentLoaded', (event) => {
document.querySelectorAll('.programlisting, .screen').forEach((element) => {
hljs.highlightElement(element);
});
});

View File

@@ -0,0 +1,70 @@
pre code.hljs {
display: block;
overflow-x: auto;
padding: 1em;
}
code.hljs {
padding: 3px 5px;
}
/*
Five-color theme from a single blue hue.
*/
.hljs {
background: #eaeef3;
color: #00193a;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-title,
.hljs-section,
.hljs-doctag,
.hljs-name,
.hljs-strong {
font-weight: bold;
}
.hljs-comment {
color: var(--color-1);
}
.hljs-string,
.hljs-title,
.hljs-section,
.hljs-built_in,
.hljs-literal,
.hljs-type,
.hljs-addition,
.hljs-tag,
.hljs-quote,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
color: var(--color-2);
}
.hljs-meta,
.hljs-subst,
.hljs-symbol,
.hljs-regexp,
.hljs-attribute,
.hljs-deletion,
.hljs-variable,
.hljs-template-variable,
.hljs-link,
.hljs-bullet {
color: var(--color-3);
}
.hljs-emphasis {
font-style: italic;
}
:root {
--color-1: #738191;
--color-2: #0048ab;
--color-3: #4c81c9;
}
@media (prefers-color-scheme: dark) {
:root {
--color-1: #8b9caf;
--color-2: #3b85e7;
--color-3: #5795e7;
}
}

View File

@@ -0,0 +1,44 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl -p unzip
set -eu
set -o pipefail
root=$(pwd)
if [ ! -f "./update.sh" ]; then
echo "Please run this script from within pkgs/misc/documentation-highlighter/!"
exit 1
fi
scratch=$(mktemp -d -t tmp.XXXXXXXXXX)
function finish {
rm -rf "$scratch"
}
trap finish EXIT
mkdir $scratch/src
cd $scratch/src
curl \
-X POST \
-H 'Content-Type: application/json' \
--data-raw '{
"api": 2,
"languages": ["bash", "nix", "shell"]
}' \
https://highlightjs.org/api/download > $scratch/out.zip
unzip "$scratch/out.zip"
out="$root/"
mkdir -p "$out"
cp ./highlight.min.js "$out/highlight.pack.js"
cp ./{LICENSE,styles/mono-blue.css} "$out"
(
echo "This file was generated with pkgs/misc/documentation-highlighter/update.sh"
echo ""
cat README.md
) > "$out/README.md"

View File

@@ -0,0 +1,73 @@
{
lib,
stdenv,
fetchFromGitLab,
gcc-arm-embedded,
binutils-arm-embedded,
makeWrapper,
python3Packages,
# Default FSIJ IDs
vid ? "234b",
pid ? "0000",
}:
stdenv.mkDerivation (finalAttrs: {
pname = "gnuk";
version = "2.2";
src = fetchFromGitLab {
domain = "salsa.debian.org";
owner = "gnuk-team";
repo = "gnuk/gnuk";
rev = "release/${finalAttrs.version}";
hash = "sha256-qY/dwkcPJiPx/+inSxH7w7a0v3cWUQDX+NYJwUjnkMY=";
fetchSubmodules = true;
};
nativeBuildInputs = [
gcc-arm-embedded
binutils-arm-embedded
makeWrapper
];
buildInputs = with python3Packages; [
python
pyusb
colorama
];
sourceRoot = "${finalAttrs.src.name}/src";
configureFlags = [ "--vidpid=${vid}:${pid}" ];
# TODO: Check how many of these patches are actually needed.
installPhase = ''
mkdir -p $out/bin
find . -name gnuk.bin -exec cp {} $out \;
#sed -i 's,Exception as e,IOError as e,' ../tool/stlinkv2.py
sed -i ../tool/stlinkv2.py \
-e "1a import array" \
-e "s,\(data_received =\) (),\1 array.array('B'),g" \
-e "s,\(data_received\) = data_received + \(.*\),\1.extend(\2),g"
cp ../tool/stlinkv2.py $out/bin/stlinkv2
wrapProgram $out/bin/stlinkv2 --prefix PYTHONPATH : "$PYTHONPATH"
# Some useful helpers
echo "#! ${stdenv.shell} -e" | tee $out/bin/{unlock,flash}
echo "$out/bin/stlinkv2 -u \$@" >> $out/bin/unlock
echo "$out/bin/stlinkv2 -b \$@ $out/gnuk.bin" >> $out/bin/flash
chmod +x $out/bin/{unlock,flash}
'';
meta = {
homepage = "https://www.fsij.org/category/gnuk.html";
description = "Implementation of USB cryptographic token for gpg";
license = lib.licenses.gpl3;
platforms = lib.platforms.linux;
maintainers = [ ];
broken = true; # Needs Picolib, which is not packaged in Nixpkgs.
};
})

View File

@@ -0,0 +1,146 @@
{
stdenv,
lib,
fetchzip,
ghostscript,
texinfo,
imagemagick,
texi2html,
extractpdfmark,
guile,
python3,
gettext,
glib,
gmp,
flex,
perl,
bison,
pkg-config,
autoreconfHook,
dblatex,
fontconfig,
freetype,
pango,
fontforge,
help2man,
freefont_ttf,
makeFontsConf,
makeWrapper,
t1utils,
boehmgc,
rsync,
coreutils,
texliveSmall,
tex ? texliveSmall.withPackages (
ps: with ps; [
epsf
fontinst
fontware
lh
metafont
]
),
}:
stdenv.mkDerivation rec {
pname = "lilypond";
version = "2.24.4";
src = fetchzip {
url = "http://lilypond.org/download/sources/v${lib.versions.majorMinor version}/lilypond-${version}.tar.gz";
hash = "sha256-UYdORvodrVchxslOxpMiXrAh7DtB9sWp9yqZU/jeB9Y=";
};
postInstall = ''
for f in "$out/bin/"*; do
# Override default argv[0] setting so LilyPond can find
# its Scheme libraries.
wrapProgram "$f" \
--set GUILE_AUTO_COMPILE 0 \
--prefix PATH : "${
lib.makeBinPath [
ghostscript
coreutils
(placeholder "out")
]
}" \
--argv0 "$f"
done
'';
preConfigure = ''
substituteInPlace scripts/build/mf2pt1.pl \
--replace-fail "mem=mf2pt1" "mem=$PWD/mf/mf2pt1"
'';
strictDeps = true;
depsBuildBuild = [
pkg-config
];
nativeBuildInputs = [
autoreconfHook
bison
dblatex
extractpdfmark
flex # for flex binary
fontconfig
fontforge
gettext
ghostscript
guile
help2man
imagemagick
makeWrapper
perl
pkg-config
python3
rsync
t1utils
tex
texi2html
texinfo
];
buildInputs = [
boehmgc
flex # FlexLexer.h
freetype
glib
gmp
pango
];
autoreconfPhase = "NOCONFIGURE=1 sh autogen.sh";
enableParallelBuilding = true;
passthru.updateScript = {
command = [ ./update.sh ];
supportedFeatures = [ "commit" ];
};
# documentation makefile uses "out" for different purposes, hence we explicitly set it to an empty string
makeFlags = [ "out=" ];
meta = {
description = "Music typesetting system";
homepage = "https://lilypond.org/";
license = with lib.licenses; [
gpl3Plus # most code
gpl3Only # ly/articulate.ly
fdl13Plus # docs
ofl # mf/
];
maintainers = with lib.maintainers; [
marcweber
yurrriq
];
platforms = lib.platforms.all;
};
FONTCONFIG_FILE = lib.optional stdenv.hostPlatform.isDarwin (makeFontsConf {
fontDirectories = [ freefont_ttf ];
});
}

View File

@@ -0,0 +1,150 @@
{
lib,
stdenv,
fetchFromGitHub,
lilypond,
}:
let
olpFont =
{
fontName,
rev,
sha256,
version ? rev,
...
}:
stdenv.mkDerivation {
inherit version;
pname = "openlilypond-font-${fontName}";
src = fetchFromGitHub {
inherit rev sha256;
owner = "OpenLilyPondFonts";
repo = fontName;
};
installPhase = ''
local fontsdir="$out/share/lilypond/${lilypond.version}/fonts"
install -m755 -d "$fontsdir/otf"
shopt -s globstar
for font in {otf,supplementary-fonts,supplementary-files}/**/*.{o,t}tf; do
echo $font
install -Dt "$fontsdir/otf" -m644 "$font"
done
install -m755 -d "$fontsdir/svg"
for font in {svg,woff}/**.{svg,woff}; do
install -Dt "$fontsdir/svg" -m644 "$font"
done
'';
meta = with lib; {
inherit (lilypond.meta) homepage platforms;
description = "${fontName} font for LilyPond";
license = licenses.ofl;
maintainers = with maintainers; [ yurrriq ];
};
};
in
rec {
beethoven = olpFont {
fontName = "beethoven";
rev = "669f400";
sha256 = "17wdklg5shmqwnb7b81qavfg52v32wx5yf15c6al0hbvv1nqqj2i";
};
bravura = olpFont {
fontName = "bravura";
rev = "53c7744";
sha256 = "1p27w1c3bzxlnm6rzq8n7dbfjwbxqjy4r0fhkmk9jbm8awmzw214";
};
cadence = olpFont {
fontName = "cadence";
rev = "1cc0fb7";
sha256 = "1zxb3m8glh8iwj8mzcgyaxhlq0bji0rwniw702m70h9kpifiim1j";
};
gonville = olpFont {
fontName = "gonville";
rev = "a638bc9";
sha256 = "15khy9677crgd6bpajn7l1drysgxy49wiym3b248khgpavidwyy9";
};
gutenberg1939 = olpFont {
fontName = "gutenberg1939";
rev = "2316a35";
sha256 = "1lkhivmrx92z37zfrb5mkhzhwggyaga9cm0wl89r0n2f2kayyc7q";
};
haydn = olpFont {
fontName = "haydn";
rev = "9e7de8b";
sha256 = "1jmbhb2jm887sdc498l2jilpivq1d8lmmgdb8lp59lv8d9fx105z";
};
improviso = olpFont {
fontName = "improviso";
rev = "0753f5a";
sha256 = "1clin9c74gjhhira12mwxynxn4b1ixij5bg04mvk828lbr740mfm";
};
lilyboulez = olpFont {
fontName = "lilyboulez";
rev = "e8455fc";
sha256 = "0mq92x0rbgfb6s7ipgg2zcxika2si30w3ay89rp7m6vwca01649y";
};
lilyjazz = olpFont {
fontName = "lilyjazz";
rev = "8fa7d554";
sha256 = "1z7px7k2sn7snnj7yfjv0p9axwbn452vn9ww9icmb1249b0d1qry";
};
lv-goldenage = olpFont {
fontName = "lv-goldenage";
rev = "8a92fd3";
sha256 = "03nbd1vmlaj7wkhsnl2lq09nafv7zj1k518zs966vclzah94qghp";
};
paganini = olpFont {
fontName = "paganini";
rev = "8e4e55a";
sha256 = "0gw9wr4hfn205j40rpgnfddhzhn9x4pwfinamj5b7607880nvx29";
};
profondo = olpFont {
fontName = "profondo";
rev = "8cfb668";
sha256 = "0armwbg9y0l935949b7klngws6fq42fi944lws61qvjl61780br8";
};
ross = olpFont {
fontName = "ross";
rev = "aa8127f";
sha256 = "1w2x3pd1d1z4x0107dpq95v7m547cj4nkkzxgqpmzfqa0074idqd";
};
scorlatti = olpFont {
fontName = "scorlatti";
rev = "1db87da";
sha256 = "07jam5hwdy6bydrm98cdla6p6rl8lmy8zzsfq46i55l64l3w956h";
};
sebastiano = olpFont {
fontName = "sebastiano";
rev = "44bf262";
sha256 = "09i8p3p4z6vz69j187cpxvikkgc4pk6gxippahy0k7i7bh0d4qaj";
};
all = [
beethoven
bravura
cadence
gonville
gutenberg1939
haydn
improviso
lilyboulez
lilyjazz
lv-goldenage
paganini
profondo
ross
scorlatti
sebastiano
];
}

View File

@@ -0,0 +1,21 @@
{
lib,
fetchzip,
lilypond,
}:
lilypond.overrideAttrs (oldAttrs: rec {
version = "2.25.27";
src = fetchzip {
url = "https://lilypond.org/download/sources/v${lib.versions.majorMinor version}/lilypond-${version}.tar.gz";
hash = "sha256-cZ6XZt1y646Kke3wdJ5Jo9ieOejbojsEBSkAvLDXNPw=";
};
passthru.updateScript = {
command = [
./update.sh
"unstable"
];
supportedFeatures = [ "commit" ];
};
})

25
pkgs/misc/lilypond/update.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl gnused nix
set -euo pipefail
if [ $# -gt 0 ] && [ "$1" = "unstable" ]; then
ATTR="lilypond-unstable"
FILE="$(dirname "${BASH_SOURCE[@]}")/unstable.nix"
QUERY="VERSION_DEVEL="
else
ATTR="lilypond"
FILE="$(dirname "${BASH_SOURCE[@]}")/default.nix"
QUERY="VERSION_STABLE="
fi
# update version
PREV=$(nix eval --raw -f default.nix $ATTR.version)
NEXT=$(curl -s 'https://gitlab.com/lilypond/lilypond/-/raw/master/VERSION' | grep "$QUERY" | cut -d= -f2)
sed -i "s|$PREV|$NEXT|" "$FILE"
echo "[{\"commitMessage\":\"$ATTR: $PREV -> $NEXT\"}]"
# update hash
PREV=$(nix eval --raw -f default.nix $ATTR.src.outputHash)
NEXT=$(nix --extra-experimental-features nix-command hash to-sri --type sha256 $(nix-prefetch-url --type sha256 --unpack $(nix eval --raw -f default.nix $ATTR.src.url)))
sed -i "s|$PREV|$NEXT|" "$FILE"

View File

@@ -0,0 +1,21 @@
{
lib,
symlinkJoin,
makeWrapper,
lilypond,
openlilylib-fonts,
}:
lib.appendToName "with-fonts" (symlinkJoin {
inherit (lilypond) meta name version;
paths = [ lilypond ] ++ openlilylib-fonts.all;
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
for p in $out/bin/*; do
wrapProgram "$p" --set LILYPOND_DATADIR "$out/share/lilypond/${lilypond.version}"
done
'';
})

View File

@@ -0,0 +1,77 @@
{
lib,
fetchFromGitHub,
elk7Version,
buildGoModule,
libpcap,
nixosTests,
systemd,
config,
}:
let
beat =
package: extraArgs:
buildGoModule (
lib.attrsets.recursiveUpdate rec {
pname = package;
version = elk7Version;
src = fetchFromGitHub {
owner = "elastic";
repo = "beats";
rev = "v${version}";
hash = "sha256-TzcKB1hIHe1LNZ59GcvR527yvYqPKNXPIhpWH2vyMTY=";
};
vendorHash = "sha256-JOCcceYYutC5MI+/lXBqcqiET+mcrG1e3kWySo3+NIk=";
subPackages = [ package ];
meta = with lib; {
homepage = "https://www.elastic.co/products/beats";
license = licenses.asl20;
maintainers = with maintainers; [
fadenb
basvandijk
dfithian
];
platforms = platforms.linux;
};
} extraArgs
);
in
rec {
auditbeat7 = beat "auditbeat" { meta.description = "Lightweight shipper for audit data"; };
filebeat7 = beat "filebeat" {
meta.description = "Lightweight shipper for logfiles";
buildInputs = [ systemd ];
tags = [ "withjournald" ];
postFixup = ''
patchelf --set-rpath ${lib.makeLibraryPath [ (lib.getLib systemd) ]} "$out/bin/filebeat"
'';
};
heartbeat7 = beat "heartbeat" { meta.description = "Lightweight shipper for uptime monitoring"; };
metricbeat7 = beat "metricbeat" {
meta.description = "Lightweight shipper for metrics";
passthru.tests = lib.optionalAttrs config.allowUnfree (
assert metricbeat7.drvPath == nixosTests.elk.unfree.ELK-7.elkPackages.metricbeat.drvPath;
{
elk = nixosTests.elk.unfree.ELK-7;
}
);
};
packetbeat7 = beat "packetbeat" {
buildInputs = [ libpcap ];
meta.description = "Network packet analyzer that ships data to Elasticsearch";
meta.longDescription = ''
Packetbeat is an open source network packet analyzer that ships the
data to Elasticsearch.
Think of it like a distributed real-time Wireshark with a lot more
analytics features. The Packetbeat shippers sniff the traffic between
your application processes, parse on the fly protocols like HTTP, MySQL,
PostgreSQL, Redis or Thrift and correlate the messages into transactions.
'';
};
}

View File

@@ -0,0 +1,163 @@
# idea: provide a build environments for your development of preference
/*
#### examples of use: ####
# Add this to your ~/.config/nixpkgs/config.nix:
{
packageOverrides = pkgs : with pkgs; {
sdlEnv = pkgs.myEnvFun {
name = "sdl";
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ stdenv SDL SDL_image SDL_ttf SDL_gfx SDL_net];
};
};
}
# Then you can install it by:
# $ nix-env -i env-sdl
# And you can load it simply calling:
# $ load-env-sdl
# and this will update your env vars to have 'make' and 'gcc' finding the SDL
# headers and libs.
##### Another example, more complicated but achieving more: #######
# Make an environment to build nix from source and create ctags (tagfiles can
# be extracted from TAG_FILES) from every source package. Here would be a
# full ~/.config/nixpkgs/config.nix
{
packageOverrides = pkgs : with pkgs; with sourceAndTags;
let complicatedMyEnv = { name, buildInputs ? [], cTags ? [], extraCmds ? ""}:
pkgs.myEnvFun {
inherit name;
buildInputs = buildInputs
++ map (x : sourceWithTagsDerivation
( (addCTaggingInfo x ).passthru.sourceWithTags ) ) cTags;
extraCmds = ''
${extraCmds}
HOME=${builtins.getEnv "HOME"}
. ~/.bashrc
'';
};
in rec {
# this is the example we will be using
nixEnv = complicatedMyEnv {
name = "nix";
buildInputs = [ libtool stdenv perl curl bzip2 openssl db5 autoconf automake zlib ];
};
};
}
# Now we should build our newly defined custom environment using this command on a shell, so type:
# $ nix-env -i env-nix
# You can load the environment simply typing a "load-env-${name}" command.
# $ load-env-nix
# The result using that command should be:
# env-nix loaded
and show you a shell with a prefixed prompt.
*/
{
mkDerivation,
replaceVars,
pkgs,
}:
{
stdenv ? pkgs.stdenv,
name,
buildInputs ? [ ],
propagatedBuildInputs ? [ ],
extraCmds ? "",
cleanupCmds ? "",
shell ? "${pkgs.bashInteractive}/bin/bash --norc",
}:
mkDerivation {
inherit buildInputs propagatedBuildInputs;
name = "env-${name}";
phases = [
"buildPhase"
"fixupPhase"
];
setupNew = ../../stdenv/generic/setup.sh;
buildPhase =
let
initialPath = import ../../stdenv/generic/common-path.nix { inherit pkgs; };
in
''
set -x
mkdir -p "$out/dev-envs" "$out/nix-support" "$out/bin"
s="$out/nix-support/setup-new-modified"
# shut some warning up.., do not use set -e
sed -e 's@set -eu@@' \
-e 's@assertEnvExists\s\+NIX_STORE@:@' \
-e 's@trap.*@@' \
-e '1i initialPath="${toString initialPath}"' \
"$setupNew" > "$s"
cat >> "$out/dev-envs/''${name/env-/}" << EOF
defaultNativeBuildInputs="$defaultNativeBuildInputs"
buildInputs="$buildInputs"
propagatedBuildInputs="$propagatedBuildInputs"
# the setup-new script wants to write some data to a temp file.. so just let it do that and tidy up afterwards
tmp="\$("${pkgs.coreutils}/bin/mktemp" -d)"
NIX_BUILD_TOP="\$tmp"
phases=
# only do all the setup stuff in nix-support/*
set +e
# This prevents having -rpath /lib in NIX_LDFLAGS
export NIX_NO_SELF_RPATH=1
if [[ -z "\$ZSH_VERSION" ]]; then
source "$s"
else
setopt interactivecomments
# fix bash indirection
# let's hope the bash arrays aren't used
# substitute is using bash array, so skip it
echo '
setopt NO_BAD_PATTERN
setopt NO_BANG_HIST
setopt NO_BG_NICE
setopt NO_EQUALS
setopt NO_FUNCTION_ARGZERO
setopt GLOB_SUBST
setopt NO_HUP
setopt INTERACTIVE_COMMENTS
setopt KSH_ARRAYS
setopt NO_MULTIOS
setopt NO_NOMATCH
setopt RM_STAR_SILENT
setopt POSIX_BUILTINS
setopt SH_FILE_EXPANSION
setopt SH_GLOB
setopt SH_OPTION_LETTERS
setopt SH_WORD_SPLIT
' >> "\$tmp/script"
sed -e 's/\''${!\([^}]*\)}/\''${(P)\1}/g' \
-e 's/[[]\*\]//' \
-e 's/substitute() {/ substitute() { return; /' \
-e 's@PATH=\$@PATH=${pkgs.coreutils}/bin@' \
"$s" >> "\$tmp/script"
echo "\$tmp/script";
source "\$tmp/script";
fi
${pkgs.coreutils}/bin/rm -fr "\$tmp"
${extraCmds}
nix_cleanup() {
:
${cleanupCmds}
}
export PATH
echo $name loaded >&2
trap nix_cleanup EXIT
EOF
mkdir -p $out/bin
sed -e 's,@shell@,${shell},' -e s,@myenvpath@,$out/dev-envs/${name}, \
-e 's,@name@,${name},' ${./loadenv.sh} > $out/bin/load-env-${name}
chmod +x $out/bin/load-env-${name}
'';
}

View File

@@ -0,0 +1,22 @@
#!@shell@
OLDPATH="$PATH"
OLDTZ="$TZ"
OLD_http_proxy="$http_proxy"
OLD_ftp_proxy="$http_proxy"
source @myenvpath@
PATH="$PATH:$OLDPATH"
export PS1="\n@name@:[\u@\h:\w]\$ "
export NIX_MYENV_NAME="@name@"
export buildInputs
export TZ="$OLDTZ"
export http_proxy="$OLD_http_proxy"
export ftp_proxy="$OLD_ftp_proxy"
if test $# -gt 0; then
exec "$@"
else
exec @shell@
fi

View File

@@ -0,0 +1,66 @@
{
lib,
stdenv,
python3Packages,
fetchFromGitHub,
makeDesktopItem,
copyDesktopItems,
desktopToDarwinBundle,
wrapQtAppsHook,
}:
python3Packages.buildPythonApplication rec {
pname = "opcua-client-gui";
version = "0.8.4";
format = "setuptools";
src = fetchFromGitHub {
owner = "FreeOpcUa";
repo = "opcua-client-gui";
rev = version;
hash = "sha256-0BH1Txr3z4a7iFcsfnovmBUreXMvIX2zpZa8QivQVx8=";
};
nativeBuildInputs = [
copyDesktopItems
wrapQtAppsHook
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ desktopToDarwinBundle ];
makeWrapperArgs = [
"\${qtWrapperArgs[@]}"
];
propagatedBuildInputs = with python3Packages; [
pyqt5
asyncua
opcua-widgets
numpy
pyqtgraph
];
#This test uses a deprecated libarby, when updating the package check if the test was updated as well
doCheck = false;
desktopItems = [
(makeDesktopItem {
name = "opcua-client";
exec = "opcua-client";
comment = "OPC UA Client";
type = "Application";
#no icon because the app dosn't have one
desktopName = "opcua-client";
terminal = false;
categories = [ "Utility" ];
})
];
meta = with lib; {
description = "OPC UA GUI Client";
homepage = "https://github.com/FreeOpcUa/opcua-client-gui";
platforms = platforms.unix;
license = licenses.gpl3Only;
maintainers = [ ];
mainProgram = "opcua-client";
};
}

View File

@@ -0,0 +1,126 @@
{
dtc,
fetchFromGitHub,
lib,
pkgsBuildBuild,
stdenv,
}:
let
defaultVersion = "4.6.0";
defaultSrc = fetchFromGitHub {
owner = "OP-TEE";
repo = "optee_os";
rev = defaultVersion;
hash = "sha256-4z706DNfZE+CAPOa362CNSFhAN1KaNyKcI9C7+MRccs=";
};
buildOptee = lib.makeOverridable (
{
version ? null,
src ? null,
platform,
extraMakeFlags ? [ ],
extraMeta ? { },
...
}@args:
let
inherit (stdenv.hostPlatform) is32bit is64bit;
taTarget =
{
"arm" = "ta_arm32";
"arm64" = "ta_arm64";
}
.${stdenv.hostPlatform.linuxArch};
in
stdenv.mkDerivation (
{
pname = "optee-os-${platform}";
version = if src == null then defaultVersion else version;
src = if src == null then defaultSrc else src;
postPatch = ''
patchShebangs $(find -type d -name scripts -printf '%p ')
'';
outputs = [
"out"
"devkit"
];
strictDeps = true;
enableParallelBuilding = true;
depsBuildBuild = [ pkgsBuildBuild.stdenv.cc ];
nativeBuildInputs = [
dtc
(pkgsBuildBuild.python3.withPackages (
p: with p; [
pyelftools
cryptography
]
))
];
makeFlags = [
"O=out"
"PLATFORM=${platform}"
"CFG_USER_TA_TARGETS=${taTarget}"
]
++ (lib.optionals is32bit [
"CFG_ARM32_core=y"
"CROSS_COMPILE32=${stdenv.cc.targetPrefix}"
])
++ (lib.optionals is64bit [
"CFG_ARM64_core=y"
"CROSS_COMPILE64=${stdenv.cc.targetPrefix}"
])
++ extraMakeFlags;
installPhase = ''
runHook preInstall
mkdir -p $out
cp out/core/{tee.elf,tee-pageable_v2.bin,tee.bin,tee-header_v2.bin,tee-pager_v2.bin,tee-raw.bin} $out
cp -r out/export-${taTarget} $devkit
runHook postInstall
'';
meta =
with lib;
{
description = "Trusted Execution Environment for ARM";
homepage = "https://github.com/OP-TEE/optee_os";
changelog = "https://github.com/OP-TEE/optee_os/blob/${defaultVersion}/CHANGELOG.md";
license = licenses.bsd2;
maintainers = [ maintainers.jmbaur ];
}
// extraMeta;
}
// removeAttrs args [ "extraMeta" ]
)
);
in
{
inherit buildOptee;
opteeQemuArm = buildOptee {
platform = "vexpress";
extraMakeFlags = [ "PLATFORM_FLAVOR=qemu_virt" ];
extraMeta.platforms = [ "armv7l-linux" ];
};
opteeQemuAarch64 = buildOptee {
platform = "vexpress";
extraMakeFlags = [ "PLATFORM_FLAVOR=qemu_armv8a" ];
extraMeta.platforms = [ "aarch64-linux" ];
};
}

View File

@@ -0,0 +1,124 @@
{
stdenv,
lib,
glibcLocales,
unzip,
hasktags,
ctags,
}:
{
# optional srcDir
annotatedWithSourceAndTagInfo =
x: (x ? passthru && x.passthru ? sourceWithTags || x ? meta && x.meta ? sourceWithTags);
# hack because passthru doesn't work the way I'd expect. Don't have time to spend on this right now
# that's why I'm abusing meta for the same purpose in ghcsAndLibs
sourceWithTagsFromDerivation =
x:
if x ? passthru && x.passthru ? sourceWithTags then
x.passthru.sourceWithTags
else if x ? meta && x.meta ? sourceWithTags then
x.meta.sourceWithTags
else
null;
# createTagFiles = [ { name = "my_tag_name_without_suffix", tagCmd = "ctags -R . -o \$TAG_FILE"; } ]
# tag command must create file named $TAG_FILE
sourceWithTagsDerivation =
{
name,
src,
srcDir ? ".",
tagSuffix ? "_tags",
createTagFiles ? [ ],
}:
stdenv.mkDerivation {
inherit src srcDir tagSuffix;
name = "${name}-source-with-tags";
nativeBuildInputs = [ unzip ];
# using separate tag directory so that you don't have to glob that much files when starting your editor
# is this a good choice?
installPhase =
let
createTags = lib.concatStringsSep "\n" (
map (a: ''
TAG_FILE="$SRC_DEST/${a.name}$tagSuffix"
echo running tag cmd "${a.tagCmd}" in `pwd`
${a.tagCmd}
TAG_FILES="$TAG_FILES''${TAG_FILES:+:}$TAG_FILE"
'') createTagFiles
);
in
''
SRC_DEST=$out/src/$name
mkdir -p $SRC_DEST
pwd; ls
cp -r $srcDir $SRC_DEST
cd $SRC_DEST
${createTags}
mkdir -p $out/nix-support
echo "TAG_FILES=\"\$TAG_FILES\''${TAG_FILES:+:}$TAG_FILES\"" >> $out/nix-support/setup-hook
'';
};
# example usage
#testSourceWithTags = sourceWithTagsDerivation (ghc68extraLibs ghcsAndLibs.ghc68).happs_server_darcs.passthru.sourceWithTags;
# creates annotated derivation (comments see above)
addHasktagsTaggingInfo =
deriv:
deriv
// {
passthru = {
sourceWithTags = {
inherit (deriv) src;
srcDir = if deriv ? srcDir then deriv.srcDir else ".";
name = deriv.name;
createTagFiles = [
{
name = "${deriv.name}_haskell";
# tagCmd = "${toString ghcsAndLibs.ghc68.ghc}/bin/hasktags --ignore-close-implementation --ctags `find . -type f -name \"*.*hs\"`; sort tags > \$TAG_FILE"; }
# *.*hs.* to catch gtk2hs .hs.pp files
tagCmd = "
srcs=\"`find . -type f -name \"*.*hs\"; find . -type f -name \"*.*hs*\";`\"
[ -z \"$srcs\" ] || {
# without this creating tag files for lifted-base fails
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
${lib.optionalString stdenv.hostPlatform.isLinux "export LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive;"}
${toString hasktags}/bin/hasktags --ignore-close-implementation --ctags .
mv tags \$TAG_FILE
}";
}
];
};
};
};
addCTaggingInfo =
deriv:
deriv
// {
passthru = {
sourceWithTags = {
inherit (deriv) src;
name = "${deriv.name}-source-ctags";
createTagFiles = [
{
inherit (deriv) name;
tagCmd = "${toString ctags}/bin/ctags --sort=yes -o \$TAG_FILE -R .";
}
];
};
};
};
}
/*
experimental
idea:
a) Attach some information to a nexpression telling how to create a tag file which can then be used within your favourite editor
Do this in a way not affecting the expression (using passthru or meta which is ignored when calculating the hash)
implementations: addCTaggingInfo (C / C++) and addHasktagsTaggingInfo (Haskell)
b) use sourceWithTagsDerivation function to create a derivation installing the source along with the generated tag files
so that you can use them easily witihn your favourite text editor
*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,45 @@
{
mkTmuxPlugin,
replaceVars,
fetchFromGitHub,
crystal,
}:
let
fingers = crystal.buildCrystalPackage rec {
format = "shards";
version = "2.5.1";
pname = "fingers";
src = fetchFromGitHub {
owner = "Morantron";
repo = "tmux-fingers";
rev = "${version}";
sha256 = "sha256-O5CfboFnl51OeOgqI2NB3MmELDeKykd5NO2d5FGXkII=";
};
shardsFile = ./shards.nix;
crystalBinaries.tmux-fingers.src = "src/fingers.cr";
postInstall = ''
shopt -s dotglob extglob
rm -rv !("tmux-fingers.tmux"|"bin")
shopt -u dotglob extglob
'';
# TODO: Needs starting a TMUX session to run tests
# Unhandled exception: Missing ENV key: "TMUX" (KeyError)
doCheck = false;
doInstallCheck = false;
};
in
mkTmuxPlugin {
inherit (fingers) version src meta;
pluginName = fingers.src.repo;
rtpFilePath = "tmux-fingers.tmux";
patches = [
(replaceVars ./fix.patch {
tmuxFingersDir = "${fingers}/bin";
})
];
}

View File

@@ -0,0 +1,41 @@
diff --git a/tmux-fingers.tmux b/tmux-fingers.tmux
index f15b509..a14e312 100755
--- a/tmux-fingers.tmux
+++ b/tmux-fingers.tmux
@@ -1,35 +1,4 @@
#!/usr/bin/env bash
-CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-if command -v "tmux-fingers" &>/dev/null; then
- FINGERS_BINARY="tmux-fingers"
-elif [[ -f "$CURRENT_DIR/bin/tmux-fingers" ]]; then
- FINGERS_BINARY="$CURRENT_DIR/bin/tmux-fingers"
-fi
-
-if [[ -z "$FINGERS_BINARY" ]]; then
- tmux run-shell -b "bash $CURRENT_DIR/install-wizard.sh"
- exit 0
-fi
-
-CURRENT_FINGERS_VERSION="$($FINGERS_BINARY version)"
-
-pushd $CURRENT_DIR &> /dev/null
-CURRENT_GIT_VERSION=$(cat shard.yml | grep "^version" | cut -f2 -d':' | sed "s/ //g")
-popd &> /dev/null
-
-SKIP_WIZARD=$(tmux show-option -gqv @fingers-skip-wizard)
-SKIP_WIZARD=${SKIP_WIZARD:-0}
-
-if [ "$SKIP_WIZARD" = "0" ] && [ "$CURRENT_FINGERS_VERSION" != "$CURRENT_GIT_VERSION" ]; then
- tmux run-shell -b "FINGERS_UPDATE=1 bash $CURRENT_DIR/install-wizard.sh"
-
- if [[ "$?" != "0" ]]; then
- echo "Something went wrong while updating tmux-fingers. Please try again."
- exit 1
- fi
-fi
-
-tmux run "$FINGERS_BINARY load-config"
+tmux run "@tmuxFingersDir@/tmux-fingers load-config"
exit $?

View File

@@ -0,0 +1,17 @@
{
cling = {
url = "https://github.com/devnote-dev/cling.git";
rev = "v3.0.0";
sha256 = "0mj5xvpiif1vhg4qds938p9zb5a47qzl397ybz1l1jks0gg361wq";
};
tablo = {
url = "https://github.com/hutou/tablo.git";
rev = "v0.10.1";
sha256 = "0aavacqa35y3zlrllw83bkmj27fmxph5h07ni5l0nx11w1m0l5j4";
};
xdg_base_directory = {
url = "https://github.com/tijn/xdg_base_directory.git";
rev = "60bf28dc060c221d5af52727927e92b840022eb0";
sha256 = "1sa8bw8mzsz0pbj3m8v0w1pnk1q86zjivr0jndfg77wa33ki34y0";
};
}

View File

@@ -0,0 +1,20 @@
{
mkTmuxPlugin,
thumbs,
replaceVars,
}:
mkTmuxPlugin {
inherit (thumbs) version src meta;
pluginName = thumbs.src.repo;
rtpFilePath = "tmux-thumbs.tmux";
patches = [
(replaceVars ./fix.patch {
tmuxThumbsDir = "${thumbs}/bin";
})
];
}

View File

@@ -0,0 +1,42 @@
diff --git i/tmux-thumbs.sh w/tmux-thumbs.sh
index 7e060e8..e7f0c57 100755
--- i/tmux-thumbs.sh
+++ w/tmux-thumbs.sh
@@ -1,22 +1,6 @@
#!/usr/bin/env bash
set -Eeu -o pipefail
-# Setup env variables to be compatible with compiled and bundled installations
-CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-RELEASE_DIR="${CURRENT_DIR}/target/release"
-
-THUMBS_BINARY="${RELEASE_DIR}/thumbs"
-TMUX_THUMBS_BINARY="${RELEASE_DIR}/tmux-thumbs"
-VERSION=$(grep 'version =' "${CURRENT_DIR}/Cargo.toml" | grep -o "\".*\"" | sed 's/"//g')
-
-if [ ! -f "$THUMBS_BINARY" ]; then
- tmux split-window "cd ${CURRENT_DIR} && bash ./tmux-thumbs-install.sh"
- exit
-elif [[ $(${THUMBS_BINARY} --version) != "thumbs ${VERSION}" ]]; then
- tmux split-window "cd ${CURRENT_DIR} && bash ./tmux-thumbs-install.sh update"
- exit
-fi
-
function get-opt-value() {
tmux show -vg "@thumbs-${1}" 2> /dev/null
}
@@ -35,7 +19,7 @@ function get-opt-arg() {
fi
}
-PARAMS=(--dir "${CURRENT_DIR}")
+PARAMS=(--dir @tmuxThumbsDir@)
function add-param() {
local type opt arg
@@ -50,4 +34,4 @@ add-param upcase-command string
add-param multi-command string
add-param osc52 boolean
-"${TMUX_THUMBS_BINARY}" "${PARAMS[@]}" || true
+@tmuxThumbsDir@/tmux-thumbs "${PARAMS[@]}" || true

View File

@@ -0,0 +1,45 @@
{
mkTmuxPlugin,
fetchFromGitHub,
lib,
check-jsonschema,
python3,
}:
mkTmuxPlugin {
pluginName = "tmux-which-key";
rtpFilePath = "plugin.sh.tmux";
version = "0-unstable-2024-06-08";
buildInputs = [
check-jsonschema
(python3.withPackages (ps: with ps; [ pyyaml ]))
];
postPatch = ''
substituteInPlace plugin.sh.tmux --replace-fail \
python3 "${lib.getExe (python3.withPackages (ps: with ps; [ pyyaml ]))}"
'';
preInstall = ''
rm -rf plugin/pyyaml
ln -s ${python3.pkgs.pyyaml.src} plugin/pyyaml
'';
postInstall = ''
patchShebangs plugin.sh.tmux plugin/build.py
'';
src = fetchFromGitHub {
owner = "alexwforsythe";
repo = "tmux-which-key";
rev = "1f419775caf136a60aac8e3a269b51ad10b51eb6";
hash = "sha256-X7FunHrAexDgAlZfN+JOUJvXFZeyVj9yu6WRnxMEA8E=";
};
meta = {
homepage = "https://github.com/alexwforsythe/tmux-which-key";
description = "Tmux plugin that allows users to select actions from a customizable popup menu";
license = lib.licenses.mit;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ novaviper ];
};
}

View File

@@ -0,0 +1,53 @@
let
modelSpecs = (builtins.fromJSON (builtins.readFile ./models.json));
in
{
lib,
stdenvNoCC,
fetchurl,
}:
let
withCodeAsKey = f: { code, ... }@attrs: lib.nameValuePair code (f attrs);
mkModelPackage =
{
name,
code,
version,
url,
checksum,
}:
stdenvNoCC.mkDerivation {
pname = "translatelocally-model-${code}";
version = toString version;
src = fetchurl {
inherit url;
sha256 = checksum;
};
dontUnpack = true;
installPhase = ''
TARGET="$out/share/translateLocally/models"
mkdir -p "$TARGET"
tar -xzf "$src" -C "$TARGET"
# avoid patching shebangs in inconsistently executable extra files
find "$out" -type f -exec chmod -x {} +
'';
meta = {
description = "TranslateLocally model - ${name}";
homepage = "https://translatelocally.com/";
# https://github.com/browsermt/students/blob/master/LICENSE.md
license = lib.licenses.cc-by-sa-40;
};
};
allModelPkgs = lib.listToAttrs (map (withCodeAsKey mkModelPackage) modelSpecs);
in
allModelPkgs
// {
passthru.updateScript = ./update.sh;
}

View File

@@ -0,0 +1,233 @@
[
{
"version": 1,
"checksum": "cd5418ba6a412fc7e06288e3b879e5ac9155508f6ddab75c175039e0277486fa",
"url": "https://data.statmt.org/bergamot/models/csen/csen.student.base.v1.cd5418ba6a412fc7.tar.gz",
"name": "Czech-English base",
"code": "cs-en-base"
},
{
"version": 1,
"checksum": "8f603aded58f0a3c97d4498550dd070a356465109229f3c98cc61f2571bb1089",
"url": "https://data.statmt.org/bergamot/models/csen/csen.student.tiny11.v1.8f603aded58f0a3c.tar.gz",
"name": "Czech-English tiny",
"code": "cs-en-tiny"
},
{
"version": 1,
"checksum": "db770d87e491b0dc26d34e96a63188232f39198db157048fed5d111391a63cd0",
"url": "https://data.statmt.org/bergamot/models/csen/encs.student.base.v1.db770d87e491b0dc.tar.gz",
"name": "English-Czech base",
"code": "en-cs-base"
},
{
"version": 1,
"checksum": "b5c1ff605296b0e5a55ae6876db434fded62ae0c947e153f758d7b8a58c2c3dd",
"url": "https://data.statmt.org/bergamot/models/csen/encs.student.tiny11.v1.b5c1ff605296b0e5.tar.gz",
"name": "English-Czech tiny",
"code": "en-cs-tiny"
},
{
"version": 2,
"checksum": "caa7c0ce3c8eaf05d333dc9458683f4b0375e5eeb604f6fb2c8585f7b70d398b",
"url": "https://data.statmt.org/bergamot/models/deen/deen.student.base.v2.caa7c0ce3c8eaf05.tar.gz",
"name": "German-English base",
"code": "de-en-base"
},
{
"version": 2,
"checksum": "9f70fcb17bf9572d969aee69ed34c5d8b54c896c60dfe057da37f2e51d46895f",
"url": "https://data.statmt.org/bergamot/models/deen/deen.student.tiny11.v2.9f70fcb17bf9572d.tar.gz",
"name": "German-English tiny",
"code": "de-en-tiny"
},
{
"version": 2,
"checksum": "37b172bc9b594f9b60460f6d5c4ac1eb6af723ecccbdfa2c213308223a8a420f",
"url": "https://data.statmt.org/bergamot/models/deen/ende.student.base.v2.37b172bc9b594f9b.tar.gz",
"name": "English-German base",
"code": "en-de-base"
},
{
"version": 2,
"checksum": "93821e13b3c511b5390f9fb79f476f738d66e3656889bf076e906897e614fed2",
"url": "https://data.statmt.org/bergamot/models/deen/ende.student.tiny11.v2.93821e13b3c511b5.tar.gz",
"name": "English-German tiny",
"code": "en-de-tiny"
},
{
"version": 1,
"checksum": "09576f06d0ad805e6851defdd63434840729c3bcc5cf19db732f00298dcdb5d9",
"url": "https://data.statmt.org/bergamot/models/esen/esen.student.tiny11.v1.09576f06d0ad805e.tar.gz",
"name": "Spanish-English tiny",
"code": "es-en-tiny"
},
{
"version": 1,
"checksum": "a7203a8f8e9daea85698d5912f25cca6fecae3e4097b188a0c31ed2d58e13c61",
"url": "https://data.statmt.org/bergamot/models/esen/enes.student.tiny11.v1.a7203a8f8e9daea8.tar.gz",
"name": "English-Spanish tiny",
"code": "en-es-tiny"
},
{
"version": 1,
"checksum": "38de61c668e42f36a6b8acd564f3044b283d0cd61ebdb3947c490a99e297a2d5",
"url": "https://data.statmt.org/bergamot/models/eten/eten.student.tiny11.v1.38de61c668e42f36.tar.gz",
"name": "Estonian-English tiny",
"code": "et-en-tiny"
},
{
"version": 1,
"checksum": "0b8f835b0c154aaa01f612bfcf1bdcd41f86f1088f1226f2d3d6fa8155cb80a0",
"url": "https://data.statmt.org/bergamot/models/eten/enet.student.tiny11.v1.0b8f835b0c154aaa.tar.gz",
"name": "English-Estonian tiny",
"code": "en-et-tiny"
},
{
"version": 2.0,
"checksum": "536d6b8808a5c0765e058a8dc98f0ed667d6e14747708ca885aacbd21a99e795",
"url": "https://data.statmt.org/bergamot/models/isen/isen.student.base.v2.536d6b8808a5c076.tar.gz",
"name": "Icelandic-English base",
"code": "is-en-base"
},
{
"version": 2.0,
"checksum": "829203cf37b7bdc4ac0cbee206d40eb48bb8d8f6d73fba0c0e6dec8cd25a3448",
"url": "https://data.statmt.org/bergamot/models/isen/isen.student.tiny11.v2.829203cf37b7bdc4.tar.gz",
"name": "Icelandic-English tiny",
"code": "is-en-tiny"
},
{
"version": 1,
"checksum": "e410ce34f8337aabe2e105af14f44669f29cfae40f92f90b107323cf8f4188a9",
"url": "https://data.statmt.org/bergamot/models/nben/nben.student.tiny11.v1.e410ce34f8337aab.tar.gz",
"name": "Norwegian (Bokmål)-English tiny",
"code": "nb-en-tiny"
},
{
"version": 1,
"checksum": "0efa37c16887eea4ccd579e5de52bf09708893d93c7b0d4656d5a13e0bc9a07f",
"url": "https://data.statmt.org/bergamot/models/nnen/nnen.student.tiny11.v1.0efa37c16887eea4.tar.gz",
"name": "Norwegian (Nynorsk)-English tiny",
"code": "nn-en-tiny"
},
{
"version": 1,
"checksum": "f9c89a3a25ff8dca84413b28c1afe722ebc969f4aa84e7ecd14ea03ba77c8ae5",
"url": "https://data.statmt.org/bergamot/models/bgen/bgen.student.tiny11.v1.f9c89a3a25ff8dca.tar.gz",
"name": "Bulgarian-English tiny",
"code": "bg-en-tiny"
},
{
"version": 1,
"checksum": "3ea060c1b76470a7769dc1f32010a99fcc9a2e868a58c429cd8e8251fa1330c8",
"url": "https://data.statmt.org/bergamot/models/bgen/enbg.student.tiny11.v1.3ea060c1b76470a7.tar.gz",
"name": "English-Bulgarian tiny",
"code": "en-bg-tiny"
},
{
"version": 1,
"checksum": "87148203cbda28421d76fffbd7d3cd6c1fc0d6dae2843c248870274d6512a388",
"url": "https://data.statmt.org/bergamot/models/plen/plen.student.tiny11.v1.87148203cbda2842.tar.gz",
"name": "Polish-English tiny",
"code": "pl-en-tiny"
},
{
"version": 1,
"checksum": "c33219daa12e7872cf7ac8a1b86a2f3e0592ebadd7e756bf11d16d9a7725cf9b",
"url": "https://data.statmt.org/bergamot/models/plen/enpl.student.tiny11.v1.c33219daa12e7872.tar.gz",
"name": "English-Polish tiny",
"code": "en-pl-tiny"
},
{
"version": 1,
"checksum": "dccea16d03c0a3897b4ce085db676ae4bb2777f7e2b1755c04c0f92efa894b01",
"url": "https://data.statmt.org/bergamot/models/fren/fren.student.tiny11.v1.dccea16d03c0a389.tar.gz",
"name": "French-English tiny",
"code": "fr-en-tiny"
},
{
"version": 1,
"checksum": "805d112122af03d0fe2769eacaaaf5a9eac2c4b97e862a5b2cf0eb95862a7efb",
"url": "https://data.statmt.org/bergamot/models/fren/enfr.student.tiny11.v1.805d112122af03d0.tar.gz",
"name": "English-French tiny",
"code": "en-fr-tiny"
},
{
"version": 2.0,
"checksum": "536d6b8808a5c0765e058a8dc98f0ed667d6e14747708ca885aacbd21a99e795",
"url": "https://data.statmt.org/bergamot/models/isen/isen.student.base.v2.536d6b8808a5c076.tar.gz",
"name": "Icelandic-English base",
"code": "is-en-base"
},
{
"version": 2.0,
"checksum": "829203cf37b7bdc4ac0cbee206d40eb48bb8d8f6d73fba0c0e6dec8cd25a3448",
"url": "https://data.statmt.org/bergamot/models/isen/isen.student.tiny11.v2.829203cf37b7bdc4.tar.gz",
"name": "Icelandic-English tiny",
"code": "is-en-tiny"
},
{
"version": 1.0,
"checksum": "fa8a29e01a5332ba78801ae269b0d1e33b2777e19cc1c23aa0c487b884236858",
"url": "https://data.statmt.org/bergamot/models/hbseng/hbseng.student.tiny11.v1.fa8a29e01a5332ba.tar.gz",
"name": "SerboCroatian-English tiny",
"code": "hbs-eng-tiny"
},
{
"version": 1.0,
"checksum": "d029034e49c3bb0843cb540d60a3f2d8e5c2fda70e6856427a3d41f383e8bda9",
"url": "https://data.statmt.org/bergamot/models/slen/slen.student.tiny11.v1.d029034e49c3bb08.tar.gz",
"name": "Slovene-English tiny",
"code": "sl-en-tiny"
},
{
"version": 1.0,
"checksum": "dd03ef56f4695c7bf967072df97cdfa3884c9a816b2da8515779da2b2879145b",
"url": "https://data.statmt.org/bergamot/models/mken/mken.student.tiny11.v1.dd03ef56f4695c7b.tar.gz",
"name": "Macedonian-English tiny",
"code": "mk-en-tiny"
},
{
"version": 1.0,
"checksum": "4089a5a036eff1c3e646415b30ee3d1455b942a122fe427d4f087cd417963c5e",
"url": "https://data.statmt.org/bergamot/models/mten/mten.student.tiny11.v1.4089a5a036eff1c3.tar.gz",
"name": "Maltese-English tiny",
"code": "mt-en-tiny"
},
{
"version": 1.0,
"checksum": "d7728d17a313230a7a12b99106c5d588c3ac7a65950211b2aac455b258ca0b30",
"url": "https://data.statmt.org/bergamot/models/tren/tren.student.tiny11.v1.d7728d17a313230a.tar.gz",
"name": "Turkish-English tiny",
"code": "tr-en-tiny"
},
{
"version": 1.0,
"checksum": "6ead0c9b236f942bd2b059996730f349861b9e99ed462618fef1c0aefccb289c",
"url": "https://data.statmt.org/bergamot/models/sqen/sqen.student.tiny11.v1.6ead0c9b236f942b.tar.gz",
"name": "Albanian-English tiny",
"code": "sq-en-tiny"
},
{
"version": 1.0,
"checksum": "edaf67d1938e80d3ad082056c08be8c19d8cd178375de1211b17c8d0cd06aec7",
"url": "https://data.statmt.org/bergamot/models/caen/caen.student.tiny11.v1.edaf67d1938e80d3.tar.gz",
"name": "Catalan-English tiny",
"code": "ca-en-tiny"
},
{
"version": 1.0,
"checksum": "000644283159637882bf8901a57bb39dce29319717e86274720c44676a158d71",
"url": "https://data.statmt.org/bergamot/models/elen/elen.student.tiny11.v1.0006442831596378.tar.gz",
"name": "Greek-English tiny",
"code": "el-en-tiny"
},
{
"version": 1.0,
"checksum": "108d04d1e160153a9dc92e676010b79cc8a5de1ec0112a997db0a834a8457420",
"url": "https://data.statmt.org/bergamot/models/uken/uken.student.tiny11.v1.108d04d1e160153a.tar.gz",
"name": "Ukrainian-English tiny",
"code": "uk-en-tiny"
}
]

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl -p jq
set -eu -o pipefail
curl https://translatelocally.com/models.json \
| jq '.models | map(with_entries(select([.key] | inside([
"name",
"code",
"version",
"url",
"checksum"
]))))' \
> "$(dirname "$0")/models.json"

View File

@@ -0,0 +1,72 @@
(Patch from https://lists.denx.de/pipermail/u-boot/2024-July/559077.html)
pkg_resources is deprecated long ago and being removed in python 3.12.
Reimplement functions with importlib.resources.
Link: https://docs.python.org/3/library/importlib.resources.html
Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
---
tools/binman/control.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 2f00279232b8..5549b0ad2185 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -8,12 +8,11 @@
from collections import OrderedDict
import glob
try:
- import importlib.resources
-except ImportError: # pragma: no cover
+ from importlib import resources
+except ImportError:
# for Python 3.6
- import importlib_resources
+ import importlib_resources as resources
import os
-import pkg_resources
import re
import sys
@@ -96,12 +95,12 @@ def _ReadMissingBlobHelp():
msg = ''
return tag, msg
- my_data = pkg_resources.resource_string(__name__, 'missing-blob-help')
+ my_data = resources.files(__package__).joinpath('missing-blob-help').read_text()
re_tag = re.compile('^([-a-z0-9]+):$')
result = {}
tag = None
msg = ''
- for line in my_data.decode('utf-8').splitlines():
+ for line in my_data.splitlines():
if not line.startswith('#'):
m_tag = re_tag.match(line)
if m_tag:
@@ -151,8 +150,9 @@ def GetEntryModules(include_testing=True):
Returns:
Set of paths to entry class filenames
"""
- glob_list = pkg_resources.resource_listdir(__name__, 'etype')
- glob_list = [fname for fname in glob_list if fname.endswith('.py')]
+ directory = resources.files("binman.etype")
+ glob_list = [entry.name for entry in directory.iterdir()
+ if entry.name.endswith('.py')]
return set([os.path.splitext(os.path.basename(item))[0]
for item in glob_list
if include_testing or '_testing' not in item])
@@ -735,7 +735,7 @@ def Binman(args):
global state
if args.full_help:
- with importlib.resources.path('binman', 'README.rst') as readme:
+ with resources.path('binman', 'README.rst') as readme:
tools.print_full_help(str(readme))
return 0
--
2.45.2

888
pkgs/misc/uboot/default.nix Normal file
View File

@@ -0,0 +1,888 @@
{
stdenv,
lib,
bc,
bison,
dtc,
fetchFromGitHub,
fetchpatch,
fetchurl,
flex,
gnutls,
installShellFiles,
libuuid,
meson-tools,
ncurses,
openssl,
rkbin,
swig,
which,
python3,
perl,
armTrustedFirmwareAllwinner,
armTrustedFirmwareAllwinnerH6,
armTrustedFirmwareAllwinnerH616,
armTrustedFirmwareRK3328,
armTrustedFirmwareRK3399,
armTrustedFirmwareRK3568,
armTrustedFirmwareRK3588,
armTrustedFirmwareS905,
opensbi,
buildPackages,
callPackages,
darwin,
}@pkgs:
let
defaultVersion = "2025.07";
defaultSrc = fetchurl {
url = "https://ftp.denx.de/pub/u-boot/u-boot-${defaultVersion}.tar.bz2";
hash = "sha256-D5M/bFpCaJW/MG6T5qxTxghw5LVM2lbZUhG+yZ5jvsc=";
};
# Dependencies for the tools need to be included as either native or cross,
# depending on which we're building
toolsDeps = [
ncurses # tools/kwboot
libuuid # tools/mkeficapsule
gnutls # tools/mkeficapsule
openssl # tools/mkimage and tools/env/fw_printenv
];
buildUBoot = lib.makeOverridable (
{
version ? null,
src ? null,
filesToInstall,
pythonScriptsToInstall ? { },
installDir ? "$out",
defconfig,
extraConfig ? "",
extraPatches ? [ ],
extraMakeFlags ? [ ],
extraMeta ? { },
crossTools ? false,
stdenv ? pkgs.stdenv,
...
}@args:
stdenv.mkDerivation (
{
pname = "uboot-${defconfig}";
version = if src == null then defaultVersion else version;
src = if src == null then defaultSrc else src;
patches = extraPatches;
postPatch = ''
${lib.concatMapStrings (script: ''
substituteInPlace ${script} \
--replace "#!/usr/bin/env python3" "#!${pythonScriptsToInstall.${script}}/bin/python3"
'') (builtins.attrNames pythonScriptsToInstall)}
patchShebangs tools
patchShebangs scripts
'';
nativeBuildInputs = [
ncurses # tools/kwboot
bc
bison
flex
installShellFiles
(buildPackages.python3.withPackages (p: [
p.libfdt
p.setuptools # for pkg_resources
p.pyelftools
]))
swig
which # for scripts/dtc-version.sh
perl # for oid build (secureboot)
]
++ lib.optionals (!crossTools) toolsDeps
++ lib.optionals stdenv.buildPlatform.isDarwin [ darwin.DarwinTools ]; # sw_vers command is needed on darwin
depsBuildBuild = [ buildPackages.gccStdenv.cc ]; # gccStdenv is needed for Darwin buildPlatform
buildInputs = lib.optionals crossTools toolsDeps;
hardeningDisable = [ "all" ];
enableParallelBuilding = true;
makeFlags = [
"DTC=${lib.getExe buildPackages.dtc}"
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
"HOSTCFLAGS=-fcommon"
]
++ extraMakeFlags;
passAsFile = [ "extraConfig" ];
configurePhase = ''
runHook preConfigure
make -j$NIX_BUILD_CORES ${defconfig}
cat $extraConfigPath >> .config
runHook postConfigure
'';
installPhase = ''
runHook preInstall
mkdir -p ${installDir}
cp ${
lib.concatStringsSep " " (filesToInstall ++ builtins.attrNames pythonScriptsToInstall)
} ${installDir}
mkdir -p "$out/nix-support"
${lib.concatMapStrings (file: ''
echo "file binary-dist ${installDir}/${baseNameOf file}" >> "$out/nix-support/hydra-build-products"
'') (filesToInstall ++ builtins.attrNames pythonScriptsToInstall)}
runHook postInstall
'';
dontStrip = true;
meta =
with lib;
{
homepage = "https://www.denx.de/wiki/U-Boot/";
description = "Boot loader for embedded systems";
license = licenses.gpl2Plus;
maintainers = with maintainers; [
dezgeg
lopsided98
];
}
// extraMeta;
}
// removeAttrs args [
"extraMeta"
"pythonScriptsToInstall"
]
)
);
in
{
inherit buildUBoot;
ubootTools = buildUBoot {
defconfig = "tools-only_defconfig";
installDir = "$out/bin";
hardeningDisable = [ ];
dontStrip = false;
extraMeta.platforms = lib.platforms.linux;
crossTools = true;
extraMakeFlags = [
"HOST_TOOLS_ALL=y"
"NO_SDL=1"
"cross_tools"
"envtools"
];
outputs = [
"out"
"man"
];
postInstall = ''
installManPage doc/*.1
# from u-boot's tools/env/README:
# "You should then create a symlink from fw_setenv to fw_printenv. They
# use the same program and its function depends on its basename."
ln -s $out/bin/fw_printenv $out/bin/fw_setenv
'';
filesToInstall = [
"tools/dumpimage"
"tools/fdt_add_pubkey"
"tools/fdtgrep"
"tools/kwboot"
"tools/mkeficapsule"
"tools/mkenvimage"
"tools/mkimage"
"tools/env/fw_printenv"
"tools/mkeficapsule"
];
pythonScriptsToInstall = {
"tools/efivar.py" = (python3.withPackages (ps: [ ps.pyopenssl ]));
};
};
ubootPythonTools = lib.recurseIntoAttrs (callPackages ./python.nix { });
ubootA20OlinuxinoLime = buildUBoot {
defconfig = "A20-OLinuXino-Lime_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootA20OlinuxinoLime2EMMC = buildUBoot {
defconfig = "A20-OLinuXino-Lime2-eMMC_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootAmx335xEVM = buildUBoot {
defconfig = "am335x_evm_defconfig";
extraMeta = {
platforms = [ "armv7l-linux" ];
broken = true; # too big, exceeds memory size
};
filesToInstall = [
"MLO"
"u-boot.img"
];
};
ubootBananaPi = buildUBoot {
defconfig = "Bananapi_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootBananaPim2Zero = buildUBoot {
defconfig = "bananapi_m2_zero_defconfig";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
extraMeta.platforms = [ "armv7l-linux" ];
};
ubootBananaPim3 = buildUBoot {
defconfig = "Sinovoip_BPI_M3_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootBananaPim64 = buildUBoot {
defconfig = "bananapi_m64_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin";
SCP = "/dev/null";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
# http://git.denx.de/?p=u-boot.git;a=blob;f=board/solidrun/clearfog/README;hb=refs/heads/master
ubootClearfog = buildUBoot {
defconfig = "clearfog_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-with-spl.kwb" ];
};
ubootCM3588NAS = buildUBoot {
defconfig = "cm3588-nas-rk3588_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3588}/bl31.elf";
ROCKCHIP_TPL = rkbin.TPL_RK3588;
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
];
};
ubootCubieboard2 = buildUBoot {
defconfig = "Cubieboard2_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootGuruplug = buildUBoot {
defconfig = "guruplug_defconfig";
extraMeta.platforms = [ "armv5tel-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootJetsonTK1 = buildUBoot {
defconfig = "jetson-tk1_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [
"u-boot"
"u-boot.dtb"
"u-boot-dtb-tegra.bin"
"u-boot-nodtb-tegra.bin"
];
# tegra-uboot-flasher expects this exact directory layout, sigh...
postInstall = ''
mkdir -p $out/spl
cp spl/u-boot-spl $out/spl/
'';
};
# Flashing instructions:
# dd if=u-boot.gxl.sd.bin of=<sdcard> conv=fsync,notrunc bs=512 skip=1 seek=1
# dd if=u-boot.gxl.sd.bin of=<sdcard> conv=fsync,notrunc bs=1 count=444
ubootLibreTechCC =
let
firmwareImagePkg = fetchFromGitHub {
owner = "LibreELEC";
repo = "amlogic-boot-fip";
rev = "4369a138ca24c5ab932b8cbd1af4504570b709df";
sha256 = "sha256-mGRUwdh3nW4gBwWIYHJGjzkezHxABwcwk/1gVRis7Tc=";
meta.license = lib.licenses.unfreeRedistributableFirmware;
};
in
buildUBoot {
defconfig = "libretech-cc_defconfig";
extraMeta = {
broken = stdenv.buildPlatform.system != "x86_64-linux"; # aml_encrypt_gxl is a x86_64 binary
platforms = [ "aarch64-linux" ];
};
filesToInstall = [ "u-boot.bin" ];
postBuild = ''
# Copy binary files & tools from LibreELEC/amlogic-boot-fip, and u-boot build to working dir
mkdir $out tmp
cp ${firmwareImagePkg}/lepotato/{acs.bin,bl2.bin,bl21.bin,bl30.bin,bl301.bin,bl31.img} \
${firmwareImagePkg}/lepotato/{acs_tool.py,aml_encrypt_gxl,blx_fix.sh} \
u-boot.bin tmp/
cd tmp
python3 acs_tool.py bl2.bin bl2_acs.bin acs.bin 0
bash -e blx_fix.sh bl2_acs.bin zero bl2_zero.bin bl21.bin bl21_zero.bin bl2_new.bin bl2
[ -f zero ] && rm zero
bash -e blx_fix.sh bl30.bin zero bl30_zero.bin bl301.bin bl301_zero.bin bl30_new.bin bl30
[ -f zero ] && rm zero
./aml_encrypt_gxl --bl2sig --input bl2_new.bin --output bl2.n.bin.sig
./aml_encrypt_gxl --bl3enc --input bl30_new.bin --output bl30_new.bin.enc
./aml_encrypt_gxl --bl3enc --input bl31.img --output bl31.img.enc
./aml_encrypt_gxl --bl3enc --input u-boot.bin --output bl33.bin.enc
./aml_encrypt_gxl --bootmk --output $out/u-boot.gxl \
--bl2 bl2.n.bin.sig --bl30 bl30_new.bin.enc --bl31 bl31.img.enc --bl33 bl33.bin.enc
'';
};
ubootNanoPCT4 = buildUBoot rec {
rkbin = fetchFromGitHub {
owner = "armbian";
repo = "rkbin";
rev = "3bd0321cae5ef881a6005fb470009ad5a5d1462d";
sha256 = "09r4dzxsbs3pff4sh70qnyp30s3rc7pkc46v1m3152s7jqjasp31";
};
defconfig = "nanopc-t4-rk3399_defconfig";
extraMeta = {
platforms = [ "aarch64-linux" ];
license = lib.licenses.unfreeRedistributableFirmware;
};
BL31 = "${armTrustedFirmwareRK3399}/bl31.elf";
filesToInstall = [
"u-boot.itb"
"idbloader.img"
];
postBuild = ''
./tools/mkimage -n rk3399 -T rksd -d ${rkbin}/rk33/rk3399_ddr_800MHz_v1.24.bin idbloader.img
cat ${rkbin}/rk33/rk3399_miniloader_v1.19.bin >> idbloader.img
'';
};
ubootNanoPCT6 = buildUBoot {
defconfig = "nanopc-t6-rk3588_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3588}/bl31.elf";
ROCKCHIP_TPL = rkbin.TPL_RK3588;
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
"u-boot-rockchip-spi.bin"
];
};
ubootNovena = buildUBoot {
defconfig = "novena_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [
"u-boot-dtb.img"
"SPL"
];
};
# Flashing instructions:
# dd if=bl1.bin.hardkernel of=<device> conv=fsync bs=1 count=442
# dd if=bl1.bin.hardkernel of=<device> conv=fsync bs=512 skip=1 seek=1
# dd if=u-boot.gxbb of=<device> conv=fsync bs=512 seek=97
ubootOdroidC2 =
let
firmwareBlobs = fetchFromGitHub {
owner = "armbian";
repo = "odroidc2-blobs";
rev = "47c5aac4bcac6f067cebe76e41fb9924d45b429c";
sha256 = "1ns0a130yxnxysia8c3q2fgyjp9k0nkr689dxk88qh2vnibgchnp";
meta.license = lib.licenses.unfreeRedistributableFirmware;
};
in
buildUBoot {
defconfig = "odroid-c2_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [
"u-boot.bin"
"u-boot.gxbb"
"${firmwareBlobs}/bl1.bin.hardkernel"
];
postBuild = ''
# BL301 image needs at least 64 bytes of padding after it to place
# signing headers (with amlbootsig)
truncate -s 64 bl301.padding.bin
cat '${firmwareBlobs}/gxb/bl301.bin' bl301.padding.bin > bl301.padded.bin
# The downstream fip_create tool adds a custom TOC entry with UUID
# AABBCCDD-ABCD-EFEF-ABCD-12345678ABCD for the BL301 image. It turns out
# that the firmware blob does not actually care about UUIDs, only the
# order the images appear in the file. Because fiptool does not know
# about the BL301 UUID, we would have to use the --blob option, which adds
# the image to the end of the file, causing the boot to fail. Instead, we
# take advantage of the fact that UUIDs are ignored and just put the
# images in the right order with the wrong UUIDs. In the command below,
# --tb-fw is really --scp-fw and --scp-fw is the BL301 image.
#
# See https://github.com/afaerber/meson-tools/issues/3 for more
# information.
'${buildPackages.armTrustedFirmwareTools}/bin/fiptool' create \
--align 0x4000 \
--tb-fw '${firmwareBlobs}/gxb/bl30.bin' \
--scp-fw bl301.padded.bin \
--soc-fw '${armTrustedFirmwareS905}/bl31.bin' \
--nt-fw u-boot.bin \
fip.bin
cat '${firmwareBlobs}/gxb/bl2.package' fip.bin > boot_new.bin
'${buildPackages.meson-tools}/bin/amlbootsig' boot_new.bin u-boot.img
dd if=u-boot.img of=u-boot.gxbb bs=512 skip=96
'';
};
ubootOdroidXU3 = buildUBoot {
defconfig = "odroid-xu3_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-dtb.bin" ];
};
ubootOlimexA64Olinuxino = buildUBoot {
defconfig = "a64-olinuxino-emmc_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin";
SCP = "/dev/null";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootOlimexA64Teres1 = buildUBoot {
defconfig = "teres_i_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin";
# Using /dev/null here is upstream-specified way that disables the inclusion of crust-firmware as it's not yet packaged and without which the build will fail -- https://docs.u-boot.org/en/latest/board/allwinner/sunxi.html#building-the-crust-management-processor-firmware
SCP = "/dev/null";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootOrangePi5 = buildUBoot {
defconfig = "orangepi-5-rk3588s_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3588}/bl31.elf";
ROCKCHIP_TPL = rkbin.TPL_RK3588;
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
"u-boot-rockchip-spi.bin"
];
};
ubootOrangePi5Max = buildUBoot {
defconfig = "orangepi-5-max-rk3588_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3588}/bl31.elf";
ROCKCHIP_TPL = rkbin.TPL_RK3588;
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
"u-boot-rockchip-spi.bin"
];
};
ubootOrangePi5Plus = buildUBoot {
defconfig = "orangepi-5-plus-rk3588_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3588}/bl31.elf";
ROCKCHIP_TPL = rkbin.TPL_RK3588;
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
"u-boot-rockchip-spi.bin"
];
};
ubootOrangePiPc = buildUBoot {
defconfig = "orangepi_pc_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootOrangePiZeroPlus2H5 = buildUBoot {
defconfig = "orangepi_zero_plus2_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin";
SCP = "/dev/null";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootOrangePiZero = buildUBoot {
defconfig = "orangepi_zero_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootOrangePiZero2 = buildUBoot {
defconfig = "orangepi_zero2_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareAllwinnerH616}/bl31.bin";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootOrangePiZero3 = buildUBoot {
defconfig = "orangepi_zero3_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
# According to https://linux-sunxi.org/H616 the H618 "is a minor update with a larger (1MB) L2 cache" (compared to the H616)
# but "does require extra support in U-Boot, TF-A and sunxi-fel. Support for that has been merged in mainline releases."
# But no extra support seems to be in TF-A.
BL31 = "${armTrustedFirmwareAllwinnerH616}/bl31.bin";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootOrangePi3 = buildUBoot {
defconfig = "orangepi_3_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareAllwinnerH6}/bl31.bin";
SCP = "/dev/null";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootOrangePi3B = buildUBoot {
defconfig = "orangepi-3b-rk3566_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
ROCKCHIP_TPL = rkbin.TPL_RK3568;
BL31 = rkbin.BL31_RK3568;
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
"u-boot-rockchip-spi.bin"
];
};
ubootPcduino3Nano = buildUBoot {
defconfig = "Linksprite_pcDuino3_Nano_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootPine64 = buildUBoot {
defconfig = "pine64_plus_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin";
SCP = "/dev/null";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootPine64LTS = buildUBoot {
defconfig = "pine64-lts_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin";
SCP = "/dev/null";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootPinebook = buildUBoot {
defconfig = "pinebook_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin";
SCP = "/dev/null";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootPinebookPro = buildUBoot {
defconfig = "pinebook-pro-rk3399_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3399}/bl31.elf";
filesToInstall = [
"u-boot.itb"
"idbloader.img"
];
};
ubootQemuAarch64 = buildUBoot {
defconfig = "qemu_arm64_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootQemuArm = buildUBoot {
defconfig = "qemu_arm_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootQemuRiscv64Smode = buildUBoot {
defconfig = "qemu-riscv64_smode_defconfig";
extraMeta.platforms = [ "riscv64-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootQemuX86 = buildUBoot {
defconfig = "qemu-x86_defconfig";
extraConfig = ''
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_XHCI_HCD=y
'';
extraMeta.platforms = [
"i686-linux"
"x86_64-linux"
];
filesToInstall = [ "u-boot.rom" ];
};
ubootQemuX86_64 = buildUBoot {
defconfig = "qemu-x86_64_defconfig";
extraConfig = ''
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_XHCI_HCD=y
'';
extraMeta.platforms = [ "x86_64-linux" ];
filesToInstall = [ "u-boot.rom" ];
};
ubootQuartz64B = buildUBoot {
defconfig = "quartz64-b-rk3566_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3568}/bl31.elf";
ROCKCHIP_TPL = rkbin.TPL_RK3566;
filesToInstall = [
"idbloader.img"
"idbloader-spi.img"
"u-boot.itb"
"u-boot-rockchip.bin"
"u-boot-rockchip-spi.bin"
];
};
ubootRadxaZero3W = buildUBoot {
defconfig = "radxa-zero-3-rk3566_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3568}/bl31.elf";
ROCKCHIP_TPL = rkbin.TPL_RK3566;
filesToInstall = [
"idbloader.img"
"u-boot.itb"
"u-boot-rockchip.bin"
];
};
ubootRaspberryPi = buildUBoot {
defconfig = "rpi_defconfig";
extraMeta.platforms = [ "armv6l-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootRaspberryPi2 = buildUBoot {
defconfig = "rpi_2_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootRaspberryPi3_32bit = buildUBoot {
defconfig = "rpi_3_32b_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootRaspberryPi3_64bit = buildUBoot {
defconfig = "rpi_3_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootRaspberryPi4_32bit = buildUBoot {
defconfig = "rpi_4_32b_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootRaspberryPi4_64bit = buildUBoot {
defconfig = "rpi_4_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootRaspberryPiZero = buildUBoot {
defconfig = "rpi_0_w_defconfig";
extraMeta.platforms = [ "armv6l-linux" ];
filesToInstall = [ "u-boot.bin" ];
};
ubootRock4CPlus = buildUBoot {
defconfig = "rock-4c-plus-rk3399_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3399}/bl31.elf";
filesToInstall = [
"u-boot.itb"
"idbloader.img"
];
};
ubootRock5ModelB = buildUBoot {
defconfig = "rock5b-rk3588_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3588}/bl31.elf";
ROCKCHIP_TPL = rkbin.TPL_RK3588;
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
"u-boot-rockchip-spi.bin"
];
};
ubootRock64 = buildUBoot {
defconfig = "rock64-rk3328_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3328}/bl31.elf";
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
];
};
# A special build with much lower memory frequency (666 vs 1600 MT/s) which
# makes ROCK64 V2 boards stable. This is necessary because the DDR3 routing
# on that revision is marginal and not unconditionally stable at the specified
# frequency. If your ROCK64 is unstable you can try this u-boot variant to
# see if it works better for you. The only disadvantage is lowered memory
# bandwidth.
ubootRock64v2 = buildUBoot {
prePatch = ''
substituteInPlace arch/arm/dts/rk3328-rock64-u-boot.dtsi \
--replace rk3328-sdram-lpddr3-1600.dtsi rk3328-sdram-lpddr3-666.dtsi
'';
defconfig = "rock64-rk3328_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3328}/bl31.elf";
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
];
};
ubootRockPiE = buildUBoot {
defconfig = "rock-pi-e-rk3328_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3328}/bl31.elf";
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
];
};
ubootRockPro64 = buildUBoot {
defconfig = "rockpro64-rk3399_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3399}/bl31.elf";
filesToInstall = [
"u-boot.itb"
"idbloader.img"
];
};
ubootROCPCRK3399 = buildUBoot {
defconfig = "roc-pc-rk3399_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [
"spl/u-boot-spl.bin"
"u-boot.itb"
"idbloader.img"
];
BL31 = "${armTrustedFirmwareRK3399}/bl31.elf";
};
ubootSheevaplug = buildUBoot {
defconfig = "sheevaplug_defconfig";
extraMeta = {
platforms = [ "armv5tel-linux" ];
broken = true; # too big, exceeds partition size
};
filesToInstall = [ "u-boot.kwb" ];
};
ubootSopine = buildUBoot {
defconfig = "sopine_baseboard_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin";
SCP = "/dev/null";
filesToInstall = [ "u-boot-sunxi-with-spl.bin" ];
};
ubootTuringRK1 = buildUBoot {
defconfig = "turing-rk1-rk3588_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3588}/bl31.elf";
ROCKCHIP_TPL = rkbin.TPL_RK3588;
filesToInstall = [
"u-boot.itb"
"idbloader.img"
"u-boot-rockchip.bin"
];
};
ubootUtilite = buildUBoot {
defconfig = "cm_fx6_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-with-nand-spl.imx" ];
buildFlags = [ "u-boot-with-nand-spl.imx" ];
extraConfig = ''
CONFIG_CMD_SETEXPR=y
'';
# sata init; load sata 0 $loadaddr u-boot-with-nand-spl.imx
# sf probe; sf update $loadaddr 0 80000
};
ubootVisionFive2 = buildUBoot {
defconfig = "starfive_visionfive2_defconfig";
extraMeta.platforms = [ "riscv64-linux" ];
OPENSBI = "${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin";
filesToInstall = [
"spl/u-boot-spl.bin.normal.out"
"u-boot.itb"
];
};
ubootWandboard = buildUBoot {
defconfig = "wandboard_defconfig";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [
"u-boot.img"
"SPL"
];
};
ubootRockPi4 = buildUBoot {
defconfig = "rock-pi-4-rk3399_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
BL31 = "${armTrustedFirmwareRK3399}/bl31.elf";
filesToInstall = [
"u-boot.itb"
"idbloader.img"
];
};
}

160
pkgs/misc/uboot/python.nix Normal file
View File

@@ -0,0 +1,160 @@
{
lib,
python3Packages,
fetchPypi,
makeWrapper,
armTrustedFirmwareTools,
bzip2,
cbfstool,
gzip,
lz4,
lzop,
openssl,
ubootTools,
vboot_reference,
xilinx-bootgen,
xz,
zstd,
}:
let
# We are fetching from PyPI because the code in the repository seems to be
# lagging behind the PyPI releases somehow...
version = "0.0.7";
in
rec {
u_boot_pylib = python3Packages.buildPythonPackage rec {
pname = "u_boot_pylib";
inherit version;
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-A5r20Y8mgxhOhaKMpd5MJN5ubzPbkodAO0Tr0RN1SRA=";
};
build-system = with python3Packages; [
setuptools
];
checkPhase = ''
${python3Packages.python.interpreter} "src/$pname/__main__.py"
# There are some tests in other files, but they are broken
'';
pythonImportsCheck = [ "u_boot_pylib" ];
};
dtoc = python3Packages.buildPythonPackage rec {
pname = "dtoc";
inherit version;
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-NA96CznIxjqpw2Ik8AJpJkJ/ei+kQTCUExwFgssV+CM=";
};
build-system = with python3Packages; [
setuptools
];
dependencies =
(with python3Packages; [
libfdt
])
++ [
u_boot_pylib
];
pythonImportsCheck = [ "dtoc" ];
};
binman =
let
btools = [
armTrustedFirmwareTools
bzip2
cbfstool
# TODO: cst
gzip
lz4
# TODO: lzma_alone
lzop
openssl
ubootTools
vboot_reference
xilinx-bootgen
xz
zstd
];
in
python3Packages.buildPythonApplication rec {
pname = "binary_manager";
inherit version;
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-llEBBhUoW5jTEQeoaTCjZN8y6Kj+PGNUSB3cKpgD06w=";
};
patches = [
./binman-resources.patch
];
patchFlags = [
"-p2"
"-d"
"src"
];
build-system = with python3Packages; [
setuptools
];
nativeBuildInputs = [ makeWrapper ];
dependencies =
(with python3Packages; [
jsonschema
pycryptodomex
pyelftools
yamllint
])
++ [
dtoc
u_boot_pylib
];
preFixup = ''
wrapProgram "$out/bin/binman" --prefix PATH : "${lib.makeBinPath btools}"
'';
};
patman = python3Packages.buildPythonApplication rec {
pname = "patch_manager";
inherit version;
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-zD9e87fpWKynpUcfxobbdk6wbM6Ja3f8hEVHS7DGIKQ=";
};
build-system = with python3Packages; [
setuptools
];
dependencies =
(with python3Packages; [
aiohttp
pygit2
])
++ [
u_boot_pylib
];
};
}