diff options
| author | Giacomo Leidi <therewasa@fishinthecalculator.me> | 2026-02-17 11:46:46 +0100 |
|---|---|---|
| committer | Giacomo Leidi <therewasa@fishinthecalculator.me> | 2026-03-04 20:18:02 +0100 |
| commit | a375202ad3443e4c3fb492160e32aa6abcc965bd (patch) | |
| tree | 1a23038208e0721302dce8130812bbc3c331cfac /gnu/services | |
| parent | e29c17a2e7c4078e1008f1b1c53097d31759b760 (diff) | |
gnu: libvirt: Configure default libvirt network.
* gnu/services/virtualization.scm (%libvirt-activation): Activate
default libvirt network configuration file.
* gnu/tests/virtualization.scm (run-libvirt-test): Drop network
definition test and replace it with a test checking that the default
network is inactive by default.
Change-Id: I03b6314a390c6d93ebf886d7033867ff5cacad74
Diffstat (limited to 'gnu/services')
| -rw-r--r-- | gnu/services/virtualization.scm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index fc42dcb8a79..3c9aadaae3f 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | ;;; Copyright © 2024 Raven Hallsby <karl@hallsby.com> | 9 | ;;; Copyright © 2024 Raven Hallsby <karl@hallsby.com> |
| 10 | ;;; Copyright © 2025 Maxim Cournoyer <maxim@guixotic.coop> | 10 | ;;; Copyright © 2025 Maxim Cournoyer <maxim@guixotic.coop> |
| 11 | ;;; Copyright © 2025 Nigko Yerden <nigko.yerden@gmail.com> | 11 | ;;; Copyright © 2025 Nigko Yerden <nigko.yerden@gmail.com> |
| 12 | ;;; Copyright © 2026 Giacomo Leidi <therewasa@fishinthecalculator.me> | ||
| 12 | ;;; | 13 | ;;; |
| 13 | ;;; This file is part of GNU Guix. | 14 | ;;; This file is part of GNU Guix. |
| 14 | ;;; | 15 | ;;; |
| @@ -493,10 +494,21 @@ avoid potential infinite waits blocking libvirt.")) | |||
| 493 | (list (user-group (name "libvirt") (system? #t)))) | 494 | (list (user-group (name "libvirt") (system? #t)))) |
| 494 | 495 | ||
| 495 | (define (%libvirt-activation config) | 496 | (define (%libvirt-activation config) |
| 496 | (let ((sock-dir (libvirt-configuration-unix-sock-dir config))) | 497 | (let ((package (libvirt-configuration-libvirt config)) |
| 498 | (sock-dir (libvirt-configuration-unix-sock-dir config))) | ||
| 497 | #~(begin | 499 | #~(begin |
| 498 | (use-modules (guix build utils)) | 500 | (use-modules (guix build utils)) |
| 499 | (mkdir-p #$sock-dir)))) | 501 | (mkdir-p #$sock-dir) |
| 502 | (mkdir-p "/etc/libvirt/qemu/networks") | ||
| 503 | ;; special-files-service-type could be used but it creates a file union | ||
| 504 | ;; and libvirtd needs to write in /etc/libvirt. This makes /etc/libvirt | ||
| 505 | ;; read-only and libvirt crashes at startup. activate-special-files | ||
| 506 | ;; creates a single symlink to the store for | ||
| 507 | ;; /etc/libvirt/qemu/networks/default.xml so libvirt doesn't notice and | ||
| 508 | ;; starts successfully. | ||
| 509 | (activate-special-files | ||
| 510 | '(("/etc/libvirt/qemu/networks/default.xml" | ||
| 511 | #$(file-append package "/etc/libvirt/qemu/networks/default.xml"))))))) | ||
| 500 | 512 | ||
| 501 | (define (libvirt-shepherd-service config) | 513 | (define (libvirt-shepherd-service config) |
| 502 | (let* ((config-file (libvirt-conf-file config)) | 514 | (let* ((config-file (libvirt-conf-file config)) |
