mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2026-11-29 22:58:06 +00:00
README: Content: Add services and use tables.
This commit is contained in:
3 files changed
+256
-81
No files matched your search
+85
-12
@@ -3,24 +3,97 @@
|
||||
;;; SPDX-License-Identifier: CC0-1.0
|
||||
;;; Copyright © 2025-2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(use-modules (guix packages)
|
||||
(use-modules (ice-9 match)
|
||||
(ice-9 string-fun)
|
||||
(srfi srfi-1)
|
||||
(srfi srfi-71)
|
||||
(guix diagnostics)
|
||||
(guix discovery)
|
||||
(guix packages)
|
||||
(guix profiles)
|
||||
(guix ui)
|
||||
(rosenthal utils packages))
|
||||
(rosenthal utils packages)
|
||||
(rosenthal utils services)
|
||||
(gnu services))
|
||||
|
||||
(define (location->org-url loc)
|
||||
(match loc
|
||||
(#f "<unknown location>")
|
||||
(($ <location> file line column)
|
||||
(format #f "[[~a][~a]]"
|
||||
(format #f "https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/~a#L~a"
|
||||
file
|
||||
line)
|
||||
(basename file)))))
|
||||
|
||||
(define (replace-newlines str)
|
||||
(define str*
|
||||
(string-replace-substring
|
||||
(string-trim-right str #\newline)
|
||||
"\n"
|
||||
" "))
|
||||
(if (string-null? str*)
|
||||
" "
|
||||
str*))
|
||||
|
||||
(format #t "\
|
||||
*** Packages
|
||||
| PACKAGE | SYNOPSIS | LOCATION |
|
||||
|-+-+-|
|
||||
")
|
||||
|
||||
(define (sort-packages packages)
|
||||
(stable-sort
|
||||
packages
|
||||
(lambda (a b)
|
||||
(string< (package-name a)
|
||||
(package-name b)))))
|
||||
|
||||
(format #t "*** Packages~%")
|
||||
(for-each
|
||||
(lambda (p)
|
||||
(format #t "- [[~a][~a]]@~a :: ~a~%"
|
||||
(format #t "|[[~a][=~a=]]@~a|~a|~a|~%"
|
||||
(package-home-page p)
|
||||
(package-name p)
|
||||
(package-version p)
|
||||
(string-drop-right
|
||||
(package-synopsis-string p)
|
||||
(string-length "\n\n"))))
|
||||
(stable-sort
|
||||
(replace-newlines (package-synopsis-string p))
|
||||
(and=> (package-location p) location->org-url)))
|
||||
(sort-packages
|
||||
(filter (negate hidden-package?)
|
||||
(all-rosenthal-packages))
|
||||
(lambda (a b)
|
||||
(string< (package-name a)
|
||||
(package-name b)))))
|
||||
(all-rosenthal-packages))))
|
||||
|
||||
|
||||
(format #t "\
|
||||
*** Services
|
||||
| SERVICE | DESCRIPTION | LOCATION |
|
||||
|-+-+-|
|
||||
")
|
||||
|
||||
;; Copied from (guix scripts system search).
|
||||
(define service-type-name*
|
||||
(compose symbol->string service-type-name))
|
||||
(define (service-type-description-string type)
|
||||
"Return the rendered and localised description of TYPE, a service type."
|
||||
(and=> (service-type-description type)
|
||||
texi->plain-text))
|
||||
|
||||
(define (sort-services services)
|
||||
(stable-sort
|
||||
services
|
||||
(lambda (a b)
|
||||
(string< (service-type-name* a)
|
||||
(service-type-name* b)))))
|
||||
|
||||
(for-each
|
||||
(lambda (s)
|
||||
(format #t "|=~a=|~a|~a|~%"
|
||||
(service-type-name* s)
|
||||
(replace-newlines (service-type-description-string s))
|
||||
(and=> (service-type-location s) location->org-url)))
|
||||
(let ((home-services
|
||||
services
|
||||
(partition (lambda (s)
|
||||
(string-prefix? "home-" (service-type-name* s)))
|
||||
(all-rosenthal-services))))
|
||||
(append
|
||||
(sort-services services)
|
||||
(sort-services home-services))))
|
||||
Reference in new issue
Block a user