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,39 @@
{
lib,
fetchFromGitHub,
rustPlatform,
dbus,
pkg-config,
openssl,
libevdev,
}:
rustPlatform.buildRustPackage rec {
pname = "tp-auto-kbbl";
version = "0.1.5";
src = fetchFromGitHub {
owner = "saibotd";
repo = "tp-auto-kbbl";
rev = version;
hash = "sha256-fhBCsOjaQH2tRsBjMGiDmZSIkAgEVxxywVp8/0uAaTU=";
};
cargoHash = "sha256-Ptc4m+99YknHY28DR5WHt/JG9tgUOcbz/TezUkezmS8=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [
dbus
libevdev
openssl
];
meta = with lib; {
description = "Auto toggle keyboard back-lighting on Thinkpads (and maybe other laptops) for Linux";
homepage = "https://github.com/saibotd/tp-auto-kbbl";
license = licenses.mit;
maintainers = [ ];
platforms = platforms.linux;
mainProgram = "tp-auto-kbbl";
};
}

View File

@@ -0,0 +1,42 @@
{
lib,
stdenv,
fetchFromGitHub,
perl,
kmod,
coreutils,
}:
# Requires the acpi_call kernel module in order to run.
stdenv.mkDerivation rec {
pname = "tpacpi-bat";
version = "3.2";
src = fetchFromGitHub {
owner = "teleshoes";
repo = "tpacpi-bat";
rev = "v${version}";
sha256 = "sha256-9XnvVNdgB5VeI3juZfc8N5weEyULXuqu1IDChZfQqFk=";
};
buildInputs = [ perl ];
installPhase = ''
mkdir -p $out/bin
cp tpacpi-bat $out/bin
'';
postPatch = ''
substituteInPlace tpacpi-bat \
--replace modprobe ${kmod}/bin/modprobe \
--replace cat ${coreutils}/bin/cat
'';
meta = {
maintainers = [ lib.maintainers.orbekk ];
platforms = lib.platforms.linux;
description = "Tool to set battery charging thresholds on Lenovo Thinkpad";
mainProgram = "tpacpi-bat";
license = lib.licenses.gpl3Plus;
};
}

View File

@@ -0,0 +1,35 @@
{
lib,
buildGoModule,
fetchFromGitHub,
}:
let
pname = "tparse";
version = "0.18.0";
in
buildGoModule {
inherit pname version;
src = fetchFromGitHub {
owner = "mfridman";
repo = "tparse";
rev = "v${version}";
hash = "sha256-oJApKmdo8uvnm6npXpzcKBRRkZ901AH1kZqGuoLdB3U=";
};
vendorHash = "sha256-4W6RryyQByUcwM2P2jmG2wXjNMrnpcCTSOJiw1M/Kd0=";
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
];
meta = {
description = "CLI tool for summarizing go test output. Pipe friendly. CI/CD friendly";
mainProgram = "tparse";
homepage = "https://github.com/mfridman/tparse";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ obreitwi ];
};
}

View File

@@ -0,0 +1,93 @@
{
lib,
stdenv,
fetchurl,
autoPatchelfHook,
makeWrapper,
parted,
util-linux,
dosfstools,
exfatprogs,
e2fsprogs,
ntfs3g,
btrfs-progs,
xfsprogs,
jfsutils,
f2fs-tools,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "tparted";
version = "2025-01-24";
src = fetchurl {
url = "https://github.com/Kagamma/tparted/releases/download/${finalAttrs.version}/linux_x86-64_tparted_${finalAttrs.version}.tar.gz";
hash = "sha256-7V3bdsP4uqZ5zyw3j/s8fhMYFCyQ1Rz5Z1JiPFc1oFY=";
};
nativeBuildInputs = [
autoPatchelfHook
makeWrapper
];
postFixup = ''
wrapProgram $out/bin/tparted \
--prefix PATH : ${
lib.makeBinPath [
parted
util-linux
dosfstools
exfatprogs
e2fsprogs
ntfs3g
btrfs-progs
xfsprogs
jfsutils
f2fs-tools
]
}
'';
runtimeDependencies = [
parted
util-linux
dosfstools
exfatprogs
e2fsprogs
ntfs3g
btrfs-progs
xfsprogs
jfsutils
f2fs-tools
];
unpackPhase = ''
runHook preUnpack
tar xf $src
runHook postUnpack
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp tparted $out/bin/
mkdir -p $out/opt/tparted
cp -r locale $out/opt/tparted/
runHook postInstall
'';
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "Text-based user interface (TUI) frontend for parted";
homepage = "https://github.com/Kagamma/tparted";
changelog = "https://github.com/Kagamma/tparted/releases/tag/${finalAttrs.version}";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ liberodark ];
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
mainProgram = "tparted";
};
})

