;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021, 2022 Maxim Cournoyer . ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu tests telephony) #:use-module (gnu) #:use-module (gnu packages) #:use-module (gnu packages guile) #:use-module (gnu packages guile-xyz) #:use-module (gnu tests) #:use-module (gnu system vm) #:use-module (gnu services) #:use-module (gnu services dbus) #:use-module (gnu services networking) #:use-module (gnu services ssh) #:use-module (gnu services telephony) #:use-module (guix gexp) #:use-module (guix modules) #:export (%test-jami %test-jami-provisioning %test-jami-provisioning-partial)) ;;; ;;; Jami daemon. ;;; (include "data/jami-dummy-account.dat") ;defines %jami-account-content-sexp (define %dummy-jami-account-archive ;; A Jami account archive is a gzipped JSON file. (computed-file "dummy-jami-account.gz" (with-extensions (list guile-json-4 guile-zlib) #~(begin (use-modules (json) (zlib)) (let ((port (open-output-file #$output))) (call-with-gzip-output-port port (lambda (port) (scm->json '#$%jami-account-content-sexp port)))))))) (define %allowed-contacts '("1dbcb0f5f37324228235564b79f2b9737e9a008f" "2dbcb0f5f37324228235564b79f2b9737e9a008f")) (define %moderators '("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")) (define %dummy-jami-account (jami-account (archive %dummy-jami-account-archive) (allowed-contacts %allowed-contacts) (moderators %moderators) (rendezvous-point? #t) (peer-discovery? #f) (bootstrap-hostnames '("bootstrap.me" "fallback.another.host")) (name-server-uri "https://my.name.server"))) ;;; Like %dummy-jami-account, but with allowed-contacts and moderators left ;;; unset (thus taking the value *unspecified*). (define %dummy-jami-account-partial (jami-account (archive %dummy-jami-account-archive) (rendezvous-point? #t) (peer-discovery? #f) (bootstrap-hostnames '("bootstrap.me" "fallback.another.host")) (name-server-uri "https://my.name.server"))) (define* (make-jami-os #:key provisioning? partial?) (operating-system (host-name "jami") (timezone "America/Montreal") (locale "en_US.UTF-8") (bootloader (bootloader-configuration (bootloader grub-bootloader) (targets '("/dev/sdX")))) (file-systems (cons (file-system (device (file-system-label "my-root")) (mount-point "/") (type "ext4")) %base-file-systems)) (firmware '()) (services (cons* (service jami-service-type (if provisioning? (jami-configuration (debug? #t) (accounts (list (if partial? %dummy-jami-account-partial %dummy-jami-account)))) (jami-configuration (debug? #t)))) (service dbus-root-service-type) ;; The following services/packages are added for ;; debugging purposes. (service dhcp-client-service-type) (service openssh-service-type (openssh-configuration (permit-root-login #t) (allow-empty-passwords? #t))) %base-services)) (packages (cons* (specification->package "recutils") (specification->package "strace") %base-packages)))) (define %jami-os (make-jami-os)) (de