maint: Relocate modules to ‘modules’ directory.

This commit is contained in:
Hilton Chain committed 2025-04-26 00:16:07 +08:00
1 parent b917cd6d36
commit 9c782fad3c
30 files changed
+2 -2

No files matched your search

@@ -0,0 +1,41 @@
;; SPDX-FileCopyrightText: 2024, 2025 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (guix import rosenthal-updaters)
#:use-module (srfi srfi-71)
#:use-module (web client)
#:use-module (guix packages)
#:use-module (guix records)
#:use-module (guix upstream)
#:export (%cloudflare-warp-updater))
(define* (cloudflare-warp-import pkg #:key version partial-version?)
(let* ((source-uri (assq-ref (package-properties pkg) 'release-monitoring-url))
(response port (http-get source-uri #:streaming? #t))
(content (recutils->alist port))
(_ (close port))
(name (package-upstream-name pkg))
(newest-version
(or version
(assoc-ref content "Version")))
(url
(if version
(string-append "https://pkg.cloudflareclient.com/"
"pool/bookworm/main/c/cloudflare-warp/"
"cloudflare-warp_" version "_amd64.deb")
(string-append "https://pkg.cloudflareclient.com/"
(assoc-ref content "Filename")))))
(upstream-source
(package name)
(version newest-version)
(urls (list url)))))
(define %cloudflare-warp-updater
(upstream-updater
(name 'cloudflare-warp)
(description "Updater for Cloudflare WARP client")
(pred (lambda (package)
(string=? "cloudflare-warp" (package-upstream-name package))))
(import cloudflare-warp-import)))
+23
View File
@@ -0,0 +1,23 @@
;; SPDX-FileCopyrightText: 2023 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal bootloader grub)
#:use-module (gnu bootloader)
#:use-module (gnu bootloader grub)
#:use-module (rosenthal packages bootloaders)
#:export (grub-efi-luks2-bootloader
grub-efi-luks2-removable-bootloader))
(define grub-efi-luks2-bootloader
(bootloader
(inherit grub-efi-bootloader)
;; NOTE: Don't change the name. Generation switching code only knows
;; bootloaders defined in (gnu bootloader grub).
(name 'grub-efi)
(package grub-efi-luks2)))
(define grub-efi-luks2-removable-bootloader
(bootloader
(inherit grub-efi-removable-bootloader)
(package grub-efi-luks2)))
+66
View File
@@ -0,0 +1,66 @@
;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Copyright © 2015, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2025 Maxim Cournoyer <maxim.cournoyer@gmail.com>
(define-module (rosenthal packages)
#:use-module (gnu packages)
#:use-module (guix diagnostics)
#:use-module (guix i18n)
#:use-module (ice-9 match)
#:use-module (srfi srfi-34)
#:replace (%patch-path
search-patch)
#:export (rosenthal-patches))
;;; Commentary:
;;;
;;; This module refines the default value of some parameters from (gnu
;;; packages) and the syntax/procedures using those. This allows
;;; 'search-paths' and friends to work without any user intervention.
;;;
;;; Code:
(define %rosenthal-root-directory
;; This is like %distro-root-directory from (gnu packages), with adjusted
;; paths.
(letrec-syntax ((dirname* (syntax-rules ()
((_ file)
(dirname file))
((_ file head tail ...)
(dirname (dirname* file tail ...)))))
(try (syntax-rules ()
((_ (file things ...) rest ...)
(match (search-path %load-path file)
(#f
(try rest ...))
(absolute
(dirname* absolute things ...))))
((_)
#f))))
(try ("rosenthal/packages/binaries.scm" rosenthal/ packages/)
("rosenthal/packages.scm" rosenthal/))))
(define %patch-path
;; Define it after '%package-module-path' so that '%load-path' contains user
;; directories, allowing patches in $GUIX_PACKAGE_PATH to be found.
(make-parameter
(map (lambda (directory)
(if (string=? directory %rosenthal-root-directory)
(string-append directory "/rosenthal/packages/patches")
directory))
%load-path)))
;;; XXX: The following must be redefined to make use of the overridden
;;; %patch-path parameter above.
(define (search-patch file-name)
"Search the patch FILE-NAME. Raise an error if not found."
(or (search-path (%patch-path) file-name)
(raise (formatted-message (G_ "~a: patch not found")
file-name))))
;;; XXX: `search-patches' being syntax, it can't be overridden by the module
;;; system, or so it seems, so we simply rename it.
(define-syntax-rule (rosenthal-patches file-name ...)
"Return the list of absolute file names corresponding to each
FILE-NAME found in %PATCH-PATH."
(list (search-patch file-name) ...))
+114
View File
@@ -0,0 +1,114 @@
;; SPDX-FileCopyrightText: 2022, 2025 Hilton Chain <hako@ultrarare.space>
;; SPDX-FileCopyrightText: 2025 William Goodspeed
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages admin)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix git-download)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system meson)
#:use-module (gnu packages admin)
#:use-module (gnu packages linux)
#:use-module (gnu packages m4)
#:use-module (gnu packages pkg-config))
(define-public dinit
(package
(name "dinit")
(version "0.19.3")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/davmac314/dinit")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0gw5jvh9bxnnwdv7ajscs03d6x2hcs9i3hxkqfjs19d4wr5rghyq"))))
(build-system meson-build-system)
(arguments
(list #:configure-flags
#~(list "-Dshutdown-prefix=dinit-"
"-Dunit-tests=true"
"-Digr-tests=true"
(string-append "-Ddinit-sbindir=" #$output "/sbin"))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'fix-paths
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "src/shutdown.cc"
(("(/sbin/swapoff|/bin/umount)" path)
(search-input-file inputs path))))))))
(native-inputs (list m4))
(inputs (list util-linux))
(home-page "https://davmac.org/projects/dinit/")
(synopsis "Service manager with dependency management")
(description
"Dinit is a service manager for Unix-like operating systems that allows
the user to manage services with dependencies and parallel startup.")
(license license:asl2.0)))
(define-public libseat-sans-logind
(let ((base libseat))
(package
(inherit base)
(name "libseat-sans-logind")
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:configure-flags configure-flags)
#~(append #$configure-flags
(list "-Dlibseat-logind=disabled")))))
(propagated-inputs '()))))
(define-public pam-dumb-runtime-dir
(package
(name "pam-dumb-runtime-dir")
(version "1.0.4")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ifreund/dumb_runtime_dir")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"0nrxhvbh3bs4pi4f5h03zw1p1ys19qmmlx263ysly8302wkxk1m4"))))
(build-system gnu-build-system)
(arguments
(list #:tests? #f ;No tests.
#:make-flags
#~(list (string-append "CC=" #$(cc-for-target))
(string-append "DESTDIR=" #$output)
"PREFIX=")
#:phases
#~(modify-phases %standard-phases
;; No configure script.
(delete 'configure))))
(native-inputs (list pkg-config))
(inputs (list linux-pam))
(home-page "https://github.com/ifreund/dumb_runtime_dir")
(synopsis "Create @code{XDG_RUNTIME_DIR} on login and never remove it")
(description
"This package creates an @code{XDG_RUNTIME_DIR} directory on login per
the freedesktop.org base directory spec. Flaunts the spec and never removes
it, even after last logout. This keeps things simple and predictable.
The user is responsible for ensuring that the @file{/run/user} directory
exists and is only writable by root.")
(license license:bsd-0)))
(define-public seatd-sans-logind
(let ((base seatd))
(package
(inherit base)
(name "seatd-sans-logind")
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:configure-flags configure-flags)
#~(append #$configure-flags
(list "-Dlibseat-logind=disabled")))))
(propagated-inputs '()))))
+414
View File
@@ -0,0 +1,414 @@
;; SPDX-FileCopyrightText: 2023-2024 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages binaries)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix gexp)
#:use-module (guix deprecation)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system copy)
#:use-module (gnu build icecat-extension)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages bootstrap)
#:use-module (gnu packages compression)
#:use-module (gnu packages elf)
#:use-module (gnu packages gcc)
#:use-module (gnu packages glib)
#:use-module (gnu packages java)
#:use-module (gnu packages nss)
#:use-module (rosenthal packages networking)
#:use-module (rosenthal packages rust-apps)
#:use-module (rosenthal packages web))
(define license
(@@ (guix licenses) license))
(define-public atuin-bin
(deprecated-package "atuin-bin" atuin))
(define bitwarden
(package
(name "bitwarden")
(version "2025.3.1")
(source (origin
(method url-fetch/zipbomb)
(uri (string-append "https://github.com/bitwarden/clients"
"/releases/download/browser-v" version
"/dist-firefox-" version ".zip"))
(sha256
(base32
"03s8z32rc4mwzi61xpzn4f9z6kxwdnshqy61h2kr3cvq9974li3s"))))
(build-system copy-build-system)
(arguments
(list #:install-plan
#~'(("." #$(assq-ref (package-properties this-package) 'addon-id)))))
(home-page "https://bitwarden.com/")
(synopsis "Bitwarden client browser extension")
(description
"This package provides browser extension for Bitwarden client.")
(license license:gpl3)
(properties '((addon-id . "{446900e4-71c2-419f-a6a7-df9c091e268b}")))))
(define-public bitwarden/icecat
(make-icecat-extension bitwarden))
(define-public clash-bin
(package
(name "clash-bin")
(version "1.18.0")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/Dreamacro/clash/releases/download/v"
version "/clash-linux-amd64-v3-v" version ".gz"))
(sha256
(base32
"0gchpc4pvy24dvhb5nk08g97rswjqr1ic6i405f1ba5snfv8i5z8"))))
(build-system copy-build-system)
(arguments
(list #:install-plan
#~'((#$(format #f "clash-linux-amd64-v3-v~a" version) "bin/clash"))
#:phases
#~(modify-phases %standard-phases
(add-after 'install 'fix-permission
(lambda _
(chmod (string-append #$output "/bin/clash") #o555))))))
(supported-systems '("x86_64-linux"))
(home-page "https://github.com/Dreamacro/clash")
(synopsis "Rule-based tunnel in Go")
(description
"Clash is a cross-platform rule-based proxy utility that runs on the
network and application layer, supporting various proxy and anti-censorship
protocols out-of-the-box.")
(license license:gpl3)))
(define-public hugo-bin
(deprecated-package "hugo-bin" hugo))
(define-public mihomo-bin
(package
(name "mihomo-bin")
(version "1.19.5")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/MetaCubeX/mihomo/releases/download/v"
version "/mihomo-linux-amd64-v" version ".gz"))
(sha256
(base32
"1x7i7v1gkfgc19fmsn9annv8nvwfl6w5pqr1m3982plzabnlr1ni"))))
(build-system copy-build-system)
(arguments
(list #:install-plan
#~'((#$(string-append
"mihomo-linux-amd64-v" (package-version this-package))
"bin/mihomo"))
#:phases
#~(modify-phases %standard-phases
(add-after 'install 'fix-permission
(lambda _
(chmod (string-append #$output "/bin/mihomo") #o555))))))
(supported-systems '("x86_64-linux"))
(home-page "https://wiki.metacubex.one/")
(synopsis "Rule-based tunnel in Go")
(description
"This package provides @command{mihomo}, another @code{clash} kernel.")
(license license:gpl3)
(properties '((upstream-name . "mihomo")))))
(define-public clash-meta-bin
(deprecated-package "clash-meta-bin" mihomo-bin))
(define-public cloudflare-warp-bin
(package
(name "cloudflare-warp-bin")
(version "2025.2.600.0")
(source (origin
(method url-fetch)
(uri (string-append "https://pkg.cloudflareclient.com"
"/pool/bookworm/main/c/cloudflare-warp/"
"cloudflare-warp_" version "_amd64.deb"))
(sha256
(base32
"0rabxl6vfj3pljn77w96kb2k9w99hh5pvis1grr4im6lf5m86xsj"))))
(build-system copy-build-system)
(arguments
(list #:install-plan
#~'(("bin" "bin" #:include ("warp-cli" "warp-svc")))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'unpack-deb
(lambda* (#:key source #:allow-other-keys)
(invoke "ar" "-x" source)
(invoke "tar" "-xf" "data.tar.gz")))
(add-after 'install 'patch-elf
(lambda _
(let ((ld.so (string-append #$(this-package-input "glibc")
#$(glibc-dynamic-linker)))
(rpath (string-join
(list
(string-append
(ungexp
(this-package-input "gcc") "lib") "/lib")
(string-append
#$(this-package-input "dbus") "/lib")
(string-append
#$(this-package-input "glibc") "/lib")
(string-append
#$(this-package-input "nspr") "/lib")
(string-append
#$(this-package-input "nss") "/lib/nss"))
":")))
(define (patch-elf file)
(format #t "Patching ~a ..." file)
(unless (string-contains file ".so")
(invoke "patchelf" "--set-interpreter" ld.so file))
(invoke "patchelf" "--set-rpath" rpath file)
(display " done\n"))
(for-each (lambda (file)
(patch-elf file))
(find-files
(string-append #$output "/bin")))))))))
(supported-systems '("x86_64-linux"))
(native-inputs (list patchelf-0.16))
(inputs (list dbus `(,gcc "lib") glibc nspr nss))
(home-page "https://1.1.1.1/")
(synopsis "Cloudflare WARP client")
(description
"The Cloudflare WARP client allows individuals to have a faster, more
secure, and more private experience online. The WARP client sits between your
device and the Internet, and has several connection modes to better suit
different needs.")
(license
(license "Nonfree"
"https://www.cloudflare.com/application/terms/"
"This is a nonfree license. Check the URI for details."))
(properties
'((upstream-name . "cloudflare-warp")
(release-monitoring-url
. "https://pkg.cloudflareclient.com/dists/bookworm/main/binary-amd64/Packages")))))
(define-public komga-bin
(package
(name "komga-bin")
(version "1.21.2")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/gotson/komga/releases/download/" version
"/komga-" version ".jar"))
(sha256
(base32
"0ya31gjikr71m8mc2pagm1pgc951q6q6yi7mvpa47qskspbkk30m"))))
(build-system copy-build-system)
(arguments
(list #:install-plan
#~'((#$(string-append "komga-" (package-version this-package) ".jar")
"lib/komga/komga.jar"))
#:phases
#~(modify-phases %standard-phases
(replace 'install
(lambda* (#:key inputs source #:allow-other-keys)
(let* ((lib (in-vicinity #$output "lib/komga"))
(bin (in-vicinity #$output "bin"))
(jar (in-vicinity lib "komga.jar"))
(exe "komga"))
(mkdir-p lib)
(copy-file source jar)
(call-with-output-file exe
(lambda (port)
(format port "~
#!~a
export LC_ALL=C.UTF-8
exec ~a -jar ~a $@~%"
(search-input-file inputs "bin/bash")
(search-input-file inputs "bin/java")
jar)))
(chmod exe #o555)
(install-file exe bin)))))))
(inputs (list bash-minimal openjdk))
(home-page "https://komga.org/")
(synopsis "Media server for comics/mangas/BDs/magazines/eBooks")
(description
"Komga is a media server for your comics, mangas, BDs, magazines and
eBooks.")
(license license:expat)
(properties '((upstream-name . "komga")))))
(define miniflux-injector
(package
(name "miniflux-injector")
(version "2.3.3")
(properties '((addon-id . "{528ec801-2e29-4cb9-ae71-5a90503138d1}")))
(source
(origin
(method url-fetch/zipbomb)
(uri (string-append
"https://github.com/Sevichecc/miniflux-injector/releases/download"
"/v" version "/miniflux_injector-" version ".zip"))
(sha256
(base32
"199z441ak6dwy7skgbwc9aa4gfd2r4i22hxfm27s5k3rv7barbvs"))
(modules '((guix build utils)))
(snippet
#~(substitute* "manifest.json"
(("homepage_url.*" line)
(string-append line "\
\"browser_specific_settings\": {
\"gecko\": {
\"id\": \"" #$(assq-ref properties 'addon-id) "\"
}
},
"))))))
(build-system copy-build-system)
(arguments
(list
#:install-plan
#~'(("." #$(assq-ref (package-properties this-package) 'addon-id)))))
(home-page "https://github.com/Sevichecc/miniflux-injector")
(synopsis "Injects Miniflux search results into search page")
(description
"This package provides a browser extension to inject Miniflux search
results into search page. Search terms are sent to your Miniflux instance and
results are added in a sidebar next to search engine results.")
(license license:expat)))
(define-public miniflux-injector/icecat
(make-icecat-extension miniflux-injector))
(define-public shadow-tls-bin
(package
(name "shadow-tls-bin")
(version "0.2.25")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/ihciah/shadow-tls/releases/download/v"
version "/shadow-tls-x86_64-unknown-linux-musl"))
(sha256
(base32
"0chmqzfmyw5w8ybshkwigc3r25svq7fyw371d0dj2ibzsprgawx1"))))
(build-system copy-build-system)
(arguments
(list #:install-plan
#~'(("shadow-tls-x86_64-unknown-linux-musl" "bin/shadow-tls"))
#:phases
#~(modify-phases %standard-phases
(add-after 'install 'fix-permission
(lambda _
(chmod (string-append #$output "/bin/shadow-tls") #o555))))))
(supported-systems '("x86_64-linux"))
(home-page "https://www.ihcblog.com/a-better-tls-obfs-proxy/")
(synopsis "Proxy to expose real tls handshake to the firewall")
(description
"Shadow TLS is a proxy to expose real tls handshake to the @acronym{MITM,
monster-in-the-middle}.")
(license license:expat)
(properties '((upstream-name . "shadow-tls")))))
(define sidebery
(package
(name "sidebery")
(version "5.3.3.7")
(source
(origin
(method url-fetch/zipbomb)
(uri (string-append
"https://github.com/mbnuqw/sidebery/releases/download/v"
(string-drop-right version 2) "/sidebery-" version ".xpi"))
(sha256
(base32
"0srply73aa3i353w8d6zlqn55wqb2ndmcmzzr4n3dsxr5hynpypx"))))
(build-system copy-build-system)
(arguments
(list
#:install-plan
#~'(("." #$(assq-ref (package-properties this-package) 'addon-id)))))
(home-page "https://github.com/mbnuqw/sidebery")
(synopsis "Manage tabs and bookmarks in sidebar")
(description
"This package provides a browser extension for managing tabs and bookmarks
in sidebar.")
(license license:expat)
(properties '((addon-id . "{3c078156-979c-498b-8990-85f7987dd929}")))))
(define-public sidebery/icecat
(make-icecat-extension sidebery))
(define-public sing-box-bin
(package
(name "sing-box-bin")
(version "1.11.8")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/SagerNet/sing-box/releases/download/v"
version "/sing-box-" version "-linux-amd64.tar.gz"))
(sha256
(base32
"0fdv8wvkydm20fgpy30hm3b6v3vz09pim178faximpyv4846m46z"))))
(build-system copy-build-system)
(arguments (list #:install-plan #~'(("sing-box" "bin/"))))
(supported-systems '("x86_64-linux"))
(home-page "https://sing-box.sagernet.org/")
(synopsis "Universal proxy platform")
(description
"This package provides @command{sing-box}, a universal proxy platform.")
(license license:gpl3+)
(properties '((upstream-name . "sing-box")))))
(define-public tailscale-bin
(deprecated-package "tailscale-bin" tailscale))
(define-public wakapi-bin
(package
(name "wakapi-bin")
(version "2.13.3")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/muety/wakapi/releases/download/"
version "/wakapi_linux_amd64.zip"))
(sha256
(base32
"1znlp9h1rvisas6qf5r76yg0mbiiqxwgrqcc10gvcjsjrib844av"))))
(build-system copy-build-system)
(arguments (list #:install-plan #~'(("wakapi" "bin/wakapi"))))
(supported-systems '("x86_64-linux"))
(native-inputs (list unzip))
(home-page "https://wakapi.dev/")
(synopsis "WakaTime-compatible backend")
(description
"This package provides @code{wakapi}, a WakaTime-compatible backend for
coding statistics.")
(license license:expat)
(properties '((upstream-name . "wakapi")))))
(define-public wakatime-cli-bin
(package
(name "wakatime-cli-bin")
(version "1.115.1")
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/wakatime/wakatime-cli"
"/releases/download/v" version
"/wakatime-cli-linux-amd64.zip"))
(sha256
(base32
"1dd4r963kfka0iq6471sid4zrqkjbdm4lw8fyhx24rk0085lhcap"))))
(build-system copy-build-system)
(arguments
(list #:install-plan
#~'(("wakatime-cli-linux-amd64" "bin/wakatime-cli"))))
(supported-systems '("x86_64-linux"))
(native-inputs (list unzip))
(home-page "https://wakatime.com/plugins")
(synopsis "Command line interface to WakaTime")
(description
"This package provides @command{wakatime-cli}, the command line interface
to WakaTime, which is used by all WakaTime text editor plugins.")
(license license:bsd-3)
(properties '((upstream-name . "wakatime-cli")))))
@@ -0,0 +1,50 @@
;; SPDX-FileCopyrightText: 2023 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages bootloaders)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (gnu packages autotools)
#:use-module (gnu packages bootloaders)
#:use-module (gnu packages python))
;; Patches obtained from:
;; <https://leo3418.github.io/collections/gentoo-config-luks2-grub-systemd/packages.html>
(define grub-luks2-argon2-support-patch
(origin
(method url-fetch)
(uri (string-append "https://leo3418.github.io/"
"res/collections/gentoo-config-luks2-grub-systemd/"
"grub-2.12-luks2-argon2-v4.patch"))
(sha256
(base32
"02y15k6rd5vj2shfijyhq2nr2775vpa55ijfy6bb8irpnh8i2272"))))
(define-public grub-efi-luks2
(let ((base grub-efi))
(package
(inherit base)
(name "grub-efi-luks2")
(source
(let ((base (package-source base)))
(origin
(inherit base)
(patches
(append (origin-patches base)
(list grub-luks2-argon2-support-patch))))))
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:configure-flags flags ''())
#~(append #$flags '("--disable-werror")))
((#:phases phases '%standard-phases)
#~(modify-phases #$phases
(add-after 'unpack 'delete-configure-script
(lambda _
(delete-file "configure")))))))
(native-inputs
(modify-inputs (package-native-inputs base)
(append autoconf automake python-minimal-wrapper))))))
+28
View File
@@ -0,0 +1,28 @@
;; SPDX-FileCopyrightText: 2022 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages busybox)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (gnu packages busybox))
(define-public busybox/static
(let ((base busybox))
(package
(inherit base)
(name "busybox-static")
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
#~(modify-phases #$phases
(add-after 'configure 'static-build
(lambda _
(substitute* ".config"
(("# CONFIG_STATIC is not set")
"CONFIG_STATIC=y"))))
;; FIXME: All mdev tests fail when building staticly.
(add-before 'check 'disable-failing-tests
(lambda _
(delete-file "testsuite/mdev.tests"))))))))))
+61
View File
@@ -0,0 +1,61 @@
;; SPDX-FileCopyrightText: 2022-2024 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages dns)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system copy)
#:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix packages))
(define-public dnsmasq-china-list
;; No version.
(let ((commit "6601f38990c06909d69364685a8ef4f3544e1e69")
(revision "18"))
(package
(name "dnsmasq-china-list")
(version (git-version "0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/felixonmars/dnsmasq-china-list")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"1sqm1mmbnc9gxj77yplslx3nlnxx34dfxv9y8gdlwkgzjhg13r5x"))))
(build-system copy-build-system)
(arguments
(list #:install-plan
#~'(("." "share/dnsmasq-china-list/" #:include-regexp ("\\.conf")))
#:phases
#~(modify-phases %standard-phases
(add-before 'install 'build
(lambda _
(for-each (lambda (target)
(invoke "make" target
"SERVER=domestic"
"SMARTDNS_SPEEDTEST_MODE=tcp:80"))
'("adguardhome"
"bind"
"coredns"
"dnscrypt-proxy"
"dnsforwarder6"
"dnsmasq"
"smartdns" "smartdns-domain-rules"
"unbound")))))))
(home-page "https://github.com/felixonmars/dnsmasq-china-list")
(synopsis "Chinese-specific DNS server configurations")
(description
"Chinese-specific configuration to improve your favorite DNS server.
Best partner for chnroutes.
@itemize
@item Improve resolve speed for Chinese domains.
@item Get the best CDN node near you whenever possible, but don't compromise
foreign CDN results so you also get best CDN node for your VPN at the same
time.
@item Block ISP ads on NXDOMAIN result (like 114so).
@end itemize")
(license license:wtfpl2))))
+64
View File
@@ -0,0 +1,64 @@
;; SPDX-FileCopyrightText: 2022-2024 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages emacs-xyz)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system emacs)
#:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix packages))
(define-public emacs-pcmpl-tailscale
(let ((commit "acd6bce54af506b0450cf6aa1068f63d4e25c8ce")
(revision "0"))
(package
(name "emacs-pcmpl-tailscale")
(version (git-version "0.0.1" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://git.thanosapollo.org/pcmpl-tailscale")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "0lk808ahy8ckg2fr2pqk3p5if81nqrwsajrgqafv9hgn8w4l1x0p"))))
(build-system emacs-build-system)
(home-page "https://git.thanosapollo.org/pcmpl-tailscale")
(synopsis "Enhanced shell completions for tailscale")
(description
"This package provides enhanced completions for the tailscale command
and it's subcommands.")
(license license:gpl3+))))
;; https://issues.guix.gnu.org/59552
(define-public emacs-wakatime-mode
;; No release since May 5, 2015.
(let ((commit "1c5b2254dd72f2ff504d6a6189a8c10be03a98d1")
(revision "60"))
(package
(name "emacs-wakatime-mode")
;; 1.0.2 on commit 32a0154cd4bbd525d354997e6b12c6a9726d0b43, not tagged
(version (git-version "1.0.2" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/wakatime/wakatime-mode")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"00qv6b756qiaqrmfg1w03psnsdj0iaz3sp50ib4kmdm2g9vgxl1s"))))
(build-system emacs-build-system)
(arguments
(list #:phases
#~(modify-phases %standard-phases
;; XXX: WakaTime hasn't packaged in Guix yet.
(delete 'patch-el-files))))
(home-page "https://wakatime.com/emacs")
(synopsis "Automatic time tracking extension for Emacs using WakaTime")
(description
"WakaTime mode is an Emacs minor mode for automatic time tracking and
metrics generated from your programming activity.")
(license license:gpl3+))))
+162
View File
@@ -0,0 +1,162 @@
;; SPDX-FileCopyrightText: 2022-2024 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages networking)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system go)
#:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (rosenthal utils download)
#:use-module (gnu packages golang)
#:use-module (gnu packages golang-build))
(define-public cloudflared
(package
(name "cloudflared")
(version "2025.4.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/cloudflare/cloudflared")
(commit version)))
(file-name (git-file-name name version))
;; TODO: Unbundle vendored dependencies.
;; (modules '((guix build utils)))
;; (snippet '(delete-file-recursively "vendor"))
(sha256
(base32
"03bhkd5cgrw2srgh82xv1y95zkpx4v2rqdy9azhv4y7fzz07p89w"))))
(build-system go-build-system)
(arguments
(list #:go go-1.23
#:install-source? #f
#:import-path "github.com/cloudflare/cloudflared/cmd/cloudflared"
#:unpack-path "github.com/cloudflare/cloudflared"
#:build-flags
#~(list (string-append
"-ldflags="
" -X main.Version=" #$(package-version this-package)
" -X github.com/cloudflare/cloudflared/cmd/cloudflared/updater.BuiltForPackageManager=Guix"))
#:phases
#~(modify-phases %standard-phases
(add-before 'build 'disable-cgo
(lambda _
(setenv "CGO_ENABLED" "0")))
(add-after 'install 'install-documentation
(lambda _
(let ((src "src/github.com/cloudflare/cloudflared/cloudflared_man_template")
(dst (string-append #$output "/share/man/man1/cloudflared.1")))
(substitute* src
(("\\$\\{VERSION\\}") #$(package-version this-package)))
(mkdir-p (dirname dst))
(copy-file src dst)))))))
(home-page "https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/")
(synopsis "Cloudflare Tunnel client")
(description
"This package provides the command-line client for Cloudflare Tunnel, a
tunneling daemon that proxies traffic from the Cloudflare network to your
origins. This daemon sits between Cloudflare network and your origin (e.g. a
webserver). Cloudflare attracts client requests and sends them to you via
this daemon, without requiring you to poke holes on your firewall --- your
origin can remain as closed as possible.")
(license license:asl2.0)))
(define-public socks2http
(package
(name "socks2http")
(version "0.0.0-20160712034938-bafa2cde8eb4")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zenhack/socks2http")
(commit (go-version->git-ref version))))
(file-name (git-file-name name version))
(sha256
(base32
"0c388rir9d0cy5vxqxj7m72nra0w5cya4mmgqdcvqmnk2vawdyb9"))))
(build-system go-build-system)
(arguments
(list #:install-source? #f
#:import-path "github.com/zenhack/socks2http"))
(inputs (list go-golang-org-x-net))
(home-page "https://github.com/zenhack/socks2http")
(synopsis "SOCKS5 to HTTP proxy")
(description
"This package provides a simple tool to plumb HTTP proxy requests through
a SOCKS5 proxy.")
(license license:expat)))
(define-public tailscale
(package
(name "tailscale")
(version "1.80.3")
(source
(origin
(method go-vendored-fetch)
(uri (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/tailscale/tailscale")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"07s8kwksvd0f9r65zkrhp3sn4jrv0c8g5w0wbiv9qq950l8gdv2h"))))
(file-name (git-file-name name version))
(sha256
(base32
"0g2pzazrfl41s1gra2g3ni34ddgw32mb2rjlv8x17g3yc7axdbqa"))
(modules '((guix build utils)))
(snippet '(delete-file-recursively "tool"))))
(build-system go-build-system)
(arguments
(list
#:go go-1.23
#:install-source? #f
#:import-path "."
#:build-flags
#~(list "-tags" "ts_include_cli"
(string-append
"-ldflags="
" -X tailscale.com/version.longStamp=v"
#$(package-version this-package)
" -X tailscale.com/version.shortStamp=v"
#$(package-version this-package)))
#:test-flags ''("-skip=^TestPackageDocs$")
#:test-subdirs ''(".")
#:modules
'(((guix build gnu-build-system) #:prefix gnu:)
(guix build go-build-system)
(guix build utils))
#:phases
#~(modify-phases %standard-phases
(replace 'unpack
(lambda args
(apply (assoc-ref gnu:%standard-phases 'unpack) args)
(unsetenv "GO111MODULE")))
(replace 'install-license-files
(assoc-ref gnu:%standard-phases 'install-license-files))
;; TODO: Fix command references.
(replace 'build
(lambda* (#:key build-flags parallel-build? #:allow-other-keys)
(let* ((njobs (if parallel-build? (parallel-job-count) 1)))
(setenv "GOMAXPROCS" (number->string njobs))
(for-each
(lambda (pkg)
(apply invoke "go" "build" "-ldflags=-s -w" "-trimpath"
"-o" (string-append #$output "/bin/" pkg)
`(,@build-flags
,(string-append "tailscale.com/cmd/" pkg))))
'("derper"
"derpprobe"
"tailscale"
"tailscaled"
"tsidp"))))))))
(home-page "https://tailscale.com/")
(synopsis "Private WireGuard® networks made easy")
(description
"This package provides @command{tailscale}, which brings an easy and secure
way to use WireGuard and 2FA.")
(license license:bsd-3)))
+78
View File
@@ -0,0 +1,78 @@
;; SPDX-FileCopyrightText: 2025 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages rust-apps)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system cargo)
#:use-module (gnu packages crates-crypto)
#:use-module (rosenthal packages rust-crates))
(define-public atuin
(package
(name "atuin")
(version "18.4.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/atuinsh/atuin")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1zi7ar999ycvig9c9crylab540xdgr0h6v99q9j8ypk9i1fviyiz"))))
(build-system cargo-build-system)
(arguments
(list
#:install-source? #f
#:features
''("client" "sync" "server" "clipboard" "daemon")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'disable-failing-tests
(lambda _
(substitute* '("crates/atuin/tests/sync.rs"
"crates/atuin/tests/users.rs"
"crates/atuin-dotfiles/src/store.rs"
"crates/atuin-dotfiles/src/store/var.rs")
(((string-append
".*async fn (" (string-join
'(;; Require running database.
"build_aliases"
"build_vars"
"sync"
"registration"
"change_password"
"multi_user_test")
"|") ")")
all)
(string-append "#[ignore]\n" all)))))
(add-after 'unpack 'patch-references
(lambda _
(substitute* (find-files "crates/atuin/src/shell")
(("atuin (uuid|history|search)" all)
(string-append #$output "/bin/" all)))))
(replace 'install
(lambda* (#:key outputs features #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(registry (string-append out "/share/cargo/registry"))
(sources (string-append out "/share/cargo/src")))
(mkdir-p out)
;; Make cargo reuse all the artifacts we just built instead
;; of defaulting to making a new temp directory
(setenv "CARGO_TARGET_DIR" "./target")
;; Only install crates which include binary targets,
;; otherwise cargo will raise an error.
(invoke "cargo" "install" "--no-track" "--path" "crates/atuin"
"--root" out "--features" (string-join features))))))))
(inputs (cons* rust-ring-0.17 atuin-cargo-inputs))
(home-page "https://atuin.sh/")
(synopsis "Sync, search and backup shell history")
(description
"Atuin replaces existing shell history with a SQLite database, and records
additional context for commands. Additionally, it provides optional and fully
encrypted synchronisation of history between machines, via an Atuin server.")
(license license:expat)))
File diff suppressed because it is too large. Load diff
+26
View File
@@ -0,0 +1,26 @@
;; SPDX-FileCopyrightText: 2022 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages ssh)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (gnu packages compression)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages ssh))
(define-public dropbear/static
(let ((base dropbear))
(package
(inherit dropbear)
(name "dropbear-static")
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:configure-flags flags)
#~(append #$flags (list "--enable-static")))))
(inputs
(modify-inputs (package-inputs base)
(append `(,zlib "static"))
(replace "libtomcrypt" `(,libtomcrypt "static"))
(replace "libtommath" `(,libtommath "static")))))))
@@ -0,0 +1,38 @@
;; SPDX-FileCopyrightText: 2023 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages tree-sitter)
#:use-module (guix gexp)
#:use-module (guix packages))
(define tree-sitter-grammar
(@@ (gnu packages tree-sitter) tree-sitter-grammar))
(define-public tree-sitter-yaml
(let ((base
(tree-sitter-grammar
"yaml" "YAML"
"1bimf5fq85wn8dwlk665w15n2bj37fma5rsfxrph3i9yb0lvzi3q"
"0.5.0"
#:repository-url "https://github.com/ikatyang/tree-sitter-yaml"
#:get-cleanup-snippet
(lambda (grammar-directories)
#~(begin
(use-modules (guix build utils))
(delete-file-recursively "docs")
(delete-file "binding.gyp")
(delete-file-recursively "bindings")
(for-each
(lambda (lang)
(with-directory-excursion lang
(delete-file "src/grammar.json")
(delete-file "src/node-types.json")
(delete-file "src/parser.c")
(delete-file-recursively "src/tree_sitter")))
'#$grammar-directories))))))
(package
(inherit base)
(arguments
(append '(#:tests? #f) ;FIXME
(package-arguments base))))))
+23
View File
@@ -0,0 +1,23 @@
;; SPDX-FileCopyrightText: 2022 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages video)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (gnu packages video))
(define-public libva-nox
(let ((base libva))
(package
(inherit base)
(name "libva-nox")
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:configure-flags configure-flags)
#~(append #$configure-flags (list "--disable-glx")))
((#:phases _) #~%standard-phases)))
(inputs
(modify-inputs (package-inputs base)
(delete "libx11" "libxext" "libxfixes"))))))
+175
View File
@@ -0,0 +1,175 @@
;; SPDX-FileCopyrightText: 2022, 2025 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages web)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (rosenthal utils download)
#:use-module (guix build-system go)
#:use-module (gnu packages golang)
#:use-module (gnu packages image)
#:use-module (gnu packages web))
(define-public buku-run-dev
(let ((revision "23")
(commit "54fcdd77fc1e8e657b785b7d4ca8dc915e5f336b"))
(package
(inherit buku-run)
(name "buku-run-dev")
(version (git-version "0.1.1" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/carnager/buku_run")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"079ygn39px71bypa54jn4z55iq24lxxcy7jv3ijy08iinqbfvldc")))))))
(define-public hugo
(package
(name "hugo")
(version "0.145.0")
(source
(origin
(method go-vendored-fetch)
(uri (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/gohugoio/hugo")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"19kfij8c1ljfn8xr3mfm5c89fhp62bl0c7rx0i8726jn6dbpl9g5"))))
(sha256
(base32
"10fmva8p4hcbs2kyjggbanrmix1mf1fym549c5zdv80khpppzfnb"))))
(build-system go-build-system)
(arguments
(list
#:go go-1.23
#:install-source? #f
#:import-path "."
#:build-flags
''("-tags" "extended withdeploy"
"-ldflags=-X github.com/gohugoio/hugo/common/hugo.vendorInfo=Nonguix")
#:test-flags ''("-skip=^TestCommands/mod|^TestCommands/server")
#:test-subdirs ''(".")
#:modules
'(((guix build gnu-build-system) #:prefix gnu:)
(guix build go-build-system)
(guix build utils))
#:phases
#~(modify-phases %standard-phases
(replace 'unpack
(lambda args
(apply (assoc-ref gnu:%standard-phases 'unpack) args)
(unsetenv "GO111MODULE")))
(replace 'install-license-files
(assoc-ref gnu:%standard-phases 'install-license-files))
(add-after 'unpack 'fix-paths
(lambda* (#:key inputs #:allow-other-keys)
(setenv "C_INCLUDE_PATH"
(string-append
(getenv "C_INCLUDE_PATH") ":"
(dirname
(dirname
(dirname
(search-input-file inputs "src/dec/alphai_dec.h"))))))
(with-directory-excursion "vendor/github.com/bep/gowebp"
(substitute* (find-files "internal/libwebp")
(("../../libwebp_src/(.*)\"" _ file)
(string-append (search-input-file inputs file) "\""))))
(with-directory-excursion "vendor/github.com/bep/golibsass"
(substitute* (find-files "internal/libsass")
(("../../libsass_src/(.*)\"" _ file)
(string-append (search-input-file inputs file) "\"")))))))))
(inputs
(list (package-source libsass)
(package-source libwebp)))
(home-page "https://gohugo.io/")
(synopsis "Static site generator")
(description
"Hugo is a static site generator written in Go, optimized for speed and
designed for flexibility.")
(license license:asl2.0)))
;; TODO: Package Forgejo without vendored dependencies.
(define-public forgejo
(package
(name "forgejo")
(version "10.0.3")
(source (origin
(method url-fetch)
(uri (string-append
"https://codeberg.org/forgejo/forgejo/releases/download/v"
version "/forgejo-src-" version ".tar.gz"))
(sha256
(base32
"0cqp4x3xrvr7q1pkijqmf6jnx3wahi20xjfrv7ap81ykif83269x"))))
(build-system go-build-system)
(arguments
(list #:go go-1.23
#:install-source? #f
#:tests? #f ;TODO
#:import-path "code.gitea.io/gitea"
#:build-flags
#~(list (string-append
"-ldflags="
" -X main.ReleaseVersion=" #$(package-version this-package)
" -X main.Version=" #$(package-version this-package)
" -X main.ForgejoVersion=" #$(package-version this-package)
" -X code.gitea.io/gitea/modules/setting.AppWorkPath=/var/lib/forgejo"
" -X code.gitea.io/gitea/modules/setting.CustomPath=" #$output "/etc/forgejo"
" -X code.gitea.io/gitea/modules/setting.CustomConf=/etc/forgejo/app.ini"))
#:modules
'(((guix build gnu-build-system) #:prefix gnu:)
(guix build go-build-system)
(guix build union)
(guix build utils))
#:phases
#~(modify-phases %standard-phases
(replace 'unpack
(assoc-ref gnu:%standard-phases 'unpack))
(add-after 'unpack 'support-module
(lambda _
(unsetenv "GO111MODULE")
(substitute* "go.mod"
(("^toolchain.*") ""))))
(replace 'build
(lambda* (#:key build-flags (parallel-build? #t)
#:allow-other-keys)
(let* ((njobs (if parallel-build? (parallel-job-count) 1)))
(setenv "GOMAXPROCS" (number->string njobs)))
(apply invoke "go" "install"
"-v" "-x"
"-ldflags=-s -w"
"-trimpath"
build-flags)))
(replace 'install
(lambda _
(mkdir-p (in-vicinity #$output "/etc/forgejo"))
(copy-file
"custom/conf/app.example.ini"
(in-vicinity #$output "etc/forgejo/app.ini"))
(for-each
(lambda (dir)
(copy-recursively
dir (string-append #$output "/etc/forgejo/" dir)))
'("options" "public" "templates"))
(with-directory-excursion (in-vicinity #$output "bin")
(rename-file "gitea" "forgejo"))))
(replace 'install-license-files
(assoc-ref gnu:%standard-phases 'install-license-files)))))
(synopsis "Lightweight software forge")
(description
"Forgejo is a self-hosted lightweight software forge. Easy to install and
low maintenance, it just does the job.")
(home-page "https://forgejo.org/")
(license license:gpl3+)))
+203
View File
@@ -0,0 +1,203 @@
;; SPDX-FileCopyrightText: 2025 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages wm)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system cargo)
#:use-module (gnu packages admin)
#:use-module (gnu packages freedesktop)
#:use-module (gnu packages gl)
#:use-module (gnu packages glib)
#:use-module (gnu packages gtk)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages wm)
#:use-module (gnu packages xdisorg)
#:use-module (rosenthal packages rust-crates))
(define rust-pipewire
(let ((commit "fd3d8f7861a29c2eeaa4c393402e013578bb36d9")
(revision "0"))
(package
(name "rust-pipewire")
(version (git-version "0.8.0" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://gitlab.freedesktop.org/pipewire/pipewire-rs.git")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "1hzyhz7xg0mz8a5y9j6yil513p1m610q3j9pzf6q55vdh5mcn79v"))))
(build-system cargo-build-system)
(arguments
(list #:skip-build? #t
#:phases
#~(modify-phases %standard-phases
;; Avoid circular dependency.
(add-after 'unpack 'remove-dev-dependencies
(lambda _
(substitute* "libspa/Cargo.toml"
(("^pipewire.*") ""))))
(replace 'package
(lambda _
(begin
;;error: invalid inclusion of reserved file name Cargo.toml.orig in package source
(when (file-exists? "Cargo.toml.orig")
(delete-file "Cargo.toml.orig"))
;; Use unstable feature ‘--registry’.
(setenv "RUSTC_BOOTSTRAP" "1")
(for-each
(lambda (pkg)
(invoke "cargo" "package" "--offline" "--package" pkg
"--registry" "crates-io" "-Z" "package-workspace"
"--no-metadata" "--no-verify")
(for-each
(lambda (crate)
(invoke "tar" "xzf" crate "-C" "guix-vendor"))
(begin
(delete-file-recursively "target/package/tmp-registry")
(find-files "target/package" "\\.crate$")))
((assoc-ref %standard-phases 'patch-cargo-checksums)))
'("libspa-sys" "libspa" "pipewire-sys" "pipewire"))
(unsetenv "RUSTC_BOOTSTRAP")))))))
(inputs rust-pipewire-cargo-inputs)
(home-page "https://pipewire.org/")
(synopsis "Rust bindings for PipeWire")
(description "This package provides Rust bindings for PipeWire.")
(license license:expat))))
(define rust-smithay
(let ((commit "0cd3345c59f7cb139521f267956a1a4e33248393")
(revision "0"))
(package
(name "rust-smithay")
(version (git-version "0.4.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/Smithay/smithay")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"191h87bpzg0l1ihfb4hmx00b86pfb5mwwc6s8i49al0vigc14l37"))))
(build-system cargo-build-system)
(arguments
(list #:skip-build? #t
#:phases
#~(modify-phases %standard-phases
(replace 'package
(lambda _
(begin
;;error: invalid inclusion of reserved file name Cargo.toml.orig in package source
(when (file-exists? "Cargo.toml.orig")
(delete-file "Cargo.toml.orig"))
;; Use unstable feature ‘--registry’.
(setenv "RUSTC_BOOTSTRAP" "1")
(for-each
(lambda (pkg)
(invoke "cargo" "package" "--offline" "--package" pkg
"--registry" "crates-io" "-Z" "package-workspace"
"--no-metadata" "--no-verify")
(for-each
(lambda (crate)
(invoke "tar" "xzf" crate "-C" "guix-vendor"))
(begin
(delete-file-recursively "target/package/tmp-registry")
(find-files "target/package" "\\.crate$")))
((assoc-ref %standard-phases 'patch-cargo-checksums)))
'("smithay" "smithay-drm-extras"))
(unsetenv "RUSTC_BOOTSTRAP")))))))
(inputs rust-smithay-cargo-inputs)
(home-page "https://github.com/Smithay/smithay")
(synopsis "Smithy for Rust Wayland compositors")
(description
"Smithay aims to provide building blocks to create wayland compositors in
Rust. While not being a full-blown compositor, it'll provide objects and
interfaces implementing common functionalities that pretty much any compositor
will need, in a generic fashion.
It supports the @code{wayland}, @code{wayland-protocols}, and some external
extensions, such as @code{wlr-protocols} and @code{plasma-wayland-protocols}.")
(license license:expat))))
(define-public niri
(package
(name "niri")
(version "25.02")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/YaLTeR/niri")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"0vzskaalcz6pcml687n54adjddzgf5r07gggc4fhfsa08h1wfd4r"))))
(build-system cargo-build-system)
(arguments
(list #:install-source? #f
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'use-guix-vendored-dependencies
(lambda _
(substitute* "Cargo.toml"
(("# version = \"0.4.1\"")
"version = \"0.4.0\"")
(("# version = \"0.1.0\"")
"version = \"0.1.0\"")
(("git.*optional")
"version = \"0.8.0\", optional")
(("^git = .*")
""))))
(add-after 'configure 'set-rust-flags
(lambda _
(setenv "RUSTFLAGS" (string-join
'("-C" "link-arg=-lEGL"
"-C" "link-arg=-lwayland-client")
" "))))
(add-before 'check 'prepare-test-environment
(lambda _
(setenv "XDG_RUNTIME_DIR" "/tmp")))
(add-after 'install 'install-extras
(lambda _
(substitute* "resources/niri.desktop"
(("niri-session")
(string-append #$output "/bin/niri --session")))
(install-file
"resources/niri.desktop"
(in-vicinity #$output "share/wayland-sessions"))
(install-file
"resources/niri-portals.conf"
(in-vicinity #$output "share/xdg-desktop-portal")))))))
(native-inputs
(list pkg-config))
(inputs
(cons* clang
libdisplay-info
libinput-minimal
libseat
libxkbcommon
mesa
pango
pipewire
rust-pipewire
rust-smithay
wayland
niri-cargo-inputs))
(home-page "https://github.com/YaLTeR/niri")
(synopsis "Scrollable-tiling Wayland compositor")
(description
"Niri is a scrollable-tiling Wayland compositor which arranges windows in a
scrollable format. It is considered stable for daily use and performs most
functions expected of a Wayland compositor.")
(license license:gpl3)))
+54
View File
@@ -0,0 +1,54 @@
;; SPDX-FileCopyrightText: 2025 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages xorg)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system cargo)
#:use-module (gnu packages llvm)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages xorg)
#:use-module (rosenthal packages rust-crates))
(define-public xwayland-satellite
(package
(name "xwayland-satellite")
(version "0.5.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/Supreeeme/xwayland-satellite")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1r99qfbmc67202pcs4kiw94hiql0aqcsx877bgnlyxy6gzilq47y"))))
(build-system cargo-build-system)
(arguments
(list #:install-source? #f
#:tests? #f ;Requires running display server.
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'fix-paths
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "src/lib.rs"
(("\"Xwayland\"")
(format #f "\"~a\""
(search-input-file inputs "bin/Xwayland")))))))))
(native-inputs (list pkg-config))
(inputs
(cons* clang
xcb-util-cursor
xorg-server-xwayland
xwayland-satellite-cargo-inputs))
(home-page "https://github.com/Supreeeme/xwayland-satellite")
(synopsis "Xwayland outside your Wayland")
(description
"@command{xwayland-satellite} grants rootless Xwayland integration to any
Wayland compositor implementing @code{xdg_wm_base} interface. This is
particularly useful for compositors that (understandably) do not want to go
through implementing support for rootless Xwayland themselves.")
(license license:mpl2.0)))
+148
View File
@@ -0,0 +1,148 @@
;; SPDX-FileCopyrightText: 2022, 2023 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services bittorrent)
#:use-module (ice-9 format)
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (gnu packages admin)
#:use-module (gnu packages bittorrent)
#:use-module (gnu services)
#:use-module (gnu services configuration)
#:use-module (gnu services shepherd)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (gnu system shadow)
#:export (qbittorrent-configuration
qbittorrent-service-type
home-qbittorrent-service-type))
;;
;; qBittorrent
;;
(define-configuration qbittorrent-configuration
(qbittorrent
(file-like qbittorrent-nox)
"The qBittorrent package to use, we need @command{qbittorrent-nox}.")
(webui-port
(integer 8080)
"Change the Web UI port.")
(profile-directory
(string "/var/lib/qbittorrent")
"Directory to store configuration files in.")
(extra-options
(list-of-strings '())
"List of extra options.")
(no-serialization))
(define %qbittorrent-accounts
(list (user-group (name "qbittorrent") (system? #t))
(user-account
(name "qbittorrent")
(group "qbittorrent")
(system? #t)
(comment "qBittorrent user")
(home-directory "/var/empty")
(shell (file-append shadow "/sbin/nologin")))))
;; Set default password to adminadmin
(define %qbittorrent-default-config-file
(plain-file
"qBittorrent.conf"
(format #f "~
[LegalNotice]
Accepted=true
[Preferences]
WebUI\\Password_PBKDF2=\"@ByteArray(ARQ77eY1NUZaQsuDHbIMCA==:0WMRkYTUWVT9wVvdDtHAjU9b3b7uB8NR1Gur2hmQCvCDpm39Q+PsJRJPaCU51dEiz+dTzh8qbPsL8WkFljQYFQ==)\"~%")))
(define qbittorrent-activation
(match-record-lambda <qbittorrent-configuration>
(profile-directory)
#~(begin
(use-modules (srfi srfi-26)
(guix build utils))
(let ((user (getpwnam "qbittorrent"))
(config-file
(string-append
#$profile-directory "/qBittorrent/config/qBittorrent.conf")))
(unless (file-exists? config-file)
(mkdir-p (dirname config-file))
(copy-file #$%qbittorrent-default-config-file config-file)
(map (cut chown <> (passwd:uid user) (passwd:gid user))
(cons #$profile-directory
(find-files #$profile-directory #:directories? #t))))))))
(define qbittorrent-shepherd-service
(match-record-lambda <qbittorrent-configuration>
(qbittorrent webui-port profile-directory extra-options)
(list (shepherd-service
(documentation "Run qbittorrent.")
(provision '(qbittorrent))
(requirement '(networking))
(start #~(make-forkexec-constructor
(list #$(file-append qbittorrent "/bin/qbittorrent-nox")
#$(string-append "--webui-port="
(number->string webui-port))
#$(string-append "--profile=" profile-directory)
#$@extra-options)
#:user "qbittorrent"
#:group "qbittorrent"
#:resource-limits '((nofile 65536 65536))))
(stop #~(make-kill-destructor #:grace-period 1800))
(actions
(list (shepherd-configuration-action
(string-append profile-directory
"/qBittorrent/config/qBittorrent.conf"))))))))
(define qbittorrent-service-type
(service-type
(name 'qbittorrent)
(extensions
(list (service-extension shepherd-root-service-type
qbittorrent-shepherd-service)
(service-extension activation-service-type
qbittorrent-activation)
(service-extension account-service-type
(const %qbittorrent-accounts))))
(default-value (qbittorrent-configuration))
(description "Run qBittorrent daemon.")))
(define home-qbittorrent-activation
#~(let ((config-file
(string-append
(or (getenv "XDG_CONFIG_HOME")
(string-append user-homedir "/.config"))
"/qBittorrent/qBittorrent.conf")))
(unless (file-exists? config-file)
(mkdir-p (dirname config-file))
(copy-file #$%qbittorrent-default-config-file config-file))))
(define home-qbittorrent-shepherd-service
(match-record-lambda <qbittorrent-configuration>
(qbittorrent webui-port extra-options)
(list (shepherd-service
(documentation "Run qbittorrent.")
(provision '(qbittorrent))
(requirement '())
(start
#~(make-forkexec-constructor
(list
#$(file-append qbittorrent "/bin/qbittorrent-nox")
#$(string-append "--webui-port=" (number->string webui-port))
#$@extra-options)))
(stop #~(make-kill-destructor #:grace-period 1800))
(auto-start? #f)))))
(define home-qbittorrent-service-type
(service-type
(name 'qbittorrent)
(extensions
(list (service-extension home-activation-service-type
(const home-qbittorrent-activation))
(service-extension home-shepherd-service-type
home-qbittorrent-shepherd-service)))
(default-value (qbittorrent-configuration))
(description "Run qBittorrent daemon.")))
+546
View File
@@ -0,0 +1,546 @@
;; SPDX-FileCopyrightText: 2022, 2023 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services child-error)
#:use-module (guix records)
#:use-module (guix gexp)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (gnu packages admin)
#:use-module (gnu packages web)
#:use-module (gnu services)
#:use-module (gnu services admin)
#:use-module (gnu services configuration)
#:use-module (gnu services databases)
#:use-module (gnu services shepherd)
#:use-module (gnu system shadow)
#:use-module (rosenthal packages binaries)
#:use-module (rosenthal packages networking)
#:use-module (rosenthal utils home-services-utils)
#:export (clash-configuration
clash-service-type
cloudflare-tunnel-configuration
cloudflare-tunnel-service-type
cloudflare-warp-configuration
cloudflare-warp-service-type
miniflux-configuration
miniflux-service-type
home-wakapi-configuration
home-wakapi-service-type
shadow-tls-configuration
shadow-tls-client-configuration
shadow-tls-server-configuration
shadow-tls-service-type
home-shadow-tls-service-type
home-socks2http-configuration
home-socks2http-service-type))
;;
;; Clash
;;
(define-configuration clash-configuration
(clash
(file-like mihomo-bin)
"The clash package.")
(log-file
(string "/var/log/clash.log")
"Where the logs go.")
(data-directory
(string "/var/lib/clash")
"Where to store data.")
(config
(file-like (plain-file "empty" ""))
"Clash configuration file.")
(shepherd-provision
(list '(clash))
"A list of Shepherd service names (symbols) provided by this service.")
(no-serialization))
(define %clash-accounts
(list (user-group (name "clash") (system? #t))))
(define clash-activation
(match-record-lambda <clash-configuration>
(data-directory config)
#~(begin
(use-modules (guix build utils))
(let ((config-dest (string-append #$data-directory "/config.yaml")))
(mkdir-p #$data-directory)
(if (file-exists? config-dest)
(delete-file config-dest))
(symlink #$config config-dest)))))
(define clash-shepherd-service
(match-record-lambda <clash-configuration>
(clash log-file data-directory shepherd-provision)
(list (shepherd-service
(documentation "Run clash.")
(provision shepherd-provision)
(requirement '(loopback networking))
(start #~(make-forkexec-constructor
(list (let ((mihomo-cmd
#$(file-append clash "/bin/mihomo"))
(clash-cmd
#$(file-append clash "/bin/clash")))
(if (file-exists? mihomo-cmd)
mihomo-cmd
clash-cmd))
"-d" #$data-directory)
#:group "clash"
#:log-file #$log-file))
(stop #~(make-kill-destructor))
(actions
(list (shepherd-configuration-action
(string-append data-directory "/config.yaml"))))))))
(define clash-service-type
(service-type
(name 'clash)
(extensions
(list (service-extension shepherd-root-service-type
clash-shepherd-service)
(service-extension activation-service-type
clash-activation)
(service-extension account-service-type
(const %clash-accounts))
(service-extension log-rotation-service-type
(compose list clash-configuration-log-file))))
(default-value (clash-configuration))
(description "Run Clash.")))
;;
;; Cloudflare Tunnel
;;
(define-configuration cloudflare-tunnel-configuration
(cloudflared
(file-like cloudflared)
"The cloudflared executable.")
;; Tunnel options
(log-level
(string "info")
"Application logging level (@code{debug}, @code{info}, @code{warn},
@code{error}, @code{fatal}). At debug level cloudflared will log request URL,
method, protocol, content length, as well as, all request and response
headers. This can expose sensitive information in your logs.")
(log-file
(string "/var/log/cloudflared.log")
"File path to store logs.")
(extra-tunnel-options
(list-of-strings '())
"List of extra tunnel options.")
;; Subcommand options
(token
(string "")
"The Tunnel token.")
(extra-options
(list-of-strings '())
"List of extra options.")
(no-serialization))
(define cloudflare-tunnel-shepherd-service
(match-record-lambda <cloudflare-tunnel-configuration>
(cloudflared log-level log-file extra-tunnel-options
token extra-options)
(list (shepherd-service
(documentation "Run cloudflared.")
(provision '(cloudflare-tunnel))
(requirement '(loopback networking))
(start #~(make-forkexec-constructor
(list #$(file-append cloudflared "/bin/cloudflared")
"tunnel"
"--no-autoupdate"
"--loglevel" #$log-level
#$@extra-tunnel-options
"run"
#$@extra-options)
#:user "nobody"
#:group "nogroup"
#:log-file #$log-file
#:environment-variables
(list (format #f "TUNNEL_TOKEN=~a" #$token))))
(stop #~(make-kill-destructor))))))
(define cloudflare-tunnel-service-type
(service-type
(name 'cloudflare-tunnel)
(extensions
(list (service-extension shepherd-root-service-type
cloudflare-tunnel-shepherd-service)
(service-extension log-rotation-service-type
(compose list cloudflare-tunnel-configuration-log-file))))
(default-value (cloudflare-tunnel-configuration))
(description "Run cloudflared, the Cloudflare Tunnel daemon.")))
;;
;; Cloudflare Warp
;;
(define-configuration cloudflare-warp-configuration
(cloudflare-warp
(file-like cloudflare-warp-bin)
"The Cloudflare Warp package.")
(no-serialization))
(define cloudflare-warp-shepherd-service
(match-record-lambda <cloudflare-warp-configuration>
(cloudflare-warp)
(list (shepherd-service
(documentation "Run warp-svc.")
(provision '(cloudflare-warp))
(start #~(make-forkexec-constructor
(list #$(file-append cloudflare-warp "/bin/warp-svc"))
;; Logs are written to
;; /var/lib/cloudflare-warp/cfwarp_service_log.txt.
#:log-file "/dev/null"))
(stop #~(make-kill-destructor))))))
(define cloudflare-warp-service-type
(service-type
(name 'cloudflare-warp)
(extensions
(list (service-extension shepherd-root-service-type
cloudflare-warp-shepherd-service)
(service-extension
profile-service-type
(compose list cloudflare-warp-configuration-cloudflare-warp))))
(default-value (cloudflare-warp-configuration))
(description "Run warp-svc, the Cloudflare Warp daemon.")))
;;
;; Miniflux
;;
(define-maybe string)
(define-configuration miniflux-configuration
(miniflux
(file-like miniflux)
"The miniflux package.")
(log-file
(string "/var/log/miniflux.log")
"Where the logs go.")
(proxy-url
maybe-string
"Proxy URL to use.")
(options
(alist '())
"Association list of miniflux configuration options.")
(no-serialization))
(define %miniflux-accounts
(list (user-account
(name "miniflux")
(group "nogroup")
(system? #t)
(home-directory "/var/empty")
(shell (file-append shadow "/sbin/nologin")))))
(define %miniflux-postgresql-role
(list (postgresql-role
(name "miniflux")
(create-database? #t))))
(define miniflux-shepherd-service
(match-record-lambda <miniflux-configuration>
(miniflux log-file proxy-url options)
(let ((config-file (mixed-text-file
"miniflux.conf"
(apply string-append
(map (lambda (option)
(format #f "~a=~a~%"
(car option) (cdr option)))
options)))))
(list (shepherd-service
(documentation "Run miniflux.")
(provision '(miniflux))
(requirement '(postgres user-processes))
(start #~(make-forkexec-constructor
(list #$(file-append miniflux "/bin/miniflux")
"-config-file" #$config-file)
#:user "miniflux"
#:group "nogroup"
#:log-file #$log-file
#:environment-variables
'#$(if (maybe-value-set? proxy-url)
(list (string-append "HTTP_PROXY=" proxy-url)
(string-append "HTTPS_PROXY=" proxy-url))
'())))
(stop #~(make-kill-destructor)))))))
(define miniflux-service-type
(service-type
(name 'miniflux)
(extensions
(list (service-extension account-service-type
(const %miniflux-accounts))
(service-extension postgresql-role-service-type
(const %miniflux-postgresql-role))
(service-extension shepherd-root-service-type
miniflux-shepherd-service)))
(default-value (miniflux-configuration))
(description "Run Miniflux, a minimalist and opinionated feed reader.")))
;;
;; Wakapi
;;
(define-configuration home-wakapi-configuration
(wakapi
(file-like wakapi-bin)
"The wakapi package.")
(config
(yaml-config '())
"Association list of Wakapi configurations.")
(no-serialization))
(define home-wakapi-shepherd-service
(match-record-lambda <home-wakapi-configuration>
(wakapi config)
(let ((config-file (mixed-text-file
"wakapi.yaml"
#~(string-append #$@(serialize-yaml-config config) "\n"))))
(list (shepherd-service
(documentation "Run wakapi.")
(provision '(wakapi))
(start #~(make-forkexec-constructor
(list #$(file-append wakapi "/bin/wakapi")
"-config" #$config-file)))
(stop #~(make-kill-destructor))
(actions (list (shepherd-configuration-action config-file))))))))
(define home-wakapi-service-type
(service-type
(name 'home-wakapi)
(extensions
(list (service-extension home-shepherd-service-type
home-wakapi-shepherd-service)))
(default-value (home-wakapi-configuration))
(description "Run Wakapi, a self-hosted WakaTime-compatible backend.")))
;;
;; ShadowTLS
;;
(define-maybe list-of-strings
(no-serialization))
(define-configuration shadow-tls-client-configuration
(listen-address
(string "")
"Listen address with port. Usually this port is used by Shadowsocks
client.")
(server-address
(string "")
"ShadowTLS server address with port.")
(sni-list
(list-of-strings '(""))
"SNI list.")
(password
(string "")
"Must be the same as the ShadowTLS server.")
(alpn
maybe-list-of-strings
"ALPN ext. Do not use unless you know what you are doing.")
(no-serialization))
(define-configuration shadow-tls-server-configuration
(listen-address
(string "")
"Listen address with port.")
(server-address
(string "")
"Data server address with port. Usually this port is listened by Shadowsocks
server.")
(tls-name-list
(list-of-strings '(""))
"TLS names. There must be a fallback server name at the last, and there can
be multiple mappings. Mappings can be represented as
@code{ServerName:Host:Port}. Host can be omitted, in this case
@code{ServerName} is used as @code{Host}. @code{Port} can be omitted too, which
is @code{443} by default")
(password
(string "")
"Must be the same as the ShadowTLS client.")
(no-serialization))
(define-record-type* <shadow-tls-configuration> shadow-tls-configuration
make-shadow-tls-configuration
shadow-tls-configuration?
this-shadow-tls-configuration
(shadow-tls shadow-tls-configuration-shadow-tls ;file-like
(default shadow-tls-bin))
(threads shadow-tls-configuration-threads ;integer | #f
(default #f))
(no-delay? shadow-tls-configuration-disable-no-delay? ;boolean
(default #t))
(v3-protocol? shadow-tls-configuration-v3-protocol? ;boolean
(default #f))
(log-level shadow-tls-configuration-log-level ;string
(default "info"))
(client shadow-tls-configuration-client ;<shadow-tls-client-configuration> | #f
(default #f))
(server shadow-tls-configuration-server ;<shadow-tls-server-configuration> | #f
(default #f))
(home-service? shadow-tls-configuration-home-service?
(default for-home?) (innate)))
(define shadow-tls-shepherd-service
(match-record-lambda <shadow-tls-configuration>
(shadow-tls threads no-delay? v3-protocol? log-level client server
home-service?)
(let ((common-options
(append (if threads
`("--threads" ,(number->string threads))
'())
(if no-delay?
'()
'("--disable-nodelay"))
(if v3-protocol?
'("--v3")
'()))))
(append
(if client
(match-record client
<shadow-tls-client-configuration>
(listen-address server-address sni-list password alpn)
(let ((log-file
(if home-service?
#~(string-append %user-log-dir "/shadow-tls-client.log")
"/var/log/shadow-tls-client.log")))
(list (shepherd-service
(documentation "Run shadow-tls client.")
(provision '(shadow-tls-client))
(requirement (if home-service? '() '(networking)))
(modules '((shepherd support)))
(start #~(make-forkexec-constructor
(list #$(file-append
shadow-tls "/bin/shadow-tls")
#$@common-options
"client"
"--listen" #$listen-address
"--server" #$server-address
"--sni" #$(string-join sni-list ";")
"--password" #$password
#$@(if (maybe-value-set? alpn)
`("--alpn" ,(string-join alpn ";"))
'()))
#:user #$(and (not home-service?) "nobody")
#:group #$(and (not home-service?) "nogroup")
#:log-file #$log-file
#:environment-variables
(list (string-append "RUST_LOG=" #$log-level))))
(stop #~(make-kill-destructor))))))
'())
(if server
(match-record server
<shadow-tls-server-configuration>
(listen-address server-address tls-name-list password)
(let ((log-file
(if home-service?
#~(string-append %user-log-dir "/shadow-tls-server.log")
"/var/log/shadow-tls-server.log")))
(list (shepherd-service
(documentation "Run shadow-tls server.")
(provision '(shadow-tls-server))
(requirement (if home-service? '() '(networking)))
(modules '((shepherd support)))
(start #~(make-forkexec-constructor
(list #$(file-append
shadow-tls "/bin/shadow-tls")
#$@common-options
"server"
"--listen" #$listen-address
"--server" #$server-address
"--tls" #$(string-join tls-name-list ";")
"--password" #$password)
#:user #$(and (not home-service?) "nobody")
#:group #$(and (not home-service?) "nogroup")
#:log-file #$log-file))
(stop #~(make-kill-destructor))))))
'())))))
(define shadow-tls-service-type
(service-type
(name 'shadow-tls)
(extensions
(list (service-extension shepherd-root-service-type
shadow-tls-shepherd-service)))
(default-value (shadow-tls-server-configuration))
(description "Run shadow-tls.")))
(define home-shadow-tls-service-type
(service-type
(inherit (system->home-service-type shadow-tls-service-type))
(default-value (for-home (shadow-tls-configuration)))))
;;
;; Socks2http
;;
(define-configuration home-socks2http-configuration
(socks2http
(file-like socks2http)
"Socks2http package to use.")
(socks-address
(string ":1080")
"SOCKS5 proxy address to connect to.")
(http-address
(string ":8000")
"HTTP proxy address to serve.")
(no-serialization))
(define home-socks2http-shepherd-service
(match-record-lambda <home-socks2http-configuration>
(socks2http socks-address http-address)
(list (shepherd-service
(documentation "Run socks2http.")
(provision '(socks2http))
(start #~(make-forkexec-constructor
(list #$(file-append socks2http "/bin/socks2http")
"-raddr" #$socks-address
"-laddr" #$http-address)))
(stop #~(make-kill-destructor))))))
(define home-socks2http-service-type
(service-type
(name 'home-socks2http)
(extensions
(list (service-extension home-shepherd-service-type
home-socks2http-shepherd-service)))
(default-value (home-socks2http-configuration))
(description "Run socks2http.")))
(define-service-type-mapping
shadow-tls-service-type => home-shadow-tls-service-type)
+48
View File
@@ -0,0 +1,48 @@
;; SPDX-FileCopyrightText: 2022, 2023 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services dns)
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (gnu services)
#:use-module (gnu services configuration)
#:use-module (gnu packages dns)
#:use-module (gnu services shepherd)
#:export (smartdns-configuration
smartdns-service-type))
;;
;; Smartdns
;;
(define-configuration smartdns-configuration
(smartdns
(file-like smartdns)
"The Smartdns package.")
(config-file
(file-like (plain-file "empty" ""))
"Configuration file for Smartdns.")
(no-serialization))
(define smartdns-shepherd-service
(match-record-lambda <smartdns-configuration>
(smartdns config-file)
(list (shepherd-service
(documentation "Run smartdns.")
(provision '(smartdns dns))
(requirement '(loopback networking))
(start #~(make-forkexec-constructor
(list #$(file-append smartdns "/sbin/smartdns")
"-f" "-c" #$(file-append config-file))))
(stop #~(make-kill-destructor))))))
(define smartdns-service-type
(service-type
(name 'smartdns)
(extensions
(list (service-extension shepherd-root-service-type
smartdns-shepherd-service)))
(default-value (smartdns-configuration))
(description "Run Smartdns daemon.")))
@@ -0,0 +1,91 @@
;; SPDX-FileCopyrightText: 2024 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services file-systems)
#:use-module (guix gexp)
#:use-module (gnu packages backup)
#:use-module (rosenthal packages admin)
#:use-module (gnu services)
#:use-module (gnu services configuration)
#:use-module (gnu services mcron)
#:use-module (gnu system pam)
#:export (btrbk-service-type
btrbk-configuration
dumb-runtime-dir-service-type))
;;
;; Btrbk
;;
(define-configuration btrbk-configuration
(btrbk
(file-like btrbk)
"@code{btrbk} package to use.")
(config-file
(file-like (plain-file "empty" ""))
"File-like object for btrbk configuration, see also @code{btrbk.conf(5)}.")
(no-serialization))
(define (btrbk-etc-service config)
`(("btrbk/btrbk.conf" ,(btrbk-configuration-config-file config))))
(define (btrbk-mcron-jobs config)
(list #~(job next-hour-from
#$(file-append (btrbk-configuration-btrbk config)
"/bin/btrbk run --quiet"))))
(define btrbk-service-type
(service-type
(name 'btrbk)
(extensions
(list (service-extension etc-service-type
btrbk-etc-service)
(service-extension mcron-service-type
btrbk-mcron-jobs)))
(default-value (btrbk-configuration))
(description "Configure and run btrbk hourly.")))
;;;
;;; pam-dumb-runtime-dir
;;;
(define dumb-runtime-dir-activation
#~(begin
(use-modules (guix build utils))
(mkdir-p "/run/user")
(chmod "/run/user" #o0755)))
(define dumb-runtime-dir-pam-service
(let ((optional-pam-entry
(pam-entry
(control "optional")
(module
(file-append
pam-dumb-runtime-dir "/lib/security/pam_dumb_runtime_dir.so")))))
(list (pam-extension
(transformer
(lambda (pam)
(if (string=? (pam-service-name pam) "login")
(pam-service
(inherit pam)
(session
(cons optional-pam-entry
(pam-service-session pam))))
pam)))))))
(define dumb-runtime-dir-service-type
(service-type
(name 'dumb-runtime-dir)
(extensions
(list (service-extension activation-service-type
(const dumb-runtime-dir-activation))
(service-extension pam-root-service-type
(const dumb-runtime-dir-pam-service))))
(default-value #f) ;No default value required.
(description "Create @code{XDG_RUNTIME_DIR} on login and never remove it.")))
+28
View File
@@ -0,0 +1,28 @@
;;; SPDX-FileCopyrightText: 2021 Andrew Tropin <andrew@trop.in>
;;;
;;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services keyboard)
#:use-module (gnu system keyboard)
#:use-module (gnu home services)
#:export (home-keyboard-service-type))
(define (set-xkb-variables layout)
(if layout
`(("XKB_DEFAULT_LAYOUT" . ,(keyboard-layout-name layout))
("XKB_DEFAULT_VARIANT" . ,(keyboard-layout-variant layout))
("XKB_DEFAULT_OPTIONS" . ,(string-join
(keyboard-layout-options layout) ","))
("XKB_DEFAULT_MODEL" . ,(keyboard-layout-model layout)))
'()))
(define home-keyboard-service-type
(service-type (name 'home-keyboard)
(extensions
(list (service-extension
home-environment-variables-service-type
set-xkb-variables)))
(default-value #f)
(description "Set layouts by configuring XKB_*
environment variables. Service accepts an instance of
@code{keyboard-layout} from @code{(gnu system keyboard)}.")))
+68
View File
@@ -0,0 +1,68 @@
;; SPDX-FileCopyrightText: 2024 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services mail)
#:use-module (srfi srfi-26)
#:use-module (guix records)
#:use-module (gnu services)
#:use-module (gnu services admin)
#:use-module (gnu services configuration)
#:use-module (gnu services docker)
#:export (docker-mailserver-configuration
docker-mailserver-service-type))
;;;
;;; Docker Mailserver
;;; https://docker-mailserver.github.io/docker-mailserver/latest/
;;;
(define-configuration docker-mailserver-configuration
(data-directory
(string "/var/lib/docker-mailserver")
"Directory to store Docker Mailserver data.")
(log-file
(string "/var/log/docker-mailserver.log")
"Path to log file.")
(shepherd-requirement
(list-of-symbols '())
"List of Shepherd service dependencies.")
(options
(alist '())
"Alist of Docker Mailserver configuration. See also
@url{https://docker-mailserver.github.io/docker-mailserver/latest/config/environment/}.")
(extra-arguments
(list '())
"List of extra Docker arguments.")
(no-serialization))
(define docker-mailserver-oci-containers
(match-record-lambda <docker-mailserver-configuration>
(data-directory log-file shepherd-requirement options extra-arguments)
(let ((docker-mailserver-path
(cut string-append data-directory <>)))
(list (oci-container-configuration
(environment options)
(image "ghcr.io/docker-mailserver/docker-mailserver:latest")
(provision "docker-mailserver")
(requirement shepherd-requirement)
(log-file log-file)
(network "host")
(volumes
`((,(docker-mailserver-path "/data") . "/var/mail")
(,(docker-mailserver-path "/state") . "/var/mail-state")
(,(docker-mailserver-path "/logs") . "/var/log/mail")
(,(docker-mailserver-path "/config") . "/tmp/docker-mailserver")
("/etc/localtime" . "/etc/localtime:ro")))
(extra-arguments extra-arguments))))))
(define docker-mailserver-service-type
(service-type
(name 'docker-mailserver)
(extensions
(list (service-extension oci-container-service-type
docker-mailserver-oci-containers)
(service-extension log-rotation-service-type
(compose list docker-mailserver-configuration-log-file))))
(default-value (docker-mailserver-configuration))
(description "Run Docker Mailserver.")))
+445
View File
@@ -0,0 +1,445 @@
;; SPDX-FileCopyrightText: 2023 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services networking)
#:use-module (srfi srfi-1)
#:use-module (ice-9 match)
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (gnu packages linux)
#:use-module (gnu packages networking)
#:use-module (rosenthal packages networking)
#:use-module (gnu services)
#:use-module (gnu services admin)
#:use-module (gnu services configuration)
#:use-module (gnu services dbus)
#:use-module (gnu services shepherd)
#:export (iwd-configuration
iwd-service-type
tailscale-configuration
tailscale-service-type))
;;
;; iwd
;;
(define %iwd-config-general
'(enable-network-configuration?
use-default-interface?
address-randomization
address-randomization-range
roam-threshold
roam-threshold-5g
roam-retry-interval
management-frame-protection
control-port-over-nl80211?
disable-anqp?
disable-ocv?
country))
(define %iwd-config-network
'(enable-ipv6?
name-resolving-service
route-priority-offset))
(define %iwd-config-blacklist
'(initial-timeout
multiplier
maximum-timeout))
(define %iwd-config-rank
'(band-modifier-5ghz
band-modifier-6ghz))
(define %iwd-config-scan
'(disable-periodic-scan?
initial-periodic-scan-interval
maximum-periodic-scan-interval
disable-roaming-scan?))
(define %iwd-config-ipv4
'(ap-address-pool))
(define %iwd-config-driver-quirks
'(default-interface
force-pae
power-save-disable))
(define (uglify-field-name field-name)
(case field-name
((control-port-over-nl80211?) "ControlPortOverNL80211")
((disable-anqp?) "DisableANQP")
((disable-ocv?) "DisableOCV")
((enable-ipv6?) "EnableIPv6")
((ap-address-pool) "APAddressPool")
(else (string-delete char-set:punctuation
(string-capitalize (symbol->string field-name))))))
(define (serialize-field field-name val)
(format #f "~a = ~a~%" (uglify-field-name field-name) val))
(define serialize-string serialize-field)
(define-maybe string)
(define (serialize-boolean field-name val)
(serialize-field field-name (if val "true" "false")))
(define cidr4? (@@ (gnu services vpn) cidr4?))
(define serialize-cidr4 serialize-field)
(define-maybe cidr4)
(define (randomization-method? val)
(memv val '(#f once network)))
(define (serialize-randomization-method field-name val)
(serialize-field field-name (or val 'disabled)))
(define (randomization-range? val)
(memv val '(full nic)))
(define serialize-randomization-range serialize-field)
(define (signal-strength? val)
(and (number? val)
(>= val -100)
(<= val 1)))
(define serialize-signal-strength serialize-field)
(define (seconds? val)
(and (integer? val)
(not (negative? val))))
(define serialize-seconds serialize-field)
(define (protection-mode? val)
(memv val '(0 1 2)))
(define serialize-protection-mode serialize-field)
(define (resolution-method? val)
(memv val '(#f resolvconf)))
(define (serialize-resolution-method field-name val)
(serialize-field field-name (or val 'none)))
(define serialize-integer serialize-field)
(define serialize-number serialize-field)
(define (serialize-list-of-strings field-name val)
(serialize-field field-name (string-join val ",")))
(define-maybe list-of-strings)
(define list-of-cidr4? (list-of cidr4?))
(define serialize-list-of-cidr4 serialize-list-of-strings)
(define-configuration iwd-configuration
(iwd
(file-like iwd)
"The iwd package to use.")
(log-file
(string "/var/log/iwd.log")
"Log file location.")
;; General
(enable-network-configuration?
(boolean #f)
"Enable network configuration.")
(use-default-interface?
(boolean #f)
"Do not allow iwd to destroy / recreate wireless interfaces at startup,
including default interfaces.")
(address-randomization
(randomization-method #f)
"Available values are @code{#f}, @code{once} and @code{network}. @code{#f}
for default kernel behavior, @code{once} to randomize the MAC address when iwd
starts or the hardware is detected for the first time, @code{network} to
randomize the MAC address on each connection to a network (the MAC address is
generated based on the SSID and permanent address of the adapter).")
(address-randomization-range
(randomization-range 'full)
"Available values are @code{nic} and @code{full}. @code{nic} to only
randomize the NIC specific octets (last 3 ones), @code{full} to randomize all
6 octets of the address.")
(roam-threshold
(signal-strength -70)
"Value in dBm, control how aggressively iwd roams when connected to a 2.4Ghz
access point.")
(roam-threshold-5g
(signal-strength -76)
"Value in dBm, control how aggressively iwd roams when connected to a 5Ghz
access point.")
(roam-retry-interval
(seconds 60)
"How long to wait before attempting to roam again if the last roam attempt
failed, or if the signal of the newly connected BSS is still considered weak.")
(management-frame-protection
(protection-mode 1)
"Available values are @code{0}, @code{1} and @code{2}. @code{0} to
completely turn off MFP (even if the hardware is capable), @code{1} to enable
MFP if the local hardware and remote AP both support it, @code{2} to always
require MFP.")
(control-port-over-nl80211?
(boolean #t)
"Enable sending EAPoL packets over NL80211.")
(disable-anqp?
(boolean #t)
"Disable ANQP queries.")
(disable-ocv?
(boolean #f)
"Disable Operating Channel Validation.")
(country
maybe-string
"ISO Alpha-2 Country Code. Request the country to be set for the system.")
;; Network
(enable-ipv6?
(boolean #t)
"Configure IPv6 addresses and routes.")
(name-resolving-service
(resolution-method 'resolvconf)
"Available values are @code{resolvconf} and @code{#f}. Configure a DNS
resolution method used by the system and must be used in conjunction with
@code{enable-network-configuration?}. @code{#f} to ignore DNS and domain name
information.")
(route-priority-offset
(integer 300)
"Configure a route priority offset used by the system to prioritize the
default routes. The route with lower priority offset is preferred.")
;; Blacklist
(initial-timeout
(seconds 60)
"The initial time that a BSS spends on the blacklist.")
(multiplier
(integer 30)
"If the BSS was blacklisted previously and another connection attempt has
failed after the initial timeout has expired, then the BSS blacklist time will
be extended by a multiple of @code{multiplier} for each unsuccessful attempt up
to @code{maximum-timeout} time.")
(maximum-timeout
(seconds 86400)
"Maximum time that a BSS is blacklisted.")
;; Rank
(band-modifier-5ghz
(number 1.0)
"Increase or decrease the preference for 5GHz access points by increasing or
decreasing the value of this modifier.")
(band-modifier-6ghz
(number 1.0)
"Increase or decrease the preference for 6GHz access points by increasing or
decreasing the value of this modifier.")
;; Scan
(disable-periodic-scan?
(boolean #f)
"Disable periodic scan.")
(initial-periodic-scan-interval
(seconds 10)
"The initial periodic scan interval upon disconnect.")
(maximum-periodic-scan-interval
(seconds 300)
"The maximum periodic scan interval.")
(disable-roaming-scan?
(boolean #f)
"Disable roaming scan.")
;; IPv4
(ap-address-pool
(list-of-cidr4 '("192.168.0.0/16"))
"Define the space of IPs used for the AP mode subnet addresses and the DHCP
server.")
;; DriverQuirks
(default-interface
maybe-list-of-strings
"List of drivers or glob matches. If a driver in use matches one in this
list, IWD will not attempt to remove and re-create the default interface.")
(force-pae
maybe-list-of-strings
"List of drivers or glob matches. If a driver in use matches one in this
list, @code{control-port-over-nl80211?} will not be used, and PAE will be used
instead.")
(power-save-disable
maybe-list-of-strings
"List of drivers or glob matches. If a driver in use matches one in this
list, power save will be disabled."))
(define (serialize-iwd-configuration config)
(apply mixed-text-file "main.conf"
(append-map
(match-lambda
((section . fields)
(list "[" section "]\n"
(serialize-configuration
config
(filter-configuration-fields
iwd-configuration-fields
fields)))))
`(("General" . ,%iwd-config-general)
("Network" . ,%iwd-config-network)
("Blacklist" . ,%iwd-config-blacklist)
("Rank" . ,%iwd-config-rank)
("Scan" . ,%iwd-config-scan)
("IPv4" . ,%iwd-config-ipv4)
("DriverQuirks" . ,%iwd-config-driver-quirks)))))
(define (add-iwd-config-file config)
`(("iwd/main.conf"
,(serialize-iwd-configuration config))))
(define add-iwd-package
(compose list iwd-configuration-iwd))
(define (iwd-shepherd-service config)
(match-record config <iwd-configuration>
(iwd log-file
enable-network-configuration? name-resolving-service)
(let ((conf (serialize-iwd-configuration config)))
(list (shepherd-service
(documentation "Run iwd")
(provision `(,@(if enable-network-configuration?
'(networking)
'())
iwd))
(requirement '(user-processes dbus-system))
(start #~(make-forkexec-constructor
(list (string-append #$iwd "/libexec/iwd"))
#:log-file #$log-file))
(stop #~(make-kill-destructor))
(actions
(list (shepherd-configuration-action "/etc/iwd/main.conf"))))))))
(define iwd-service-type
(service-type
(name 'iwd)
(extensions
(list (service-extension shepherd-root-service-type
iwd-shepherd-service)
(service-extension dbus-root-service-type
add-iwd-package)
(service-extension etc-service-type
add-iwd-config-file)
(service-extension profile-service-type
add-iwd-package)
(service-extension log-rotation-service-type
(compose list iwd-configuration-log-file))))
(default-value (iwd-configuration))
(description "Run iwd, the iNet wireless daemon.")))
;;
;; Tailscale
;;
(define-configuration tailscale-configuration
(tailscale
(file-like tailscale)
"The tailscale package to use.")
(iptables
(file-like iptables-nft)
"The iptables package to use.")
(log-file
(string "/var/log/tailscaled.log")
"Path to log file.")
(socket
(string "/var/run/tailscale/tailscaled.sock")
"Path of the service UNIX socket.")
(state-directory
(string "/var/lib/tailscale")
"Path to directory for storage of config state, TLS certs, temporary incoming
Taildrop files, etc. If empty, it's derived from @code{state-file} when
possible.")
(upload-log?
(boolean #f)
"Whether to upload logs or not, technical support is also disabled when set
to #f.")
(verbosity
(integer 0)
"Log verbosity level; 0 is default, 1 or higher are increasingly verbose.")
(extra-options
(list-of-strings '())
"List of extra options.")
(no-serialization))
(define tailscale-shepherd-service
(match-record-lambda <tailscale-configuration>
(tailscale iptables log-file socket state-directory
upload-log? verbosity extra-options)
(let ((environment
#~(list (string-append "PATH="
(string-join
'(#$(file-append iptables "/sbin")
#$(file-append iproute "/sbin"))
":")))))
(list (shepherd-service
(documentation "Run tailscaled")
(provision '(tailscaled))
(requirement '(user-processes))
(start
#~(make-forkexec-constructor
(list
#$(file-append tailscale "/bin/tailscaled")
#$@(if upload-log?
'()
'("-no-logs-no-support"))
"-socket" #$socket
"-statedir" #$state-directory
"-verbose" #$(number->string verbosity)
#$@extra-options)
#:environment-variables #$environment
#:log-file #$log-file))
(stop #~(make-kill-destructor)))))))
(define tailscale-service-type
(service-type
(name 'tailscaled)
(extensions
(list (service-extension shepherd-root-service-type
tailscale-shepherd-service)
(service-extension profile-service-type
(compose list tailscale-configuration-tailscale))
(service-extension log-rotation-service-type
(compose list tailscale-configuration-log-file))))
(default-value (tailscale-configuration))
(description "Run tailscaled.")))
+459
View File
@@ -0,0 +1,459 @@
;; SPDX-FileCopyrightText: 2024 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services web)
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (gnu packages admin)
#:use-module (gnu packages version-control)
#:use-module (rosenthal packages binaries)
#:use-module (rosenthal packages web)
#:use-module (gnu services)
#:use-module (gnu services admin)
#:use-module (gnu services configuration)
#:use-module (gnu services databases)
#:use-module (gnu services docker)
#:use-module (gnu services shepherd)
#:use-module (gnu system shadow)
#:use-module (rosenthal utils home-services-utils)
#:export (forgejo-configuration
forgejo-service-type
jellyfin-configuration
jellyfin-service-type
komga-configuration
komga-service-type
misskey-configuration
misskey-service-type
vaultwarden-configuration
vaultwarden-service-type))
;;
;; Forgejo
;;
(define (file-object? val)
(or (string? val)
(file-like? val)))
(define list-of-file-likes?
(list-of file-like?))
(define-configuration forgejo-configuration
(forgejo
(file-like forgejo)
"Package to provide @file{/bin/forgejo}.")
(git-packages
(list-of-file-likes (list git git-lfs))
"@code{git} and extension packages to install.")
(config-file
(file-object "/var/lib/forgejo/app.ini")
"Filesystem path or file-like object of Forgejo configuration,
@file{app.ini}.")
(no-serialization))
(define %forgejo-accounts
(list (user-group (name "forgejo") (system? #t))
(user-account
(name "forgejo")
(group "forgejo")
(system? #t)
(comment "Forgejo user")
(home-directory "/var/lib/forgejo"))))
(define %forgejo-postgresql-role
(list (postgresql-role
(name "forgejo")
(create-database? #t))))
(define forgejo-activation
#~(begin
(use-modules (guix build utils))
(let ((dir "/var/lib/forgejo")
(user (getpwnam "forgejo")))
(mkdir-p dir)
(chown dir (passwd:uid user) (passwd:gid user))
(chmod dir #o750))))
(define forgejo-shepherd-service
(match-record-lambda <forgejo-configuration>
(forgejo config-file)
(list (shepherd-service
(documentation "Run Forgejo.")
(provision '(forgejo))
(requirement '(loopback postgresql))
(start
#~(make-forkexec-constructor
(list #$(file-append forgejo "/bin/forgejo")
"--config" #$config-file)
#:user "forgejo"
#:group "forgejo"
#:log-file "/var/log/forgejo.log"
#:environment-variables
'("GIT_EXEC_PATH=/run/current-system/profile/libexec/git-core"
"GIT_SSL_CAINFO=/run/current-system/profile/etc/ssl/certs/ca-certificates.crt"
"HOME=/var/lib/forgejo"
"PATH=/run/current-system/profile/bin"
"SSL_CERT_DIR=/run/current-system/profile/etc/ssl/certs"
"SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt")
#:resource-limits '((nofile 524288 524288))))
(stop
#~(make-kill-destructor))
(actions
(list (shepherd-configuration-action config-file)))))))
(define forgejo-service-type
(service-type
(name 'forgejo)
(extensions
(list (service-extension account-service-type
(const %forgejo-accounts))
(service-extension postgresql-role-service-type
(const %forgejo-postgresql-role))
(service-extension profile-service-type
forgejo-configuration-git-packages)
(service-extension activation-service-type
(const forgejo-activation))
(service-extension shepherd-root-service-type
forgejo-shepherd-service)))
(default-value (forgejo-configuration))
(description "Run Forgejo.")))
;;
;; Jellyfin
;;
(define-maybe string)
(define-configuration jellyfin-configuration
(cache-directory
(string "/var/cache/jellyfin")
"Path to cache directory.")
(config-directory
(string "/var/lib/jellyfin")
"Path to configuration directory.")
(proxy-url
maybe-string
"Proxy URL.")
(log-file
(string "/var/log/jellyfin.log")
"Path to log file.")
(auto-start?
(boolean #t)
"Whether to start automatically.")
(extra-options
(list '())
"List of extra options.")
(no-serialization))
(define %jellyfin-accounts
(list (user-account
(name "jellyfin")
(group "docker")
(system? #t)
(home-directory "/var/empty")
(shell (file-append shadow "/sbin/nologin")))))
(define jellyfin-activation
(match-record-lambda <jellyfin-configuration>
(cache-directory config-directory)
#~(let ((user (getpwnam "jellyfin")))
(for-each
(lambda (directory)
(unless (file-exists? directory)
(mkdir-p directory)
(chown directory (passwd:uid user) (passwd:gid user))))
'#$(list cache-directory config-directory)))))
(define jellyfin-oci-containers
(match-record-lambda <jellyfin-configuration>
(cache-directory config-directory
proxy-url log-file auto-start? extra-options)
(list (oci-container-configuration
(user "jellyfin")
(group "docker")
(environment
(if (maybe-value-set? proxy-url)
`(("http_proxy" . ,proxy-url)
("https_proxy" . ,proxy-url))
'()))
(image "jellyfin/jellyfin:latest")
(provision "jellyfin")
(log-file log-file)
(auto-start? auto-start?)
(respawn? #t)
(network "host")
(volumes
`((,cache-directory . "/cache")
(,config-directory . "/config")))
(extra-arguments extra-options)))))
(define jellyfin-service-type
(service-type
(name 'jellyfin)
(extensions
(list (service-extension account-service-type
(const %jellyfin-accounts))
(service-extension activation-service-type
jellyfin-activation)
(service-extension log-rotation-service-type
(compose list jellyfin-configuration-log-file))
(service-extension oci-container-service-type
jellyfin-oci-containers)))
(default-value (jellyfin-configuration))
(description "Run Jellyfin, a media system.")))
;;;
;;; Komga
;;;
(define-configuration komga-configuration
(komga
(file-like komga-bin)
"Package to provide @file{/bin/komga}.")
(port
(integer 25600)
"Port to listen to for the API and web interface.")
(auto-start?
(boolean #t)
"Whether to start automatically.")
(no-serialization))
(define %komga-accounts
(list (user-group (name "komga") (system? #t))
(user-account
(name "komga")
(group "komga")
(system? #t)
(comment "Komga user")
(home-directory "/var/lib/komga"))))
(define komga-shepherd-service
(match-record-lambda <komga-configuration>
(komga port auto-start?)
(list (shepherd-service
(documentation "Run Komga.")
(provision '(komga))
(requirement '(loopback))
(start
#~(make-forkexec-constructor
(list #$(file-append komga "/bin/komga"))
#:user "komga"
#:group "komga"
#:log-file "/var/log/komga.log"
#:environment-variables
'("KOMGA_CONFIGDIR=/var/lib/komga"
#$(string-append "SERVER_PORT=" (number->string port)))))
(stop
#~(make-kill-destructor))
(auto-start? auto-start?)))))
(define komga-service-type
(service-type
(name 'komga)
(extensions
(list (service-extension account-service-type
(const %komga-accounts))
(service-extension shepherd-root-service-type
komga-shepherd-service)))
(default-value (komga-configuration))
(description "Run Komga.")))
;;
;; Misskey
;;
(define-configuration misskey-configuration
(image
(string "misskey/misskey:latest")
"Misskey docker image to use.")
(config
(yaml-config '())
"Alist of Misskey configuration, to be serialized to YAML format.")
(data-directory
(string "/var/lib/misskey")
"Directory to store @file{files} in.")
(log-file
(string "/var/log/misskey.log")
"Log file to use.")
(no-serialization))
(define %misskey-accounts
(list (user-account
(name "misskey")
(group "docker")
(system? #t)
(home-directory "/var/empty")
(shell (file-append shadow "/sbin/nologin")))))
(define %misskey-postgresql-role
(list (postgresql-role
(name "misskey")
(create-database? #t))))
(define misskey-activation
(match-record-lambda <misskey-configuration>
(data-directory)
#~(begin
(use-modules (guix build utils))
(let ((user (getpwnam "misskey")))
(unless (file-exists? #$data-directory)
(mkdir-p #$data-directory)
(chown #$data-directory (passwd:uid user) (passwd:gid user)))))))
(define misskey-oci-containers
(match-record-lambda <misskey-configuration>
(image config data-directory log-file )
(let ((config-file
(mixed-text-file
"misskey.yaml"
#~(string-append #$@(serialize-yaml-config config) "\n"))))
(list (oci-container-configuration
(user "misskey")
(group "docker")
(image image)
(provision "misskey")
(requirement '(postgresql redis))
(log-file log-file)
(respawn? #t)
(network "host")
(volumes
`((,(string-append data-directory "/files") . "/misskey/files")
(,config-file . "/misskey/.config/default.yml"))))))))
(define misskey-service-type
(service-type
(name 'misskey)
(extensions
(list (service-extension account-service-type
(const %misskey-accounts))
(service-extension postgresql-role-service-type
(const %misskey-postgresql-role))
(service-extension log-rotation-service-type
(compose list misskey-configuration-log-file))
(service-extension activation-service-type
misskey-activation)
(service-extension oci-container-service-type
misskey-oci-containers)))
(default-value (misskey-configuration))
(description "Run Misskey, an interplanetary microblogging platform.")))
;;
;; Vaultwarden
;;
(define-configuration vaultwarden-configuration
(admin-token
maybe-string
"Token for the admin interface, preferably an Argon2 PCH string.")
(database-url
(string "postgresql://user:password@host:port/database")
"Database URL.")
(port
(integer 8000)
"Port to listen on.")
(data-directory
(string "/var/lib/vaultwarden")
"Main data folder.")
(log-file
(string "/var/log/vaultwarden.log")
"Logging to this file.")
(proxy-url
maybe-string
"Proxy URL to use.")
(extra-options
(alist '())
"Extra options.")
(no-serialization))
(define %vaultwarden-accounts
(list (user-account
(name "vaultwarden")
(group "docker")
(system? #t)
(home-directory "/var/empty")
(shell (file-append shadow "/sbin/nologin")))))
(define %vaultwarden-postgresql-role
(list (postgresql-role
(name "vaultwarden")
(create-database? #t))))
(define vaultwarden-activation
(match-record-lambda <vaultwarden-configuration>
(data-directory log-file)
#~(begin
(use-modules (guix build utils))
(let ((user (getpwnam "vaultwarden")))
(unless (file-exists? #$data-directory)
(mkdir-p #$data-directory)
(chown #$data-directory (passwd:uid user) (passwd:gid user)))
(unless (file-exists? #$log-file)
(mkdir-p (dirname #$log-file))
(call-with-output-file #$log-file
(lambda (port)
(write-char #\newline port)))
(chown #$log-file (passwd:uid user) (passwd:gid user)))))))
(define vaultwarden-oci-containers
(match-record-lambda <vaultwarden-configuration>
(admin-token database-url port data-directory log-file proxy-url extra-options)
(list (oci-container-configuration
(user "vaultwarden")
(group "docker")
(host-environment
`(,@(if (maybe-value-set? admin-token)
`(("ADMIN_TOKEN" . ,admin-token))
'())
("DATABASE_URL" . ,database-url)))
(environment
`(,@(if (maybe-value-set? proxy-url)
`(("HTTP_PROXY" . ,proxy-url))
'())
("LOG_FILE" . "vaultwarden.log")
("ROCKET_PORT" . ,(number->string port))
("USE_SYSLOG" . "True")
,@extra-options))
(image "vaultwarden/server:latest-alpine")
(provision "vaultwarden")
(requirement '(postgresql))
(respawn? #t)
(network "host")
(volumes
`((,data-directory . "/data")
(,log-file . "/vaultwarden.log")))
(extra-arguments
`(,@(if (maybe-value-set? admin-token)
'("--env" "ADMIN_TOKEN")
'())
"--env" "DATABASE_URL"))))))
(define vaultwarden-service-type
(service-type
(name 'vaultwarden)
(extensions
(list (service-extension account-service-type
(const %vaultwarden-accounts))
(service-extension postgresql-role-service-type
(const %vaultwarden-postgresql-role))
(service-extension activation-service-type
vaultwarden-activation)
(service-extension log-rotation-service-type
(compose list vaultwarden-configuration-log-file))
(service-extension oci-container-service-type
vaultwarden-oci-containers)))
(default-value (vaultwarden-configuration))
(description "Run Vaultwarden, a Bitwarden compatible server.")))
+50
View File
@@ -0,0 +1,50 @@
;; SPDX-FileCopyrightText: 2025 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal utils download)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix build-system gnu)
#:use-module (guix build-system go)
#:export (go-vendored-fetch))
;; NOTE: This approach shouldn't be upstreamed.
(define* (go-vendored-fetch src hash-algo hash
#:optional name
#:key (system (%current-system))
(go
(module-ref
(resolve-interface '(gnu packages golang))
;; Use latest Go in Guix.
'go-1.23))
(nss-certs
(module-ref
(resolve-interface '(gnu packages certs))
'nss-certs)))
(gexp->derivation
(or name
(string-append (origin-file-name src) "-vendored"))
(with-imported-modules %default-gnu-imported-modules
#~(begin
(use-modules (guix build gnu-build-system)
(guix build utils))
(setenv "GOCACHE" "/tmp/go")
(setenv "GOMODCACHE" "/tmp/gomod")
(setenv "SSL_CERT_DIR" #+(file-append nss-certs "/etc/ssl/certs"))
;; Support Unicode in file name.
(setlocale LC_ALL "C.UTF-8")
((assoc-ref %standard-phases 'unpack) #:source #+src)
(invoke #+(file-append go "/bin/go") "mod" "vendor")
(copy-recursively "." #$output)))
#:system system
#:hash-algo hash-algo
#:hash hash
;; Is a directory.
#:recursive? #t
;; Honor the user's proxy and locale settings.
#:leaked-env-vars '("http_proxy" "https_proxy"
"LC_ALL" "LC_MESSAGES" "LANG"
"COLUMNS")
#:local-build? #t))
@@ -0,0 +1,441 @@
;; SPDX-FileCopyrightText: 2021 Xinglu Chen <public@yoctocell.xyz>
;; SPDX-FileCopyrightText: 2021 Andrew Tropin <andrew@trop.in>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal utils home-services-utils)
#:use-module (gnu services configuration)
#:use-module (gnu home services utils)
#:use-module (guix ui)
#:use-module (guix diagnostics)
#:use-module (guix gexp)
#:use-module (guix monads)
#:use-module (guix i18n)
#:use-module (guix profiles)
#:use-module (guix packages)
#:use-module (guix build-system trivial)
#:use-module (guix deprecation)
#:use-module (ice-9 curried-definitions)
#:use-module (ice-9 match)
#:use-module (ice-9 string-fun)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-171)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-43)
#:re-export (filter-configuration-fields
list-of
list-of-strings?
alist?
text-config?
serialize-text-config
generic-serialize-alist-entry
generic-serialize-alist
maybe-object->string
object->snake-case-string
object->camel-case-string)
#:export (slurp-file-gexp
alist-entry->mixed-text
boolean->yes-or-no
boolean->true-or-false
list->human-readable-list
ini-config?
generic-serialize-ini-config
generic-serialize-git-ini-config
yaml-config?
serialize-yaml-config
string-or-gexp?
serialize-string-or-gexp
gexp-text-config?
serialize-gexp-text-config
rest
maybe-list
optional
wrap-package
define-enum
enum-name
enum-value))
;;;
;;; User's utils.
;;;
(define* (slurp-file-gexp file #:key (encoding "UTF-8"))
"Returns a gexp, which reads all the content of the FILE and returns
it as a string. FILE must be a file-like object."
(when (not (file-like? file))
(raise (formatted-message
(G_ "~a is not a file-like object.")
file)))
#~(call-with-input-file #$file
(@ (ice-9 textual-ports) get-string-all)
#:encoding #$encoding))
(define-deprecated/alias slurp-file-gexp slurp-file-like)
;;;
;;; Configuration related helpers.
;;;
(define* ((alist-entry->mixed-text prefix sep #:optional (suffix "\n"))
alist-entry)
"Create a list from ALIST-ENTRY, which can be used with
@code{mixed-text-file} for example to create key-value configuration
file or shell script.
PREFIX is the string to prefix the key-value pair with. For example,
@code{\"export\"} will return @code{'(\"export\" KEY SEP VALUE)},
where KEY is the first element of ALIST-ENTRY, and VALUE is the second
element of ALIST-ENTRY.
SEP is the separator between the key and the value.
SUFFIX is the optional argument, default to newline.
Different things will happen depending on the value of VALUE:
@itemize @bullet
@item If VALUE is #f, ignore everything in the entry and just return
an empty list.
@item If VALUE is #t or not provided (empty list), ignore the VALUE
and SEP and just return a list of PREFIX and KEY followed by a
SUFFIX.
@item If VALUE is a flat list, it will get added to the resulting
list. If not flat the exception will be raised.
@item If VALUE is not a list (string, file-like object, etc), return a
list of PREFIX, KEY, SEP and VALUE followed by a SUFFIX.
The following code
@lisp
((alist-entry->mixed-text \"export \" \"=\") '(\"EDITOR\" . \"emacsclient\"))
((alist-entry->mixed-text \"export \" \"=\") '(\"EDITOR\" . #t))
((alist-entry->mixed-text \"export \" \"=\") '(\"EDITOR\"))
((alist-entry->mixed-text \"export \" \"=\") '(\"EDITOR\" . #f))
((alist-entry->mixed-text \"export \" \"=\") '(\"EDITOR\" . (\"emacsclient\" \"vim\")))
@end lisp
would yield
@example
(\"export \" \"EDITOR\" \"=\" \"emacsclient\" \"\n\")
(\"export \" \"EDITOR\" \"\n\")
(\"export \" \"EDITOR\" \"\n\")
()
(\"export \" \"EDITOR\" \"=\" \"emacsclient\" \"vim\" \"\n\")
@end example"
(define (not-alist-entry-error)
(raise (formatted-message
(G_ "~a has to be an association list entry")
alist-entry)))
(match alist-entry
((key . value)
(let* ((values (cond
((eq? value #f)
#f)
((or (eq? value #t) (null? value))
'(""))
((list? value)
(if (any list? value)
(raise (formatted-message
(G_ "~a is not a flat list")
value))
value))
(else
(list value))))
(sep (if (eq? values '(""))
""
sep)))
(if values
`(,prefix ,key ,sep ,@values ,suffix)
'())))
(_ (not-alist-entry-error))))
(define* (boolean->yes-or-no bool #:optional (capitalize? #f))
"Convert a boolean BOOL to \"yes\" or \"no\".
Setting CAPITALIZE? to @code{#t} will capitalize the word, it is set to
@code{#f} by default."
(let ((word (if (eq? bool #t) "yes" "no")))
(if capitalize?
(string-capitalize word)
word)))
(define* (boolean->true-or-false bool #:optional (capitalize? #f))
"Convert a boolean BOOL to \"true\" or \"false\".
Setting CAPITALIZE? to @code{#t} will capitalize the word, it is set to
@code{#f} by default."
(let ((word (if bool "true" "false")))
(if capitalize?
(string-capitalize word)
word)))
;; TODO: Remove once upstreamed
(define* (list->human-readable-list lst
#:key
(cumulative? #f)
(proc identity))
"Turn a list LST into a sequence of terms readable by humans.
If CUMULATIVE? is @code{#t}, use ``and'', otherwise use ``or'' before
the last term.
PROC is a procedure to apply to each of the elements of a list before
turning them into a single human readable string.
@example
(list->human-readable-list '(1 4 9) #:cumulative? #t #:proc sqrt)
@result{} \"1, 2, and 3\"
@end example
yields:"
(let* ((word (if cumulative? "and " "or "))
(init (append (drop-right lst 1))))
(format #f "~a" (string-append
(string-join
(map (compose maybe-object->string proc) init)
", " 'suffix)
word
(maybe-object->string (proc (last lst)))))))
;;;
;;; Serializers.
;;;
(define ini-config? list?)
(define (generic-serialize-ini-config-section section proc)
"Format a section from SECTION for an INI configuration.
Apply the procedure PROC on SECTION after it has been converted to a string"
(format #f "[~a]\n" (proc section)))
(define default-ini-format-section
(match-lambda
((section subsection)
(string-append (maybe-object->string section) " "
(maybe-object->string subsection)))
(section
(maybe-object->string section))))
(define* (generic-serialize-ini-config
#:key
(combine-ini string-join)
(combine-alist string-append)
(combine-section-alist string-append)
(format-section default-ini-format-section)
serialize-field
fields)
"Create an INI configuration from nested lists FIELDS. This uses
@code{generic-serialize-ini-config-section} and @{generic-serialize-alist} to
serialize the section and the association lists, respectively.
@example
(generic-serialize-ini-config
#:serialize-field (lambda (a b) (format #f \"~a = ~a\n\" a b))
#:format-section (compose string-capitalize symbol->string)
#:fields '((application ((key . value)))))
@end example
@result{} \"[Application]\nkey = value\n\""
(combine-ini
(map (match-lambda
((section alist)
(combine-section-alist
(generic-serialize-ini-config-section section format-section)
(generic-serialize-alist combine-alist serialize-field alist))))
fields)
"\n"))
(define* (generic-serialize-git-ini-config
#:key
(combine-ini string-join)
(combine-alist string-append)
(combine-section-alist string-append)
(format-section default-ini-format-section)
serialize-field
fields)
"Like @code{generic-serialize-ini-config}, but the section can also
have a @dfn{subsection}. FORMAT-SECTION will take a list of two
elements: the section and the subsection."
(combine-ini
(map (match-lambda
((section subsection alist)
(combine-section-alist
(generic-serialize-ini-config-section
(list section subsection) format-section)
(generic-serialize-alist combine-alist serialize-field alist)))
((section alist)
(combine-section-alist
(generic-serialize-ini-config-section section format-section)
(generic-serialize-alist combine-alist serialize-field alist))))
fields)
"\n"))
(define yaml-config? list?)
(define (make-yaml-indent depth)
(make-string (* 2 depth) #\space))
(define ((serialize-yaml-value depth) value)
(let* ((tab (make-yaml-indent depth)))
(cond
((string? value)
(list (format #f "'~a'" value)))
((boolean? value)
(list (format #f "~a" (if value "true" "false"))))
((file-like? value)
(list value))
((alist? value)
(serialize-yaml-alist value #:depth (1+ depth)))
((vector? value)
(serialize-yaml-vector value #:depth depth))
(else (list (format #f "~a" value))))))
(define ((serialize-yaml-key depth) key)
(when (vector? key)
(raise (formatted-message
(G_ "Vector as key value are not supported by serializer, \
try to avoid them. ~a") key)))
((serialize-yaml-value depth) key))
(define ((serialize-yaml-key-value depth) key value)
(let ((tab (make-yaml-indent depth)))
`("\n"
,tab
,@((serialize-yaml-key depth) key) ": "
,@((serialize-yaml-value depth) value))))
(define ((serialize-yaml-vector-elem depth) elem)
(let ((tab (make-yaml-indent (1+ depth))))
(cons*
"\n" tab "- "
((serialize-yaml-value (1+ depth)) elem))))
(define* (serialize-yaml-vector vec #:key (depth 0))
(append-map (serialize-yaml-vector-elem depth) (vector->list vec)))
(define* (serialize-yaml-alist lst #:key (depth 0))
(generic-serialize-alist append (serialize-yaml-key-value depth) lst))
(define (serialize-yaml-config config)
"Simplified yaml serializer, which supports only a subset of yaml, use
it with caution."
(serialize-yaml-alist config))
(define (string-or-gexp? sg) (or (string? sg) (gexp? sg)))
(define (serialize-string-or-gexp field-name val) "")
;; Guix proper has a different version of text-config.
(define (gexp-text-config? config)
(and (list? config) (every string-or-gexp? config)))
(define (serialize-gexp-text-config field-name val)
#~(string-append #$@(interpose val "\n" 'suffix)))
;;;
;;; Miscellaneous.
;;;
(define rest cdr)
;; Confusing with maybe-list type.
(define (maybe-list a)
"If A is a list, return it, otherwise return a singleton list with A."
(if (list? a)
a
(list a)))
;; If EXPR1 evaluates to a non-@code{#f} value and EXPR2 is specified,
;; return EXPR2; if it isn't specified, return EXPR1. Otherwise, return
;; an empty list @code{'()}.
(define-syntax optional
(syntax-rules ()
((_ expr1)
(if expr1 expr1 '()))
((_ expr1 expr2)
(if expr1 expr2 '()))))
(define (wrap-package pkg executable-name gexp)
"Create a @code{<package>} object that is a wrapper for PACKAGE, and
runs GEXP. NAME is the name of the executable that will be put in the store."
(let* ((wrapper-name (string-append executable-name "-wrapper"))
(wrapper (program-file wrapper-name gexp)))
(package
(inherit pkg)
(name wrapper-name)
(source wrapper)
(propagated-inputs `((,(package-name pkg) ,pkg)))
(build-system trivial-build-system)
(arguments
`(#:modules
((guix build utils))
#:builder
(begin
(use-modules (guix build utils)
(srfi srfi-1))
(let* ((bin (string-append %output "/bin"))
(wrapper (assoc-ref %build-inputs "source")))
(mkdir-p bin)
(copy-file wrapper (string-append bin "/" ,executable-name)))))))))
;;;
;;; Enums.
;;;
(define-record-type <enum>
(make-enum name value)
enum?
(name enum-name)
(value enum-value))
;; Copied from (gnu services configuration)
(define-syntax-rule (id ctx parts ...)
"Assemble PARTS into a raw (unhygienic) identifier."
(datum->syntax ctx (symbol-append (syntax->datum parts) ...)))
;; (define-enum pinentry-flavor
;; '(emacs gtk qt ncurses tty))
;;
;; (pinentry-flavor? 'gtk)
;; => #t
;;
;; (enum-value pinentry-flavor)
;; => '(emacs gtk qt ncurses tty)
;;
;; (pinentry-flavor? 'vim)
;; exception: `pinetry-flavor' must be one of `emacs', `gtk', `qt',
;; `ncurses', or `tty', was given `vim'
(define-syntax define-enum
(lambda (x)
(syntax-case x ()
((_ stem value)
(with-syntax ((stem? (id #'stem #'stem #'?))
(msg (list->human-readable-list
(second (syntax->datum #'value))
#:proc (cut format #f "`~a'" <>))))
#'(begin
(define stem (make-enum (quote stem) value))
(define (stem? val)
(if (member val value)
#t
(raise (formatted-message
(G_ "`~a' must of ~a, was given: ~s")
(enum-name stem)
(syntax->datum msg)
val))))))))))