View File

@@ -0,0 +1,26 @@
{
rustPlatform,
fetchFromGitHub,
lib,
}:
rustPlatform.buildRustPackage rec {
pname = "tpi";
version = "1.0.7";
src = fetchFromGitHub {
owner = "turing-machines";
repo = "tpi";
rev = "v${version}";
hash = "sha256-se5+8Zf+RKtvfkmDDxKiUVp5J+bQ9j9RFedDK/pxCgA=";
};
cargoHash = "sha256-neXFAMeo/LG3beNoR9q2gAZhlNrk0T4A5IdqR2cZocs=";
meta = {
description = "CLI tool to control your Turing Pi 2 board";
homepage = "https://github.com/turing-machines/tpi";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ WoutSwinkels ];
mainProgram = "tpi";
};
}

View File

@@ -0,0 +1,62 @@
{
lib,
rustPlatform,
fetchFromGitHub,
pkg-config,
clang,
ffmpeg-headless,
openssl,
alsa-lib,
opencv,
makeWrapper,
}:
rustPlatform.buildRustPackage rec {
pname = "tplay";
version = "0.6.3";
src = fetchFromGitHub {
owner = "maxcurzi";
repo = "tplay";
rev = "v${version}";
hash = "sha256-JVkezG2bs99IFOTONeZZRljjbi0EhFf+DMxcfiWI4p4=";
};
cargoHash = "sha256-LHRTmjAwDPMOP6YQfL01leEzqRKtteU1cnUqL6UeWKk=";
checkFlags = [
# requires network access
"--skip=pipeline::image_pipeline::tests::test_process"
"--skip=pipeline::image_pipeline::tests::test_to_ascii"
"--skip=pipeline::image_pipeline::tests::test_to_ascii_ext"
"--skip=pipeline::runner::tests::test_time_to_send_next_frame"
];
nativeBuildInputs = [
rustPlatform.bindgenHook
pkg-config
clang
makeWrapper
];
buildInputs = [
openssl.dev
alsa-lib.dev
ffmpeg-headless.dev
opencv
];
postFixup = ''
wrapProgram $out/bin/tplay \
--prefix PATH : "${lib.makeBinPath [ ffmpeg-headless ]}"
'';
meta = {
description = "Terminal Media Player";
homepage = "https://github.com/maxcurzi/tplay";
platforms = lib.platforms.linux;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
demine
colemickens
];
};
}

View File

@@ -0,0 +1,37 @@
{
lib,
fetchFromGitHub,
buildGoModule,
pinentry-tty,
}:
buildGoModule {
pname = "tpm-fido";
version = "0-unstable-2024-10-30";
src = fetchFromGitHub {
owner = "psanford";
repo = "tpm-fido";
rev = "5f8828b82b58f9badeed65718fca72bc31358c5c";
hash = "sha256-Yfr5B4AfcBscD31QOsukamKtEDWC9Cx2ee4L6HM2554=";
};
vendorHash = "sha256-qm/iDc9tnphQ4qooufpzzX7s4dbnUbR9J5L770qXw8Y=";
buildInputs = [
pinentry-tty
];
ldFlags = [
"-s "
"-w"
];
meta = {
description = "WebAuthn/U2F token protected by a TPM";
homepage = "https://github.com/psanford/tpm-fido";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ genga898 ];
mainProgram = "tpm-fido";
};
}

View File

