diff options
| author | Johannes Christ <jc@jchri.st> | 2026-05-05 22:44:13 +0200 |
|---|---|---|
| committer | Nguyễn Gia Phong <cnx@loang.net> | 2026-06-15 11:28:34 +0900 |
| commit | db263e855406a12594a124afc8c7b8a3d0ba90a0 (patch) | |
| tree | 6b424cc0dce325cc47504516805704e7a5515a8e /gnu | |
| parent | 9b3e0b6fac204b7a403eb3d0f51c517ffc957945 (diff) | |
gnu: Add swtpm.
* gnu/packages/virtualization.scm (swtpm): New variable.
Merges: https://codeberg.org/guix/guix/pulls/8383
Signed-off-by: Nguyễn Gia Phong <cnx@loang.net>
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/packages/virtualization.scm | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index 41161ff8adc..fef0f9e4990 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm | |||
| @@ -168,6 +168,7 @@ | |||
| 168 | #:use-module (gnu packages sphinx) | 168 | #:use-module (gnu packages sphinx) |
| 169 | #:use-module (gnu packages spice) | 169 | #:use-module (gnu packages spice) |
| 170 | #:use-module (gnu packages ssh) | 170 | #:use-module (gnu packages ssh) |
| 171 | #:use-module (gnu packages tcl) | ||
| 171 | #:use-module (gnu packages texinfo) | 172 | #:use-module (gnu packages texinfo) |
| 172 | #:use-module (gnu packages textutils) | 173 | #:use-module (gnu packages textutils) |
| 173 | #:use-module (gnu packages tls) | 174 | #:use-module (gnu packages tls) |
| @@ -1365,6 +1366,106 @@ it emulates a variety of hardware and peripherals.") | |||
| 1365 | of one or more RISC-V harts.") | 1366 | of one or more RISC-V harts.") |
| 1366 | (license license:bsd-3)))) | 1367 | (license license:bsd-3)))) |
| 1367 | 1368 | ||
| 1369 | (define-public swtpm | ||
| 1370 | (package | ||
| 1371 | (name "swtpm") | ||
| 1372 | ;; When updating this package, please make sure that the path patching logic | ||
| 1373 | ;; below is still functional. | ||
| 1374 | (version "0.10.1") | ||
| 1375 | (source | ||
| 1376 | (origin | ||
| 1377 | (method git-fetch) | ||
| 1378 | (uri (git-reference | ||
| 1379 | (url "https://github.com/stefanberger/swtpm") | ||
| 1380 | (commit (string-append "v" version)))) | ||
| 1381 | (file-name (git-file-name name version)) | ||
| 1382 | (sha256 | ||
| 1383 | (base32 "0wah3zsnkasccazzlycq8scc52q4h1g58w0br45sr185inw6zgrp")) | ||
| 1384 | (snippet | ||
| 1385 | #~(begin | ||
| 1386 | ;; Do not attempt to install /var. | ||
| 1387 | (use-modules (guix build utils)) | ||
| 1388 | (substitute* "samples/Makefile.am" | ||
| 1389 | (("install-data-local") | ||
| 1390 | "install-data-local-DISABLED")))))) | ||
| 1391 | (build-system gnu-build-system) | ||
| 1392 | (arguments | ||
| 1393 | (list | ||
| 1394 | ;; Most tests require networking, at least loopback. | ||
| 1395 | #:make-flags | ||
| 1396 | #~(let ((tests '("test_ctrlchannel4" | ||
| 1397 | "test_parameters" | ||
| 1398 | "test_print_capabilities" | ||
| 1399 | "test_swtpm_cert" | ||
| 1400 | "test_swtpm_setup_create_cert" | ||
| 1401 | "test_swtpm_setup_file_backend" | ||
| 1402 | "test_swtpm_setup_misc" | ||
| 1403 | "test_swtpm_setup_overwrite" | ||
| 1404 | "test_tpm2_parameters" | ||
| 1405 | "test_tpm2_print_capabilities" | ||
| 1406 | "test_tpm2_swtpm_cert" | ||
| 1407 | "test_tpm2_swtpm_cert_ecc" | ||
| 1408 | "test_tpm2_swtpm_localca" | ||
| 1409 | "test_tpm2_swtpm_setup_create_cert" | ||
| 1410 | "test_tpm2_swtpm_setup_overwrite"))) | ||
| 1411 | (list (string-append "TESTS=" (string-join tests " ")))) | ||
| 1412 | #:configure-flags | ||
| 1413 | #~'("--localstatedir=/var") | ||
| 1414 | #:phases | ||
| 1415 | #~(modify-phases %standard-phases | ||
| 1416 | (add-after 'unpack 'fix-program-references | ||
| 1417 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 1418 | (substitute* "tests/common" | ||
| 1419 | (("CERTTOOL=certtool") | ||
| 1420 | (string-append "CERTTOOL=" | ||
| 1421 | (search-input-file inputs "bin/certtool")))) | ||
| 1422 | (substitute* "src/swtpm_localca/swtpm_localca.c" | ||
| 1423 | (("CERTTOOL_NAME \"certtool\"") | ||
| 1424 | (string-append "CERTTOOL_NAME \"" | ||
| 1425 | (search-input-file inputs "bin/certtool") "\"")) | ||
| 1426 | (("g_find_program_in_path\\(\"swtpm_cert\"}\\)") | ||
| 1427 | (string-append "strdup(\"" | ||
| 1428 | #$output "/bin/swtpm_cert" | ||
| 1429 | "\")"))) | ||
| 1430 | (substitute* "src/swtpm_setup/swtpm_setup.c" | ||
| 1431 | (("g_find_program_in_path\\(\"swtpm\"\\)") | ||
| 1432 | (string-append "strdup(\"" | ||
| 1433 | #$output "/bin/swtpm" | ||
| 1434 | "\")"))))) | ||
| 1435 | ;; The swtpm tools reference themselves, | ||
| 1436 | ;; and #$output only exists after installation. | ||
| 1437 | (delete 'check) | ||
| 1438 | (add-after 'install 'check | ||
| 1439 | (assoc-ref %standard-phases 'check))))) | ||
| 1440 | (inputs (list ;; can be removed once the following is released: | ||
| 1441 | ;; https://github.com/stefanberger/swtpm/pull/1119 | ||
| 1442 | gnutls | ||
| 1443 | gmp | ||
| 1444 | openssl | ||
| 1445 | json-glib | ||
| 1446 | libseccomp | ||
| 1447 | libselinux | ||
| 1448 | libtasn1 | ||
| 1449 | libtool | ||
| 1450 | libtpms)) | ||
| 1451 | (native-inputs (list autoconf | ||
| 1452 | automake | ||
| 1453 | bash-minimal | ||
| 1454 | expect | ||
| 1455 | iproute | ||
| 1456 | net-tools | ||
| 1457 | socat | ||
| 1458 | perl | ||
| 1459 | pkg-config | ||
| 1460 | python)) | ||
| 1461 | (home-page "https://github.com/stefanberger/swtpm") | ||
| 1462 | (synopsis "TPM emulator") | ||
| 1463 | (description | ||
| 1464 | "swtpm provides a TPM emulator with socket, character device, | ||
| 1465 | and CUSE interface. It can be combined with qemu & libvirt to expose TPM | ||
| 1466 | functionality to virtual machines.") | ||
| 1467 | (license license:bsd-3))) | ||
| 1468 | |||
| 1368 | (define-public incus | 1469 | (define-public incus |
| 1369 | (package | 1470 | (package |
| 1370 | (name "incus") | 1471 | (name "incus") |
