aboutsummaryrefslogtreecommitdiff | |
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2022 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013, 2015, 2017, 2018, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016-2022 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2014, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016, 2018, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017, 2020-2022 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2017, 2019, 2021, 2022 Eric Bavier <bavier@posteo.net>
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
;;; Copyright © 2021 Lars-Dominik Braun <ldb@leibniz-psychology.org>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; 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 algebra)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages bison)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
#:use-module (gnu packages cpp)
#:use-module (gnu packages documentation)
#:use-module (gnu packages ed)
#:use-module (gnu packages flex)
#:use-module (gnu packages fltk)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gl)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages image)
#:use-module (gnu packages java)
#:use-module (gnu packages maths)
#:use-module (gnu packages mpi)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages ocaml)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages readline)
#:use-module (gnu packages shells)
#:use-module (gnu packages tex)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages xiph)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
#:use-module (guix build-system ant)
#:use-module (guix build-system gnu)
#:use-module (guix build-system cmake)
#:use-module (guix build-system python)
#:use-module (guix build-system r)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix hg-download)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (ice-9 match))
(define-public mpfrcx
(package
(name "mpfrcx")
(version "0.6.3")
(source (origin
(method url-fetch)
(uri (string-append
"http://www.multiprecision.org/downloads/mpfrcx-"
version ".tar.gz"))
(sha256
(base32
"1545vgizpypqi2rrriad0ybqv0qwbn9zr0ibxpk00gha9ihv7acx"))))
(build-system gnu-build-system)
(propagated-inputs
(list gmp mpfr mpc)) ; Header files are included by mpfrcx.h.
(synopsis "Arithmetic of polynomials over arbitrary precision numbers")
(description
"Mpfrcx is a library for the arithmetic of univariate polynomials over
arbitrary precision real (mpfr) or complex (mpc) numbers, without control
on the rounding. For the time being, only the few functions needed to
implement the floating point approach to complex multiplication are
implemented. On the other hand, these comprise asymptotically fast
multiplication routines such as Toom–Cook and the FFT.")
(license license:lgpl3+)
(home-page "http://www.multiprecision.org/mpfrcx/")))
(define-public gf2x
(package
(name "gf2x")
(version "1.3.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://gitlab.inria.fr/gf2x/gf2x")
(commit (string-append name "-" version))))
(file-name (git-file-name name version))
(sha256
(base32
"04g5jg0i4vz46b4w2dvbmahwzi3k6b8g515mfw7im1inc78s14id"))))
(build-system gnu-build-system)
(native-inputs (list autoconf automake libtool))
(synopsis "Arithmetic of polynomials over binary finite fields")
(description
"The gf2x library provides arithmetic of polynomials over finite fields
of characteristic 2. It implements the multiplication, squaring and
greatest common divisor operations.")
(home-page "https://gitlab.inria.fr/gf2x/gf2x")
(license license:gpl3+)))
(define-public cm
(package
(name "cm")
(version "0.4.0")
(source (origin
(method url-fetch)
(uri (string-append
"http://www.multiprecision.org/downloads/cm-"
version ".tar.gz"))
(sha256
(base32
"04l3inafql40n0r5rq8rmp21zplgdrzblil2kgkpx5s0jbs9i8rr"))))
(build-system gnu-build-system)
(propagated-inputs
(list mpfrcx zlib)) ; Header files included from cm_common.h.
(inputs
(list pari-gp))
(synopsis "CM constructions for elliptic curves")
(description
"The CM software implements the construction of ring class fields of
imaginary quadratic number fields and of elliptic curves with complex
multiplication via floating point approximations. It consists of libraries
that can be called from within a C program and of executable command
line applications.")
(license license:gpl3+)
(home-page "http://www.multiprecision.org/cm/")))
(define-public fplll
(package
(name "fplll")
(version "5.4.2")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/fplll/fplll")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32
"0044nyfnwzgyfrsikbcbh00f54dd61hwn3fb6711rrskkfnw977a"))))
(build-system gnu-build-system)
(native-inputs
(list autoconf automake libtool pkg-config))
(propagated-inputs ; header files pulled in by fplll/defs.h
(list gmp mpfr))
(home-page "https://github.com/fplll/fplll")
(synopsis "Library for LLL-reduction of euclidean lattices")
(description
"fplll contains implementations of several lattice algorithms.
The implementation relies on floating-point orthogonalization, and LLL
is central to the code, hence the name.
It includes implementations of floating-point LLL reduction
algorithms, offering different speed/guarantees ratios. It contains
a @emph{wrapper} choosing the estimated best sequence of variants in
order to provide a guaranteed output as fast as possible. In the case
of the wrapper, the succession of variants is oblivious to the user.
It includes an implementation of the BKZ reduction algorithm,
including the BKZ-2.0 improvements (extreme enumeration
pruning, pre-processing of blocks, early termination). Additionally,
Slide reduction and self dual BKZ are supported.
It also includes a floating-point implementation of the
Kannan-Fincke-Pohst algorithm that finds a shortest non-zero lattice
vector. For the same task, the GaussSieve algorithm is also available
in fplll. Finally, it contains a variant of the enumeration algorithm
that computes a lattice vector closest to a given vector belonging to
the real span of the lattice.")
(license license:l (let ((lxqt (lxqt-package config)))
(map (lambda (name)
((package-direct-input-selector name) lxqt))
'("lxqt-admin"))))
(define lxqt-desktop-service-type
(service-type
(name 'lxqt-desktop)
(extensions
(list (service-extension polkit-service-type
lxqt-polkit-settings)
(service-extension profile-service-type
(compose list lxqt-package))))
(default-value (lxqt-desktop-configuration))
(description "Run LXQt desktop environment.")))
;;;
;;; Sugar desktop service.
;;;
(define-record-type* <sugar-desktop-configuration> sugar-desktop-configuration
make-sugar-desktop-configuration
sugar-desktop-configuration?
(sugar sugar-package (default sugar))
(gobject-introspection
sugar-gobject-introspection (default gobject-introspection))
(activities
sugar-activities (default (list sugar-help-activity))))
(define (sugar-polkit-settings config)
"Return the list of packages that provide polkit actions and rules."
(list (sugar-package config)))
(define sugar-desktop-service-type
(service-type
(name 'sugar-desktop)
(extensions
(list (service-extension polkit-service-type
sugar-polkit-settings)
(service-extension profile-service-type
(lambda (config)
(cons* (sugar-package config)
(sugar-gobject-introspection config)
(sugar-activities config))))))
(default-value (sugar-desktop-configuration))
(description "Run the Sugar desktop environment.")))
;;;
;;; X11 socket directory service
;;;
(define x11-socket-directory-service-type
(let ((x11-socket-directory-shepherd-service
(shepherd-service
(documentation "Create @file{/tmp/.X11-unix} for XWayland.")
(requirement '(file-systems))
(provision '(x11-socket-directory))
(one-shot? #t)
(start #~(lambda _
(let ((directory "/tmp/.X11-unix"))
(mkdir-p directory)
(chmod directory #o1777)))))))
(service-type
(name 'x11-socket-directory-service)
(extensions
(list
(service-extension shepherd-root-service-type
(compose
list
(const x11-socket-directory-shepherd-service)))))
(default-value #f) ; no default value required
(description
"Create @file{/tmp/.X11-unix} for XWayland. When using X11, libxcb
takes care of creating that directory however, when using XWayland, we
need to create it beforehand."))))
(define-deprecated x11-socket-directory-service
x11-socket-directory-service-type
;; Return a service that creates /tmp/.X11-unix. When using X11, libxcb
;; takes care of creating that directory. However, when using XWayland, we
;; need to create beforehand. Thus, create it unconditionally here.
(service x11-socket-directory-service-type))
;;;
;;; Enlightenment desktop service.
;;;
(define-record-type* <enlightenment-desktop-configuration>
enlightenment-desktop-configuration make-enlightenment-desktop-configuration
enlightenment-desktop-configuration?
;; <package>
(enlightenment enlightenment-package
(default enlightenment)))
(define (enlightenment-privileged-programs enlightenment-desktop-configuration)
(match-record enlightenment-desktop-configuration
<enlightenment-desktop-configuration>
(enlightenment)
(map (lambda (program) (privileged-program (program program)
(setuid? #t)))
(list (file-append enlightenment
"/lib/enlightenment/utils/enlightenment_sys")
(file-append enlightenment
"/lib/enlightenment/utils/enlightenment_system")
(file-append enlightenment
"/lib/enlightenment/utils/enlightenment_ckpasswd")))))
(define enlightenment-desktop-service-type
(service-type
(name 'enlightenment-desktop)
(extensions
(list (service-extension dbus-root-service-type
(compose list
(package-direct-input-selector
"efl")
enlightenment-package))
(service-extension udev-service-type
(compose list
(package-direct-input-selector
"ddcutil")
enlightenment-package))
(service-extension privileged-program-service-type
enlightenment-privileged-programs)
(service-extension profile-service-type
(compose list
enlightenment-package))))
(default-value (enlightenment-desktop-configuration))
(description
"Return a service that adds the @code{enlightenment} package to the system
profile, and extends dbus with the ability for @code{efl} to generate
thumbnails and privileges the programs which enlightenment needs to function
as expected.")))
;;;
;;; KDE Plasma desktop service.
;;;
(define-record-type* <plasma-desktop-configuration> plasma-desktop-configuration
make-plasma-desktop-configuration
plasma-desktop-configuration?
(plasma-package plasma-package (default plasma)))
(define (plasma-polkit-settings config)
"Return the list of KDE Plasma dependencies that provide polkit actions and
rules."
(let ((plasma-plasma (plasma-package config)))
(map (lambda (name)
((package-direct-input-selector name) plasma-plasma))
'("plasma-desktop"
"plasma-workspace"
"plasma-disks"
"kinfocenter"
"libksysguard"
"ktexteditor"
"powerdevil"
"plasma-firewall"))))
(define (plasma-dbus-service config)
"Return the list of KDE Plasma dependencies that provide D-Bus services."
(let ((plasma-plasma (plasma-package config)))
(map (lambda (name)
((package-direct-input-selector name) plasma-plasma))
'("plasma-desktop"
"plasma-workspace"
"kactivitymanagerd"
"plasma-disks"
"kinfocenter"
"libksysguard"
"ktexteditor"
"powerdevil"
"kwallet"
"plasma-firewall"))))
;; see https://bugs.kde.org/show_bug.cgi?id=456210
;; if `kde' no exits, fallback to `other', and then unlock lockscreen not work,
;; so add it.
(define (plasma-pam-services config)
(list (unix-pam-service "kde")))
(define plasma-desktop-service-type
(service-type
(name 'plasma-desktop)
(description "Run the KDE Plasma desktop environment.")
(default-value (plasma-desktop-configuration))
(extensions
(list (service-extension polkit-service-type
plasma-polkit-settings)
(service-extension dbus-root-service-type
plasma-dbus-service)
(service-extension pam-root-service-type
plasma-pam-services)
(service-extension profile-service-type
(compose list
plasma-package))))))
;;;
;;; inputattach-service-type
;;;
(define-record-type* <inputattach-configuration>
inputattach-configuration
make-inputattach-configuration
inputattach-configuration?
(device-type inputattach-configuration-device-type
(default "wacom"))
(device inputattach-configuration-device
(default "/dev/ttyS0"))
(baud-rate inputattach-configuration-baud-rate
(default #f))
(log-file inputattach-configuration-log-file
(default #f)))
(define inputattach-shepherd-service
(match-lambda
(($ <inputattach-configuration> type device baud-rate log-file)
(let ((args (append (if baud-rate
(list "--baud" (number->string baud-rate))
'())
(list (string-append "--" type)
device))))
(list (shepherd-service
(provision '(inputattach))
(requirement '(udev))
(documentation "inputattach daemon")
(start #~(make-forkexec-constructor
(cons (string-append #$inputattach
"/bin/inputattach")
(quote #$args))
#:log-file #$log-file))
(stop #~(make-kill-destructor))))))))
(define inputattach-service-type
(service-type
(name 'inputattach)
(extensions
(list (service-extension shepherd-root-service-type
inputattach-shepherd-service)))
(default-value (inputattach-configuration))
(description "Return a service that runs inputattach on a device and
dispatches events from it.")))
;;;
;;; gnome-keyring-service-type
;;;
(define-record-type* <gnome-keyring-configuration> gnome-keyring-configuration
make-gnome-keyring-configuration
gnome-keyring-configuration?
(keyring gnome-keyring-package (default gnome-keyring))
(pam-services gnome-keyring-pam-services (default '(("gdm-password" . login)
("passwd" . passwd)))))
(define (pam-gnome-keyring config)
(define (%pam-keyring-entry . arguments)
(pam-entry
(control "optional")
(module (file-append (gnome-keyring-package config)
"/lib/security/pam_gnome_keyring.so"))
(arguments arguments)))
(list
(pam-extension
(transformer
(lambda (service)
(case (assoc-ref (gnome-keyring-pam-services config)
(pam-service-name service))
((login)
(pam-service
(inherit service)
(auth (append (pam-service-auth service)
(list (%pam-keyring-entry))))
(session (append (pam-service-session service)
(list (%pam-keyring-entry "auto_start"))))))
((passwd)
(pam-service
(inherit service)
(password (append (pam-service-password service)
(list (%pam-keyring-entry))))))
(else service)))))))
(define gnome-keyring-service-type
(service-type
(name 'gnome-keyring)
(extensions (list
(service-extension pam-root-service-type pam-gnome-keyring)))
(default-value (gnome-keyring-configuration))
(description "Return a service, that adds the @code{gnome-keyring} package
to the system profile and extends PAM with entries using
@code{pam_gnome_keyring.so}, unlocking a user's login keyring when they log in
or setting its password with passwd.")))
;;;
;;; polkit-wheel-service -- Allow wheel group to perform admin actions
;;;
(define polkit-wheel
(file-union
"polkit-wheel"
`(("share/polkit-1/rules.d/wheel.rules"
,(plain-file
"wheel.rules"
"polkit.addAdminRule(function(action, subject) {
return [\"unix-group:wheel\"];
});
")))))
(define polkit-wheel-service
(simple-service 'polkit-wheel polkit-service-type (list polkit-wheel)))
;;;
;;; seatd-service-type -- minimal seat management daemon
;;;
(define (seatd-group-sanitizer group-or-name)
(match group-or-name
((? user-group? group) group)
((? string? group-name) (user-group (name group-name) (system? #t)))
(_ (leave (G_ "seatd: '~a' is not a valid group~%") group-or-name))))
(define-record-type* <seatd-configuration> seatd-configuration
make-seatd-configuration
seatd-configuration?
(seatd seatd-package (default seatd))
(group seatd-group ; string | <user-group>
(default "seat")
(sanitize seatd-group-sanitizer))
(socket seatd-socket (default "/run/seatd.sock"))
(logfile seatd-logfile (default "/var/log/seatd.log"))
(loglevel seatd-loglevel (default "info")))
(define (seatd-shepherd-service config)
(list (shepherd-service
(documentation "Minimal seat management daemon")
(requirement '())
;; TODO: once cgroups is separate dependency
;; here we should depend on it rather than elogind
(provision '(seatd elogind))
(start #~(make-forkexec-constructor
(list #$(file-append (seatd-package config) "/bin/seatd")
"-g" #$(user-group-name (seatd-group config)))
#:environment-variables
(list (string-append "SEATD_LOGLEVEL="
#$(seatd-loglevel config))
(string-append "SEATD_DEFAULTPATH="
#$(seatd-socket config)))
#:log-file #$(seatd-logfile config)))
(stop #~(make-kill-destructor)))))
(define seatd-accounts
(match-lambda (($ <seatd-configuration> _ group) (list group))))
(define seatd-environment
(match-lambda
(($ <seatd-configuration> _ _ socket)
`(("SEATD_SOCK" . ,socket)))))
(define seatd-service-type
(service-type
(name 'seatd)
(description "Seat management takes care of mediating access
to shared devices (graphics, input), without requiring the
applications needing access to be root.")
(extensions
(list
(service-extension account-service-type seatd-accounts)
(service-extension session-environment-service-type seatd-environment)
;; TODO: once cgroups is separate dependency we should not mount it here
;; for now it is mounted here, because elogind mounts it
(service-extension file-system-service-type (const %control-groups))
(service-extension shepherd-root-service-type seatd-shepherd-service)))
(default-value (seatd-configuration))))
;;;
;;; The default set of desktop services.
;;;
(define* (desktop-services-for-system #:optional
(system (or (%current-target-system)
(%current-system))))
;; List of services typically useful for a "desktop" use case.
;; Since GDM depends on Rust (gdm -> gnome-shell -> gjs -> mozjs -> rust)
;; and Rust is currently unavailable on non-x86_64 platforms, default to
;; SDDM there (FIXME).
(cons* (if (string-prefix? "x86_64" system)
(service gdm-service-type)
(service sddm-service-type))
;; Screen lockers are a pretty useful thing and these are small.
(service screen-locker-service-type
(screen-locker-configuration
(name "slock")
(program (file-append slock "/bin/slock"))))
(service screen-locker-service-type
(screen-locker-configuration
(name "xlock")
(program (file-append xlockmore "/bin/xlock"))))
;; Add udev rules for MTP devices so that non-root users can access
;; them.
(simple-service 'mtp udev-service-type (list libmtp))
;; Add udev rules for scanners.
(service sane-service-type)
;; Add polkit rules, so that non-root users in the wheel group can
;; perform administrative tasks (similar to "sudo").
polkit-wheel-service
;; Allow desktop users to also mount NTFS and NFS file systems
;; without root.
(simple-service 'mount-setuid-helpers setuid-program-service-type
(map (lambda (program)
(privileged-program
(program program)
(setuid? #t)))
(list (file-append nfs-utils "/sbin/mount.nfs")
(file-append ntfs-3g "/sbin/mount.ntfs-3g"))))
;; This is a volatile read-write file system mounted at /var/lib/gdm,
;; to avoid GDM stale cache and permission issues.
gdm-file-system-service
;; The global fontconfig cache directory can sometimes contain
;; stale entries, possibly referencing fonts that have been GC'd,
;; so mount it read-only.
fontconfig-file-system-service
;; NetworkManager and its applet.
(service network-manager-service-type)
(service wpa-supplicant-service-type) ;needed by NetworkManager
(simple-service 'network-manager-applet
profile-service-type
(list network-manager-applet))
(service modem-manager-service-type)
(service usb-modeswitch-service-type)
;; The D-Bus clique.
(service avahi-service-type)
(service udisks-service-type)
(service upower-service-type)
(service accountsservice-service-type)
(service cups-pk-helper-service-type)
(service colord-service-type)
(service geoclue-service-type)
(service polkit-service-type)
(service elogind-service-type)
(service dbus-root-service-type)
(service ntp-service-type)
(service x11-socket-directory-service-type)
(service pulseaudio-service-type)
(service alsa-service-type)
%base-services))
(define-syntax %desktop-services
(identifier-syntax (desktop-services-for-system)))
;;; desktop.scm ends here
|