From patchwork Fri Aug 20 12:45:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Whatson X-Patchwork-Id: 32200 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0336D27BC78; Fri, 20 Aug 2021 13:46:26 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6E0C227BC6B for ; Fri, 20 Aug 2021 13:46:25 +0100 (BST) Received: from localhost ([::1]:54020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mH3uh-000673-Iy for patchwork@mira.cbaines.net; Fri, 20 Aug 2021 08:46:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH3uO-00063m-BE for guix-patches@gnu.org; Fri, 20 Aug 2021 08:46:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mH3uN-0005wy-VL for guix-patches@gnu.org; Fri, 20 Aug 2021 08:46:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mH3uN-0002W3-Ti for guix-patches@gnu.org; Fri, 20 Aug 2021 08:46:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50133] [PATCH 5/6] gnu: Add lxd. Resent-From: Andrew Whatson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 20 Aug 2021 12:46:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50133 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50133@debbugs.gnu.org Cc: Andrew Whatson Received: via spool by 50133-submit@debbugs.gnu.org id=B50133.16294635549613 (code B ref 50133); Fri, 20 Aug 2021 12:46:03 +0000 Received: (at 50133) by debbugs.gnu.org; 20 Aug 2021 12:45:54 +0000 Received: from localhost ([127.0.0.1]:33166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH3uD-0002Uy-NZ for submit@debbugs.gnu.org; Fri, 20 Aug 2021 08:45:54 -0400 Received: from mail-pl1-f170.google.com ([209.85.214.170]:35689) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mH3u9-0002UF-EO for 50133@debbugs.gnu.org; Fri, 20 Aug 2021 08:45:50 -0400 Received: by mail-pl1-f170.google.com with SMTP id b9so1513617plx.2 for <50133@debbugs.gnu.org>; Fri, 20 Aug 2021 05:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SSXJKEO3Tl7gZhQke8VjMVFbt3a5LU8kqnVXMuDd5Xs=; b=k8xhji/GhK8tL8vwcmY/Ltm3UHbbjeLfZGOFwFXbpTPUTAkeiMJtsVTlE5TNg7JJP5 oaH5I4ZcWb1a1k1xxSHpjzoQQ9ruuFRgrCL15VzukKzbdxk3hU98DZPcm/BBAsF7Mlii xvbyNQ5fVdM70AYyJMcsoErpJuXa782TmTvIclV9bP/0p/x0TOh6BcTCJ8SRUkKagw+S dX3LRMAZwhQarKq8k56kv9FVtFRGmr/yah4ebNXOxgHOZb9xqBpDvtcG8GkW6ONJfTDS ZmqJFI1Qi84X5NM0tRXUq3hB4NFDJBdBZjSNLR0v12e486f7SZZBhCmhgZ2EjuIs3uoG UH6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SSXJKEO3Tl7gZhQke8VjMVFbt3a5LU8kqnVXMuDd5Xs=; b=cWg61n4iVccqUTMSWkJyeQ7dUbj8KsqSvHHeU5ZJyJQIus+ffEWvR1Ld/qDLPQ+TOV iorgF2SHZEhYKX6pgOlYW6KzWDDhHLMXzWTblALuqBqklzlMGrDCMbTgUD/d+ce5ScWv qCjEX/I5Rq1P+aZ7egyyMSkTU2TJLQzquQmSFOzhKySwiviZx55G7oy08t3UQRoMNdCj zd8RBYw9AAKqcsUkte0LQ/WxZTl8G1ydxgkNDlM1t4wNVx1EnHa1TcItXDIt3pOMwk+K sXCsE8kJzyHN33hxAS58UArVn4pocbRF9TBAlrauiTrnUEJPeO109oEhdawOYnAt8a0i 4UIA== X-Gm-Message-State: AOAM53241LYYvrCeRUt7dmnjTBAc6OObPdTz6VS2PGHM65yO0I1oCLMp 3bBmAg0jHc7KxINKI8oB+c0CuCNwVmU= X-Google-Smtp-Source: ABdhPJzRXWrRNf2CLfBupidMkXYXcNhu3PZB2E7iXCvrUV3XorFpzqfptGP6hsHjh9qDu25Shc01LA== X-Received: by 2002:a17:90a:b284:: with SMTP id c4mr4519300pjr.213.1629463543496; Fri, 20 Aug 2021 05:45:43 -0700 (PDT) Received: from muon.fritz.box (220-235-208-141.tpgi.com.au. [220.235.208.141]) by smtp.gmail.com with ESMTPSA id o10sm5113868pfk.212.2021.08.20.05.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Aug 2021 05:45:43 -0700 (PDT) From: Andrew Whatson Date: Fri, 20 Aug 2021 22:45:23 +1000 Message-Id: <20210820124524.117090-5-whatson@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210820124524.117090-1-whatson@gmail.com> References: <20210820124524.117090-1-whatson@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/virtualization.scm (lxd): New variable. --- gnu/packages/virtualization.scm | 113 ++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index 07ad1cb101..da130d1e9d 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -20,6 +20,7 @@ ;;; Copyright © 2021 Leo Famulari ;;; Copyright © 2021 Pierre Langlois ;;; Copyright © 2021 Dion Mendel +;;; Copyright © 2021 Andrew Whatson ;;; ;;; This file is part of GNU Guix. ;;; @@ -49,6 +50,7 @@ #:use-module (gnu packages bison) #:use-module (gnu packages build-tools) #:use-module (gnu packages check) + #:use-module (gnu packages cluster) #:use-module (gnu packages cmake) #:use-module (gnu packages compression) #:use-module (gnu packages cross-base) @@ -102,6 +104,7 @@ #:use-module (gnu packages python-xyz) #:use-module (gnu packages pulseaudio) #:use-module (gnu packages readline) + #:use-module (gnu packages rsync) #:use-module (gnu packages selinux) #:use-module (gnu packages sdl) #:use-module (gnu packages sphinx) @@ -1070,6 +1073,116 @@ of making Linux containers feel more like a virtual machine. It started as a side project of LXC but can be used by any run-time.") (license license:lgpl2.1+))) +(define-public lxd + (package + (name "lxd") + (version "4.17") + (source (origin + (method url-fetch) + (uri (string-append + "https://github.com/lxc/lxd/releases/download/" + "lxd-" version "/lxd-" version ".tar.gz")) + (sha256 + (base32 + "1kzmgyg5kw3zw9qa6jabld6rmb53b6yy69h7y9znsdlf74jllljl")))) + (build-system go-build-system) + (arguments + `(#:import-path "github.com/lxc/lxd" + #:tests? #f ;; tests fail due to missing /var, cgroups, etc. + #:modules ((guix build go-build-system) + (guix build union) + (guix build utils) + (srfi srfi-1)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'unpack-dist + (lambda* (#:key import-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" import-path) + ;; remove the link back to the top level + (delete-file (string-append "_dist/src/" import-path)) + ;; move all the deps into the src directory + (copy-recursively "_dist/src" "../../..")) + #t)) + (replace 'build + (lambda* (#:key import-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" import-path) + (invoke "make" "build" "CC=gcc" "TAG_SQLITE3=libsqlite3") + #t))) + (replace 'check + (lambda* (#:key tests? import-path #:allow-other-keys) + (when tests? + (with-directory-excursion (string-append "src/" import-path) + (invoke "make" "check" "CC=gcc" "TAG_SQLITE3=libsqlite3"))) + #t)) + (replace 'install + (lambda* (#:key inputs outputs import-path #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin-dir + (string-append out "/bin/")) + (doc-dir + (string-append out "/share/doc/lxd-" ,version)) + (completions-dir + (string-append out "/share/bash-completion/completions"))) + (with-directory-excursion (string-append "src/" import-path) + ;; wrap lxd with runtime dependencies + (wrap-program (string-append bin-dir "lxd") + `("PATH" ":" prefix + ,(fold (lambda (input paths) + (let* ((in (assoc-ref inputs input)) + (bin (string-append in "/bin")) + (sbin (string-append in "/sbin"))) + (append (filter file-exists? + (list bin sbin)) paths))) + '() + '("bash" "acl" "rsync" "tar" "xz" "btrfs-progs" + "gzip" "dnsmasq" "squashfs-tools" "iproute2" + "criu" "iptables")))) + ;; remove unwanted binaries + (for-each (lambda (prog) + (delete-file (string-append bin-dir prog))) + '("deps" "macaroon-identity" "generate")) + ;; install documentation + (for-each (lambda (file) + (install-file file doc-dir)) + (find-files "doc")) + ;; install bash completion + (rename-file "scripts/bash/lxd-client" "scripts/bash/lxd") + (install-file "scripts/bash/lxd" completions-dir))) + #t))))) + (native-inputs + `(;; test dependencies: + ;; ("go-github-com-rogpeppe-godeps" ,go-github-com-rogpeppe-godeps) + ;; ("go-github-com-tsenart-deadcode" ,go-github-com-tsenart-deadcode) + ;; ("go-golang-org-x-lint" ,go-golang-org-x-lint) + ("pkg-config" ,pkg-config))) + (inputs + `(("acl" ,acl) + ("eudev" ,eudev) + ("libdqlite" ,libdqlite) + ("libraft" ,libraft) + ("libcap" ,libcap) + ("lxc" ,lxc) + ;; runtime dependencies: + ("bash" ,bash-minimal) + ("rsync" ,rsync) + ("tar" ,tar) + ("xz" ,xz) + ("btrfs-progs" ,btrfs-progs) + ("gzip" ,gzip) + ("dnsmasq" ,dnsmasq) + ("squashfs-tools" ,squashfs-tools) + ("iproute2" ,iproute) + ("criu" ,criu) + ("iptables" ,iptables))) + (synopsis "Daemon based on liblxc offering a REST API to manage containers") + (home-page "https://linuxcontainers.org/lxd/") + (description "LXD is a next generation system container manager. It +offers a user experience similar to virtual machines but using Linux +containers instead. It's image based with pre-made images available for a +wide number of Linux distributions and is built around a very powerful, yet +pretty simple, REST API.") + (license license:asl2.0))) + (define-public libvirt (package (name "libvirt")