;;; GNU Guix --- Functional package management for GNU
;;;
;;; Copyright © 2021 muradm <mail@muradm.net>
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
;;;
;;; This file is not 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 (guixrus packages greetd)
#:use-module (gnu packages crates-io)
#:use-module (gnu packages freedesktop)
#:use-module (gnu packages linux)
#:use-module (gnu packages admin)
#:use-module (gnu packages gtk)
#:use-module (gnu packages man)
#:use-module (gnu packages web)
#:use-module (gnu packages pkg-config)
#:use-module (guixrus packages common rust)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages qt)
#:use-module (guix build-system cargo)
#:use-module (guix build-system meson))
;;;--> upstream: move into (gnu packages admin);
;;; add modules freedesktop, build-system cargo
(define-public libseat-next
(package
(name "libseat-next")
(version "0.6.2")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://git.sr.ht/~kennylevinsen/seatd")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32
"0c07i1nq0k60xmcsnr37ryqs7nzbg4qfq6fzbnzwbh1yhr8kypcm"))))
(build-system meson-build-system)
(arguments
`(#:configure-flags '("-Dlibseat-logind=elogind"
"-Dserver=disabled")))
(native-inputs
`(("pkg-config" ,pkg-config)))
(propagated-inputs
`(("elogind" ,elogind)))
(home-page "https://sr.ht/~kennylevinsen/seatd")
(synopsis "Seat management library")
(description
"This package provides a universal seat management library that
allows applications to use whatever seat management is available.")
(license license:expat)))
(define-public seatd-next
(package
(inherit libseat-next)
(name "seatd-next")
(arguments
`(#:configure-flags '("-Dlibseat-logind=elogind")
#:phases
(modify-phases %standard-phases
(add-after 'install 'remove-libs
(lambda* (#:key outputs #:allow-other-keys)
(with-directory-excursion (assoc-ref outputs "out")
(for-each delete-file-recursively '("lib" "include"))))))))
(native-inputs
`(("pkg-config" ,pkg-config)
("scdoc" ,scdoc)))
(inputs '())
(synopsis "Seat management daemon")
(description
"This package provides a minimal seat management daemon whose task is to
mediate access to shared devices, such as graphics and input, for applications
that require it.")
(license license:expat)))
(define-public greetd
(package
(name "greetd")
(version "0.8.0")
(home-page "https://git.sr.ht/~kennylevinsen/greetd")
(source (origin
(method git-fetch)
(uri (git-reference
(url home-page)
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "0x5c3jkw09kvj2grcxm899y2n6ws8p990cyp9cs0fy6lm4fzlh6v"))))
(build-system cargo-build-system)
(arguments
`(#:cargo-inputs
(("rust-nix" ,rust-nix-0.19)
("rust-pam-sys" ,rust-pam-sys-0.5)
("rust-rpassword" ,rust-rpassword-5)
("rust-users" ,rust-users-0.11)
("rust-serde" ,rust-serde-1)
("rust-serde-json" ,rust-serde-json-1)
("rust-libc" ,rust-libc-0.2)
("rust-tokio" ,rust-tokio-1)
("rust-getopts" ,rust-getopts-0.2)
("rust-thiserror" ,rust-thiserror-1)
("rust-async-trait" ,rust-async-trait-0.1)
("rust-enquote" ,rust-enquote-1))
#:phases
(modify-phases %standard-phases
(delete 'package)
(add-after 'build 'build-man-pages
(lambda* (#:key inputs #:allow-other-keys)
(define (scdoc-cmd doc lvl)
(system (string-append "scdoc < "
doc "-" lvl ".scd > "
doc "." lvl)))
(with-directory-excursion "man"
(scdoc-cmd "greetd" "1")
(scdoc-cmd "greetd" "5")
(scdoc-cmd "greetd-ipc" "7")
(scdoc-cmd "agreety" "1"))))
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(sbin (string-append out "/sbin"))
(share (string-append out "/share"))
(man (string-append share "/man"))
(man1 (string-append man "/man1"))
(man5 (string-append man "/man5"))
(man7 (string-append man "/man7"))
(release "target/release")
(greetd-bin (string-append release "/greetd"))
(agreety-bin (string-append release "/agreety")))
(install-file greetd-bin sbin)
(install-file agreety-bin bin)
(with-directory-excursion "man"
(install-file "greetd.1" man1)
(install-file "greetd.5" man5)
(install-file "greetd-ipc.7" man7)
(install-file "agreety.1" man1))))))))
(native-inputs
`(("linux-pam" ,linux-pam)
("scdoc" ,scdoc)))
(synopsis "Minimal and flexible login manager daemon")
(description "greetd is a minimal and flexible login manager daemon
hat makes no assumptions about what you want to launch.
If you can run it from your shell in a TTY, greetd can start it.
If it can be taught to speak a simple JSON-based IPC protocol,
hen it can be a greeter.")
(license license:gpl3+)))
(define-public greetd-pam-mount
(package
(inherit pam-mount)
(name "greetd-pam-mount")
(arguments
(substitute-keyword-arguments
(package-arguments pam-mount)
((#:configure-flags flags ''())
`(cons* "--with-rundir=/run/greetd" ,flags))
((#:phases phases)
`(modify-phases ,phases
(add-after 'unpack 'patch-config-file-name
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "src/pam_mount.c"
((".*define CONFIGFILE .*$")
"#define CONFIGFILE \"/etc/security/greetd_pam_mount.conf.xml\"\n")
(("pam_mount_config") "greetd_pam_mount_config")
(("pam_mount_system_authtok") "greetd_pam_mount_system_authtok"))))))))
(synopsis "pam-mount specifically compiled for use with greetd")
(description
"Pam-mount is a PAM module that can mount volumes when a user logs in.
It supports mounting local filesystems of any kind the normal mount utility
supports. It can also mount encrypted LUKS volumes using the password
supplied by the user when logging in.
This package inherits pam-mount in the way that it is compiled specifically
for use with greetd daemon. It uses different configuration location and
name space for storing data in PAM.
greetd-pam-mount is used in configuration of greetd to provide
auto-(mounting/unmounting) of XDG_RUNTIME_DIR in the way that it will not
interfere with default pam-mount configuration.")))
;;; greeters - TODO wlgreet, tuigreet (, ddlm)
(define-public qtgreet
(package
(name "qtgreet")
(version "1.0.0")
(source
(origin
(method git-fetch)
(uri
(git-reference
(url "https://gitlab.com/marcusbritanicus/QtGreet")
(commit "32b9a0f50ef29550f3a25dd0bf8ef1f76ae38139")))
(sha256
(base32 "1l4hxhr04kdyazszrpam2r3a2smviffyy0kdzn9iisg9qxbnk0wv"))))
(native-inputs (list pkg-config))
(inputs (list qtbase-5 json-c))
(build-system meson-build-system)
(synopsis "Qt-based, featureful greeter for greetd")
(description "This is a Qt-based greeter using a wlroots based
compositor (cage, sway, wayfire) to display a login interface that's
defined via QML.")
(home-page "https://gitlab.com/marcusbritanicus/QtGreet")
(license license:expat)))
(define-public gtkgreet
(package
(name "gtkgreet")
(version "0.7")
(source
(origin
(method git-fetch)
(uri
(git-reference
(url "https://git.sr.ht/~kennylevinsen/gtkgreet")
(commit "c09696f6a27aa0e4769fd3f707f27be4407ec95d")))
(sha256
(base32 "1d19v60ilxw4szhc5mbpav5kzml5lvckdy3fasjrhlpl87slvfz9"))))
(native-inputs
(list pkg-config scdoc))
(inputs
(list gtk+ gtk-layer-shell json-c))
(build-system meson-build-system)
(synopsis "GTK based greeter for greetd")
(description "This is a GTK-based greeter using a wlroots based
compositor (cage, sway, wayfire) to display a login interface.")
(home-page "https://git.sr.ht/~kennylevinsen/gtkgreet")
(license license:expat)))