@@ -0,0 +1,63 @@
diff --git a/swtpm-utils/lib/hmac.c b/swtpm-utils/lib/hmac.c
index 5545375..f9bedea 100644
--- a/swtpm-utils/lib/hmac.c
+++ b/swtpm-utils/lib/hmac.c
@@ -381,15 +381,19 @@ uint32_t TSS_authhmac(unsigned char *digest, unsigned char *key, unsigned int ke
/****************************************************************************/
uint32_t TSS_rawhmac(unsigned char *digest, const unsigned char *key, unsigned int keylen, ...)
{
- HMAC_CTX hmac;
+ HMAC_CTX* hmac;
unsigned int dlen;
unsigned char *data;
va_list argp;
-
-#ifdef HAVE_HMAC_CTX_CLEANUP
- HMAC_CTX_init(&hmac);
-#endif
- HMAC_Init(&hmac,key,keylen,EVP_sha1());
+
+ hmac = HMAC_CTX_new();
+
+ if (hmac == NULL)
+ {
+ return ERR_MEM_ERR;
+ }
+
+ HMAC_Init_ex(hmac,key,keylen,EVP_sha1(),NULL);
va_start(argp,keylen);
for (;;)
@@ -398,15 +402,11 @@ uint32_t TSS_rawhmac(unsigned char *digest, const unsigned char *key, unsigned i
if (dlen == 0) break;
data = (unsigned char *)va_arg(argp,unsigned char *);
if (data == NULL) return ERR_NULL_ARG;
- HMAC_Update(&hmac,data,dlen);
+ HMAC_Update(hmac,data,dlen);
}
- HMAC_Final(&hmac,digest,&dlen);
+ HMAC_Final(hmac,digest,&dlen);
-#ifdef HAVE_HMAC_CTX_CLEANUP
- HMAC_CTX_cleanup(&hmac);
-#else
- HMAC_cleanup(&hmac);
-#endif
+ HMAC_CTX_free(hmac);
va_end(argp);
return 0;
}
diff --git a/swtpm-utils/lib/keys.c b/swtpm-utils/lib/keys.c
index 99691b6..6627a1f 100644
--- a/swtpm-utils/lib/keys.c
+++ b/swtpm-utils/lib/keys.c
@@ -1249,8 +1249,7 @@ RSA *TSS_convpubkey(pubkeydata *k)
exp);
}
/* set up the RSA public key structure */
- rsa->n = mod;
- rsa->e = exp;
+ RSA_set0_key(rsa, mod, exp, NULL);
return rsa;
}

View File

