aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
;;; Copyright © 2020, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
;;; Copyright © 2022 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; 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 <http://www.gnu.org/licenses/>.

(define-module (gnu packages storage)
  #:use-module (guix download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix build-system cmake)
  #:use-module (gnu packages)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages assembly)
  #:use-module (gnu packages authentication)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages bdw-gc)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages crypto)
  #:use-module (gnu packages cryptsetup)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages disk)
  #:use-module (gnu packages gperf)
  #:use-module (gnu packages jemalloc)
  #:use-module (gnu packages icu4c)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages lua)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages networking)
  #:use-module (gnu packages nss)
  #:use-module (gnu packages openldap)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages pretty-print)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages rpc)
  #:use-module (gnu packages sphinx)
  #:use-module (gnu packages sqlite)
  #:use-module (gnu packages textutils)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages web)
  #:use-module (gnu packages xml))

(define-public ceph
  (package
    (name "ceph")
    (version "17.2.7")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://download.ceph.com/tarballs/ceph-"
                                  version ".tar.gz"))
              (sha256
               (base32
                "1612424yrf39dz010ygz8k5x1vc8731549ckfj1r39dg00m62klp"))
              (patches
               (search-patches
                "ceph-disable-cpu-optimizations.patch"
                "ceph-fix-for-newer-boost.patch" ))
              (modules '((guix build utils)))
              (snippet
               '(for-each delete-file-recursively
                          '(;; TODO: Unbundle these:
                            "src/arrow"
                            ;;"src/isa-l"
                            ;;"src/lua"
                            ;;"src/xxHash"
                            ;;"src/zstd"
                            ;;"src/civetweb"
                            "src/c-ares"
                            "src/fmt"
                            "src/googletest"
                            "src/rapidjson"
                            "src/spdk"
                            "src/rocksdb"
                            "src/boost"
                            "src/utf8proc")))))
    (build-system cmake-build-system)
    (arguments
     (list
      #:parallel-build? #f ;because mgr_legacy_options.h is not built in time
      #:configure-flags
      '(let* ((out (assoc-ref %outputs "out"))
              (lib (assoc-ref %outputs "lib"))
              (libdir (string-append lib "/lib")))
         (list (string-append "-DCMAKE_INSTALL_PREFIX=" out)
               (string-append "-DCMAKE_INSTALL_LIBDIR=" libdir)
               (string-append "-DCMAKE_INSTALL_INCLUDEDIR="
                              lib "/include")
               ;; We need both libdir and libdir/ceph in RUNPATH.
               (string-append "-DCMAKE_INSTALL_RPATH="
                              libdir ";" libdir "/ceph")
               (string-append "-DCMAKE_INSTALL_SYSCONFDIR=" out "/etc")
               (string-append "-DCMAKE_INSTALL_DATADIR=" lib "/share")
               (string-append "-DCMAKE_INSTALL_MANDIR=" out "/share/man")
               (string-append "-DCMAKE_INSTALL_DOCDIR=" out "/share/ceph/doc")
               (string-append "-DCMAKE_INSTALL_LIBEXECDIR=" out "/libexec")
               (string-append "-DKEYUTILS_INCLUDE_DIR="
                              (assoc-ref %build-inputs "keyutils") "/include")
               (string-append "-DXFS_INCLUDE_DIR="
                              (assoc-ref %build-inputs "xfsprogs") "/include")
               "-DCMAKE_INSTALL_LOCALSTATEDIR=/var"
               "-DBUILD_SHARED_LIBS=ON"
               "-DWITH_SYSTEM_ARROW=ON"
               "-DWITH_SYSTEM_BOOST=ON"
               "-DWITH_SYSTEM_ROCKSDB=ON"
               "-DWITH_SYSTEM_UTF8PROC=ON"

               ;; TODO: Enable these when available in Guix.
               "-DWITH_MGR_DASHBOARD_FRONTEND=OFF" ;requires node + nodeenv
               "-DWITH_BABELTRACE=OFF"
               "-DWITH_LTTNG=OFF"
               "-DWITH_SPDK=OFF"
               "-DWITH_RADOSGW_AMQP_ENDPOINT=OFF"

               ;; Use jemalloc instead of tcmalloc.
               "-DALLOCATOR=jemalloc"

               ;; Don't install systemd unit files.
               "-DWITH_SYSTEMD=OFF"

               ;; Do not bother building the tests; we are not currently running
               ;; them, and they do not build with system googletest as of 14.2.5.
               "-DWITH_TESTS=OFF"))
       ;; FIXME: Some of the tests leak Btrfs subvolumes on Btrfs. See
       ;; <https://bugs.gnu.org/29674> for details. Disable tests until
       ;; resolved.
       #:tests? #f
       #:phases
       `(modify-phases %standard-phases
          (add-after 'unpack 'patch-source
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))
                    (lib (assoc-ref outputs "lib")))

                (substitute* "src/rgw/store/dbstore/sqlite/CMakeLists.txt"
                  (("add_library\\(sqlite_db \\$")
                   "add_library(sqlite_db STATIC $"))
                (substitute* "src/rgw/store/dbstore/CMakeLists.txt"
                  (("add_library\\(dbstore \\$")
                   "add_library(dbstore STATIC $")
                  (("add_library\\(dbstore_lib \\$")
                   "add_library(dbstore_lib STATIC $"))

                (substitute* "cmake/modules/Distutils.cmake"
                  ;; Prevent creation of Python eggs.
                  (("setup.py install")
                   "setup.py install --single-version-externally-managed --root=/")
                  ;; Inject the -rpath linker argument when linking
                  ;; Python C libraries so RUNPATH gets set up correctly.
                  (("LDFLAGS=(.*)\n" _ flags)
                   (string-append "LDFLAGS=\\\"" flags
                                  " -Wl,-rpath=" lib "/lib\\\"\n")))

                ;; Statically link libcrc32 because it does not get installed,
                ;; yet several libraries end up referring to it.
                (substitute* "src/common/CMakeLists.txt"
                  (("add_library\\(crc32")
                   "add_library(crc32 STATIC"))

                (substitute* "udev/50-rbd.rules"
                  (("/usr/bin/ceph-rbdnamer")
                   (string-append out "/bin/ceph-rbdnamer"))))))
          (add-before 'install 'set-install-environment
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (py3sitedir
                      (string-append out "/lib/python"
                                     ,(version-major+minor
                                       (package-version python))
                                     "/site-packages")))
                ;; The Python install scripts refuses to function if
                ;; the install directory is not on PYTHONPATH.
                (setenv "PYTHONPATH" py3sitedir))))
          (add-after 'install 'wrap-python-scripts
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (scripts '("bin/ceph" "bin/cephfs-top" "sbin/ceph-volume"))
                     (dependencies (map (lambda (input)
                                          (assoc-ref inputs input))
                                        '("python-prettytable" "python-pyyaml")))
                     (sitedir (lambda (package)
                                (string-append package
                                               "/lib/python"
                                               ,(version-major+minor
                                                 (package-version python))
                                               "/site-packages")))
                     (PYTHONPATH (string-join (map sitedir (cons out dependencies))
                                              ":")))
                (for-each (lambda (executable)
                            (wrap-program (string-append out "/" executable)
                              `("GUIX_PYTHONPATH" ":" prefix (,PYTHONPATH))))
                          scripts)))))))
    (outputs
     '("out" "lib"))
    (native-inputs
     (list gperf pkg-config python-cython python-sphinx yasm))
    (inputs
     (list `(,apache-thrift "lib")
           `(,apache-thrift "include")
           `(,apache-arrow-for-ceph "lib")
           bash-minimal
           boost
           curl
           cryptsetup
           eudev
           expat
           fcgi
           fmt-8
           fuse-2
           icu4c
           jemalloc
           keyutils
           leveldb
           libaio
           libatomic-ops
           libcap-ng
           libnl
           librdkafka
           lua
           lz4
           oath-toolkit
           openldap
           openssl
           ncurses
           nss
           python-prettytable           ;used by ceph_daemon.py
           python-pyyaml                ;from python-common/setup.py
           python
           rapidjson
           rdma-core
           rocksdb
           snappy
           sqlite
           utf8proc
           util-linux
           `(,util-linux "lib")
           xfsprogs
           zlib))
    (home-page "https://ceph.com/")
    (synopsis "Distributed object store and file system")
    (description
     "Ceph is a distributed storage system designed for reliability and
performance.  It provides network-based block devices (RBD), a POSIX
compliant file system (CephFS), and offers compatibility with various
storage protocols (S3, NFS, and others) through the RADOS gateway.")
    ;; The Ceph libraries are LGPL2.1 and most of the utilities fall under
    ;; GPL2. The installed erasure code plugins are BSD-3 licensed and do
    ;; not use the GPL code. The source archive includes a number of files
    ;; carrying other licenses; consult COPYING for more information. Note
    ;; that COPYING does not cover third-party bundled software.
    (license (list license:lgpl2.1 license:gpl2  ;some files are 'or later'
                   license:cc-by-sa3.0           ;documentation
                   license:bsd-3                 ;isa-l,jerasure,++
                   license:expat))))             ;civetweb,java bindings