@@ -0,0 +1,50 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
gawk,
trousers,
cryptsetup,
openssl,
}:
stdenv.mkDerivation {
pname = "tpm-luks";
version = "unstable-2015-07-11";
src = fetchFromGitHub {
owner = "momiji";
repo = "tpm-luks";
rev = "c9c5b7fdddbcdac1cd4d2ea6baddd0617cc88ffa";
sha256 = "sha256-HHyZLZAXfmuimpHV8fOWldZmi4I5uV1NnSmP4E7ZQtc=";
};
patches = [
./openssl-1.1.patch
./signed-ptr.patch
];
nativeBuildInputs = [ autoreconfHook ];
buildInputs = [
gawk
trousers
cryptsetup
openssl
];
installPhase = ''
mkdir -p $out
make install DESTDIR=$out
mv $out/$out/sbin $out/bin
rm -r $out/nix
'';
meta = with lib; {
description = "LUKS key storage in TPM NVRAM";
homepage = "https://github.com/shpedoikal/tpm-luks/";
maintainers = [ ];
license = with licenses; [ gpl2Only ];
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,15 @@
diff --git a/swtpm-utils/getcapability.c b/swtpm-utils/getcapability.c
index 7359ba3..17b4324 100644
--- a/swtpm-utils/getcapability.c
+++ b/swtpm-utils/getcapability.c
@@ -480,7 +480,8 @@ int main(int argc, char *argv[])
}
if (c) {
- char pcrmap[4], *pf;
+ char pcrmap[4];
+ unsigned char *pf;
memcpy(pcrmap, ndp.pcrInfoRead.pcrSelection.pcrSelect,
ndp.pcrInfoRead.pcrSelection.sizeOfSelect);

View File

@@ -0,0 +1,41 @@
{
lib,
stdenv,
fetchurl,
trousers,
openssl,
}:
stdenv.mkDerivation rec {
pname = "tpm-quote-tools";
version = "1.0.4";
src = fetchurl {
url = "mirror://sourceforge/project/tpmquotetools/${version}/${pname}-${version}.tar.gz";
sha256 = "1qjs83xb4np4yn1bhbjfhvkiika410v8icwnjix5ad96w2nlxp0h";
};
buildInputs = [
trousers
openssl
];
postFixup = ''
patchelf \
--set-rpath "${lib.makeLibraryPath [ openssl ]}:$(patchelf --print-rpath $out/bin/tpm_mkaik)" \
$out/bin/tpm_mkaik
'';
meta = with lib; {
description = "Collection of programs that provide support for TPM based attestation using the TPM quote mechanism";
longDescription = ''
The TPM Quote Tools is a collection of programs that provide support
for TPM based attestation using the TPM quote mechanism. The manual
page for tpm_quote_tools provides a usage overview.
'';
homepage = "http://tpmquotetools.sourceforge.net/";
license = licenses.bsd3;
maintainers = with maintainers; [ ak ];
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,54 @@
{
lib,
stdenv,
fetchurl,
autoreconfHook,
trousers,
openssl,
opencryptoki,
perl,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "tpm-tools";
version = "1.3.9.2";
src = fetchurl {
url = "mirror://sourceforge/trousers/tpm-tools/${finalAttrs.version}/tpm-tools-${finalAttrs.version}.tar.gz";
hash = "sha256-ivg3lJouwwsZU4msiisxvEn+MVBQdRt9TQ1DK/eBKpc=";
};
postPatch = ''
mkdir -p po
mkdir -p m4
cp -R po_/* po/
touch po/Makefile.in.in
touch m4/Makefile.am
substituteInPlace include/tpm_pkcs11.h \
--replace-fail "libopencryptoki.so" "${opencryptoki}/lib/opencryptoki/libopencryptoki.so"
'';
nativeBuildInputs = [
autoreconfHook
perl
];
buildInputs = [
trousers
openssl
opencryptoki
];
meta = {
description = "Management tools for TPM hardware";
longDescription = ''
tpm-tools is an open-source package designed to enable user and
application enablement of Trusted Computing using a Trusted Platform
Module (TPM), similar to a smart card environment.
'';
homepage = "https://sourceforge.net/projects/trousers/files/tpm-tools/";
license = lib.licenses.cpl10;
maintainers = [ lib.maintainers.ak ];
platforms = lib.platforms.unix;
};
})

View File

@@ -0,0 +1,70 @@
{
stdenv,
lib,
fetchFromGitHub,
autoreconfHook,
pkg-config,
autoconf-archive,
makeWrapper,
which,
tpm2-tss,
glib,
dbus,
cmocka,
}:
stdenv.mkDerivation rec {
pname = "tpm2-abrmd";
version = "3.0.0";
src = fetchFromGitHub {
owner = "tpm2-software";
repo = "tpm2-abrmd";
rev = version;
sha256 = "sha256-l0ncCMsStaeFACRU3Bt6F1zyiOTGY6wOHewA4AD58Ww=";
};
nativeBuildInputs = [
autoconf-archive
autoreconfHook
glib
makeWrapper
pkg-config
which
];
buildInputs = [
tpm2-tss
glib
dbus
];
nativeCheckInputs = [ cmocka ];
enableParallelBuilding = true;
# Emulate the required behavior of ./bootstrap in the original
# package
preAutoreconf = ''
echo "${version}" > VERSION
'';
# Unit tests are currently broken as the check phase attempts to start a dbus daemon etc.
#configureFlags = [ "--enable-unit" ];
doCheck = false;
# Even though tpm2-tss is in the RUNPATH, starting from 2.3.0 abrmd
# seems to require the path to the device TCTI (used for accessing
# /dev/tpm0) in it's LD_LIBRARY_PATH
postFixup = ''
wrapProgram $out/bin/tpm2-abrmd \
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ tpm2-tss ]}"
'';
meta = with lib; {
description = "TPM2 resource manager, accessible via D-Bus";
mainProgram = "tpm2-abrmd";
homepage = "https://github.com/tpm2-software/tpm2-tools";
license = licenses.bsd3;
platforms = platforms.linux;
maintainers = with maintainers; [ matthiasbeyer ];
};
}

View File

@@ -0,0 +1,49 @@
{
stdenv,
lib,
autoreconfHook,
fetchFromGitHub,
autoconf-archive,
nix-update-script,
pkg-config,
openssl,
tpm2-tss,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "tpm2-openssl";
version = "1.3.0";
src = fetchFromGitHub {
owner = "tpm2-software";
repo = "tpm2-openssl";
rev = finalAttrs.version;
hash = "sha256-CCTR7qBqI/y+jLBEEcgRanYOBNUYM/sH/hCqOLGA4QM=";
};
nativeBuildInputs = [
autoreconfHook
autoconf-archive
pkg-config
];
buildInputs = [
openssl
tpm2-tss
];
configureFlags = [ "--with-modulesdir=$$out/lib/ossl-modules" ];
postPatch = ''
echo ${finalAttrs.version} > VERSION
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "OpenSSL Provider for TPM2 integration";
homepage = "https://github.com/tpm2-software/tpm2-openssl";
license = licenses.bsd3;
maintainers = with maintainers; [ stv0g ];
platforms = platforms.linux;
};
})

View File

@@ -0,0 +1,12 @@
{
tpm2-pkcs11,
...
}@args:
tpm2-pkcs11.override (
args
// {
fapiSupport = false;
extraDescription = "Disables FAPI support, as if TPM2_PKCS11_BACKEND were always set to 'esysdb'.";
}
)

View File

@@ -0,0 +1,13 @@
{
tpm2-pkcs11,
...
}@args:
tpm2-pkcs11.override (
args
// {
fapiSupport = true;
defaultToFapi = true;
extraDescription = "Enables fapi by default, as if TPM2_PKCS11_BACKEND defaulted to 'fapi'.";
}
)

View File

@@ -0,0 +1,33 @@
From 648f0d08953152185e13feaca4feda02f8665341 Mon Sep 17 00:00:00 2001
From: Morgan Jones <me@numin.it>
Date: Wed, 9 Apr 2025 00:12:47 -0700
Subject: [PATCH] backend: default to fapi
---
src/lib/backend.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/lib/backend.c b/src/lib/backend.c
index 128f58b..8404afe 100644
--- a/src/lib/backend.c
+++ b/src/lib/backend.c
@@ -15,12 +15,12 @@ static enum backend get_backend(void) {
const char *env = getenv("TPM2_PKCS11_BACKEND");
- if (!env || !strcasecmp(env, "esysdb")) {
- return backend_esysdb;
+ if (!env || !strcasecmp(env, "fapi")) {
+ return backend_fapi;
}
- if (!strcasecmp(env, "fapi")) {
- return backend_fapi;
+ if (!strcasecmp(env, "esysdb")) {
+ return backend_esysdb;
}
return backend_error;
--
2.47.0

View File

@@ -0,0 +1,58 @@
diff --git a/Makefile-integration.am b/Makefile-integration.am
index e2255de..3cea1d8 100644
--- a/Makefile-integration.am
+++ b/Makefile-integration.am
@@ -7,7 +7,6 @@ integration_scripts = \
test/integration/pkcs11-dbup.sh.nosetup \
test/integration/tls-tests.sh \
test/integration/openssl.sh \
- test/integration/pkcs11-javarunner.sh.java \
test/integration/nss-tests.sh \
test/integration/ptool-link.sh.nosetup \
test/integration/python-pkcs11.sh
@@ -110,13 +109,5 @@ test_integration_pkcs_lockout_int_CFLAGS = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_pkcs_lockout_int_LDADD = $(TESTS_LDADD) $(SQLITE3_LIBS)
test_integration_pkcs_lockout_int_SOURCES = test/integration/pkcs-lockout.int.c test/integration/test.c
-#
-# Java Tests
-#
-AM_JAVA_LOG_FLAGS = --tabrmd-tcti=$(TABRMD_TCTI) --tsetup-script=$(top_srcdir)/test/integration/scripts/create_pkcs_store.sh
-JAVA_LOG_COMPILER=$(LOG_COMPILER)
-dist_noinst_JAVA = test/integration/PKCS11JavaTests.java
-CLEANFILES += test/integration/PKCS11JavaTests.class
-
endif
# END INTEGRATION
diff --git a/configure.ac b/configure.ac
index 1ec6eb4..7a0a8ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,13 +258,6 @@ AC_ARG_ENABLE(
[build and execute integration tests])],,
[enable_integration=no])
-# Test for Java compiler and interpreter without throwing fatal errors (since
-# these macros are defined using AC_DEFUN they cannot be called conditionally)
-m4_pushdef([AC_MSG_ERROR], [have_javac=no])
-AX_PROG_JAVAC()
-AX_PROG_JAVA()
-m4_popdef([AC_MSG_ERROR])
-
AC_DEFUN([integration_test_checks], [
AC_CHECK_PROG([tpm2_createprimary], [tpm2_createprimary], [yes], [no])
@@ -382,13 +375,6 @@ AC_DEFUN([integration_test_checks], [
[AC_MSG_ERROR([Integration tests enabled but tss2_provision executable not found.])])
])
- AS_IF([test "x$have_javac" = "xno"],
- [AC_MSG_ERROR([Integration tests enabled but no Java compiler was found])])
- AX_CHECK_CLASS([org.junit.Assert], ,
- [AC_MSG_ERROR([Integration tests enabled but JUnit not found, try setting CLASSPATH])])
- AX_CHECK_CLASS([org.hamcrest.SelfDescribing], ,
- [AC_MSG_ERROR([Integration tests enabled but Hamcrest not found, try setting CLASSPATH])])
-
AC_SUBST([ENABLE_INTEGRATION], [$enable_integration])
]) # end function integration_test_checks

View File

@@ -0,0 +1,257 @@
{
autoconf-archive,
autoreconfHook,
buildEnv,
clangStdenv,
cmocka,
dbus,
expect,
fetchFromGitHub,
glibc,
gnutls,
iproute2,
lib,
libyaml,
makeWrapper,
opensc,
openssh,
openssl,
nss,
p11-kit,
patchelf,
pkg-config,
python3,
stdenv,
sqlite,
swtpm,
tpm2-abrmd,
tpm2-openssl,
tpm2-pkcs11, # for passthru tests
tpm2-pkcs11-esapi,
tpm2-pkcs11-fapi,
tpm2-tools,
tpm2-tss,
which,
xxd,
abrmdSupport ? false,
fapiSupport ? true,
defaultToFapi ? false,
enableFuzzing ? false,
extraDescription ? null,
}:
let
chosenStdenv = if enableFuzzing then clangStdenv else stdenv;
in
chosenStdenv.mkDerivation (finalAttrs: {
pname = "tpm2-pkcs11";
version = "1.9.1";
src = fetchFromGitHub {
owner = "tpm2-software";
repo = "tpm2-pkcs11";
tag = finalAttrs.version;
hash = "sha256-W74ckrpK7ypny1L3Gn7nNbOVh8zbHavIk/TX3b8XbI8=";
};
# Disable Javabased tests because of missing dependencies
patches =
lib.singleton ./disable-java-integration.patch
++ lib.optional defaultToFapi ./default-to-fapi.patch;
postPatch = ''
echo ${lib.escapeShellArg finalAttrs.version} >VERSION
# Don't run git in the bootstrap
substituteInPlace bootstrap --replace-warn "git" "# git"
# Provide configuration file for D-Bus
substituteInPlace Makefile.am --replace-fail \
"dbus-run-session" \
"dbus-run-session --config-file=${dbus}/share/dbus-1/session.conf"
# Disable failing tests
sed -E -i '/\<test\/integration\/(pkcs-crypt\.int|pkcs11-tool\.sh)\>/d' \
Makefile-integration.am
patchShebangs test tools
# The preConfigure phase doesn't seem to be working here
# ./bootstrap MUST be executed as the first step, before all
# of the autoreconfHook stuff
./bootstrap
'';
configureFlags = [
(lib.enableFeature finalAttrs.doCheck "unit")
(lib.enableFeature finalAttrs.doCheck "integration")
# Strangely, it uses --with-fapi=yes|no instead of a normal configure flag.
"--with-fapi=${if fapiSupport then "yes" else "no"}"
]
++ lib.optionals enableFuzzing [
"--enable-fuzzing"
"--disable-hardening"
];
strictDeps = true;
nativeBuildInputs = [
autoconf-archive
autoreconfHook
makeWrapper
patchelf
pkg-config
(python3.withPackages (
ps:
with ps;
[
packaging
pyyaml
python-pkcs11
cryptography
pyasn1-modules
tpm2-pytss
]
++ cryptography.optional-dependencies.ssh
))
];
buildInputs = [
libyaml
opensc
openssl
sqlite
tpm2-tools
tpm2-tss
];
nativeCheckInputs = [
dbus
expect
gnutls
iproute2
nss.tools
opensc
openssh
openssl
p11-kit
sqlite
swtpm
tpm2-abrmd
tpm2-tools
which
xxd
];
checkInputs = [
cmocka
tpm2-abrmd
];
enableParallelBuilding = true;
hardeningDisable = lib.optional enableFuzzing "all";
outputs = [
"out"
"bin"
"dev"
];
doCheck = true;
dontStrip = true;
dontPatchELF = true;
preCheck =
let
openssl-modules = buildEnv {
name = "openssl-modules";
pathsToLink = [ "/lib/ossl-modules" ];
paths = map lib.getLib [
openssl
tpm2-openssl
];
};
in
''
# Enable tests to load TCTI modules
export LD_LIBRARY_PATH+=":${
lib.makeLibraryPath [
swtpm
tpm2-tools
tpm2-abrmd
]
}"
# Enable tests to load TPM2 OpenSSL module
export OPENSSL_MODULES="${openssl-modules}/lib/ossl-modules"
''
+ lib.optionalString defaultToFapi ''
# Need to change the default since the tests expect the other way.
export TPM2_PKCS11_BACKEND=esysdb
'';
postInstall = ''
mkdir -p $bin/bin/ $bin/share/tpm2_pkcs11/
mv ./tools/* $bin/share/tpm2_pkcs11/
makeWrapper $bin/share/tpm2_pkcs11/tpm2_ptool.py $bin/bin/tpm2_ptool \
--prefix PATH : ${lib.makeBinPath [ tpm2-tools ]}
'';
# To be able to use the userspace resource manager, the RUNPATH must
# explicitly include the tpm2-abrmd shared libraries.
preFixup =
let
rpath = lib.makeLibraryPath (
[
glibc
libyaml
openssl
sqlite
tpm2-tss
]
++ (lib.optional abrmdSupport tpm2-abrmd)
);
in
''
patchelf \
--set-rpath ${rpath} \
${lib.optionalString abrmdSupport "--add-needed ${lib.makeLibraryPath [ tpm2-abrmd ]}/libtss2-tcti-tabrmd.so"} \
--add-needed ${lib.makeLibraryPath [ tpm2-tss ]}/libtss2-tcti-device.so \
$out/lib/libtpm2_pkcs11.so.0.0.0
'';
passthru = rec {
esapi = tpm2-pkcs11-esapi;
fapi = tpm2-pkcs11-fapi;
abrmd = tpm2-pkcs11.override {
abrmdSupport = true;
};
esapi-abrmd = tpm2-pkcs11-esapi.override {
abrmdSupport = true;
};
fapi-abrmd = tpm2-pkcs11-fapi.override {
abrmdSupport = true;
};
tests = {
inherit
esapi
fapi
abrmd
esapi-abrmd
fapi-abrmd
;
};
};
meta = {
description =
"PKCS#11 interface for TPM2 hardware"
+ lib.optionalString (extraDescription != null) " ${extraDescription}";
homepage = "https://github.com/tpm2-software/tpm2-pkcs11";
license = lib.licenses.bsd2;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ numinit ];
mainProgram = "tpm2_ptool";
};
})

View File

@@ -0,0 +1,62 @@
{
stdenv,
fetchurl,
lib,
pandoc,
pkg-config,
makeWrapper,
curl,
openssl,
tpm2-tss,
libuuid,
abrmdSupport ? true,
tpm2-abrmd ? null,
}:
stdenv.mkDerivation rec {
pname = "tpm2-tools";
version = "5.7";
src = fetchurl {
url = "https://github.com/tpm2-software/${pname}/releases/download/${version}/${pname}-${version}.tar.gz";
sha256 = "sha256-OBDTa1B5JW9PL3zlUuIiE9Q7EDHBMVON+KLbw8VwmDo=";
};
nativeBuildInputs = [
pandoc
pkg-config
makeWrapper
];
buildInputs = [
curl
openssl
tpm2-tss
libuuid
];
preFixup =
let
ldLibraryPath = lib.makeLibraryPath (
[
tpm2-tss
]
++ (lib.optional abrmdSupport tpm2-abrmd)
);
in
''
wrapProgram $out/bin/tpm2 --suffix LD_LIBRARY_PATH : "${ldLibraryPath}"
wrapProgram $out/bin/tss2 --suffix LD_LIBRARY_PATH : "${ldLibraryPath}"
'';
# Unit tests disabled, as they rely on a dbus session
#configureFlags = [ "--enable-unit" ];
doCheck = false;
meta = with lib; {
description = "Command line tools that provide access to a TPM 2.0 compatible device";
homepage = "https://github.com/tpm2-software/tpm2-tools";
license = licenses.bsd3;
platforms = platforms.linux;
maintainers = [ ];
};
}

View File

@@ -0,0 +1,52 @@
{
lib,
stdenv,
fetchFromGitHub,
tpm2-tss,
autoreconfHook,
autoconf-archive,
pandoc,
pkg-config,
withPlymouth ? false,
plymouth,
qrencode,
}:
stdenv.mkDerivation rec {
pname = "tpm2-totp";
version = "0.3.0";
src = fetchFromGitHub {
owner = "tpm2-software";
repo = "tpm2-totp";
rev = "v${version}";
hash = "sha256-aeWhI2GQcWa0xAqlmHfcbCMg78UqcD6eanLlEVNVnRM=";
};
preConfigure = ''
echo '0.3.0' > VERSION
'';
nativeBuildInputs = [
autoreconfHook
autoconf-archive
pandoc
pkg-config
];
buildInputs = [
tpm2-tss
qrencode
]
++ lib.optional withPlymouth plymouth;
meta = with lib; {
description = "Attest the trustworthiness of a device against a human using time-based one-time passwords";
homepage = "https://github.com/tpm2-software/tpm2-totp";
changelog = "https://github.com/tpm2-software/tpm2-totp/blob/${src.rev}/CHANGELOG.md";
license = licenses.bsd3;
mainProgram = "tpm2-totp";
platforms = platforms.all;
maintainers = with maintainers; [ raitobezarius ];
};
}

View File

@@ -0,0 +1,66 @@
{
lib,
fetchFromGitHub,
rustPlatform,
cmake,
pkg-config,
oniguruma,
installShellFiles,
tpnote,
versionCheckHook,
nix-update-script,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "tpnote";
version = "1.25.15";
src = fetchFromGitHub {
owner = "getreu";
repo = "tp-note";
tag = "v${finalAttrs.version}";
hash = "sha256-vmHRpY2KvG6vxVQ6OVi/u6wpD8oqQFXn2IJOT0Nh/V0=";
};
cargoHash = "sha256-dltBOA6pxy2gLemVoX8l0Z+xkiJvhGWSmediWWnN1bc=";
nativeBuildInputs = [
cmake
pkg-config
installShellFiles
];
buildInputs = [
oniguruma
];
postInstall = ''
installManPage docs/build/man/man1/tpnote.1
'';
RUSTONIG_SYSTEM_LIBONIG = true;
# The `tpnote` crate has no unit tests. All tests are in `tpnote-lib`.
checkType = "debug";
cargoTestFlags = "--package tpnote-lib";
doCheck = true;
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = "--version";
doInstallCheck = true;
passthru = {
updateScript = nix-update-script { };
};
meta = {
changelog = "https://github.com/getreu/tp-note/releases/tag/v${finalAttrs.version}";
description = "Markup enhanced granular note-taking";
homepage = "https://blog.getreu.net/projects/tp-note/";
license = lib.licenses.mit;
mainProgram = "tpnote";
maintainers = with lib.maintainers; [ getreu ];
};
})

View File

@@ -0,0 +1,36 @@
{
lib,
buildGoModule,
fetchFromGitHub,
nix-update-script,
}:
buildGoModule rec {
pname = "tproxy";
version = "0.9.1";
src = fetchFromGitHub {
owner = "kevwan";
repo = "tproxy";
tag = "v${version}";
hash = "sha256-Ck7WtCxWiZxkKlx7D/N0EZmFEgrW7MpPj5ATvJxGXgg=";
};
vendorHash = "sha256-xYPF3RGrOQ1e2EPHtvlM9QKSE+V4cnG8f9JTS0hkAYU=";
ldflags = [
"-w"
"-s"
];
passthru.updateScript = nix-update-script { };
meta = {
description = "CLI tool to proxy and analyze TCP connections";
homepage = "https://github.com/kevwan/tproxy";
changelog = "https://github.com/kevwan/tproxy/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ DCsunset ];
mainProgram = "tproxy";
};
}

View File

@@ -0,0 +1,59 @@
{
lib,
fetchFromGitLab,
rustPlatform,
rustc,
wasm-pack,
wasm-bindgen-cli_0_2_95,
binaryen,
}:
let
version = "0.1.1";
in
rustPlatform.buildRustPackage {
pname = "tpsecore";
inherit version;
src = fetchFromGitLab {
owner = "UniQMG";
repo = "tpsecore";
rev = "v${version}";
hash = "sha256-+OynnLMBEiYwdFzxGzgkcBN6xrHoH1Q6O5i+OW7RBLo=";
};
cargoHash = "sha256-EM/THiR0NV4N3mFGjRYe1cpaF82rCYnOPLxv67BronU=";
nativeBuildInputs = [
wasm-pack
wasm-bindgen-cli_0_2_95
binaryen
rustc.llvmPackages.lld
];
buildPhase = ''
runHook preBuild
HOME=$(mktemp -d) wasm-pack build --target web --release
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r pkg/ $out
runHook postInstall
'';
doCheck = false;
meta = {
description = "Self contained toolkit for creating, editing, and previewing TPSE files";
homepage = "https://gitlab.com/UniQMG/tpsecore";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ huantian ];
platforms = lib.platforms.linux;
};
}

View File

@@ -0,0 +1,69 @@
{
lib,
stdenv,
fetchurl,
swi-prolog,
tcsh,
perl,
patchelf,
curl,
}:
stdenv.mkDerivation rec {
pname = "TPTP";
version = "9.1.0";
src = fetchurl {
urls = [
"https://tptp.org/TPTP/Distribution/TPTP-v${version}.tgz"
"https://tptp.org/TPTP/Archive/TPTP-v${version}.tgz"
];
hash = "sha256-KylCpKEdjvXTzYU2MOi0FDrr4e6je2YB366+dxy3Xmo=";
};
nativeBuildInputs = [
patchelf
swi-prolog
];
buildInputs = [
tcsh
swi-prolog
perl
];
installPhase = ''
sharedir=$out/share/tptp
mkdir -p $sharedir
cp -r ./ $sharedir
export TPTP=$sharedir
tcsh $sharedir/Scripts/tptp2T_install -default
substituteInPlace $sharedir/TPTP2X/tptp2X_install --replace /bin/mv mv
tcsh $sharedir/TPTP2X/tptp2X_install -default
patchelf --interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath ${lib.getLib curl}/lib $sharedir/Scripts/tptp4X
mkdir -p $out/bin
ln -s $sharedir/TPTP2X/tptp2X $out/bin
ln -s $sharedir/Scripts/tptp2T $out/bin
ln -s $sharedir/Scripts/tptp4X $out/bin
'';
meta = with lib; {
description = "Thousands of problems for theorem provers and tools";
maintainers = with maintainers; [
raskin
];
# 6.3 GiB of data. Installation is unpacking and editing a few files.
# No sense in letting Hydra build it.
# Also, it is unclear what is covered by "verbatim" - we will edit configs
hydraPlatforms = [ ];
platforms = platforms.all;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfreeRedistributable;
homepage = "https://tptp.org/TPTP/";
};
}