a href='/guix/commit/gnu/system.scm?id=ccb62d8feb50e2859d7c41429a9e3d9e0fe30bfe'>Merge remote-tracking branch 'origin/master' into core-updatesAndreas Enge 2023-03-16services: etc-service: Deprecate etc-service procedure....* gnu/services.scm (etc-service): Deprecate procedure. * gnu/system.scm (operating-system-etc-service): Replace etc-service with etc-service-type. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Bruno Victal 2023-03-13system: Remove redundant gexp-ungexp usage....* gnu/system.scm (os-release): Convert to variable. (operating-system-etc-service): Remove redundant gexp-ungexps. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Bruno Victal 2023-03-13system: Simplify nsswitch binding....* gnu/system.scm (operating-system-etc-service): Simplify nsswitch binding. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Bruno Victal 2023-03-02Merge remote-tracking branch 'savannah/master' into core-updates...Conflicts: gnu/local.mk gnu/packages/autotools.scm gnu/packages/cmake.scm gnu/packages/gnuzilla.scm gnu/packages/haskell.scm gnu/packages/pdf.scm gnu/packages/python-xyz.scm gnu/packages/samba.scm gnu/packages/tex.scm gnu/packages/tls.scm gnu/packages/wxwidgets.scm Christopher Baines 2023-03-03services: base: Deprecate 'host-name-service' procedure....* doc/guix.texi (operating-system Reference): Reorder cross-reference. Add an anchor to be used ... (Base services): ... here by host-name-service-type. Document host-name-service-type. * gnu/services/base.scm: Export host-name-service-type. (host-name-service): Deprecate procedure. * gnu/system.scm (operating-system-default-essential-services): Use host-name-service-type. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Bruno Victal 2023-02-23system: Do not export local-host-entries....Unlike the deprecated 'local-host-aliases', there's no use for local-host-entries since it's used to set the default value for hosts-service-type. Given that this service-type is expected to be extended, one presumes that when they explicitly override the service default value they do not have much interest in the 'local-host-entries' procedure. * gnu/system.scm: Do not export local-host-entries. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Bruno Victal 2023-02-09system: Deprecate hosts-file....* gnu/system.scm (operating-system-hosts-file): Deprecate procedure. (warn-hosts-file-field-deprecation): New procedure, helper for deprecated variable. (operating-system)[hosts-file]: Use helper to warn deprecated field. (local-host-aliases): Mark as deprecated. (local-host-entries): New procedure. (operating-system-default-essential-services, hurd-default-essential-services): Use hosts-service-type. Use '%operating-system-hosts-file' and 'local-host-entries'. (default-/etc/hosts): Remove procedure. (operating-system-etc-service): Remove hosts file. * doc/guix.texi (operating-system Reference) (Networking Services) (Virtualization Services): Rewrite documentation entries to use hosts-service-type. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Bruno Victal 2023-01-30Merge remote-tracking branch 'origin/master' into core-updates... Conflicts: doc/guix.texi gnu/local.mk gnu/packages/admin.scm gnu/packages/base.scm gnu/packages/chromium.scm gnu/packages/compression.scm gnu/packages/databases.scm gnu/packages/diffoscope.scm gnu/packages/freedesktop.scm gnu/packages/gnome.scm gnu/packages/gnupg.scm gnu/packages/guile.scm gnu/packages/inkscape.scm gnu/packages/llvm.scm gnu/packages/openldap.scm gnu/packages/pciutils.scm gnu/packages/ruby.scm gnu/packages/samba.scm gnu/packages/sqlite.scm gnu/packages/statistics.scm gnu/packages/syndication.scm gnu/packages/tex.scm gnu/packages/tls.scm gnu/packages/version-control.scm gnu/packages/xml.scm guix/build-system/copy.scm guix/scripts/home.scm Efraim Flashner 2023-01-05system: Define default 'PS1' in /etc/bashrc rather than ~/.bashrc....Users can override 'PS1' in ~/.bashrc if they wish. Previously, on Guix Home, the "default" 'PS1' would be set in ~/.bashrc when 'home-bash-configuration-guix-defaults?' is true, preventing users from overriding it via the 'environment-variables' field of 'home-bash-extension'. * gnu/system/shadow.scm (%default-bashrc): Remove 'PS1' setting. * gnu/system.scm (operating-system-etc-service): Define PS1 in /etc/bashrc. * gnu/home/services/shells.scm (add-bash-configuration): When 'home-bash-configuration-guix-defaults?' is true, add a default 'PS1' to ~/.bash_profile. Ludovic Courtès