mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2026-11-29 22:58:06 +00:00
Compare commits
119
Commits
bde35a43ac
...
trunk
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f77ce5db2 | ||
|
|
0dec192155 | ||
|
|
c174d7a009 | ||
|
|
357aba2039 | ||
|
|
328d7023af | ||
|
|
e4dafed2ad | ||
|
|
17cae93520 | ||
|
|
fff737cc07 | ||
|
|
a6736d8030 | ||
|
|
00b4c71c87 | ||
|
|
809e90d7fb | ||
|
|
bfe0d7379d | ||
|
|
e0db50c276 | ||
|
|
55d68222f4 | ||
|
|
1c6b3e3cb6 | ||
|
|
22d0abb36a | ||
|
|
0daf8b388b | ||
|
|
a19f1684cf | ||
|
|
a4de900221 | ||
|
|
a6124dd914 | ||
|
|
0e4f53ed58 | ||
|
|
c3781eefc8 | ||
|
|
8b1ecc349e | ||
|
|
cdb841b71e | ||
|
|
18cef20133 | ||
|
|
078c2d7983 | ||
|
|
877fe611c6 | ||
|
|
9c154fa85c | ||
|
|
279e3645b6 | ||
|
|
19d981d97a | ||
|
|
fb5e0fd076 | ||
|
|
c3cb87ecb5 | ||
|
|
e0333310c8 | ||
|
|
db99800394 | ||
|
|
4f8e710735 | ||
|
|
42e0ad6d86 | ||
|
|
f5da8e8aeb | ||
|
|
30cb0fca4f | ||
|
|
0999318f8d | ||
|
|
3507deee77 | ||
|
|
db46c04f3d | ||
|
|
2b03183286 | ||
|
|
579db10847 | ||
|
|
7912112268 | ||
|
|
be842ba63f | ||
|
|
2fb0028c81 | ||
|
|
c27ac08668 | ||
|
|
4b892bd318 | ||
|
|
52f55af4e9 | ||
|
|
9b9071c9e0 | ||
|
|
f6a6436ebc | ||
|
|
a7073acb39 | ||
|
|
276eca71dd | ||
|
|
e1b25f7d8d | ||
|
|
9afc4e56da | ||
|
|
27baf1ba57 | ||
|
|
fc235e2eb0 | ||
|
|
e076f5f3de | ||
|
|
01d1c44615 | ||
|
|
8a41a4e33d | ||
|
|
42e079f438 | ||
|
|
631adacf12 | ||
|
|
b98b1b1e9f | ||
|
|
2e08e1a93e | ||
|
|
90537893e2 | ||
|
|
15e867800b | ||
|
|
717eb109be | ||
|
|
58c47e9bfc | ||
|
|
c62ff66702 | ||
|
|
98a49dcb06 | ||
|
|
14ce4e3aba | ||
|
|
567a1e7a55 | ||
|
|
f25d748dbd | ||
|
|
9f77f8a014 | ||
|
|
3e1ac671e3 | ||
|
|
8f5f47e0c3 | ||
|
|
ee479dbfda | ||
|
|
200667cddc | ||
|
|
c66f1a8c8d | ||
|
|
1122c6fec9 | ||
|
|
755e5c109a | ||
|
|
6142ed7cd5 | ||
|
|
a332d68283 | ||
|
|
a3b53eb118 | ||
|
|
649be3f514 | ||
|
|
ccc53c9afc | ||
|
|
731b5877ff | ||
|
|
c2897f17ad | ||
|
|
2dae5082ff | ||
|
|
5119a0fbfd | ||
|
|
9525c5b1c0 | ||
|
|
bdde9175c6 | ||
|
|
e4aff75551 | ||
|
|
0d00baa9e1 | ||
|
|
34502202bf | ||
|
|
641f1fbd71 | ||
|
|
1398722e04 | ||
|
|
74b0cd7410 | ||
|
|
ed54329e1f | ||
|
|
14bde08c8b | ||
|
|
1f35f0e393 | ||
|
|
87bfe33314 | ||
|
|
5f312b336d | ||
|
|
805ea83faf | ||
|
|
8aae7d26dd | ||
|
|
8bebafaacd | ||
|
|
b353ee7610 | ||
|
|
09bfd608cf | ||
|
|
2816e3e06a | ||
|
|
8f0677e5e3 | ||
|
|
0f8ae9ca08 | ||
|
|
8a8142d16c | ||
|
|
b15af6f9ff | ||
|
|
08b1980f22 | ||
|
|
9454089804 | ||
|
|
ed43a49877 | ||
|
|
c8625f6a8c | ||
|
|
a88ac359a0 | ||
|
|
f34040153c |
No files matched your search
@@ -42,6 +42,9 @@
|
||||
.
|
||||
((geiser-repl-add-project-paths . ("modules"))
|
||||
|
||||
(eval . (put 'match-record/dolly 'scheme-indent-function 3))
|
||||
(eval . (put 'match-record-lambda/dolly 'scheme-indent-function 2))
|
||||
|
||||
(eval . (put 'computed-substitution-with-inputs 'scheme-indent-function 1))
|
||||
(eval . (put 'hidden-desktop-entry 'scheme-indent-function 1))
|
||||
(eval . (put 'modify-services/by-name 'scheme-indent-function 1))
|
||||
|
||||
+4
-3
@@ -10,8 +10,8 @@ Feel free to upstream things from this channel if you find them useful and
|
||||
suitable. I can help with that but don't have the energy to finish all the
|
||||
process by myself.
|
||||
|
||||
NOTE: everything in this channel is subject to change and may be deleted *at
|
||||
any time*, please [[https://codeberg.org/hako/Rosenthal/issues][report an issue]] if you are affected.
|
||||
NOTE: everything in this channel is subject to change and may be deleted *at any
|
||||
time*, please [[https://codeberg.org/hako/Rosenthal/issues][report an issue]] if you are affected.
|
||||
|
||||
Channel specification:
|
||||
#+begin_src scheme
|
||||
@@ -26,7 +26,8 @@ Channel specification:
|
||||
"13E7 6CD6 E649 C28C 3385 4DF5 5E5A A665 6149 17F7"))))
|
||||
#+end_src
|
||||
|
||||
You can use [[https://toys.whereis.social/?search=&channel=rosenthal][toys.whereis.social]] or [[https://search.guix.moe/?search=&channel=rosenthal][search.guix.moe]] to search packages, services
|
||||
Available packages and services are listed in [[file:etc/docs/index.org][index.org]] (outputed by the [[file:etc/scripts/index][index]]
|
||||
script). You can also use [[https://toys.whereis.social/?search=&channel=rosenthal][toys.whereis.social]] or [[https://search.guix.moe/?search=&channel=rosenthal][search.guix.moe]] to search them
|
||||
and public symbols from Rosenthal and other Guix channels.
|
||||
|
||||
[[https://guix.gnu.org/manual/devel/en/html_node/Substitutes.html][Substitutes]] (pre-built package binaries) for this channel are available via [[https://guix.moe/][Guix
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
*** Packages
|
||||
| PACKAGE | SYNOPSIS | LOCATION |
|
||||
|-+-+-|
|
||||
|[[https://github.com/ai-robots-txt/ai.robots.txt][=ai-robots-txt=]]@2.1|List of AI agents and robots to block|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/web.scm#L37][web.scm]]|
|
||||
|[[https://grafana.com/oss/alloy-opentelemetry-collector/][=alloy-bin=]]@1.21.2|OpenTelemetry Collector distribution with programmable pipelines|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L609][binaries.scm]]|
|
||||
|[[https://github.com/anthonyhab/bb-auth][=bb-auth=]]@0.2.0|Unified polkit, keyring, and pinentry authentication daemon|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/authentication.scm#L22][authentication.scm]]|
|
||||
|[[https://bitwarden.com/][=bitwarden-icecat=]]@2026.10.0|Bitwarden client browser extension|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/browser-extensions.scm#L48][browser-extensions.scm]]|
|
||||
|[[https://www.busybox.net][=busybox-static=]]@1.37.0|Many common UNIX utilities in a single executable|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/busybox.scm#L14][busybox.scm]]|
|
||||
|[[https://caddyserver.com/][=caddy=]]@2.11.7|Extensible HTTP web server with automatic HTTPS|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/web.scm#L70][web.scm]]|
|
||||
|[[https://git.guix.moe/hako/caddy][=caddy-dolly=]]@2026.10.23|Extensible HTTP web server with automatic HTTPS|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/web.scm#L139][web.scm]]|
|
||||
|[[https://1.1.1.1/][=cloudflare-warp-bin=]]@2026.8.2115.0|Cloudflare WARP client|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L42][binaries.scm]]|
|
||||
|[[https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/][=cloudflared=]]@2026.10.3|Cloudflare Tunnel client|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/networking.scm#L25][networking.scm]]|
|
||||
|[[https://davmac.org/projects/dinit/][=dinit=]]@0.22.1|Service manager with dependency management|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/admin.scm#L25][admin.scm]]|
|
||||
|[[https://github.com/felixonmars/dnsmasq-china-list][=dnsmasq-china-list=]]@0.0.0-22.c79474a|Chinese-specific DNS server configurations|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/dns.scm#L18][dns.scm]]|
|
||||
|[[https://matt.ucc.asn.au/dropbear/dropbear.html][=dropbear-static=]]@2025.89|Small SSH server and client|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/ssh.scm#L16][ssh.scm]]|
|
||||
|[[https://github.com/Schnouki/caddyfile-mode][=emacs-caddyfile-mode=]]@0.2-0.fc41148|Emacs major mode for editing Caddy configuration files|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L25][emacs-xyz.scm]]|
|
||||
|[[https://github.com/dakra/ghostel][=emacs-consult-ghostel=]]@0.59.0|Consult integration for ghostel|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L51][emacs-xyz.scm]]|
|
||||
|[[https://codeberg.org/akib/emacs-eat][=emacs-eat-dolly=]]@0.9.4|Terminal emulator in Emacs|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L77][emacs-xyz.scm]]|
|
||||
|[[https://github.com/astoff/isearch-mb][=emacs-isearch-mb=]]@0.8|Control `isearch' from the minibuffer|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L95][emacs-xyz.scm]]|
|
||||
|[[https://github.com/taquangtrung/emacs-kdl-mode][=emacs-kdl-mode=]]@0.0.1-1.e966ed4|Emacs major mode for editing files in the KDL document language|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L120][emacs-xyz.scm]]|
|
||||
|[[https://github.com/dandavison/magit-delta][=emacs-magit-delta-dolly=]]@0.1-0.5fc7dbd|Integration of `delta' with `emacs-magit'|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L141][emacs-xyz.scm]]|
|
||||
|[[https://github.com/0WD0/majutsu][=emacs-majutsu-dolly=]]@0.6.0-7.19856a9|Emacs interface for Jujutsu version control system|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L156][emacs-xyz.scm]]|
|
||||
|[[https://github.com/xuchunyang/msgpack.el][=emacs-msgpack=]]@0.1.1-0.5353a7b|Read and write MessagePack object in Emacs|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L180][emacs-xyz.scm]]|
|
||||
|[[https://git.thanosapollo.org/pcmpl-tailscale][=emacs-pcmpl-tailscale=]]@0.0.1-0.acd6bce|Enhanced shell completions for tailscale|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L206][emacs-xyz.scm]]|
|
||||
|[[https://codeberg.org/divyaranjan/emacs-reader][=emacs-reader=]]@0.3.2-4.4fca3aa|Emacs document reader|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L231][emacs-xyz.scm]]|
|
||||
|[[https://github.com/ArthurHeymans/emacs-tramp-rpc][=emacs-tramp-rpc=]]@0.15.0|TRAMP backend using RPC|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L264][emacs-xyz.scm]]|
|
||||
|[[https://wakatime.com/emacs][=emacs-wakatime-mode=]]@1.0.2-60.1c5b225|Automatic time tracking extension for Emacs using WakaTime|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/emacs-xyz.scm#L298][emacs-xyz.scm]]|
|
||||
|[[https://forgejo.org/][=forgejo=]]@16.0.6|Self-hosted, lightweight software forge|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/web.scm#L161][web.scm]]|
|
||||
|[[https://grafana.com/][=grafana-bin=]]@13.2.4|Platform for monitoring and observability|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L416][binaries.scm]]|
|
||||
|[[https://github.com/hylophile/guile-toml][=guile-toml=]]@1.0|TOML module for Guile Scheme|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/guile-xyz.scm#L19][guile-xyz.scm]]|
|
||||
|[[https://github.com/hifi/heisenbridge][=heisenbridge=]]@1.15.4|Bouncer-style Matrix IRC bridge|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/messaging.scm#L33][messaging.scm]]|
|
||||
|[[https://komga.org/][=komga-bin=]]@1.29.1|Media server for comics/mangas/BDs/magazines/eBooks|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L190][binaries.scm]]|
|
||||
|[[https://sr.ht/~kennylevinsen/seatd][=libseat-sans-logind=]]@0.9.3|Seat management library|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/admin.scm#L62][admin.scm]]|
|
||||
|[[https://www.freedesktop.org/wiki/Software/vaapi/][=libva-nox=]]@2.22.0|Video acceleration library|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/video.scm#L14][video.scm]]|
|
||||
|[[https://github.com/Limine-Bootloader/Limine][=limine=]]@12.9.4|Multiprotocol bootloader and boot manager|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/bootloaders.scm#L40][bootloaders.scm]]|
|
||||
|[[https://cachyos.org/][=linux-cachyos-bore-zen4=]]@7.2.11-1|CachyOS Linux kernel (bore + znver4)|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/linux.scm#L289][linux.scm]]|
|
||||
|[[https://cachyos.org/][=linux-cachyos-lts-server=]]@6.18.55-1|CachyOS Linux kernel (lts + server)|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/linux.scm#L247][linux.scm]]|
|
||||
|[[https://grafana.com/oss/loki/][=loki-bin=]]@3.7.9|Log aggregation system|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L545][binaries.scm]]|
|
||||
|[[https://github.com/sot-tech/LottieConverter][=lottie-converter=]]@0.2-0.3ad34af|Lottie animation converter|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/animation.scm#L22][animation.scm]]|
|
||||
|[[https://github.com/mautrix/telegram][=mautrix-telegram=]]@0.2610.0|Matrix-Telegram hybrid puppeting/relaybot bridge|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/messaging.scm#L66][messaging.scm]]|
|
||||
|[[https://wiki.metacubex.one/][=mihomo=]]@1.19.33|Rule-based proxy|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/networking.scm#L70][networking.scm]]|
|
||||
|[[https://grafana.com/oss/mimir/][=mimir-bin=]]@3.2.3|Scalable long-term storage for Prometheus|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L505][binaries.scm]]|
|
||||
|[[https://github.com/Sevichecc/miniflux-injector][=miniflux-injector-icecat=]]@2.3.3|Injects Miniflux search results into search page|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/browser-extensions.scm#L97][browser-extensions.scm]]|
|
||||
|[[https://codeberg.org/hako/mirror-substitutes][=mirror-substitutes=]]@0.0.3|Mirror Guix substitutes|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/package-management.scm#L39][package-management.scm]]|
|
||||
|[[https://www.navidrome.org/][=navidrome-bin=]]@0.64.2|Web-based music collection server and streamer|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L238][binaries.scm]]|
|
||||
|[[https://noctalia.dev/][=noctalia-greeter=]]@1.7.0|Login greeter for greetd|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/wm.scm#L40][wm.scm]]|
|
||||
|[[https://github.com/27justin/ohmyech][=ohmyech-icecat=]]@1.5|Visual indicator for Encrpted Client Hello|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/browser-extensions.scm#L147][browser-extensions.scm]]|
|
||||
|[[https://github.com/ifreund/dumb_runtime_dir][=pam-dumb-runtime-dir=]]@1.0.4|Create `XDG_RUNTIME_DIR' on login and never remove it|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/admin.scm#L74][admin.scm]]|
|
||||
|[[https://prismlauncher.org/][=prismlauncher-dolly=]]@11.1.1|Free, open source launcher for Minecraft|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/games.scm#L45][games.scm]]|
|
||||
|[[https://prometheus.io/][=prometheus-bin=]]@3.15.1|Monitoring system and time series database|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L453][binaries.scm]]|
|
||||
|[[https://pypi.org/project/coherent.licensed/][=python-coherent-licensed=]]@0.5.2|License management tooling|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/python-xyz.scm#L31][python-xyz.scm]]|
|
||||
|[[https://github.com/cher-nov/cryptg][=python-cryptg=]]@0.5.2|Cryptographic utilities for Telegram|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/python-xyz.scm#L53][python-xyz.scm]]|
|
||||
|[[https://github.com/jaraco/irc][=python-irc=]]@20.3.1|Python Internet Relay Chat protocol library|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/python-xyz.scm#L109][python-xyz.scm]]|
|
||||
|[[https://github.com/jaraco/jaraco.logging][=python-jaraco-logging=]]@3.4.0|Python logging facility|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/python-xyz.scm#L144][python-xyz.scm]]|
|
||||
|[[https://github.com/jaraco/jaraco.stream][=python-jaraco-stream=]]@3.0.4|Routines for dealing with data streams|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/python-xyz.scm#L170][python-xyz.scm]]|
|
||||
|[[https://github.com/mautrix/python][=python-mautrix=]]@0.20.8|Python 3 asyncio Matrix framework|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/python-xyz.scm#L195][python-xyz.scm]]|
|
||||
|[[https://github.com/tulir/Telethon][=python-tulir-telethon=]]@1.99.0a6|Python 3 MTProto API Telegram client library|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/python-xyz.scm#L228][python-xyz.scm]]|
|
||||
|[[https://sr.ht/~kennylevinsen/seatd][=seatd-sans-logind=]]@0.9.3|Seat management daemon|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/admin.scm#L111][admin.scm]]|
|
||||
|[[https://www.ihcblog.com/a-better-tls-obfs-proxy/][=shadow-tls-bin=]]@0.2.25|Proxy to expose real tls handshake to the firewall|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L288][binaries.scm]]|
|
||||
|[[https://sing-box.sagernet.org/][=sing-box=]]@1.14.3|Universal proxy platform|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/networking.scm#L118][networking.scm]]|
|
||||
|[[https://github.com/zenhack/socks2http][=socks2http=]]@0.0.0-20160712034938-bafa2cde8eb4|SOCKS5 to HTTP proxy|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/networking.scm#L190][networking.scm]]|
|
||||
|[[https://tangled.org/oppi.li/stinkpot][=stinkpot=]]@0.1.0|Search shell history|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/shellutils.scm#L18][shellutils.scm]]|
|
||||
|[[https://systemd.io/][=systemd-stub=]]@262.1|Unified kernel image UEFI stub|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/bootloaders.scm#L103][bootloaders.scm]]|
|
||||
|[[https://tailscale.com/][=tailscale=]]@1.104.2|Mesh VPN service utilizing the WireGuard protocol and 2FA|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/networking.scm#L217][networking.scm]]|
|
||||
|[[https://matrix-construct.github.io/tuwunel/][=tuwunel-bin=]]@1.9.4|Matrix homeserver|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L131][binaries.scm]]|
|
||||
|[[https://systemd.io][=ukify=]]@262.1|Unified kernel image UEFI tool|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/bootloaders.scm#L146][bootloaders.scm]]|
|
||||
|[[https://wakapi.dev/][=wakapi-bin=]]@2.18.2|WakaTime-compatible backend|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L318][binaries.scm]]|
|
||||
|[[https://wakatime.com/plugins][=wakatime-cli-bin=]]@2.27.13|Command line interface to WakaTime|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/packages/binaries.scm#L366][binaries.scm]]|
|
||||
*** Services
|
||||
| SERVICE | DESCRIPTION | LOCATION |
|
||||
|-+-+-|
|
||||
|=alloy=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/monitoring.scm#L82][monitoring.scm]]|
|
||||
|=btrbk=|Configure and run btrbk hourly.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/file-systems.scm#L53][file-systems.scm]]|
|
||||
|=caddy=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/web.scm#L160][web.scm]]|
|
||||
|=clash=|Run Clash.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/child-error.scm#L121][child-error.scm]]|
|
||||
|=cloudflare-tunnel=|Run cloudflared, the Cloudflare Tunnel daemon.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/child-error.scm#L219][child-error.scm]]|
|
||||
|=cloudflare-warp=|Run warp-svc, the Cloudflare Warp daemon.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/child-error.scm#L255][child-error.scm]]|
|
||||
|=cuirass=|Run the Cuirass continuous integration service.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/cuirass.scm#L68][cuirass.scm]]|
|
||||
|=cuirass-worker-container=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/cuirass.scm#L208][cuirass.scm]]|
|
||||
|=docker-mailserver=|Run Docker Mailserver.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/mail.scm#L77][mail.scm]]|
|
||||
|=dumb-runtime-dir=|Create `XDG_RUNTIME_DIR' on login and never remove it.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/file-systems.scm#L94][file-systems.scm]]|
|
||||
|=forgejo=|Run Forgejo.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/web.scm#L302][web.scm]]|
|
||||
|=gamemode=|Set up Guix System environment for gamemode.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/games.scm#L51][games.scm]]|
|
||||
|=grafana=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/monitoring.scm#L180][monitoring.scm]]|
|
||||
|=heisenbridge=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/messaging.scm#L95][messaging.scm]]|
|
||||
|=iocaine=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/web.scm#L408][web.scm]]|
|
||||
|=jellyfin=|Run the Jellyfin media system.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/web.scm#L544][web.scm]]|
|
||||
|=jellyfin-oci=|Run Jellyfin, a media system.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/web.scm#L634][web.scm]]|
|
||||
|=komga=|Run Komga.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/web.scm#L706][web.scm]]|
|
||||
|=loki=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/monitoring.scm#L269][monitoring.scm]]|
|
||||
|=mautrix-telegram=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/messaging.scm#L181][messaging.scm]]|
|
||||
|=mimir=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/monitoring.scm#L356][monitoring.scm]]|
|
||||
|=misskey=|Run Misskey, an interplanetary microblogging platform.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/web.scm#L798][web.scm]]|
|
||||
|=navidrome=|Run Navidrome.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/web.scm#L888][web.scm]]|
|
||||
|=network-online=|Wait for the network to come up.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/networking.scm#L72][networking.scm]]|
|
||||
|=nix-search-paths=|Set up search paths for `with-nix-profile'.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/nix.scm#L59][nix.scm]]|
|
||||
|=noctalia-greeter=|Set up environment for `noctalia-greeter-session'.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/base.scm#L76][base.scm]]|
|
||||
|=prometheus=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/monitoring.scm#L447][monitoring.scm]]|
|
||||
|=qbittorrent=|Run qBittorrent daemon.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/bittorrent.scm#L120][bittorrent.scm]]|
|
||||
|=shadow-tls=|Run shadow-tls.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/child-error.scm#L451][child-error.scm]]|
|
||||
|=sing-box=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/networking.scm#L176][networking.scm]]|
|
||||
|=smartdns=|Run Smartdns daemon.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/dns.scm#L44][dns.scm]]|
|
||||
|=tailscaled=|Run tailscaled.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/networking.scm#L249][networking.scm]]|
|
||||
|=tuwunel=|Run Tuwunel.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/web.scm#L975][web.scm]]|
|
||||
|=vaultwarden=|Run Vaultwarden, a Bitwarden compatible server.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/web.scm#L1114][web.scm]]|
|
||||
|=zfs=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/file-systems.scm#L187][file-systems.scm]]|
|
||||
|=home-atuin=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/shellutils.scm#L68][shellutils.scm]]|
|
||||
|=home-bb-auth=|Run `bb-auth' daemon.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L423][desktop.scm]]|
|
||||
|=home-blueman-applet=|Run blueman applet, a tray applet for managing bluetooth.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L122][desktop.scm]]|
|
||||
|=home-direnv=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/shellutils.scm#L105][shellutils.scm]]|
|
||||
|=home-emacs=|Install Emacs into home profile and run its daemon.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/home/services/emacs.scm#L142][emacs.scm]]|
|
||||
|=home-fcitx5=|Run fcitx5, an input method framework.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L246][desktop.scm]]|
|
||||
|=home-goimapnotify=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/mail.scm#L129][mail.scm]]|
|
||||
|=home-graphical-session=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/home/services/desktop.scm#L165][desktop.scm]]|
|
||||
|=home-gtk2=|Set up GTK2 settings in `~/.config/gtk-2.0/gtkrc'|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/home/services/gtk.scm#L53][gtk.scm]]|
|
||||
|=home-gtk3=|Set up GTK3 settings in `~/.config/gtk-3.0/settings.ini'|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/home/services/gtk.scm#L74][gtk.scm]]|
|
||||
|=home-gtk4=|Set up GTK4 settings in `~/.config/gtk-4.0/settings.ini'|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/home/services/gtk.scm#L84][gtk.scm]]|
|
||||
|=home-keyboard=|Set layouts by configuring XKB_* environment variables. Service accepts an instance of `keyboard-layout' from `(gnu system keyboard)'.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/keyboard.scm#L21][keyboard.scm]]|
|
||||
|=home-mako=|Run mako, a notification daemon.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L302][desktop.scm]]|
|
||||
|=home-network-manager-applet=|Run nm-applet, a tray applet for managing networks.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L341][desktop.scm]]|
|
||||
|=home-network-online=|Wait for the network to come up.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/networking.scm#L81][networking.scm]]|
|
||||
|=home-niri=|Set up configuration file for niri, a scrollable-tiling Wayland compositor.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L381][desktop.scm]]|
|
||||
|=home-nix-search-paths=|Set up search paths for `with-nix-profile'.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/nix.scm#L74][nix.scm]]|
|
||||
|=home-noctalia=|Run Noctalia, a lightweight Wayland shell and bar.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/home/services/desktop.scm#L219][desktop.scm]]|
|
||||
|=home-polkit-gnome=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L450][desktop.scm]]|
|
||||
|=home-qbittorrent=|Run qBittorrent daemon.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/bittorrent.scm#L158][bittorrent.scm]]|
|
||||
|=home-rofi=|Set up configuration file for rofi, an application launcher.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L476][desktop.scm]]|
|
||||
|=home-shadow-tls=|Run shadow-tls.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/child-error.scm#L460][child-error.scm]]|
|
||||
|=home-socks2http=|Run socks2http.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/child-error.scm#L495][child-error.scm]]|
|
||||
|=home-stinkpot=|Set up `stinkpot' for Fish shell.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/shellutils.scm#L143][shellutils.scm]]|
|
||||
|=home-swaybg=|Run swaybg, a screen wallpaper utility for Wayland compositors.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L516][desktop.scm]]|
|
||||
|=home-theme=|Set up desktop themes.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L615][desktop.scm]]|
|
||||
|=home-wakapi=|Run Wakapi, a self-hosted WakaTime-compatible backend.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/child-error.scm#L298][child-error.scm]]|
|
||||
|=home-waybar=|Run waybar, a status bar for Wayland compositors.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/desktop.scm#L680][desktop.scm]]|
|
||||
|=home-writable-files-manager=|Provide an `update-writable-files' script, which copies files to configuration files, makes them writable and creates symlinks to directories on every activation. If an existing file would be overwritten, backs up that file first.|[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/home/services/writable-files-manager.scm#L264][writable-files-manager.scm]]|
|
||||
|=home-zoxide=| |[[https://codeberg.org/hako/Rosenthal/src/branch/trunk/modules/rosenthal/services/shellutils.scm#L177][shellutils.scm]]|
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: scheme; -*-
|
||||
exec guix repl -- "$0" "$@"
|
||||
!#
|
||||
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2025-2026 Hilton Chain <hako@ultrarare.space>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
||||
;;; under the terms of the GNU General Public License as published by
|
||||
;;; the Free Software Foundation; either version 3 of the License, or (at
|
||||
;;; your option) any later version.
|
||||
;;;
|
||||
;;; GNU Guix is distributed in the hope that it will be useful, but
|
||||
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;; GNU General Public License for more details.
|
||||
;;;
|
||||
;;; You should have received a copy of the GNU General Public License
|
||||
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;;
|
||||
;;; Usage: cleanup-crates.scm [FILE] ...
|
||||
;;;
|
||||
|
||||
(use-modules (ice-9 match)
|
||||
(ice-9 regex)
|
||||
(srfi srfi-26)
|
||||
(system base compile)
|
||||
(guix ui)
|
||||
(guix utils)
|
||||
(guix scripts shell))
|
||||
|
||||
(define (cleanup-crates file)
|
||||
(define %unused
|
||||
(let ((warnings (open-output-string)))
|
||||
(parameterize ((current-warning-port warnings))
|
||||
(compile-file file
|
||||
#:optimization-level 0
|
||||
#:warning-level 0
|
||||
#:opts '(#:warnings (unused-toplevel))))
|
||||
(map (cut match:substring <> 1)
|
||||
(list-matches "`(rust-[^']*)'" (get-output-string warnings)))))
|
||||
|
||||
(info (G_ "removing ~a unused definitions~%") (length %unused))
|
||||
(for-each (lambda (name)
|
||||
(info (G_ "removing '~a'...~%") name)
|
||||
(and=> (find-definition-location file (string->symbol name) #:define-prefix 'define)
|
||||
delete-expression))
|
||||
%unused)
|
||||
|
||||
(info (G_ "collapsing newlines~%"))
|
||||
(guix-shell "sed" "--" "sed" "--in-place" ":a;N;$!ba;s/\\n\\n\\+/\\n\\n/g" file))
|
||||
|
||||
(match (program-arguments)
|
||||
((_ files ..1)
|
||||
(for-each cleanup-crates files))
|
||||
(_
|
||||
(cleanup-crates "modules/rosenthal/packages/rust-crates.scm")))
|
||||
@@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env -S guix repl
|
||||
#!/bin/sh
|
||||
# -*- mode: scheme; -*-
|
||||
exec guix repl -- "$0" "$@"
|
||||
!#
|
||||
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2020, 2021, 2022, 2023 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
|
||||
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
|
||||
;;; Copyright © 2022 Maxim Cournoyer <maxim@guixotic.coop>
|
||||
;;; Copyright © 2022, 2026 Maxim Cournoyer <maxim@guixotic.coop>
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
@@ -25,7 +26,9 @@
|
||||
(ice-9 rdelim)
|
||||
(ice-9 regex)
|
||||
(ice-9 textual-ports)
|
||||
(guix gexp))
|
||||
(guix gexp)
|
||||
(guix modules)
|
||||
(guix packages))
|
||||
|
||||
(define* (break-string str #:optional (max-line-length 70))
|
||||
"Break the string STR into lines that are no longer than MAX-LINE-LENGTH.
|
||||
@@ -380,6 +383,30 @@ modifying."
|
||||
(cons* new (old-sexp (first hunks)) hunks)))
|
||||
(group-hunks-by-sexp hunks)))
|
||||
|
||||
(define (new+old+hunks->package new+old+hunks)
|
||||
"Return the package object whose source is referenced in a new+old+hunks
|
||||
tuple, which describes modifications to the package in a tuple containing the
|
||||
new sexp, the old sexp as well as a tail of <hunk> objects."
|
||||
(match new+old+hunks
|
||||
((new-sexp old-sexp . hunks)
|
||||
(let* ((hunk-file-name (hunk-file-name (first hunks)))
|
||||
(variable-name (second new-sexp))
|
||||
(module-name
|
||||
(match (file-name->module-name hunk-file-name)
|
||||
(('modules 'rosenthal symbols ...)
|
||||
(cons 'rosenthal symbols))
|
||||
(x x))))
|
||||
(module-ref (resolve-module module-name) variable-name)))))
|
||||
|
||||
(define (sort-new+old+hunks-by-closure new+old+hunks)
|
||||
"Sort new+old+hunks by their package closure size."
|
||||
(sort new+old+hunks
|
||||
(match-lambda*
|
||||
(((= new+old+hunks->package x-package)
|
||||
(= new+old+hunks->package y-package))
|
||||
(< (length (package-closure (list x-package)))
|
||||
(length (package-closure (list y-package))))))))
|
||||
|
||||
(define %delay 1000)
|
||||
|
||||
(define (main . args)
|
||||
@@ -441,7 +468,7 @@ modifying."
|
||||
hunks)
|
||||
(define copyright-line
|
||||
(any (lambda (line) (and=> (string-prefix? "+;;; Copyright ©" line)
|
||||
(const line)))
|
||||
(const line)))
|
||||
(hunk-diff-lines (first hunks))))
|
||||
(cond
|
||||
(copyright-line
|
||||
@@ -456,13 +483,14 @@ modifying."
|
||||
(usleep %delay)
|
||||
(unless (eqv? 0 (status:exit-val (close-pipe port)))
|
||||
(error "Cannot commit")))))))
|
||||
(new+old+hunks (match definitions
|
||||
('() changes) ;reuse
|
||||
(_
|
||||
;; XXX: we recompute the hunks here because previous
|
||||
;; insertions lead to offsets.
|
||||
(let-values (((definitions changes)
|
||||
(partition hunk-type (diff-info))))
|
||||
changes)))))))))
|
||||
(sort-new+old+hunks-by-closure
|
||||
(new+old+hunks (match definitions
|
||||
('() changes) ;reuse
|
||||
(_
|
||||
;; XXX: we recompute the hunks here because previous
|
||||
;; insertions lead to offsets.
|
||||
(let-values (((definitions changes)
|
||||
(partition hunk-type (diff-info))))
|
||||
changes))))))))))
|
||||
|
||||
(apply main (cdr (command-line)))
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: scheme; -*-
|
||||
exec guix repl -- "$0" "$@"
|
||||
!#
|
||||
;;; SPDX-License-Identifier: CC0-1.0
|
||||
;;; Copyright © 2025-2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(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 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)))))
|
||||
|
||||
(for-each
|
||||
(lambda (p)
|
||||
(format #t "|[[~a][=~a=]]@~a|~a|~a|~%"
|
||||
(package-home-page p)
|
||||
(package-name p)
|
||||
(package-version p)
|
||||
(replace-newlines (package-synopsis-string p))
|
||||
(and=> (package-location p) location->org-url)))
|
||||
(sort-packages
|
||||
(filter (negate hidden-package?)
|
||||
(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))))
|
||||
@@ -1,67 +1,18 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2016 Petter <petter@mykolab.ch>
|
||||
;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
|
||||
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
|
||||
;;; Copyright © 2021-2022 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2021, 2023 Efraim Flashner <efraim@flashner.co.il>
|
||||
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
|
||||
;;; Copyright © 2024 Christina O'Donnell <cdo@mutix.org>
|
||||
;;; Copyright © 2024 Troy Figiel <troy@troyfigiel.com>
|
||||
;;; Copyright © 2024 Sharlatan Hellseher <sharlatanus@gmail.com>
|
||||
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (rosenthal build-system go-vendored)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix store)
|
||||
#:use-module (guix monads)
|
||||
#:use-module (guix search-paths)
|
||||
#:use-module (rosenthal utils download)
|
||||
#:use-module (guix build-system)
|
||||
#:use-module (guix build-system gnu)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (rosenthal utils download)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 regex)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-34)
|
||||
#:use-module (srfi srfi-35)
|
||||
#:use-module (guix build-system go)
|
||||
#:export (%default-go-vendored-imported-modules
|
||||
%default-go-vendored-modules
|
||||
go-vendored-build-system))
|
||||
|
||||
;; Commentary:
|
||||
;;
|
||||
;; Standard build procedure for packages using the Go build system. It is
|
||||
;; implemented as an extension of 'gnu-build-system'.
|
||||
;;
|
||||
;; Code:
|
||||
|
||||
(define (go-target target)
|
||||
;; Parse the nix-system equivalent of the target and set the
|
||||
;; target for compilation accordingly.
|
||||
(match (string-split (gnu-triplet->nix-system target) #\-)
|
||||
((arch os)
|
||||
(list (match arch
|
||||
("aarch64" "arm64")
|
||||
("armhf" "arm")
|
||||
("powerpc64le" "ppc64le")
|
||||
("powerpc64" "ppc64")
|
||||
("i686" "386")
|
||||
("x86_64" "amd64")
|
||||
("mips64el" "mips64le")
|
||||
("loongarch64" "loong64")
|
||||
(_ arch))
|
||||
(match os
|
||||
((or "mingw32" "cygwin") "windows")
|
||||
("gnu" "hurd")
|
||||
(_ os))))
|
||||
(_
|
||||
(raise
|
||||
(condition
|
||||
(&unsupported-cross-compilation-target-error
|
||||
(build-system go-vendored-build-system)
|
||||
(target target)))))))
|
||||
|
||||
(define %default-go-vendored-imported-modules
|
||||
;; Build-side modules imported and used by default.
|
||||
`(,@%default-gnu-imported-modules
|
||||
@@ -74,223 +25,50 @@
|
||||
(guix build utils)
|
||||
(rosenthal build go-vendored-build-system)))
|
||||
|
||||
(define (default-go)
|
||||
(@* (gnu packages golang) go))
|
||||
|
||||
(define (default-gccgo)
|
||||
(@* (gnu packages gcc) gccgo-15))
|
||||
|
||||
(define (make-go-std)
|
||||
(@* (gnu packages golang) make-go-std))
|
||||
|
||||
(define* (lower name
|
||||
#:key source inputs native-inputs outputs system target
|
||||
(go (if (supported-package? (default-go))
|
||||
(default-go)
|
||||
(default-gccgo)))
|
||||
vendor-hash
|
||||
#:allow-other-keys
|
||||
#:rest arguments)
|
||||
"Return a bag for NAME."
|
||||
(define* (lower name #:key source go vendor-hash #:allow-other-keys #:rest rest)
|
||||
(define private-keywords
|
||||
'(#:target #:go #:vendor-hash #:inputs #:native-inputs))
|
||||
'(#:vendor-hash))
|
||||
|
||||
(define inputs-with-cache
|
||||
;; XXX: Avoid a circular dependency. This should be rewritten with
|
||||
;; 'package-mapping' or similar.
|
||||
(let ((go-std-name (string-append (package-name go) "-std")))
|
||||
(if (string-prefix? go-std-name name)
|
||||
inputs
|
||||
(cons `(,go-std-name ,((make-go-std) go)) inputs))))
|
||||
(define go-lower
|
||||
(build-system-lower go-build-system))
|
||||
|
||||
(define go-bag
|
||||
(apply go-lower name
|
||||
#:source source
|
||||
#:go go
|
||||
rest))
|
||||
|
||||
(bag
|
||||
(name name)
|
||||
(system system)
|
||||
(target target)
|
||||
(build-inputs `(,@(if source
|
||||
`(("source" ,source))
|
||||
'())
|
||||
,@(if (and source vendor-hash)
|
||||
`(("vendored-go-dependencies"
|
||||
,(origin
|
||||
(method (go-mod-vendor #:go go))
|
||||
(uri source)
|
||||
(sha256 vendor-hash))))
|
||||
'())
|
||||
,@native-inputs
|
||||
,@`(("go" ,go))
|
||||
,@(if target '() inputs-with-cache)
|
||||
,@(if target
|
||||
;; Use the standard cross inputs of
|
||||
;; 'gnu-build-system'.
|
||||
(standard-cross-packages target 'host)
|
||||
'())
|
||||
;; Keep the standard inputs of 'gnu-build-system'.
|
||||
,@(standard-packages)))
|
||||
(host-inputs (if target inputs-with-cache '()))
|
||||
|
||||
;; The cross-libc is really a target package, but for bootstrapping
|
||||
;; reasons, we can't put it in 'host-inputs'. Namely, 'cross-gcc' is a
|
||||
;; native package, so it would end up using a "native" variant of
|
||||
;; 'cross-libc' (built with 'gnu-build'), whereas all the other packages
|
||||
;; would use a target variant (built with 'gnu-cross-build'.)
|
||||
(target-inputs (if target
|
||||
(standard-cross-packages target 'target)
|
||||
'()))
|
||||
|
||||
(outputs outputs)
|
||||
(build (if target go-vendored-cross-build go-vendored-build))
|
||||
(arguments (strip-keyword-arguments private-keywords arguments))))
|
||||
|
||||
(define* (go-vendored-build name inputs
|
||||
#:key
|
||||
source
|
||||
(phases '%standard-phases)
|
||||
(outputs '("out"))
|
||||
(search-paths '())
|
||||
(install-source? #t)
|
||||
(embed-files ''())
|
||||
(import-path ".")
|
||||
(unpack-path "")
|
||||
(build-flags ''())
|
||||
(skip-build? #f)
|
||||
(tests? #t)
|
||||
(test-flags ''())
|
||||
(test-subdirs ''("..."))
|
||||
(parallel-build? #t)
|
||||
(parallel-tests? #t)
|
||||
(allow-go-reference? #f)
|
||||
(system (%current-system))
|
||||
(goarch #f)
|
||||
(goos #f)
|
||||
(guile #f)
|
||||
(imported-modules %default-go-vendored-imported-modules)
|
||||
(modules %default-go-vendored-modules)
|
||||
(substitutable? #t))
|
||||
(define builder
|
||||
(with-imported-modules imported-modules
|
||||
#~(begin
|
||||
(use-modules #$@modules)
|
||||
(go-vendored-build #:name #$name
|
||||
#:source #+source
|
||||
#:system #$system
|
||||
#:phases #$phases
|
||||
#:outputs #$(outputs->gexp outputs)
|
||||
#:goarch #$goarch
|
||||
#:goos #$goos
|
||||
#:embed-files #$embed-files
|
||||
#:search-paths '#$(sexp->gexp
|
||||
(map search-path-specification->sexp
|
||||
search-paths))
|
||||
#:install-source? #$install-source?
|
||||
#:import-path #$import-path
|
||||
#:unpack-path #$unpack-path
|
||||
#:build-flags #$build-flags
|
||||
#:skip-build? #$skip-build?
|
||||
#:tests? #$tests?
|
||||
#:test-flags #$test-flags
|
||||
#:test-subdirs #$test-subdirs
|
||||
#:parallel-build? #$parallel-build?
|
||||
#:parallel-tests? #$parallel-tests?
|
||||
#:allow-go-reference? #$allow-go-reference?
|
||||
#:inputs #$(input-tuples->gexp inputs)))))
|
||||
|
||||
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
|
||||
system #:graft? #f)))
|
||||
(gexp->derivation name builder
|
||||
#:system system
|
||||
#:graft? #f
|
||||
#:substitutable? substitutable?
|
||||
#:guile-for-build guile)))
|
||||
|
||||
(define* (go-vendored-cross-build name
|
||||
#:key
|
||||
source target
|
||||
build-inputs target-inputs host-inputs
|
||||
(phases '%standard-phases)
|
||||
(outputs '("out"))
|
||||
(search-paths '())
|
||||
(native-search-paths '())
|
||||
(install-source? #t)
|
||||
(import-path ".")
|
||||
(unpack-path "")
|
||||
(build-flags ''())
|
||||
(skip-build? #f)
|
||||
(tests? #f) ; nothing can be done
|
||||
(test-flags ''())
|
||||
(test-subdirs ''("..."))
|
||||
(parallel-build? #t)
|
||||
(parallel-tests? #t)
|
||||
(allow-go-reference? #f)
|
||||
(system (%current-system))
|
||||
(goarch (first (go-target target)))
|
||||
(goos (last (go-target target)))
|
||||
(embed-files ''())
|
||||
(guile #f)
|
||||
(imported-modules %default-go-vendored-imported-modules)
|
||||
(modules %default-go-vendored-modules)
|
||||
(substitutable? #t))
|
||||
"Cross-build NAME using GO, where TARGET is a GNU triplet and with INPUTS."
|
||||
(define builder
|
||||
(with-imported-modules imported-modules
|
||||
#~(begin
|
||||
(use-modules #$@(sexp->gexp modules))
|
||||
|
||||
(define %build-host-inputs
|
||||
#+(input-tuples->gexp build-inputs))
|
||||
|
||||
(define %build-target-inputs
|
||||
(append #$(input-tuples->gexp host-inputs)
|
||||
#+(input-tuples->gexp target-inputs)))
|
||||
|
||||
(define %build-inputs
|
||||
(append %build-host-inputs %build-target-inputs))
|
||||
|
||||
(define %outputs
|
||||
#$(outputs->gexp outputs))
|
||||
|
||||
(go-vendored-build #:name #$name
|
||||
#:source #+source
|
||||
#:system #$system
|
||||
#:phases #$phases
|
||||
#:outputs %outputs
|
||||
#:target #$target
|
||||
#:goarch #$goarch
|
||||
#:goos #$goos
|
||||
#:embed-files #$embed-files
|
||||
#:inputs %build-target-inputs
|
||||
#:native-inputs %build-host-inputs
|
||||
#:search-paths '#$(map search-path-specification->sexp
|
||||
search-paths)
|
||||
#:native-search-paths '#$(map
|
||||
search-path-specification->sexp
|
||||
native-search-paths)
|
||||
#:install-source? #$install-source?
|
||||
#:import-path #$import-path
|
||||
#:unpack-path #$unpack-path
|
||||
#:build-flags #$build-flags
|
||||
#:skip-build? #$skip-build?
|
||||
#:tests? #$tests?
|
||||
#:test-flags #$test-flags
|
||||
#:test-subdirs #$test-subdirs
|
||||
#:parallel-build? #$parallel-build?
|
||||
#:parallel-tests? #$parallel-tests?
|
||||
#:make-dynamic-linker-cache? #f ;cross-compiling
|
||||
#:allow-go-reference? #$allow-go-reference?
|
||||
#:inputs %build-inputs))))
|
||||
|
||||
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
|
||||
system #:graft? #f)))
|
||||
(gexp->derivation name builder
|
||||
#:system system
|
||||
#:target target
|
||||
#:graft? #f
|
||||
#:substitutable? substitutable?
|
||||
#:guile-for-build guile)))
|
||||
(inherit go-bag)
|
||||
(build-inputs
|
||||
`(,@(if (and source vendor-hash)
|
||||
`(("vendored-go-dependencies"
|
||||
,(origin
|
||||
(method (go-mod-vendor #:go go))
|
||||
(uri source)
|
||||
(file-name (string-append name "-vendored-go-dependencies"))
|
||||
(hash
|
||||
(if (content-hash? vendor-hash)
|
||||
vendor-hash
|
||||
(content-hash vendor-hash))))))
|
||||
'())
|
||||
,@(bag-build-inputs go-bag)))
|
||||
(build (bag-build go-bag))
|
||||
(arguments
|
||||
(substitute-keyword-arguments
|
||||
(strip-keyword-arguments private-keywords (bag-arguments go-bag))
|
||||
((#:imported-modules imported-modules '())
|
||||
(if (null? imported-modules)
|
||||
%default-go-vendored-imported-modules
|
||||
imported-modules))
|
||||
((#:modules modules '())
|
||||
(if (null? modules)
|
||||
%default-go-vendored-modules
|
||||
modules))))))
|
||||
|
||||
(define go-vendored-build-system
|
||||
(build-system
|
||||
(name 'go-vendored)
|
||||
(description
|
||||
"Build system for Go programs")
|
||||
"Build system for Go programs, with vendored dependencies")
|
||||
(lower lower)))
|
||||
@@ -6,7 +6,7 @@
|
||||
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
|
||||
#:use-module ((guix build go-build-system) #:prefix go:)
|
||||
#:export (%standard-phases
|
||||
go-vendored-build))
|
||||
go-build))
|
||||
|
||||
(define* (unpack-vendored-dependencies #:key native-inputs inputs #:allow-other-keys)
|
||||
(let ((vendored-dependencies
|
||||
@@ -24,6 +24,6 @@
|
||||
(replace 'install-license-files
|
||||
(assoc-ref gnu:%standard-phases 'install-license-files))))
|
||||
|
||||
(define* (go-vendored-build #:key inputs (phases %standard-phases)
|
||||
#:allow-other-keys #:rest args)
|
||||
(define* (go-build #:key inputs (phases %standard-phases)
|
||||
#:allow-other-keys #:rest args)
|
||||
(apply gnu:gnu-build #:inputs inputs #:phases phases args))
|
||||
@@ -1,66 +0,0 @@
|
||||
{
|
||||
"appLauncher": {
|
||||
"terminalCommand": "wezterm start --"
|
||||
},
|
||||
"colorSchemes": {
|
||||
"darkMode": false,
|
||||
"predefinedScheme": "Nord"
|
||||
},
|
||||
"dock": {
|
||||
"displayMode": "exclusive",
|
||||
"enabled": true,
|
||||
"position": "left",
|
||||
"size": 2
|
||||
},
|
||||
"osd": {
|
||||
"enabled": true,
|
||||
"enabledTypes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3
|
||||
]
|
||||
},
|
||||
"sessionMenu": {
|
||||
"countdownDuration": 10000,
|
||||
"enableCountdown": true,
|
||||
"largeButtonsLayout": "single-row",
|
||||
"largeButtonsStyle": true,
|
||||
"position": "center",
|
||||
"powerOptions": [
|
||||
{
|
||||
"action": "lock",
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"action": "suspend",
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"action": "hibernate",
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"action": "reboot",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"action": "logout",
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"action": "shutdown",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"action": "rebootToUefi",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"showHeader": true,
|
||||
"showNumberLabels": true
|
||||
},
|
||||
"wallpaper": {
|
||||
"enabled": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
[bar.default]
|
||||
capsule = true
|
||||
concave_edge_corners = false
|
||||
margin_ends = 0
|
||||
radius = 0
|
||||
|
||||
[dock]
|
||||
concave_edge_corners = false
|
||||
enabled = true
|
||||
launcher_position = "start"
|
||||
position = "left"
|
||||
show_dots = true
|
||||
|
||||
[shell]
|
||||
polkit_agent = true
|
||||
|
||||
[[shell.session.actions]]
|
||||
action = "reboot"
|
||||
variant = "default"
|
||||
|
||||
[[shell.session.actions]]
|
||||
action = "shutdown"
|
||||
variant = "destructive"
|
||||
|
||||
[theme]
|
||||
builtin = "Nord"
|
||||
mode = "light"
|
||||
|
||||
[wallpaper]
|
||||
enabled = false
|
||||
@@ -16,7 +16,7 @@
|
||||
#:use-module (gnu home services)
|
||||
#:use-module (gnu home services shepherd)
|
||||
;; Guix packages
|
||||
#:autoload (rosenthal packages wm) (noctalia)
|
||||
#:autoload (gnu packages window-management) (noctalia-shell)
|
||||
#:export (home-graphical-session-service-type
|
||||
home-graphical-session-configuration
|
||||
|
||||
@@ -53,8 +53,9 @@
|
||||
(let ((name (in-vicinity directory name)))
|
||||
(and (string-match pattern name)
|
||||
(access? name O_RDWR)))))
|
||||
(or (reverse (scandir directory))
|
||||
'())))
|
||||
(reverse
|
||||
(or (scandir directory)
|
||||
'()))))
|
||||
|
||||
(if socket
|
||||
(let ((display
|
||||
@@ -194,7 +195,7 @@
|
||||
|
||||
(define-configuration/no-serialization home-noctalia-configuration
|
||||
(noctalia
|
||||
(file-like noctalia)
|
||||
(file-like noctalia-shell)
|
||||
"File-like object to provide @command{/bin/noctalia}."))
|
||||
|
||||
(define home-noctalia-shepherd-service
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix profiles)
|
||||
#:use-module (guix records)
|
||||
#:use-module (guix search-paths)
|
||||
#:autoload (guix self) (make-config.scm)
|
||||
;; Guix System - services
|
||||
#:use-module (gnu services)
|
||||
#:use-module (gnu services configuration)
|
||||
@@ -45,41 +45,21 @@ of Emacs extensions.")
|
||||
(content (manifest
|
||||
(cons (package->manifest-entry emacs)
|
||||
(manifest-entries packages))))))
|
||||
(home-emacs-search-paths
|
||||
(map search-path-specification->sexp
|
||||
(manifest-search-paths
|
||||
(profile-content home-emacs-profile))))
|
||||
(home-emacs-program
|
||||
(program-file "home-emacs-program"
|
||||
(with-imported-modules
|
||||
(source-module-closure
|
||||
'((guix search-paths)
|
||||
(guix build utils)))
|
||||
(cons `((guix config) => ,(make-config.scm))
|
||||
(delete '(guix config)
|
||||
(source-module-closure '((guix profiles)))))
|
||||
#~(begin
|
||||
(use-modules (ice-9 match)
|
||||
(guix search-paths)
|
||||
(guix build utils))
|
||||
(let ((profile #$home-emacs-profile))
|
||||
;; See also (@ (guix profiles) load-profile).
|
||||
(for-each
|
||||
(match-lambda
|
||||
((($ <search-path-specification> variable _ separator) . value)
|
||||
(let ((current (getenv variable)))
|
||||
(setenv variable
|
||||
(if current
|
||||
(if separator
|
||||
(string-append value separator current)
|
||||
value)
|
||||
value)))))
|
||||
(evaluate-search-paths
|
||||
(map sexp->search-path-specification
|
||||
'#$home-emacs-search-paths)
|
||||
(list profile)))
|
||||
(match (command-line)
|
||||
((cmd . args)
|
||||
(apply system*
|
||||
(string-append profile "/bin/" (basename cmd))
|
||||
args)))))))))
|
||||
(guix profiles))
|
||||
(load-profile #$home-emacs-profile)
|
||||
(match (command-line)
|
||||
((cmd . args)
|
||||
(apply system*
|
||||
(string-append #$home-emacs-profile "/bin/" (basename cmd))
|
||||
args))))))))
|
||||
(package
|
||||
(inherit emacs)
|
||||
(name "emacs-wrapper")
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
(define-public cloudflare-warp-bin
|
||||
(package
|
||||
(name "cloudflare-warp-bin")
|
||||
(version "2026.6.880.0")
|
||||
(version "2026.8.2115.0")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "https://pkg.cloudflareclient.com"
|
||||
@@ -49,7 +49,7 @@
|
||||
"cloudflare-warp_" version "_amd64.deb"))
|
||||
(sha256
|
||||
(base32
|
||||
"1wf2p09c1ak4mnnpl5pgnwlfy1x4nmhvsfnapyj1gdys93w4v7iy"))))
|
||||
"1haml4d32ddsryhzinf84h20gcw3y6hb1bzyik0q16vvxg6gqrwn"))))
|
||||
(build-system gnu-build-system)
|
||||
(arguments
|
||||
(list
|
||||
@@ -130,7 +130,7 @@ different needs.")
|
||||
(define-public tuwunel-bin
|
||||
(package
|
||||
(name "tuwunel-bin")
|
||||
(version "1.8.2")
|
||||
(version "1.9.4")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
@@ -140,7 +140,7 @@ different needs.")
|
||||
(file-name (string-append name "-" version ".zst"))
|
||||
(sha256
|
||||
(base32
|
||||
"0v6dlarsdr8rnj3gr7m3la0hv9xv18cyc4jx46qy0lljiwjrcdw2"))))
|
||||
"18ymxl238xzgwr2mp0d8f173qbik20nkzfdf6949xnny2dnqwqkq"))))
|
||||
(build-system gnu-build-system)
|
||||
(arguments
|
||||
(list #:tests? (not (%current-target-system))
|
||||
@@ -189,7 +189,7 @@ the most niche uses.")
|
||||
(define-public komga-bin
|
||||
(package
|
||||
(name "komga-bin")
|
||||
(version "1.26.3")
|
||||
(version "1.29.1")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
@@ -197,7 +197,7 @@ the most niche uses.")
|
||||
"/komga-" version ".jar"))
|
||||
(sha256
|
||||
(base32
|
||||
"09vrygb58zpngq9bp4zl3ip8h5am39nlni5igj6hpirw8p0v2g0n"))))
|
||||
"0d58dvcmbddw2sbymbz2xm73iv9pnzngkzvm4dy123bdxkhzmjp9"))))
|
||||
(build-system copy-build-system)
|
||||
(arguments
|
||||
(list #:install-plan
|
||||
@@ -237,7 +237,7 @@ eBooks.")
|
||||
(define-public navidrome-bin
|
||||
(package
|
||||
(name "navidrome-bin")
|
||||
(version "0.63.2")
|
||||
(version "0.64.2")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
@@ -245,7 +245,7 @@ eBooks.")
|
||||
version "/navidrome_" version "_linux_amd64.tar.gz"))
|
||||
(sha256
|
||||
(base32
|
||||
"1w6lvqyhlgf4xi1jybpgnn5y6ga2cs39i5vv734sj4fcwmpnsk12"))))
|
||||
"0gn5sbx6q1jwz68jm0mkjp3n4sc5rv34vhhbqp16g1l10z8pzn7x"))))
|
||||
(build-system gnu-build-system)
|
||||
(arguments
|
||||
(list #:tests? (not (%current-target-system))
|
||||
@@ -317,7 +317,7 @@ monster-in-the-middle}.")
|
||||
(define-public wakapi-bin
|
||||
(package
|
||||
(name "wakapi-bin")
|
||||
(version "2.17.6")
|
||||
(version "2.18.2")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
@@ -325,7 +325,7 @@ monster-in-the-middle}.")
|
||||
version "/wakapi_linux_amd64.zip"))
|
||||
(sha256
|
||||
(base32
|
||||
"0pcf7n9znjb9yisf6kpxg79rlkxlrifahzp644z1ga5zrc1cjr9q"))))
|
||||
"0fr7948g4ddyzd5ih16w586i689viswzbgykbridvr4sm7q9hkm6"))))
|
||||
(build-system gnu-build-system)
|
||||
(arguments
|
||||
(list #:tests? (not (%current-target-system))
|
||||
@@ -365,7 +365,7 @@ coding statistics.")
|
||||
(define-public wakatime-cli-bin
|
||||
(package
|
||||
(name "wakatime-cli-bin")
|
||||
(version "2.24.4")
|
||||
(version "2.27.13")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "https://github.com/wakatime/wakatime-cli"
|
||||
@@ -373,7 +373,7 @@ coding statistics.")
|
||||
"/wakatime-cli-linux-amd64.zip"))
|
||||
(sha256
|
||||
(base32
|
||||
"19g1y19k76pmnzi7irsk1jb7dvrqjd5884434x1s441v4zz6bynz"))))
|
||||
"12v7cm406vd8f01k8fzpcb68inm1zzlyq9v91n8pn1pfypagdbw9"))))
|
||||
(build-system gnu-build-system)
|
||||
(arguments
|
||||
(list #:tests? (not (%current-target-system))
|
||||
@@ -415,15 +415,15 @@ to WakaTime, which is used by all WakaTime text editor plugins.")
|
||||
(define-public grafana-bin
|
||||
(package
|
||||
(name "grafana-bin")
|
||||
(version "12.4.2")
|
||||
(version "13.2.4")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "https://dl.grafana.com/grafana/release/"
|
||||
version "/grafana_" version "_"
|
||||
"23531306697_linux_amd64.tar.gz"))
|
||||
"38252365904_linux_amd64.tar.gz"))
|
||||
(sha256
|
||||
(base32
|
||||
"07sr78wi5nqlsx1nfj87bzgq29hcflqm6r5f5xcn9gq3m00b4h7j"))))
|
||||
"1awjgdcg79k7rzrx0q73nd5fda7q38jp19jfgrh751fqiyc6b1y4"))))
|
||||
(build-system copy-build-system)
|
||||
(arguments
|
||||
(list #:tests? (not (%current-target-system))
|
||||
@@ -452,7 +452,7 @@ metrics no matter where they are stored.")
|
||||
(define-public prometheus-bin
|
||||
(package
|
||||
(name "prometheus-bin")
|
||||
(version "3.14.0")
|
||||
(version "3.15.1")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "https://github.com/prometheus/prometheus"
|
||||
@@ -460,7 +460,7 @@ metrics no matter where they are stored.")
|
||||
"/prometheus-" version ".linux-amd64.tar.gz"))
|
||||
(sha256
|
||||
(base32
|
||||
"13a76636fw649d89nx4apwbv9jckjxyhrlqmr6cs6yzb37dccrgn"))))
|
||||
"113sv7sdarm67g7fgl8zlxl588mn5z77ds1npzmyznca6a2nhwka"))))
|
||||
(build-system gnu-build-system)
|
||||
(arguments
|
||||
(list #:tests? (not (%current-target-system))
|
||||
@@ -504,7 +504,7 @@ observed.")
|
||||
(define-public mimir-bin
|
||||
(package
|
||||
(name "mimir-bin")
|
||||
(version "3.0.4")
|
||||
(version "3.2.3")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
@@ -512,7 +512,7 @@ observed.")
|
||||
version "/mimir-linux-amd64"))
|
||||
(sha256
|
||||
(base32
|
||||
"09bhfbax659p1svzk8gq37vckqd62xsr219ab8f4r36c74ml3vz8"))))
|
||||
"17rhn69z3vvkxhfjr14gv7zx22x1spgf1cyj8gc0zidwy09d8wzj"))))
|
||||
(build-system copy-build-system)
|
||||
(arguments
|
||||
(list #:tests? (not (%current-target-system))
|
||||
@@ -544,7 +544,7 @@ multi-tenant, long-term storage for Prometheus.")
|
||||
(define-public loki-bin
|
||||
(package
|
||||
(name "loki-bin")
|
||||
(version "3.7.6")
|
||||
(version "3.7.9")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
@@ -552,7 +552,7 @@ multi-tenant, long-term storage for Prometheus.")
|
||||
version "/loki-linux-amd64.zip"))
|
||||
(sha256
|
||||
(base32
|
||||
"1sj8a9nmva2lnvbca8x62wy2lwlhnahdr99rpw814n0nfm117lh9"))))
|
||||
"1pc15vwi3d9knx3kjix9mv99n5hbj8h6dir71ibb6cz7ikigm98p"))))
|
||||
(build-system copy-build-system)
|
||||
(arguments
|
||||
(list #:install-plan
|
||||
@@ -578,7 +578,7 @@ rather a set of labels for each log stream.")
|
||||
(package
|
||||
(inherit %binary-source)
|
||||
(name "alloy")
|
||||
(version "1.18.1")
|
||||
(version "1.21.2")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
@@ -586,13 +586,13 @@ rather a set of labels for each log stream.")
|
||||
version "/alloy-linux-amd64.zip"))
|
||||
(sha256
|
||||
(base32
|
||||
"0g28gg013a8i3d35aqfxhsp94hzp65dni6lg6si50flqqg5m7j7s"))))))
|
||||
"1kq4gz8aza3gwvzkgnw00rclsphlnkcsqwq14n2724j00rmb9b8y"))))))
|
||||
|
||||
(define-public %alloy-source-aarch64-linux
|
||||
(package
|
||||
(inherit %binary-source)
|
||||
(name "alloy")
|
||||
(version "1.18.1")
|
||||
(version "1.21.2")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
@@ -600,7 +600,7 @@ rather a set of labels for each log stream.")
|
||||
version "/alloy-linux-arm64.zip"))
|
||||
(sha256
|
||||
(base32
|
||||
"1mknhvxbppcg5x2lwk7832l6wlk2h7cm7y8ay34xc515wb7ld529"))))))
|
||||
"00gld9kxrj0xrci519vcaj4rxbcr6zk5204gq40g2pyf9d4sf8ip"))))))
|
||||
|
||||
(define-public alloy-bin
|
||||
(binary-package
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
(define-public limine
|
||||
(package
|
||||
(name "limine")
|
||||
(version "11.3.1")
|
||||
(version "12.9.4")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
@@ -47,7 +47,7 @@
|
||||
"/download/v" version "/limine-" version ".tar.xz"))
|
||||
(sha256
|
||||
(base32
|
||||
"0d0221xc3374xq6bx26dkmidcf6slxc6dq6qnjdc3lrx3xda21jw"))))
|
||||
"1hzl8701h26cadq004jvv55yb2q2ydnd09zxbpghk3c1xiin8mqb"))))
|
||||
(build-system gnu-build-system)
|
||||
(arguments
|
||||
(list #:tests? #f
|
||||
@@ -84,8 +84,7 @@
|
||||
(description
|
||||
"Limine is a multiprotocol bootloader and boot manager. It's also used as
|
||||
the reference implementation for the Limine boot protocol.")
|
||||
(license license:bsd-2)
|
||||
(properties '((disable-updater? . #t)))))
|
||||
(license license:bsd-2)))
|
||||
|
||||
|
||||
;;;
|
||||
@@ -103,7 +102,7 @@ the reference implementation for the Limine boot protocol.")
|
||||
(define-public systemd-stub
|
||||
(package
|
||||
(name "systemd-stub")
|
||||
(version "261.2")
|
||||
(version "262.1")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -112,7 +111,7 @@ the reference implementation for the Limine boot protocol.")
|
||||
(file-name (git-file-name "name" version))
|
||||
(sha256
|
||||
(base32
|
||||
"014mjygixfh9j1p1f09xgy114v5lfah6hwh8xcscy1nqxk3p2hf3"))))
|
||||
"1v2i19b9iq83q9krhy69wn59xdianql69gyblx9ljxr37x0phkq4"))))
|
||||
(build-system meson-build-system)
|
||||
(arguments
|
||||
(list #:tests? #f
|
||||
@@ -146,7 +145,7 @@ Supports measured and/or verified boot environments.")
|
||||
(define-public ukify
|
||||
(package
|
||||
(name "ukify")
|
||||
(version "261.2")
|
||||
(version "262.1")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -155,7 +154,7 @@ Supports measured and/or verified boot environments.")
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"014mjygixfh9j1p1f09xgy114v5lfah6hwh8xcscy1nqxk3p2hf3"))))
|
||||
"1v2i19b9iq83q9krhy69wn59xdianql69gyblx9ljxr37x0phkq4"))))
|
||||
(build-system pyproject-build-system)
|
||||
(arguments
|
||||
(list #:phases
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
(define bitwarden
|
||||
(package
|
||||
(name "bitwarden")
|
||||
(version "2026.3.0")
|
||||
(version "2026.10.0")
|
||||
(source (origin
|
||||
(method url-fetch/zipbomb)
|
||||
(uri (string-append "https://github.com/bitwarden/clients"
|
||||
@@ -28,7 +28,7 @@
|
||||
"/dist-firefox-" version ".zip"))
|
||||
(sha256
|
||||
(base32
|
||||
"1jsc9w8w1vix7gzcrlxg3aslqnr27hwhaqvf0slhc7s3dgwnfrqq"))))
|
||||
"0k8c1wfq9yzgyq7whj5gbp00pbkr4a7aklkd3ybczi4zws1d55v8"))))
|
||||
(build-system copy-build-system)
|
||||
(arguments
|
||||
(list #:install-plan
|
||||
@@ -103,7 +103,7 @@ results are added in a sidebar next to search engine results.")
|
||||
(define ohmyech
|
||||
(package
|
||||
(name "ohmyech")
|
||||
(version "1.2")
|
||||
(version "1.5")
|
||||
(properties
|
||||
'((addon-id . "{46b8ab0b-8adf-4e43-ad67-acef5a8d45c9}")
|
||||
(hidden? . #t)
|
||||
@@ -112,11 +112,11 @@ results are added in a sidebar next to search engine results.")
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/27justin/ohmyech")
|
||||
(commit "aa0cf4cc5c4bcb6ce508d8a4e7ee4c95c2e63cbe")))
|
||||
(commit "1faea936f6507580c6b2bd04dc57449398c799f4")))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"1cqgfv2q7shisi9ijac5s85xy9q2rz9f9hxwq3q41vfgrcvd8zng"))
|
||||
"0r1kipfy3afgc0jabav7q7h90d153nly1iakn4pfrwf8401n4qsi"))
|
||||
(modules '((guix build utils)))
|
||||
(snippet
|
||||
#~(substitute* "manifest.json"
|
||||
|
||||
@@ -11,11 +11,3 @@
|
||||
#:use-module (guix git-download)
|
||||
;; Guix packages
|
||||
#:use-module (gnu packages ci))
|
||||
|
||||
(define-public cuirass/dolly
|
||||
(package
|
||||
(inherit
|
||||
(package-with-extra-patches cuirass
|
||||
(rosenthal-patches "cuirass-templates-Add-more-forges.patch")))
|
||||
(name "cuirass-dolly")
|
||||
(properties '((disable-updater? . #t)))))
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
(define-public dnsmasq-china-list
|
||||
;; No version.
|
||||
(let ((commit "7da1a5a5885c3f19dd000aa76a25e457352dd696")
|
||||
(revision "21"))
|
||||
(let ((commit "c79474a5445e7ebbde7275648b1078a0582510ab")
|
||||
(revision "22"))
|
||||
(package
|
||||
(name "dnsmasq-china-list")
|
||||
(version (git-version "0.0.0" revision commit))
|
||||
@@ -26,7 +26,7 @@
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"04dgra5123k94k0q1v9f7rmk3zdzc429hkr6jvn1lx4cxfcs0zfq"))))
|
||||
"0ifgkg7l31623q46cx0ymcfvw4gkmnir47z2xdn203icwic6224y"))))
|
||||
(build-system copy-build-system)
|
||||
(arguments
|
||||
(list #:install-plan
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
(define-module (rosenthal packages emacs-xyz)
|
||||
;; Utilities
|
||||
#:use-module (guix deprecation)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:use-module (guix packages)
|
||||
@@ -50,7 +51,7 @@ editing Caddyfiles, configuration files for @code{caddy}.")
|
||||
(define-public emacs-consult-ghostel
|
||||
(package
|
||||
(name "emacs-consult-ghostel")
|
||||
(version "0.53.0")
|
||||
(version "0.59.0")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -59,7 +60,7 @@ editing Caddyfiles, configuration files for @code{caddy}.")
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"0ph1gjl3915wgf7qz2c389gnm64yn07q9jb69dyqy6r8fkzmyd37"))))
|
||||
"1rfs5jd2xgpilh9xv9mpjpqn7b71iixkgbnpmqi3nwzb8dz0rqnm"))))
|
||||
(build-system emacs-build-system)
|
||||
(arguments
|
||||
(list #:tests? #f ;no tests
|
||||
@@ -91,30 +92,6 @@ editing Caddyfiles, configuration files for @code{caddy}.")
|
||||
"14d6nvagcri0r687y3m179ijmnad89m5d5dj2rn2p6rpfc5nssr0"))))))
|
||||
(name "emacs-eat-dolly")))
|
||||
|
||||
(define-public emacs-flycheck-eglot
|
||||
(let ((commit "cd1dd78cec0ae1f566c765d98bbff322cc7b67ef")
|
||||
(revision "0"))
|
||||
(package
|
||||
(name "emacs-flycheck-eglot")
|
||||
(version (git-version "1.0" revision commit))
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/flycheck/flycheck-eglot")
|
||||
(commit commit)))
|
||||
(sha256 (base32 "19i2a33mpddd64mnvjk247ayn325p66lknm9pqjb0ccjfwi54sml"))))
|
||||
(build-system emacs-build-system)
|
||||
(propagated-inputs (list emacs-flycheck))
|
||||
(home-page "https://github.com/flycheck/flycheck-eglot")
|
||||
(synopsis "Flycheck support for eglot")
|
||||
(description
|
||||
"This package provides a simple \"glue\" minor mode that allows Flycheck
|
||||
and Eglot to work together. Thus, the Flycheck frontend can display the results
|
||||
of syntactic checks performed by the LSP server.")
|
||||
(license (list license:gpl3+ license:expat))
|
||||
(properties '((disable-updater? . #t))))))
|
||||
|
||||
(define-public emacs-isearch-mb
|
||||
(package
|
||||
(name "emacs-isearch-mb")
|
||||
@@ -139,8 +116,8 @@ some keybindings are slightly simplified.")
|
||||
(properties '((disable-updater? . #t)))))
|
||||
|
||||
(define-public emacs-kdl-mode
|
||||
(let ((commit "2d849e298199f490e4894c01764a8a83decd704a")
|
||||
(revision "0"))
|
||||
(let ((commit "e966ed4b53f8a72b88a016e61bcadec42f317e39")
|
||||
(revision "1"))
|
||||
(package
|
||||
(name "emacs-kdl-mode")
|
||||
(version (git-version "0.0.1" revision commit))
|
||||
@@ -152,7 +129,7 @@ some keybindings are slightly simplified.")
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"18va5ipay9grbv84kwq9ji4dn1sabnzydj4hb1mjd9mbbibw1wg4"))))
|
||||
"070ngannx77m39hwvsdr4pk17ki1l4nzsi746w21q5mfbp8gl9w1"))))
|
||||
(build-system emacs-build-system)
|
||||
(arguments (list #:tests? #f)) ;No tests.
|
||||
(home-page "https://github.com/taquangtrung/emacs-kdl-mode")
|
||||
@@ -174,29 +151,7 @@ some keybindings are slightly simplified.")
|
||||
(name "emacs-magit-delta-dolly")
|
||||
(properties '((disable-updater? . #t)))))
|
||||
|
||||
(define-public emacs-majutsu/dolly
|
||||
(let ((commit "56b6e263cd4ecaf8e44e955647bffafe56f54f34")
|
||||
(revision "5"))
|
||||
(package
|
||||
(inherit emacs-majutsu)
|
||||
(name "emacs-majutsu-dolly")
|
||||
(version (git-version "0.6.0" revision commit))
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/0WD0/majutsu")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"0ljq6psp8rar0sksfnjydji2sm3vvhpvpi4yay14wa6ldaclihx4"))))
|
||||
(arguments
|
||||
(substitute-keyword-arguments arguments
|
||||
((#:tests? _ #t) #f)))
|
||||
(propagated-inputs
|
||||
(modify-inputs propagated-inputs
|
||||
(prepend emacs-consult emacs-plz)))
|
||||
(properties '((disable-updater? . #t))))))
|
||||
(define-deprecated-package emacs-majutsu/dolly "emacs-majutsu-dolly" emacs-majutsu)
|
||||
|
||||
(define-public emacs-msgpack
|
||||
(let ((commit "5353a7b2da854c843cbec4536996242001f63471")
|
||||
@@ -249,45 +204,12 @@ and it's subcommands.")
|
||||
(properties
|
||||
'((disable-updater? . #t))))))
|
||||
|
||||
(define-public emacs-reader
|
||||
(let ((commit "a0e3615adbf520a5743bbbfd7da6d2bb8478b30b")
|
||||
(revision "2"))
|
||||
(package
|
||||
(name "emacs-reader")
|
||||
(version (git-version "0.3.2" revision commit))
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://codeberg.org/divyaranjan/emacs-reader")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32 "012i36l5wgzw4mbxr2knb96f7x95qfg0pqa7dfam23fmsfw57fy0"))))
|
||||
(build-system emacs-build-system)
|
||||
(arguments
|
||||
(list
|
||||
#:tests? #f ;no tests
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'install 'build-module
|
||||
(lambda _
|
||||
(invoke "make" "USE_PKGCONFIG=no")))
|
||||
(add-after 'build-module 'install-module
|
||||
(lambda _
|
||||
(install-file "render-core.so" (elpa-directory #$output)))))))
|
||||
(inputs (list mupdf))
|
||||
(home-page "https://codeberg.org/divyaranjan/emacs-reader")
|
||||
(synopsis "Emacs document reader")
|
||||
(description
|
||||
"GNU Emacs document reader that supports all major document formats.")
|
||||
(license license:gpl3+)
|
||||
(properties '((disable-updater? . #t))))))
|
||||
(define-deprecated-package emacs-reader emacs-emureader)
|
||||
|
||||
(define-public emacs-tramp-rpc
|
||||
(package
|
||||
(name "emacs-tramp-rpc")
|
||||
(version "0.13.1")
|
||||
(version "0.15.0")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -296,7 +218,7 @@ and it's subcommands.")
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"1991b8vc3k3kkm77ad5c9z8jx9nxpxbmv26vv1y5v7z3cdp12wzj"))))
|
||||
"168v9hfawrb496da3mhy1a4pignbfa5109q3x5rlk7pjaf1z7836"))))
|
||||
(build-system emacs-build-system)
|
||||
(arguments
|
||||
(list #:lisp-directory "lisp"
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (rosenthal packages file-systems)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix git-download)
|
||||
#:use-module (gnu packages file-systems))
|
||||
|
||||
(define-public zfs-cachyos
|
||||
(let ((commit "fb48c76e17d3e0092fbba430a9eec1960e1b9961")
|
||||
(revision "0"))
|
||||
(package/inherit zfs
|
||||
(name "zfs-cachyos")
|
||||
(version (git-version "2.4.5" revision commit))
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/CachyOS/zfs")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32 "1zb3rs40fhkhn2fd3g5aspm50cy4xvg84ah84h5brz6abvfr1rg4")))))))
|
||||
@@ -44,7 +44,7 @@
|
||||
(define-public prismlauncher/dolly
|
||||
(package
|
||||
(name "prismlauncher-dolly")
|
||||
(version "11.0.3")
|
||||
(version "11.1.1")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -54,7 +54,7 @@
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"04dv4c849lghhqq25p58l5aq37r2kvx9297w1139x9ajab97xhhf"))
|
||||
"1dm1fdb2z6jyb04ml2jxdqgaxr14a6a4i41r89fdpg22ngx12kkk"))
|
||||
(modules '((guix build utils)))
|
||||
(snippet
|
||||
'(substitute* "launcher/CMakeLists.txt"
|
||||
@@ -101,6 +101,7 @@
|
||||
"libX11.so"
|
||||
"libXcursor.so"
|
||||
"libXext.so"
|
||||
"libXi.so"
|
||||
"libXrandr.so"
|
||||
"libXxf86vm.so"
|
||||
;; openal
|
||||
@@ -124,6 +125,7 @@
|
||||
libarchive
|
||||
libusb
|
||||
libx11
|
||||
libxi
|
||||
libxcursor
|
||||
libxext
|
||||
libxrandr
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (rosenthal packages linux)
|
||||
;; Guile builtins
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 regex)
|
||||
;; Utilities
|
||||
#:use-module (guix diagnostics)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix utils)
|
||||
;; Guix origin methods
|
||||
#:use-module (guix download)
|
||||
#:use-module (guix git-download)
|
||||
;; Guix packages
|
||||
#:use-module (gnu packages linux)
|
||||
#:export (default-initrd-configs
|
||||
cachyos-configs))
|
||||
|
||||
(define* (default-initrd-configs
|
||||
#:optional
|
||||
(system (or (%current-target-system)
|
||||
(%current-system))))
|
||||
"Kernel configurations required by 'default-linux-libre-initrd-modules'."
|
||||
`("CONFIG_NLS_ISO8859_1=m"
|
||||
|
||||
"CONFIG_CRYPTO_SERPENT=m"
|
||||
"CONFIG_CRYPTO_WP512=m"
|
||||
"CONFIG_DM_CRYPT=m"
|
||||
|
||||
"CONFIG_BLK_DEV_NVME=m"
|
||||
"CONFIG_MMC_BLOCK=m"
|
||||
"CONFIG_SATA_AHCI=m"
|
||||
"CONFIG_USB_STORAGE=m"
|
||||
"CONFIG_USB_UAS=m"
|
||||
,@(if (string-match "^(x86_64|i[3-6]86)-" system)
|
||||
'("CONFIG_PATA_ACPI=m"
|
||||
"CONFIG_PATA_ATIIXP=m"
|
||||
"CONFIG_SCSI_ISCI=m")
|
||||
'())
|
||||
|
||||
"CONFIG_HW_RANDOM_VIRTIO=m"
|
||||
"CONFIG_SCSI_VIRTIO=m"
|
||||
"CONFIG_VIRTIO_BALLOON=m"
|
||||
"CONFIG_VIRTIO_BLK=m"
|
||||
"CONFIG_VIRTIO_CONSOLE=m"
|
||||
"CONFIG_VIRTIO_MMIO=m"
|
||||
"CONFIG_VIRTIO_NET=m"
|
||||
"CONFIG_VIRTIO_PCI=m"
|
||||
|
||||
"CONFIG_HID_GENERIC=m"
|
||||
"CONFIG_USB_HID=m"
|
||||
,@(if (target-riscv64? system)
|
||||
'()
|
||||
'("CONFIG_HID_APPLE=m"))))
|
||||
|
||||
|
||||
;;;
|
||||
;;; linux-cachyos
|
||||
;;; https://github.com/CachyOS/linux-cachyos
|
||||
;;;
|
||||
|
||||
(define* (cachyos-configs #:key (major-version "6")
|
||||
cachy-config?
|
||||
cpusched
|
||||
cc-harder?
|
||||
per-gov?
|
||||
tcp-bbr3?
|
||||
HZ-ticks
|
||||
tickrate
|
||||
preempt
|
||||
hugepage
|
||||
processor-opt)
|
||||
`(,@(match processor-opt
|
||||
('generic
|
||||
'("CONFIG_GENERIC_CPU=y"
|
||||
"CONFIG_MZEN4"
|
||||
"CONFIG_X86_NATIVE_CPU"))
|
||||
('zen4
|
||||
'("CONFIG_GENERIC_CPU"
|
||||
"CONFIG_MZEN4=y"
|
||||
"CONFIG_X86_NATIVE_CPU"))
|
||||
('native
|
||||
'("CONFIG_GENERIC_CPU"
|
||||
"CONFIG_MZEN4"
|
||||
"CONFIG_X86_NATIVE_CPU=y"))
|
||||
(_ '()))
|
||||
,@(if cachy-config?
|
||||
'("CONFIG_CACHY=y")
|
||||
'())
|
||||
,@(match cpusched
|
||||
((or 'cachyos 'bore 'hardened)
|
||||
'("CONFIG_SCHED_BORE=y"))
|
||||
('bmq
|
||||
'("CONFIG_SCHED_ALT=y"
|
||||
"CONFIG_SCHED_BMQ=y"))
|
||||
('eevdf
|
||||
'())
|
||||
('rt
|
||||
'("CONFIG_PREEMPT_RT=y"))
|
||||
('rt-bore
|
||||
'("CONFIG_SCHED_BORE=y"
|
||||
"CONFIG_PREEMPT_RT=y"))
|
||||
(_ '()))
|
||||
,@(match HZ-ticks
|
||||
((or 100 250 500 600 750 1000)
|
||||
`("CONFIG_HZ_300"
|
||||
,(format #f "CONFIG_HZ_~a=y" HZ-ticks)
|
||||
,(format #f "CONFIG_HZ=~a" HZ-ticks)))
|
||||
(300
|
||||
'("CONFIG_HZ_300=y"
|
||||
"CONFIG_HZ=300"))
|
||||
(_ '()))
|
||||
,@(if per-gov?
|
||||
'("CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL"
|
||||
"CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y")
|
||||
'())
|
||||
,@(match tickrate
|
||||
('periodic
|
||||
'("CONFIG_NO_HZ_IDLE"
|
||||
"CONFIG_NO_HZ_FULL"
|
||||
"CONFIG_NO_HZ"
|
||||
"CONFIG_NO_HZ_COMMON"
|
||||
"CONFIG_HZ_PERIODIC=y"))
|
||||
('idle
|
||||
'("CONFIG_HZ_PERIODIC"
|
||||
"CONFIG_NO_HZ_FULL"
|
||||
"CONFIG_NO_HZ_IDLE=y"
|
||||
"CONFIG_NO_HZ"
|
||||
"CONFIG_NO_HZ_COMMON"))
|
||||
('full
|
||||
'("CONFIG_HZ_PERIODIC"
|
||||
"CONFIG_NO_HZ_IDLE"
|
||||
"CONFIG_CONTEXT_TRACKING_FORCE"
|
||||
"CONFIG_NO_HZ_FULL=y"
|
||||
"CONFIG_NO_HZ=y"
|
||||
"CONFIG_NO_HZ_COMMON=y"
|
||||
"CONFIG_CONTEXT_TRACKING=y")))
|
||||
,@(if (not (member cpusched '(rt rt-bore)))
|
||||
(if (version>=? major-version "7.0")
|
||||
(match preempt
|
||||
('full
|
||||
'("CONFIG_PREEMPT=y"
|
||||
"CONFIG_PREEMPT_LAZY"))
|
||||
('lazy
|
||||
'("CONFIG_PREEMPT"
|
||||
"CONFIG_PREEMPT_LAZY=y"))
|
||||
(_ '()))
|
||||
(match preempt
|
||||
('full
|
||||
'("CONFIG_PREEMPT_DYNAMIC=y"
|
||||
"CONFIG_PREEMPT=y"
|
||||
"CONFIG_PREEMPT_VOLUNTARY"
|
||||
"CONFIG_PREEMPT_LAZY"
|
||||
"CONFIG_PREEMPT_NONE"))
|
||||
('lazy
|
||||
'("CONFIG_PREEMPT_DYNAMIC=y"
|
||||
"CONFIG_PREEMPT"
|
||||
"CONFIG_PREEMPT_VOLUNTARY"
|
||||
"CONFIG_PREEMPT_LAZY=y"
|
||||
"CONFIG_PREEMPT_NONE"))
|
||||
('voluntary
|
||||
'("CONFIG_PREEMPT_DYNAMIC"
|
||||
"CONFIG_PREEMPT=y"
|
||||
"CONFIG_PREEMPT_VOLUNTARY=y"
|
||||
"CONFIG_PREEMPT_LAZY"
|
||||
"CONFIG_PREEMPT_NONE"))
|
||||
('none
|
||||
'("CONFIG_PREEMPT_DYNAMIC"
|
||||
"CONFIG_PREEMPT"
|
||||
"CONFIG_PREEMPT_VOLUNTARY"
|
||||
"CONFIG_PREEMPT_LAZY"
|
||||
"CONFIG_PREEMPT_NONE=y"))
|
||||
(_ '())))
|
||||
'())
|
||||
,@(if cc-harder?
|
||||
'("CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE"
|
||||
"CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y")
|
||||
'())
|
||||
,@(if tcp-bbr3?
|
||||
'("CONFIG_TCP_CONG_CUBIC=m"
|
||||
"CONFIG_DEFAULT_CUBIC"
|
||||
"CONFIG_TCP_CONG_BBR=y"
|
||||
"CONFIG_DEFAULT_BBR=y"
|
||||
"CONFIG_DEFAULT_TCP_CONG=\"bbr\""
|
||||
"CONFIG_NET_SCH_FQ_CODEL=m"
|
||||
"CONFIG_NET_SCH_FQ=y"
|
||||
"CONFIG_DEFAULT_FQ_CODEL"
|
||||
"CONFIG_DEFAULT_FQ=y")
|
||||
'())
|
||||
,@(match hugepage
|
||||
('always
|
||||
'("CONFIG_TRANSPARENT_HUGEPAGE_MADVISE"
|
||||
"CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y"))
|
||||
('madvise
|
||||
'("CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS"
|
||||
"CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y"))
|
||||
(_ '()))
|
||||
,@(if (version>=? major-version "7.0")
|
||||
'()
|
||||
'("CONFIG_USER_NS=y"))))
|
||||
|
||||
(define (%kernel-config commit hash)
|
||||
(let ((source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://codeberg.org/hako/kernel-config.git")
|
||||
(commit commit)))
|
||||
(file-name (string-append "kernel-config." (string-take commit 7)))
|
||||
(hash
|
||||
(if (content-hash? hash)
|
||||
hash
|
||||
(content-hash hash))))))
|
||||
(lambda (path)
|
||||
(file-append source path))))
|
||||
|
||||
(define-public linux-cachyos-lts-server
|
||||
(let* ((version "6.18.65-1")
|
||||
(config
|
||||
(%kernel-config
|
||||
"30ca31f1a4b05d9c42f1b9482f6a7419b12453be"
|
||||
(base32 "0qb8mgrj458xxjp3m050lf03wf4j2nz4jpxix068cv0pnvlj3y3k")))
|
||||
(kernel
|
||||
(customize-linux
|
||||
#:name "linux-cachyos-lts-server"
|
||||
#:source
|
||||
(origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
"https://github.com/CachyOS/linux/releases/download/cachyos-"
|
||||
version "/cachyos-" version ".tar.gz"))
|
||||
(sha256
|
||||
(base32 "102ad9k412166b6kdaiql15dynanqm11gppagpi1zx4cz80lwkm0")))
|
||||
#:defconfig (config "/defconfig_server")
|
||||
#:configs
|
||||
(string-join
|
||||
(append (cachyos-configs
|
||||
#:major-version (version-major version)
|
||||
#:cachy-config? #f
|
||||
#:cpusched 'eevdf
|
||||
#:cc-harder? #t
|
||||
#:per-gov? #f
|
||||
#:tcp-bbr3? #t
|
||||
#:HZ-ticks 300
|
||||
#:tickrate 'full
|
||||
#:preempt 'none
|
||||
#:hugepage 'madvise
|
||||
#:processor-opt 'generic)
|
||||
(default-initrd-configs))
|
||||
"\n"))))
|
||||
(package
|
||||
(inherit kernel)
|
||||
(version version)
|
||||
(home-page "https://cachyos.org/")
|
||||
(synopsis "CachyOS Linux kernel (lts + server)")
|
||||
(description "")
|
||||
(supported-systems '("x86_64-linux"))
|
||||
(properties
|
||||
(cons '(disable-updater? . #t)
|
||||
(package-properties kernel))))))
|
||||
|
||||
(define-public linux-cachyos-bore-zen4
|
||||
(let* ((version "7.3.6-1")
|
||||
(config
|
||||
(%kernel-config
|
||||
"f45de89952cd52542e3a3cbf4fcedaa75d817e89"
|
||||
(base32 "12xhs53ihg4k1vgx042acfri174mblbfrcp0199i3fbl0vy0xpaz")))
|
||||
(kernel
|
||||
(customize-linux
|
||||
#:name "linux-cachyos-bore-zen4"
|
||||
#:source
|
||||
(origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
"https://github.com/CachyOS/linux/releases/download/cachyos-"
|
||||
version "/cachyos-" version ".tar.gz"))
|
||||
(sha256
|
||||
(base32 "0gvgp0hwnrdgxs07wlz474c40g15z1r3aq7dq1yi4nn5p09yhp7v"))
|
||||
(patches (map config '("/patches/bore-cachy-7.3.patch"))))
|
||||
#:defconfig (config "/defconfig_desktop")
|
||||
#:configs
|
||||
(string-join
|
||||
(append (cachyos-configs
|
||||
#:major-version (version-major version)
|
||||
#:cachy-config? #t
|
||||
#:cpusched 'bore
|
||||
#:cc-harder? #t
|
||||
#:per-gov? #f
|
||||
#:tcp-bbr3? #t
|
||||
#:HZ-ticks 1000
|
||||
#:tickrate 'full
|
||||
#:preempt 'full
|
||||
#:hugepage 'always
|
||||
#:processor-opt 'zen4)
|
||||
(default-initrd-configs))
|
||||
"\n"))))
|
||||
(package
|
||||
(inherit kernel)
|
||||
(version version)
|
||||
(home-page "https://cachyos.org/")
|
||||
(synopsis "CachyOS Linux kernel (bore + znver4)")
|
||||
(description "")
|
||||
(supported-systems '("x86_64-linux"))
|
||||
(properties
|
||||
(cons '(disable-updater? . #t)
|
||||
(package-properties kernel))))))
|
||||
@@ -65,7 +65,7 @@ users.")
|
||||
(define-public mautrix-telegram
|
||||
(package
|
||||
(name "mautrix-telegram")
|
||||
(version "0.2608.0")
|
||||
(version "0.2610.0")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -74,12 +74,12 @@ users.")
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"1h9nl6ba1lxdy7fxk36asigpxmgav6bw8ydif267cscfq7vxq3hi"))))
|
||||
"1vcb2s3gjmy2zgzn0mqhwf7q64fxnwkk2rwgpzzdm125vamfv0fs"))))
|
||||
(build-system go-vendored-build-system)
|
||||
(arguments
|
||||
(list #:go go-1.26
|
||||
(list #:go go-1.27
|
||||
#:vendor-hash
|
||||
(base32 "0vz2ziaps5l19zzpw2mkxhbnl33pn3srs6ayvblj51ap6dxc47dj")
|
||||
(base32 "0pam76235zni6xpxmxmaddwhbw8fpcb9idlkmsvs085df0kfbf95")
|
||||
#:install-source? #f
|
||||
#:import-path "./cmd/mautrix-telegram"
|
||||
#:phases
|
||||
|
||||
@@ -24,22 +24,20 @@
|
||||
(define-public cloudflared
|
||||
(package
|
||||
(name "cloudflared")
|
||||
(version "2026.8.2")
|
||||
(version "2026.10.3")
|
||||
(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
|
||||
"050xr8yjzrcyj53grvvafpi5d5dl7hjiiv4zjjzb2bcf65rak5za"))))
|
||||
"1f5hvvzwkwa2idchpds4492byf9qph0all3qakwy9d68f688qlwk"))))
|
||||
(build-system go-vendored-build-system)
|
||||
(arguments
|
||||
(list #:go go-1.26
|
||||
(list #:go go-1.27
|
||||
#:vendor-hash (base32 "13abls96kzzw813i09r04agbriv0608cz66c9rsi53xl95fcp91a")
|
||||
#:install-source? #f
|
||||
#:import-path "./cmd/cloudflared"
|
||||
#:build-flags
|
||||
@@ -71,7 +69,7 @@ origin can remain as closed as possible.")
|
||||
(define-public mihomo
|
||||
(package
|
||||
(name "mihomo")
|
||||
(version "1.19.30")
|
||||
(version "1.19.33")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -80,12 +78,12 @@ origin can remain as closed as possible.")
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"07zxbng654wjy3qj776px1ds6kzr30hp832r3pcvjchiabqcab23"))))
|
||||
"0ji0yrv0slsjafir6058dmb5c8h0gr4x84z2r3v3vlbdc78qjqrv"))))
|
||||
(build-system go-vendored-build-system)
|
||||
(arguments
|
||||
(list
|
||||
#:go go-1.26
|
||||
#:vendor-hash (base32 "0vw4xcqmmpq4mkskwlwszb6la1qjyiwy5bbhpji6zsmixwzaxr70")
|
||||
#:go go-1.27
|
||||
#:vendor-hash (base32 "08krx6f9k0n6y9g0ki2djr9qqqy5nx9dh0x2vbx0xf52kp52myf0")
|
||||
#:tests? (not (%current-target-system)) ;TODO: Run test suite.
|
||||
#:install-source? #f
|
||||
#:build-flags
|
||||
@@ -119,7 +117,7 @@ bypass network restrictions." )
|
||||
(define-public sing-box
|
||||
(package
|
||||
(name "sing-box")
|
||||
(version "1.14.0")
|
||||
(version "1.14.3")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -128,12 +126,12 @@ bypass network restrictions." )
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"1yavxj1raksii1sy5j1fp4v54glrbpz9la19l5cpzqw7rn05pzyn"))))
|
||||
"0qysb5c9z8n9dzzvxna9f3pdms88n6rhvjkl94c66almb20pjbqb"))))
|
||||
(build-system go-vendored-build-system)
|
||||
(arguments
|
||||
(list
|
||||
#:go go-1.26
|
||||
#:vendor-hash (base32 "16h4lmpi636dnz760qyihnqxgv3hn4vb9p22j5wjhfx7955gfph6")
|
||||
#:go go-1.27
|
||||
#:vendor-hash (base32 "0dxmrd6arnhq099valg02wzpni2lb3r61yy8haq3y23299lvhry1")
|
||||
#:install-source? #f
|
||||
#:import-path "./cmd/sing-box"
|
||||
#:build-flags
|
||||
@@ -218,7 +216,7 @@ a SOCKS5 proxy.")
|
||||
(define-public tailscale
|
||||
(package
|
||||
(name "tailscale")
|
||||
(version "1.102.3")
|
||||
(version "1.104.2")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -227,7 +225,7 @@ a SOCKS5 proxy.")
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"0pqnc5bxl01nzpg2alb6njwq9k0g9psckw7v3wjfraf228rawd9p"))
|
||||
"1gc9n452qgzv30wca73gjyrcxizrblhndk29147zazxhjha0vjdw"))
|
||||
(patches
|
||||
(rosenthal-patches
|
||||
"tailscale-set-guix-system-PATH-for-SSH.patch"))
|
||||
@@ -240,8 +238,8 @@ a SOCKS5 proxy.")
|
||||
(build-system go-vendored-build-system)
|
||||
(arguments
|
||||
(list
|
||||
#:go go-1.26
|
||||
#:vendor-hash (base32 "01wvidvld4749f9bdsmvi84l005k6lfsqvcn6yw13jikzd8a8qka")
|
||||
#:go go-1.27
|
||||
#:vendor-hash (base32 "1vimwbhaddc52nvp4akrz548z47r6iw7x9f3zjbcsrqaqi5q66sp")
|
||||
#:tests? (not (%current-target-system)) ;TODO: Run test suite.
|
||||
#:install-source? #f
|
||||
#:build-flags
|
||||
|
||||
@@ -18,21 +18,9 @@
|
||||
#:use-module (gnu packages guile)
|
||||
#:use-module (gnu packages package-management))
|
||||
|
||||
(define-public guix/dolly
|
||||
(package
|
||||
(inherit
|
||||
(package-with-extra-patches guix
|
||||
(rosenthal-patches "guix-change-publish-cache-storage.patch")))
|
||||
(name "guix-dolly")
|
||||
(arguments
|
||||
(substitute-keyword-arguments arguments
|
||||
((#:parallel-build? _ #f) #t)
|
||||
((#:tests? _ #t) #f)))
|
||||
(properties '((disable-updater? . #t)))))
|
||||
|
||||
(define guix-for-mirror-substitutes
|
||||
(let ((commit "64d4de2a920445e5992f020e56490f5fcbdbba7c")
|
||||
(revision "6"))
|
||||
(let ((commit "5ceffb60e55b86920fd720817dd24b0e1f900ac1")
|
||||
(revision "7"))
|
||||
(package
|
||||
(inherit guix)
|
||||
(name "guix")
|
||||
@@ -42,19 +30,15 @@
|
||||
(uri (git-reference
|
||||
(url "https://git.guix.gnu.org/guix.git")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(file-name (string-append "guix-" version "-checkout"))
|
||||
(sha256
|
||||
(base32
|
||||
"1j3gz77rrlg62ffxqacg1r0rhibmhbhkh0ygh27ambj495i0mi0b"))))
|
||||
(arguments
|
||||
(substitute-keyword-arguments arguments
|
||||
((#:parallel-build? _ #f) #t)
|
||||
((#:tests? _ #t) #f))))))
|
||||
"0nb0xhd2jlg613d3z3br6yl3xj75b4vlyw9y45pwg8zrq02kjajd")))))))
|
||||
|
||||
(define-public mirror-substitutes
|
||||
(package
|
||||
(name "mirror-substitutes")
|
||||
(version "0.0.2")
|
||||
(version "0.0.3")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -63,7 +47,7 @@
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"1fbv24n12p83gp9l8nnjmymgqbwyvmy086fnfwxdg8c9c6rfbl4j"))))
|
||||
"1qf2180bj36py05wz031m5fk2xmzwyf2cl8nhcnny63ghkm27m7j"))))
|
||||
(build-system guile-build-system)
|
||||
(arguments
|
||||
(list
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
From 90bf62f411590cc0b813e6f62c3a0ef89cf17d1f Mon Sep 17 00:00:00 2001
|
||||
From: Hilton Chain <hako@ultrarare.space>
|
||||
Date: Sun, 30 Nov 2025 12:13:36 +0800
|
||||
Subject: [PATCH] templates: Add more forges.
|
||||
|
||||
---
|
||||
src/cuirass/templates.scm | 16 +++++++++++++---
|
||||
1 file changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
|
||||
index 1cf7ebf..042d46a 100644
|
||||
--- a/src/cuirass/templates.scm
|
||||
+++ b/src/cuirass/templates.scm
|
||||
@@ -1526,7 +1526,9 @@ (define %vcs-web-views
|
||||
("git.guix.gnu.org" ,labhub-url) ;alias for codeberg.org
|
||||
("gitlab.com" ,labhub-url)
|
||||
("gitlab.inria.fr" ,labhub-url)
|
||||
- ("github.com" ,labhub-url))))
|
||||
+ ("github.com" ,labhub-url)
|
||||
+ ("git.sr.ht" ,labhub-url)
|
||||
+ ("git.guix.moe" ,labhub-url))))
|
||||
|
||||
(define %vcs-web-commit-range-views
|
||||
;; List of host names and corresponding URL to display a commit range.
|
||||
@@ -1541,7 +1543,13 @@ (define %vcs-web-commit-range-views
|
||||
(if (string-suffix? ".git" repository-url)
|
||||
(string-drop-right repository-url 4)
|
||||
repository-url)
|
||||
- "/compare/" commit1 ".." commit2))))
|
||||
+ "/compare/" commit1 ".." commit2)))
|
||||
+ (sourcehut-url (lambda (repository-url _ commit2)
|
||||
+ (string-append
|
||||
+ (if (string-suffix? ".git" repository-url)
|
||||
+ (string-drop-right repository-url 4)
|
||||
+ repository-url)
|
||||
+ "/log/?from=" commit2))))
|
||||
`(("git.savannah.gnu.org"
|
||||
,(lambda (repository-url commit1 commit2)
|
||||
(string-append (string-replace-substring repository-url
|
||||
@@ -1552,7 +1560,9 @@ (define %vcs-web-commit-range-views
|
||||
("git.guix.gnu.org" ,github-url) ;alias for codeberg.org
|
||||
("gitlab.com" ,gitlab-url)
|
||||
("gitlab.inria.fr" ,gitlab-url)
|
||||
- ("github.com" ,github-url))))
|
||||
+ ("github.com" ,github-url)
|
||||
+ ("git.sr.ht" ,sourcehut-url)
|
||||
+ ("git.guix.moe" ,github-url))))
|
||||
|
||||
(define* (commit-hyperlink url commit
|
||||
#:optional (text commit))
|
||||
--
|
||||
2.52.0
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
From 4d8509b60d17cc5d242d0bb157beef123dd28923 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <4d8509b60d17cc5d242d0bb157beef123dd28923.1769270645.git.hako@ultrarare.space>
|
||||
From: Hilton Chain <hako@ultrarare.space>
|
||||
Date: Sat, 23 Aug 2025 14:07:19 +0800
|
||||
Subject: [PATCH] publish: Store cache in a layout identical to HTTP endpoints.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This allows serving substitutes using a file server.
|
||||
|
||||
Original layout:
|
||||
--8<---------------cut here---------------start------------->8---
|
||||
/path/to/publish/cache
|
||||
├── hashes
|
||||
│ ├── k0pin1y1r0vdkdbg3lwjqc52hpwjbdyb
|
||||
│ └── ql2nxr2b587kjydfwivjsnhmqya957bq
|
||||
└── nar
|
||||
├── none
|
||||
│ ├── k0pin1y1r0vdkdbg3lwjqc52hpwjbdyb-hello-2.12.2.narinfo
|
||||
│ └── k0pin1y1r0vdkdbg3lwjqc52hpwjbdyb-hello-2.12.2.nar
|
||||
└── zstd
|
||||
├── ql2nxr2b587kjydfwivjsnhmqya957bq-helix-25.01.1.narinfo
|
||||
└── ql2nxr2b587kjydfwivjsnhmqya957bq-helix-25.01.1.nar
|
||||
--8<---------------cut here---------------end--------------->8---
|
||||
|
||||
Modified layout:
|
||||
--8<---------------cut here---------------start------------->8---
|
||||
/path/to/publish/cache
|
||||
├── hashes
|
||||
│ ├── k0pin1y1r0vdkdbg3lwjqc52hpwjbdyb
|
||||
│ └── ql2nxr2b587kjydfwivjsnhmqya957bq
|
||||
├── nar
|
||||
│ ├── none
|
||||
│ │ └── k0pin1y1r0vdkdbg3lwjqc52hpwjbdyb-hello-2.12.2
|
||||
│ └── zstd
|
||||
│ └── ql2nxr2b587kjydfwivjsnhmqya957bq-helix-25.01.1
|
||||
├── k0pin1y1r0vdkdbg3lwjqc52hpwjbdyb.narinfo
|
||||
└── ql2nxr2b587kjydfwivjsnhmqya957bq.narinfo
|
||||
--8<---------------cut here---------------end--------------->8---
|
||||
|
||||
Change-Id: I07689f08eef23c5cd4494451678f4e1ad709f1b3
|
||||
---
|
||||
guix/scripts/publish.scm | 21 +++++++-----------
|
||||
tests/publish.scm | 48 ++++++++++++++++++++--------------------
|
||||
2 files changed, 32 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm
|
||||
index 1143cd29cfd..24b7f40cbd7 100644
|
||||
--- a/guix/scripts/publish.scm
|
||||
+++ b/guix/scripts/publish.scm
|
||||
@@ -47,6 +47,7 @@ (define-module (guix scripts publish)
|
||||
#:use-module (guix base32)
|
||||
#:use-module (guix base64)
|
||||
#:use-module (guix config)
|
||||
+ #:use-module (guix records)
|
||||
#:use-module (gcrypt hash)
|
||||
#:use-module (guix pki)
|
||||
#:use-module (gcrypt pk-crypto)
|
||||
@@ -306,8 +307,6 @@ (define* (store-item->recutils store-item
|
||||
(let ((url (encode-and-join-uri-path
|
||||
`(,@(split-and-decode-uri-path nar-path)
|
||||
,@(match compression
|
||||
- (($ <compression> 'none)
|
||||
- '())
|
||||
(($ <compression> type)
|
||||
(list (symbol->string type))))
|
||||
,(basename store-item)))))
|
||||
@@ -424,16 +423,13 @@ (define* (render-narinfo store request hash
|
||||
|
||||
(define* (nar-cache-file directory item
|
||||
#:key (compression %no-compression))
|
||||
- (string-append directory "/"
|
||||
+ (string-append directory "/nar/"
|
||||
(symbol->string (compression-type compression))
|
||||
- "/" (basename item) ".nar"))
|
||||
+ "/" (basename item)))
|
||||
|
||||
(define* (narinfo-cache-file directory item
|
||||
#:key (compression %no-compression))
|
||||
- (string-append directory "/"
|
||||
- (symbol->string (compression-type compression))
|
||||
- "/" (basename item)
|
||||
- ".narinfo"))
|
||||
+ (string-append directory "/" (string-take (basename item) 32) ".narinfo"))
|
||||
|
||||
(define (hash-part-mapping-cache-file directory hash)
|
||||
(string-append directory "/hashes/" hash))
|
||||
@@ -533,11 +529,9 @@ (define* (render-narinfo/cached store request hash
|
||||
requested using POOL."
|
||||
(define (delete-entry narinfo)
|
||||
;; Delete NARINFO and the corresponding nar from CACHE.
|
||||
- (let* ((nar (string-append (string-drop-right narinfo
|
||||
- (string-length ".narinfo"))
|
||||
- ".nar"))
|
||||
- (base (basename narinfo ".narinfo"))
|
||||
- (hash (string-take base (string-index base #\-)))
|
||||
+ (let* ((path (uri-decode (assoc-ref (call-with-input-file narinfo recutils->alist) "URL")))
|
||||
+ (nar (in-vicinity (dirname narinfo) path))
|
||||
+ (hash (basename narinfo ".narinfo"))
|
||||
(mapping (hash-part-mapping-cache-file cache hash)))
|
||||
(delete-file* narinfo)
|
||||
(delete-file* nar)
|
||||
@@ -1044,6 +1038,7 @@ (define (string->compression-type string)
|
||||
("gzip" 'gzip)
|
||||
("lzip" 'lzip)
|
||||
("zstd" 'zstd)
|
||||
+ ("none" 'none)
|
||||
(_ #f)))
|
||||
|
||||
(define (effective-compression requested-type compressions)
|
||||
diff --git a/tests/publish.scm b/tests/publish.scm
|
||||
index 3c80c50d515..52c6f6d10c4 100644
|
||||
--- a/tests/publish.scm
|
||||
+++ b/tests/publish.scm
|
||||
@@ -173,7 +173,7 @@ (define %gzip-magic-bytes
|
||||
(canonical-sexp->string
|
||||
(signed-string unsigned-info))))))
|
||||
(format #f "~aSignature: 1;~a;~a
|
||||
-URL: nar/~a
|
||||
+URL: nar/none/~a
|
||||
Compression: none
|
||||
FileSize: ~a\n"
|
||||
unsigned-info (gethostname) signature
|
||||
@@ -223,7 +223,7 @@ (define %gzip-magic-bytes
|
||||
(canonical-sexp->string
|
||||
(signed-string unsigned-info))))))
|
||||
(format #f "~aSignature: 1;~a;~a
|
||||
-URL: nar/~a
|
||||
+URL: nar/none/~a
|
||||
Compression: none
|
||||
FileSize: ~a~%"
|
||||
unsigned-info (gethostname) signature
|
||||
@@ -332,7 +332,7 @@ (define %gzip-magic-bytes
|
||||
(recutils->alist body)))))
|
||||
|
||||
(test-equal "/*.narinfo for a compressed file"
|
||||
- '("none" "nar") ;compression-less nar
|
||||
+ '("none" "nar/none") ;compression-less nar
|
||||
;; Assume 'guix publish -C' is already running on port 6799.
|
||||
(let* ((item (add-text-to-store %store "fake.tar.gz"
|
||||
"This is a fake compressed file."))
|
||||
@@ -378,7 +378,7 @@ (define %gzip-magic-bytes
|
||||
(test-equal "custom nar path"
|
||||
;; Serve nars at /foo/bar/chbouib instead of /nar.
|
||||
(list `(("StorePath" . ,%item)
|
||||
- ("URL" . ,(string-append "foo/bar/chbouib/" (basename %item)))
|
||||
+ ("URL" . ,(string-append "foo/bar/chbouib/none/" (basename %item)))
|
||||
("Compression" . "none"))
|
||||
200
|
||||
404)
|
||||
@@ -403,7 +403,7 @@ (define %gzip-magic-bytes
|
||||
(recutils->alist body))
|
||||
(response-code (http-get nar-url))
|
||||
(response-code
|
||||
- (http-get (string-append base "nar/" (basename %item))))))))
|
||||
+ (http-get (string-append base "nar/none/" (basename %item))))))))
|
||||
|
||||
(test-equal "/nar/ with properly encoded '+' sign"
|
||||
"Congrats!"
|
||||
@@ -479,10 +479,10 @@ (define %gzip-magic-bytes
|
||||
(part (store-path-hash-part %item))
|
||||
(url (string-append base part ".narinfo"))
|
||||
(nar-url (string-append base "nar/gzip/" (basename %item)))
|
||||
- (cached (string-append cache "/gzip/" (basename %item)
|
||||
+ (cached (string-append cache "/" part
|
||||
".narinfo"))
|
||||
- (nar (string-append cache "/gzip/"
|
||||
- (basename %item) ".nar"))
|
||||
+ (nar (string-append cache "/nar/gzip/"
|
||||
+ (basename %item)))
|
||||
(response (http-get url)))
|
||||
(and (= 404 (response-code response))
|
||||
|
||||
@@ -535,15 +535,15 @@ (define %gzip-magic-bytes
|
||||
(url (string-append base part ".narinfo"))
|
||||
(nar-url (cute string-append "nar/" <> "/"
|
||||
(basename %item)))
|
||||
- (cached (cute string-append cache "/" <> "/"
|
||||
- (basename %item) ".narinfo"))
|
||||
- (nar (cute string-append cache "/" <> "/"
|
||||
- (basename %item) ".nar"))
|
||||
+ (cached (string-append cache "/"
|
||||
+ part ".narinfo"))
|
||||
+ (nar (cute string-append cache "/nar/" <> "/"
|
||||
+ (basename %item)))
|
||||
(response (http-get url)))
|
||||
- (wait-for-file (cached "gzip"))
|
||||
+ (wait-for-file cached)
|
||||
(let* ((body (http-get-port url))
|
||||
(narinfo (recutils->alist body))
|
||||
- (uncompressed (string-append base "nar/"
|
||||
+ (uncompressed (string-append base "nar/none/"
|
||||
(basename %item))))
|
||||
(and (file-exists? (nar "gzip"))
|
||||
(file-exists? (nar "lzip"))
|
||||
@@ -576,7 +576,7 @@ (define %gzip-magic-bytes
|
||||
(list #t
|
||||
(* 42 3600) ;TTL on narinfo
|
||||
`(("StorePath" . ,item)
|
||||
- ("URL" . ,(string-append "nar/" (basename item)))
|
||||
+ ("URL" . ,(string-append "nar/none/" (basename item)))
|
||||
("Compression" . "none"))
|
||||
200 ;nar/…
|
||||
(* 42 3600) ;TTL on nar/…
|
||||
@@ -595,10 +595,10 @@ (define %gzip-magic-bytes
|
||||
(let* ((base "http://localhost:6796/")
|
||||
(part (store-path-hash-part item))
|
||||
(url (string-append base part ".narinfo"))
|
||||
- (cached (string-append cache "/none/"
|
||||
- (basename item) ".narinfo"))
|
||||
- (nar (string-append cache "/none/"
|
||||
- (basename item) ".nar"))
|
||||
+ (cached (string-append cache "/"
|
||||
+ part ".narinfo"))
|
||||
+ (nar (string-append cache "/nar/none/"
|
||||
+ (basename item)))
|
||||
(response (http-get url)))
|
||||
(and (= 404 (response-code response))
|
||||
|
||||
@@ -607,7 +607,7 @@ (define %gzip-magic-bytes
|
||||
(body (http-get-port url))
|
||||
(compressed (http-get (string-append base "nar/gzip/"
|
||||
(basename item))))
|
||||
- (uncompressed (http-get (string-append base "nar/"
|
||||
+ (uncompressed (http-get (string-append base "nar/none/"
|
||||
(basename item))))
|
||||
(narinfo (recutils->alist body)))
|
||||
(list (file-exists? nar)
|
||||
@@ -650,8 +650,8 @@ (define %gzip-magic-bytes
|
||||
(item (add-text-to-store %store "random" (random-text)))
|
||||
(part (store-path-hash-part item))
|
||||
(url (string-append base part ".narinfo"))
|
||||
- (cached (string-append cache "/gzip/"
|
||||
- (basename item)
|
||||
+ (cached (string-append cache "/"
|
||||
+ part
|
||||
".narinfo"))
|
||||
(response (http-get url)))
|
||||
(and (= 200 (response-code response)) ;we're below the threshold
|
||||
@@ -676,7 +676,7 @@ (define %gzip-magic-bytes
|
||||
(part (store-path-hash-part item))
|
||||
(narinfo (string-append base part ".narinfo"))
|
||||
(nar (string-append base "nar/gzip/" (basename item)))
|
||||
- (cached (string-append cache "/gzip/" (basename item)
|
||||
+ (cached (string-append cache "/" part
|
||||
".narinfo")))
|
||||
;; We're below the default cache bypass threshold, so NAR and NARINFO
|
||||
;; should immediately return 200. The NARINFO request should trigger
|
||||
@@ -712,7 +712,7 @@ (define %gzip-magic-bytes
|
||||
(part (store-path-hash-part item))
|
||||
(narinfo (string-append base part ".narinfo"))
|
||||
(nar (string-append base "nar/gzip/" (basename item)))
|
||||
- (cached (string-append cache "/gzip/" (basename item)
|
||||
+ (cached (string-append cache "/" part
|
||||
".narinfo")))
|
||||
;; The first response used to be 500 and to terminate the daemon
|
||||
;; connection as a side effect.
|
||||
|
||||
base-commit: 5dbab32115de3276f582bcb801fd9f88abe0d397
|
||||
--
|
||||
2.52.0
|
||||
|
||||
@@ -1,28 +1,47 @@
|
||||
From 06ab33a4317d41953ad167bfabd5b5ff4e001fee Mon Sep 17 00:00:00 2001
|
||||
From f1a0448e42ce876a58c01da9f5b40c4991a44b27 Mon Sep 17 00:00:00 2001
|
||||
From: Hilton Chain <hako@ultrarare.space>
|
||||
Date: Wed, 29 Oct 2025 18:58:27 +0800
|
||||
Date: Sat, 10 Oct 2026 09:17:00 +0800
|
||||
Subject: [PATCH] Set Guix System PATH for Tailscale SSH.
|
||||
|
||||
---
|
||||
ssh/tailssh/user.go | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
ssh/tailssh/user_unix.go | 2 ++
|
||||
version/distro/distro.go | 3 +++
|
||||
2 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/ssh/tailssh/user.go b/ssh/tailssh/user.go
|
||||
index ac92c762a..fccc5cbf5 100644
|
||||
--- a/ssh/tailssh/user.go
|
||||
+++ b/ssh/tailssh/user.go
|
||||
@@ -109,9 +109,9 @@ func defaultPathForUser(u *user.User) string {
|
||||
diff --git a/ssh/tailssh/user_unix.go b/ssh/tailssh/user_unix.go
|
||||
index eb1941886..5840f2af7 100644
|
||||
--- a/ssh/tailssh/user_unix.go
|
||||
+++ b/ssh/tailssh/user_unix.go
|
||||
@@ -92,6 +92,8 @@ func defaultPathForUser(u *user.User) string {
|
||||
return "/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
|
||||
case distro.NixOS:
|
||||
return defaultPathForUserOnNixOS(u)
|
||||
+ case distro.Guix:
|
||||
+ return "/run/privileged/bin:/run/current-system/profile/sbin:/run/current-system/profile/bin"
|
||||
}
|
||||
if isRoot {
|
||||
- return "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
+ return "/run/privileged/bin:/run/current-system/profile/sbin:/run/current-system/profile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
}
|
||||
- return "/usr/local/bin:/usr/bin:/bin"
|
||||
+ return "/run/privileged/bin:/run/current-system/profile/sbin:/run/current-system/profile/bin:/usr/local/bin:/usr/bin:/bin"
|
||||
}
|
||||
return "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
diff --git a/version/distro/distro.go b/version/distro/distro.go
|
||||
index 5407f8dae..2a6312bf7 100644
|
||||
--- a/version/distro/distro.go
|
||||
+++ b/version/distro/distro.go
|
||||
@@ -34,6 +34,7 @@
|
||||
Alpine = Distro("alpine")
|
||||
UBNT = Distro("ubnt") // Ubiquiti Networks
|
||||
JetKVM = Distro("jetkvm")
|
||||
+ Guix = Distro("guix")
|
||||
)
|
||||
|
||||
func defaultPathForUserOnNixOS(u *user.User) string {
|
||||
var distro lazy.SyncValue[Distro]
|
||||
@@ -112,6 +113,8 @@ func linuxDistro() Distro {
|
||||
return Alpine
|
||||
case runtime.GOARCH == "arm" && isDeviceModel("JetKVM"):
|
||||
return JetKVM
|
||||
+ case have("/run/current-system/parameters"):
|
||||
+ return Guix
|
||||
}
|
||||
return ""
|
||||
}
|
||||
--
|
||||
2.51.0
|
||||
2.54.0
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (rosenthal packages shellutils)
|
||||
;; Utilities
|
||||
#:use-module (guix gexp)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix utils)
|
||||
;; Guix origin methods
|
||||
#:use-module (guix git-download)
|
||||
;; Guix build systems
|
||||
#:use-module (rosenthal build-system go-vendored)
|
||||
;; Guix packages
|
||||
#:use-module (gnu packages golang))
|
||||
|
||||
(define-public stinkpot
|
||||
(package
|
||||
(name "stinkpot")
|
||||
(version "0.1.0")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://tangled.org/oppi.li/stinkpot")
|
||||
(commit (string-append "v" version))))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"1mnxjg3krvdgxclh4bd757p8wgvx57s9i8zyrppgwhcps1r2ifw2"))))
|
||||
(build-system go-vendored-build-system)
|
||||
(arguments
|
||||
(list #:tests? #f ;no tests
|
||||
#:go go-1.27
|
||||
#:vendor-hash
|
||||
(base32 "1kqmw6c2h11wxx4a683k10rzrsydc1pbq5rp3d570nk8bl5c0lr1")
|
||||
#:install-source? #f
|
||||
#:import-path "."
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'unpack 'patch-references
|
||||
(lambda _
|
||||
(substitute* "main.go"
|
||||
(("stinkpot (add|search)" all)
|
||||
(string-append #$output "/bin/" all))))))))
|
||||
(home-page "https://tangled.org/oppi.li/stinkpot")
|
||||
(synopsis "Search shell history")
|
||||
(description
|
||||
"@command{stinkpot} is an sqlite backed shell-history searcher.")
|
||||
(license license:expat)))
|
||||
+103
-129
@@ -1,5 +1,6 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2022, 2025 Hilton Chain <hako@ultrarare.space>
|
||||
;;; Copyright © 2026 Maxim Cournoyer <maxim@guixotic.coop>
|
||||
|
||||
(define-module (rosenthal packages web)
|
||||
;; Utilities
|
||||
@@ -16,19 +17,26 @@
|
||||
;; Guix build systems
|
||||
#:use-module (guix build-system cargo)
|
||||
#:use-module (guix build-system copy)
|
||||
#:use-module (guix build-system gnu)
|
||||
#:use-module (guix build-system go)
|
||||
#:use-module (rosenthal build-system go-vendored)
|
||||
;; Guix packages
|
||||
#:use-module (gnu packages base)
|
||||
#:use-module (gnu packages bash)
|
||||
#:use-module (gnu packages compression)
|
||||
#:use-module (gnu packages golang)
|
||||
#:use-module (gnu packages image)
|
||||
#:use-module (gnu packages jemalloc)
|
||||
#:use-module (gnu packages node)
|
||||
#:use-module (gnu packages sqlite)
|
||||
#:use-module (gnu packages ssh)
|
||||
#:use-module (gnu packages version-control)
|
||||
#:use-module (gnu packages web))
|
||||
|
||||
(define-public ai-robots-txt
|
||||
(package
|
||||
(name "ai-robots-txt")
|
||||
(version "1.50")
|
||||
(version "2.1")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -37,7 +45,7 @@
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"18ahcvhicbgn30km8aph1vq3l4x09aasj0xvz3b0s0p8pkqqmw7g"))
|
||||
"1vfayd064mhksqyzak2qy08ydgqwfnf4jamzq25qlzqfi5fji9k4"))
|
||||
(modules '((guix build utils)))
|
||||
(snippet '(delete-file-recursively "code"))))
|
||||
(build-system copy-build-system)
|
||||
@@ -58,80 +66,11 @@ website owners block unwanted AI crawlers from accessing their sites.")
|
||||
|
||||
(define-deprecated/public-alias anubis-anti-crawler anubis-ai-firewall)
|
||||
|
||||
(define-public caddy
|
||||
(package
|
||||
(name "caddy")
|
||||
(version "2.11.4")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/caddyserver/caddy")
|
||||
(commit (string-append "v" version))))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"04ypcnmplbkmp7r5vi3q2lx270q2195c4h8ripdjc32z2qlkqff3"))))
|
||||
(build-system go-vendored-build-system)
|
||||
(arguments
|
||||
(list #:go go-1.26
|
||||
#:vendor-hash (base32 "0vjdmwp4qdxvkrn1h7pk9ckwi5cjksq7nbd96yqd2dqan4ri4v6q")
|
||||
#:tests? (not (%current-target-system)) ;TODO: Run test suite.
|
||||
#:install-source? #f
|
||||
#:import-path
|
||||
(if (string=? "caddy" (package-name this-package))
|
||||
"./cmd/caddy"
|
||||
".")
|
||||
#:build-flags
|
||||
#~(list "-tags" "nobadger nomysql nopgx"
|
||||
(string-append
|
||||
"-ldflags="
|
||||
" -X github.com/caddyserver/caddy/v2.CustomVersion="
|
||||
#$(package-version this-package)))
|
||||
#:modules
|
||||
(cons '(ice-9 match)
|
||||
%default-go-vendored-modules)
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'install 'install-extras
|
||||
(lambda _
|
||||
(let ((caddy
|
||||
(or (which "caddy")
|
||||
(in-vicinity #$output "bin/caddy"))))
|
||||
(invoke caddy "manpage" "--directory"
|
||||
(in-vicinity #$output "share/man/man8"))
|
||||
(map
|
||||
(match-lambda
|
||||
((shell . path)
|
||||
(let ((file (in-vicinity #$output path)))
|
||||
(mkdir-p (dirname file))
|
||||
(with-output-to-file file
|
||||
(lambda ()
|
||||
(invoke caddy "completion" shell))))))
|
||||
'(("bash" . "etc/bash_completion.d/caddy")
|
||||
("fish" . "share/fish/vendor_completions.d/caddy.fish")
|
||||
("zsh" . "share/zsh/site-functions/_caddy"))))))
|
||||
(delete 'check)
|
||||
(add-after 'install 'check
|
||||
(lambda* (#:key tests? #:allow-other-keys)
|
||||
(when tests?
|
||||
(let ((caddy (in-vicinity #$output "bin/caddy")))
|
||||
(invoke caddy "help")
|
||||
(invoke caddy "version"))))))))
|
||||
(home-page "https://caddyserver.com/")
|
||||
(synopsis "Extensible HTTP web server with automatic HTTPS")
|
||||
(description
|
||||
"Caddy is a web server designed for simplicity and ease of use. It is
|
||||
notable for its automatic HTTPS feature, which enables secure connections
|
||||
without requiring complex configuration. Caddy is built with a focus on
|
||||
performance and flexibility, making it suitable for a variety of applications,
|
||||
from serving static websites to running dynamic web applications.")
|
||||
(license license:asl2.0)))
|
||||
|
||||
(define-public caddy/dolly
|
||||
(package
|
||||
(inherit caddy)
|
||||
(name "caddy-dolly")
|
||||
(version "2026.06.01")
|
||||
(version "2026.10.23")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
@@ -140,72 +79,107 @@ from serving static websites to running dynamic web applications.")
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"1b8606rbg57ylxz2q88335s04q8yvg6b33qkq3hk9895vwd74mq0"))))
|
||||
"1amgxdy9598jpm1zkp7yvrxhj3zyzlc8rzp64mivlhhv58gmnfmz"))))
|
||||
(build-system go-vendored-build-system)
|
||||
(arguments
|
||||
(substitute-keyword-arguments arguments
|
||||
((#:go _ #f) go-1.27)
|
||||
((#:import-path _ #f) ".")
|
||||
((#:vendor-hash _ #f)
|
||||
(base32 "0bwpayz2yf18cycffy02iiq88cl0smljimsf0yrdzrn1l3flg37s"))))
|
||||
(base32 "1k45xgbay9fyahh7ng8y6n58m9nnv2wyjqwzyjf3via08mlh1cjm"))))
|
||||
(native-inputs '())
|
||||
(inputs '())
|
||||
(propagated-inputs '())
|
||||
(home-page "https://git.guix.moe/hako/caddy")
|
||||
(properties '((disable-updater? . #t)))))
|
||||
|
||||
;; https://codeberg.org/guix/guix/pulls/9006
|
||||
(define-public forgejo
|
||||
(package
|
||||
(name "forgejo")
|
||||
(version "14.0.4")
|
||||
;; TODO: Address npm dependencies and fetch from git.
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
"https://codeberg.org/forgejo/forgejo/releases/download/v"
|
||||
version "/forgejo-src-" version ".tar.gz"))
|
||||
(sha256
|
||||
(base32
|
||||
"0mjmns7yqhhkqc3jcg8bffs64zj4b52hy2v1lvr14pq162r6wcil"))))
|
||||
(build-system go-vendored-build-system)
|
||||
(version "16.0.6")
|
||||
(source
|
||||
(origin
|
||||
(method url-fetch)
|
||||
;; XXX: We build from the release tarball for now, which includes all
|
||||
;; of the needed Go dependencies.
|
||||
;; TODO: "Unbundle" the index.js and index.css by building them with
|
||||
;; webpack. This cannot currently be done because of missing Node
|
||||
;; modules.
|
||||
(uri (string-append "https://codeberg.org/forgejo/forgejo/"
|
||||
"releases/download/v" version
|
||||
"/forgejo-src-" version ".tar.gz"))
|
||||
(sha256
|
||||
(base32
|
||||
"0c56zxadj8rpn9xj7i3l97z2xh0w318vwrbxmb1nw071qh5krs8g"))))
|
||||
(build-system gnu-build-system)
|
||||
(outputs (list "out" "data"))
|
||||
(arguments
|
||||
(list #:tests? (not (%current-target-system)) ;TODO: Run test suite.
|
||||
#:go go-1.26
|
||||
#:install-source? #f
|
||||
#: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 forgejo.org/modules/setting.AppWorkPath=/var/lib/forgejo"
|
||||
" -X forgejo.org/modules/setting.CustomPath=" #$output "/etc/forgejo"
|
||||
" -X forgejo.org/modules/setting.CustomConf=/etc/forgejo/app.ini"))
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'install 'rename-binary
|
||||
(lambda _
|
||||
(rename-file (in-vicinity #$output "bin/forgejo.org")
|
||||
(in-vicinity #$output "bin/forgejo"))))
|
||||
(add-after 'install 'install-extras
|
||||
(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"))))
|
||||
(delete 'check)
|
||||
(add-after 'rename-binary 'check
|
||||
(lambda* (#:key tests? #:allow-other-keys)
|
||||
(when tests?
|
||||
(let ((forgejo (in-vicinity #$output "bin/forgejo")))
|
||||
(invoke forgejo "--help")
|
||||
(invoke forgejo "--version"))))))))
|
||||
(native-inputs (list git-minimal))
|
||||
(list
|
||||
#:test-target "test-backend" ;test-frontend requires npm modules
|
||||
#:make-flags #~(list "TAGS=sqlite sqlite_unlock_notify") ;sqlite support
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'unpack 'patch-paths
|
||||
(lambda* (#:key inputs #:allow-other-keys)
|
||||
(substitute* "modules/git/hook_generate.go"
|
||||
(("/usr/bin/env")
|
||||
(search-input-file inputs "bin/env")))))
|
||||
(add-after 'unpack 'set-static-root-path
|
||||
(lambda _
|
||||
(substitute* "modules/setting/server.go"
|
||||
(("StaticRootPath = AppWorkPath")
|
||||
(format #f "StaticRootPath = ~s" #$output:data)))))
|
||||
(add-after 'unpack 'disable-problematic-tests
|
||||
(lambda _
|
||||
(for-each
|
||||
delete-file
|
||||
;; Theses tests require internet.
|
||||
'("modules/hcaptcha/hcaptcha_test.go"
|
||||
"modules/updatechecker/update_checker_test.go"
|
||||
"services/migrations/migrate_test.go"
|
||||
"services/migrations/allowlist/is_migrate_allowed_test.go"
|
||||
;; The 'TestGetDirectorySize' test expects 8037
|
||||
;; entries, finds 7597 for unknown reasons.
|
||||
"modules/repository/create_test.go"))))
|
||||
(replace 'configure
|
||||
(lambda _
|
||||
(setenv "CC" "gcc")
|
||||
(setenv "CGO_ENABLED" "1")
|
||||
(setenv "GOTOOLCHAIN" "local") ;use 'go' from Guix
|
||||
(setenv "HOME" (getcwd))
|
||||
(invoke "git" "init"))) ;for tests
|
||||
(add-after 'install 'post-install
|
||||
(lambda* (#:key inputs #:allow-other-keys)
|
||||
(rename-file "go/bin/forgejo.org" "go/bin/forgejo")
|
||||
(let ((forgejo (string-append #$output "/bin/forgejo")))
|
||||
(install-file "go/bin/forgejo" (dirname forgejo))
|
||||
(wrap-program forgejo
|
||||
`("PATH" prefix
|
||||
,(map (lambda (c)
|
||||
(dirname
|
||||
(search-input-file inputs
|
||||
(string-append "bin/" c))))
|
||||
'("git" "gzip" "sh" "ssh"))))
|
||||
(substitute* forgejo ;avoid stripping argv[0] in wrapper
|
||||
(("exec -a \"\\$\\{0##\\*/\\}\" ")
|
||||
"exec ")))
|
||||
;; Install data files.
|
||||
(copy-recursively "options"
|
||||
(string-append #$output:data "/options"))
|
||||
(copy-recursively "public"
|
||||
(string-append #$output:data "/public"))
|
||||
(copy-recursively "templates"
|
||||
(string-append #$output:data "/templates")))))))
|
||||
(native-inputs (list git go-1.26 openssh node sqlite))
|
||||
(inputs (list bash coreutils git gzip openssh))
|
||||
(home-page "https://forgejo.org/")
|
||||
(synopsis "Lightweight software forge")
|
||||
(synopsis "Self-hosted, lightweight software forge")
|
||||
(description
|
||||
"Forgejo is a self-hosted, lightweight software forge designed to
|
||||
facilitate collaborative software development. It is built to be easy to
|
||||
install and maintain, making it an ideal choice for teams and organizations
|
||||
looking for a reliable platform to manage their software projects.")
|
||||
(license license:gpl3+)
|
||||
(properties
|
||||
'((disable-updater? . #t)))))
|
||||
"Forgejo is a lightweight software forge that aims to be easy to self-host
|
||||
and maintain. It offers a rich web API for accessing its data. ALong the usual
|
||||
forge features such as issues and pull requests tracking, it also includes
|
||||
simple software project management features like roles, scopes, and time
|
||||
tracking to ease collaboration.")
|
||||
(license license:expat)
|
||||
(properties '((disable-updater? . #t)))))
|
||||
@@ -32,38 +32,23 @@
|
||||
#:use-module (gnu packages polkit)
|
||||
#:use-module (gnu packages pulseaudio)
|
||||
#:use-module (gnu packages stb)
|
||||
#:use-module (gnu packages window-management)
|
||||
#:use-module (gnu packages xdisorg)
|
||||
#:use-module (gnu packages xml))
|
||||
|
||||
(define wayland-protocols-1.48
|
||||
(define-public noctalia-greeter
|
||||
(package
|
||||
(inherit wayland-protocols)
|
||||
(name "wayland-protocols")
|
||||
(version "1.48")
|
||||
(name "noctalia-greeter")
|
||||
(version "1.7.0")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://gitlab.freedesktop.org/wayland/wayland-protocols")
|
||||
(commit version)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"0zqnn7bwqzifchjhclrrcqnp39cpd3nnf6nbd9bav2hwhcx92mwy"))))))
|
||||
|
||||
;; TODO: Unbundle dependencies under the third_party directory.
|
||||
(define-public noctalia
|
||||
(package
|
||||
(name "noctalia")
|
||||
(version "5.1.0")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/noctalia-dev/noctalia-shell")
|
||||
(url "https://github.com/noctalia-dev/noctalia-greeter")
|
||||
(commit (string-append "v" version))))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"1zf4q6lrpb0zp3sdwlqmj1cxfhislkssya8cslj0w9y096ha3dq3"))))
|
||||
"1wsrmjh8mmnbsfsspn0hvpd6di9mlm20qiigxcniq5s6za74ic90"))))
|
||||
(build-system meson-build-system)
|
||||
(arguments
|
||||
(list #:build-type "release"
|
||||
@@ -71,54 +56,36 @@
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'unpack 'prepare-for-build
|
||||
(lambda _
|
||||
;; /bin/sh doesn't exist in the build environment.
|
||||
(substitute* "tests/process_test.cpp"
|
||||
(("/bin/(sh)" _ cmd)
|
||||
(which cmd)))
|
||||
;; Adjust import paths for STB headers packaged in Guix.
|
||||
(substitute* (find-files "." "\\.cpp$|^meson\\.build$")
|
||||
(("\\bstb/stb_") "stb_")))))))
|
||||
(native-inputs
|
||||
(list pkg-config))
|
||||
(("\\bstb/stb_") "stb_"))
|
||||
;; Reproducibility.
|
||||
(substitute* "meson.build"
|
||||
(("'-march=native', '-mtune=native',") "")))))))
|
||||
(native-inputs (list pkg-config wayland))
|
||||
(inputs
|
||||
(list cairo
|
||||
curl
|
||||
fontconfig
|
||||
freetype
|
||||
glib
|
||||
gmp
|
||||
harfbuzz
|
||||
jemalloc
|
||||
mpfr
|
||||
(librsvg-for-system)
|
||||
libjxl
|
||||
libical
|
||||
libqalculate
|
||||
libsecret
|
||||
libsndfile
|
||||
libsodium
|
||||
(librsvg-for-system)
|
||||
libwebp
|
||||
libxkbcommon
|
||||
libxml2
|
||||
linux-pam
|
||||
md4c
|
||||
mesa
|
||||
nlohmann-json
|
||||
pango
|
||||
pipewire
|
||||
polkit
|
||||
sdbus-c++
|
||||
stb-image-resize2
|
||||
stb-image-write
|
||||
tomlplusplus
|
||||
wayland
|
||||
wayland-protocols-1.48
|
||||
wireplumber))
|
||||
wayland-protocols
|
||||
wlroots))
|
||||
(home-page "https://noctalia.dev/")
|
||||
(synopsis "Wayland shell and bar")
|
||||
(synopsis "Login greeter for greetd")
|
||||
(description
|
||||
"Noctalia is a lightweight Wayland shell and bar built directly on
|
||||
Wayland and OpenGL ES, with no Qt or GTK dependency.")
|
||||
"Noctalia Greeter is a minimal login greeter for greetd that matches the
|
||||
look and feel of Noctalia Shell")
|
||||
(license license:expat)))
|
||||
|
||||
(define-deprecated-package noctalia-shell noctalia)
|
||||
@@ -5,14 +5,112 @@
|
||||
;; Utilities
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix records)
|
||||
#:use-module (rosenthal utils contract combinators)
|
||||
#:use-module (rosenthal utils file)
|
||||
#:use-module (rosenthal utils records)
|
||||
#:use-module (rosenthal utils packages)
|
||||
;; Guix System
|
||||
#:use-module (gnu system keyboard)
|
||||
;; Guix System - services
|
||||
#:use-module (gnu services)
|
||||
#:use-module (gnu services base)
|
||||
#:use-module (gnu services dbus)
|
||||
;; Guix packages
|
||||
#:use-module (gnu packages admin)
|
||||
#:use-module (gnu packages bash)
|
||||
#:use-module (rosenthal packages admin)
|
||||
#:export (greetd-tuigreet-session))
|
||||
#:use-module (rosenthal packages wm)
|
||||
#:export (noctalia-greeter-configuration
|
||||
noctalia-greeter-service-type
|
||||
greetd-noctalia-greeter-session
|
||||
|
||||
greetd-tuigreet-session))
|
||||
|
||||
|
||||
;;;
|
||||
;;; noctalia-greeter
|
||||
;;;
|
||||
|
||||
(define-record-type/dolly <noctalia-greeter-configuration>
|
||||
noctalia-greeter-configuration
|
||||
make-noctalia-greeter-configuration
|
||||
noctalia-greeter-configuration?
|
||||
this-noctalia-greeter-configuration
|
||||
(package
|
||||
noctalia-greeter-configuration-package
|
||||
(default noctalia-greeter)
|
||||
(contract file-like?)
|
||||
(documentation
|
||||
"Noctalia greeter package."))
|
||||
(keyboard-layout
|
||||
noctalia-greeter-configuration-keyboard-layout
|
||||
(default #f)
|
||||
(contract (or/c #f keyboard-layout?))
|
||||
(documentation
|
||||
"Keyboard layout to use in a Noctalia greeter session.")))
|
||||
|
||||
(define (noctalia-greeter-activation-service _)
|
||||
#~(mkdir-p/perms "/var/lib/noctalia-greeter" (getpwnam "greeter") #o750))
|
||||
|
||||
(define noctalia-greeter-special-files-service
|
||||
(match-record-lambda/dolly <noctalia-greeter-configuration>
|
||||
(keyboard-layout)
|
||||
(if keyboard-layout
|
||||
(let* ((name (keyboard-layout-name keyboard-layout))
|
||||
(variant (keyboard-layout-variant keyboard-layout))
|
||||
(options (keyboard-layout-options keyboard-layout))
|
||||
(layout
|
||||
`(("layout" . ,name)
|
||||
,@(if variant
|
||||
`(("variant" . ,variant))
|
||||
'())
|
||||
,@(if (null? options)
|
||||
'()
|
||||
`(("options" . ,(string-join options ",")))))))
|
||||
`(("/var/lib/noctalia-greeter/greeter.toml"
|
||||
,(toml-file "greeter.toml"
|
||||
`(("keyboard" . ,layout))))))
|
||||
'())))
|
||||
|
||||
(define noctalia-greeter-service-type
|
||||
(service-type
|
||||
(name 'noctalia-greeter)
|
||||
(extensions
|
||||
(list (service-extension activation-service-type
|
||||
noctalia-greeter-activation-service)
|
||||
(service-extension special-files-service-type
|
||||
noctalia-greeter-special-files-service)
|
||||
(service-extension polkit-service-type
|
||||
(compose list noctalia-greeter-configuration-package))
|
||||
(service-extension profile-service-type
|
||||
(compose list noctalia-greeter-configuration-package))))
|
||||
(default-value (noctalia-greeter-configuration))
|
||||
(description "Set up environment for @command{noctalia-greeter-session}.")))
|
||||
|
||||
(define-record-type/dolly <greetd-noctalia-greeter-session>
|
||||
greetd-noctalia-greeter-session
|
||||
make-greetd-noctalia-greeter-session
|
||||
greetd-noctalia-greeter-session?
|
||||
this-greetd-noctalia-greeter-session
|
||||
(noctalia-greeter-session
|
||||
greetd-noctalia-greeter-session-noctalia-greeter-session
|
||||
(default (file-append noctalia-greeter "/bin/noctalia-greeter-session"))
|
||||
(contract (or/c file-like? string?))
|
||||
(documentation
|
||||
"@command{noctalia-greeter-session} executable file.")))
|
||||
|
||||
(define-gexp-compiler (greetd-noctalia-greeter-session-compiler
|
||||
(session <greetd-noctalia-greeter-session>)
|
||||
system target)
|
||||
(match-record/dolly session <greetd-noctalia-greeter-session> (noctalia-greeter-session)
|
||||
(lower-object
|
||||
(program-file "noctalia-greeter-wrapper"
|
||||
#~(execl #$noctalia-greeter-session #$noctalia-greeter-session)))))
|
||||
|
||||
|
||||
;;;
|
||||
;;; tuigreet
|
||||
;;;
|
||||
|
||||
(define-record-type* <greetd-tuigreet-session>
|
||||
greetd-tuigreet-session make-greetd-tuigreet-session
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
;; Guix packages
|
||||
#:use-module (gnu packages fcitx5)
|
||||
#:use-module (gnu packages fonts)
|
||||
#:autoload (gnu packages glib) (glib)
|
||||
#:use-module (gnu packages gnome)
|
||||
#:use-module (gnu packages guile)
|
||||
#:use-module (gnu packages hardware)
|
||||
@@ -353,22 +354,36 @@
|
||||
;;;
|
||||
|
||||
(define-configuration/no-serialization home-niri-configuration
|
||||
(niri
|
||||
(file-like niri)
|
||||
"")
|
||||
(config
|
||||
maybe-file-like
|
||||
""))
|
||||
|
||||
(define (validated-niri-config niri file)
|
||||
(computed-file "niri.kdl"
|
||||
(with-imported-modules '((guix build utils))
|
||||
#~(begin
|
||||
(use-modules (guix build utils))
|
||||
(invoke #+(file-append niri "/bin/niri") "validate"
|
||||
"--config" #$file)
|
||||
(copy-file #$file #$output)))))
|
||||
|
||||
(define %home-niri-xdg-config
|
||||
(match-record-lambda <home-niri-configuration>
|
||||
(config)
|
||||
(niri config)
|
||||
(if (maybe-value-set? config)
|
||||
`(("niri/config.kdl" ,config))
|
||||
`(("niri/config.kdl" ,(validated-niri-config niri config)))
|
||||
'())))
|
||||
|
||||
(define home-niri-service-type
|
||||
(service-type
|
||||
(name 'home-niri)
|
||||
(extensions
|
||||
(list (service-extension home-xdg-configuration-files-service-type
|
||||
(list (service-extension home-profile-service-type
|
||||
(compose list home-niri-configuration-niri))
|
||||
(service-extension home-xdg-configuration-files-service-type
|
||||
%home-niri-xdg-config)))
|
||||
(default-value (home-niri-configuration))
|
||||
(description
|
||||
@@ -522,7 +537,7 @@ compositor.")))
|
||||
(string "Adwaita")
|
||||
"")
|
||||
(font
|
||||
(string "Sans")
|
||||
(string "sans-serif 11")
|
||||
"")
|
||||
(cursor-theme
|
||||
(string "Adwaita")
|
||||
@@ -534,6 +549,14 @@ compositor.")))
|
||||
(string "Default")
|
||||
""))
|
||||
|
||||
(define home-theme-activation-service
|
||||
(match-record-lambda <home-theme-configuration>
|
||||
(icon-theme cursor-theme font)
|
||||
#~(let ((gsettings #$(file-append (gexp-input glib "bin") "/bin/gsettings")))
|
||||
(system* gsettings "set" "org.gnome.desktop.interface" "icon-theme" #$icon-theme)
|
||||
(system* gsettings "set" "org.gnome.desktop.interface" "cursor-theme" #$cursor-theme)
|
||||
(system* gsettings "set" "org.gnome.desktop.interface" "font-name" #$font))))
|
||||
|
||||
(define (%home-theme-environment-variables _)
|
||||
'(("QT_QPA_PLATFORMTHEME" . "gtk3")
|
||||
("QT_WAYLAND_DECORATION" . "adwaita")))
|
||||
@@ -542,7 +565,6 @@ compositor.")))
|
||||
(match-record-lambda <home-theme-configuration>
|
||||
(packages)
|
||||
(cons* adwaita-icon-theme
|
||||
hicolor-icon-theme
|
||||
packages)))
|
||||
|
||||
(define home-theme-icons-config
|
||||
@@ -580,11 +602,22 @@ compositor.")))
|
||||
("gtk-cursor-theme-size" . ,cursor-size)
|
||||
("gtk-key-theme-name" . ,key-theme))))
|
||||
|
||||
(define home-theme-gtk4
|
||||
(match-record-lambda <home-theme-configuration>
|
||||
(icon-theme font cursor-theme cursor-size key-theme)
|
||||
`(("gtk-theme-name" . "Adwaita")
|
||||
("gtk-icon-theme-name" . ,icon-theme)
|
||||
("gtk-font-name" . ,font)
|
||||
("gtk-cursor-theme-name" . ,cursor-theme)
|
||||
("gtk-cursor-theme-size" . ,cursor-size))))
|
||||
|
||||
(define home-theme-service-type
|
||||
(service-type
|
||||
(name 'home-theme)
|
||||
(extensions
|
||||
(list (service-extension home-environment-variables-service-type
|
||||
(list (service-extension home-activation-service-type
|
||||
home-theme-activation-service)
|
||||
(service-extension home-environment-variables-service-type
|
||||
%home-theme-environment-variables)
|
||||
(service-extension home-profile-service-type
|
||||
%home-theme-profile)
|
||||
@@ -597,7 +630,7 @@ compositor.")))
|
||||
(service-extension home-gtk3-service-type
|
||||
home-theme-gtk3)
|
||||
(service-extension home-gtk4-service-type
|
||||
home-theme-gtk3)))
|
||||
home-theme-gtk4)))
|
||||
(default-value (home-theme-configuration))
|
||||
(description "Set up desktop themes.")))
|
||||
|
||||
@@ -676,18 +709,12 @@ compositor.")))
|
||||
,@(default-skeletons)))
|
||||
|
||||
(define %rosenthal-skeletons-installer
|
||||
`((".config/noctalia/settings.json"
|
||||
,(local-file "../examples/dot-config/noctalia/settings.json"))
|
||||
`((".local/state/noctalia/.setup-complete"
|
||||
,(plain-file "empty" ""))
|
||||
(".local/state/noctalia/settings.toml"
|
||||
,(local-file "../examples/dot-config/noctalia/settings.toml"))
|
||||
(".config/wezterm/wezterm.lua"
|
||||
,(local-file "../examples/dot-config/wezterm/wezterm.lua"))
|
||||
;; Prevent Noctalia shell initial screen.
|
||||
(".cache/noctalia/shell-state.json"
|
||||
,(json-file "noctalia-shell-state.json"
|
||||
#~'(("changelogState"
|
||||
("lastSeenVersion"
|
||||
. #$(string-append "v" (package-version noctalia-shell))))
|
||||
("telemetry"
|
||||
("instanceId" . "")))))
|
||||
,@%rosenthal-skeletons))
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix modules)
|
||||
#:use-module (guix records)
|
||||
#:use-module (rosenthal utils file)
|
||||
#:use-module (rosenthal utils predicates)
|
||||
;; Guix System
|
||||
#:use-module (gnu system shadow)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#:use-module (guix i18n)
|
||||
#:use-module (guix records)
|
||||
#:use-module (rosenthal utils packages)
|
||||
#:use-module (rosenthal utils records)
|
||||
;; Guix System - services
|
||||
#:use-module (gnu services)
|
||||
#:use-module (gnu services configuration)
|
||||
@@ -20,12 +21,16 @@
|
||||
;; Guix packages
|
||||
#:use-module (gnu packages rust-apps)
|
||||
#:use-module (gnu packages shellutils)
|
||||
#:use-module (rosenthal packages shellutils)
|
||||
#:export (home-fish-plugin-atuin-service-type
|
||||
home-atuin-configuration
|
||||
|
||||
home-fish-plugin-direnv-service-type
|
||||
home-direnv-configuration
|
||||
|
||||
home-fish-plugin-stinkpot-service-type
|
||||
home-stinkpot-configuration
|
||||
|
||||
home-fish-plugin-zoxide-service-type
|
||||
home-zoxide-configuration))
|
||||
|
||||
@@ -108,6 +113,41 @@ end\n"))))))
|
||||
(define-deprecated/public-alias home-direnv-service-type
|
||||
home-fish-plugin-direnv-service-type)
|
||||
|
||||
|
||||
;;;
|
||||
;;; stinkpot
|
||||
;;;
|
||||
|
||||
(define-record-type/dolly <home-stinkpot-configuration>
|
||||
home-stinkpot-configuration
|
||||
make-home-stinkpot-configuration
|
||||
home-stinkpot-configuration?
|
||||
this-home-stinkpot-configuration
|
||||
(stinkpot
|
||||
home-stinkpot-configuration-stinkpot
|
||||
(default stinkpot)
|
||||
(contract file-like?)))
|
||||
|
||||
(define home-stinkpot-fish-service
|
||||
(match-record-lambda/dolly <home-stinkpot-configuration>
|
||||
(stinkpot)
|
||||
(home-fish-extension
|
||||
(config
|
||||
(list (mixed-text-file "stinkpot.fish" "\
|
||||
status is-interactive
|
||||
and begin
|
||||
" stinkpot "/bin/stinkpot init fish | source
|
||||
end\n"))))))
|
||||
|
||||
(define home-fish-plugin-stinkpot-service-type
|
||||
(service-type
|
||||
(name 'home-stinkpot)
|
||||
(extensions
|
||||
(list (service-extension home-fish-service-type
|
||||
home-stinkpot-fish-service)))
|
||||
(default-value (home-stinkpot-configuration))
|
||||
(description "Set up @command{stinkpot} for Fish shell.")))
|
||||
|
||||
|
||||
;;;
|
||||
;;; zoxide
|
||||
|
||||
@@ -6,9 +6,12 @@
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix modules)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix profiles)
|
||||
#:use-module (guix records)
|
||||
#:use-module (rosenthal utils contract combinators)
|
||||
#:use-module (rosenthal utils file)
|
||||
#:use-module (rosenthal utils predicates)
|
||||
#:use-module (rosenthal utils records)
|
||||
;; Guix origin methods
|
||||
#:use-module (guix download)
|
||||
;; Guix System
|
||||
@@ -229,45 +232,59 @@
|
||||
|
||||
(define forgejo-activation
|
||||
#~(begin
|
||||
(use-modules (guix build utils))
|
||||
(let ((user (getpwnam "forgejo")))
|
||||
(for-each
|
||||
(lambda (dir)
|
||||
(mkdir-p dir)
|
||||
(chown dir (passwd:uid user) (passwd:gid user))
|
||||
(chmod dir #o750))
|
||||
'("/var/lib/forgejo" "/var/log/forgejo")))))
|
||||
(use-modules (srfi srfi-26))
|
||||
(for-each (cute mkdir-p/perms <> (getpwnam "forgejo") #o750)
|
||||
'("/var/lib/forgejo" "/var/log/forgejo"))))
|
||||
|
||||
(define forgejo-shepherd-service
|
||||
(match-record-lambda <forgejo-configuration>
|
||||
(forgejo config)
|
||||
(forgejo git-packages config)
|
||||
(let ((config-file
|
||||
(if (file-config? config)
|
||||
(ini-file "forgejo.ini" config)
|
||||
config)))
|
||||
(list (shepherd-service
|
||||
(documentation "Run Forgejo.")
|
||||
(provision '(forgejo))
|
||||
(requirement '(loopback postgresql))
|
||||
(start
|
||||
#~(make-forkexec-constructor
|
||||
(list "/run/current-system/profile/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))))))))
|
||||
config))
|
||||
(git-profile
|
||||
(profile
|
||||
(name "forgejo-git-profile")
|
||||
(content (packages->manifest git-packages)))))
|
||||
(list
|
||||
(shepherd-service
|
||||
(documentation "Run Forgejo.")
|
||||
(provision '(forgejo))
|
||||
(requirement '(user-processes postgresql loopback))
|
||||
(start
|
||||
#~(lambda _
|
||||
(define (forgejo-run . options)
|
||||
(let ((command
|
||||
(cons* #$(file-append forgejo "/bin/forgejo")
|
||||
"--config" #$config-file
|
||||
options))
|
||||
(args
|
||||
(list #:user "forgejo"
|
||||
#:group "forgejo"
|
||||
#:log-file
|
||||
(if (null? options)
|
||||
"/var/log/forgejo.log"
|
||||
"/var/log/forgejo-init.log")
|
||||
#:environment-variables
|
||||
(list "HOME=/var/lib/forgejo"
|
||||
"SSL_CERT_DIR=/etc/ssl/certs"
|
||||
"SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt"
|
||||
"GIT_SSL_CAINFO=/etc/ssl/certs/ca-certificates.crt"
|
||||
(format #f "GIT_EXEC_PATH=~a/libexec/git-core" #$git-profile)
|
||||
(format #f "PATH=/run/current-system/profile/bin:~a/bin" #$git-profile))
|
||||
#:resource-limits '((nofile 524288 524288)))))
|
||||
(if (null? options)
|
||||
(apply fork+exec-command command args)
|
||||
(unless (zero? (apply spawn-command command args))
|
||||
(error "failed to run forgejo command" command)))))
|
||||
(forgejo-run "migrate")
|
||||
(forgejo-run "admin" "regenerate" "hooks")
|
||||
(forgejo-run "admin" "regenerate" "keys")
|
||||
(forgejo-run "doctor" "check" "--all")
|
||||
(forgejo-run)))
|
||||
(stop #~(make-kill-destructor))
|
||||
(actions (list (shepherd-configuration-action config-file))))))))
|
||||
|
||||
(define forgejo-service-type
|
||||
(service-type
|
||||
@@ -277,10 +294,6 @@
|
||||
forgejo-account)
|
||||
(service-extension postgresql-role-service-type
|
||||
forgejo-postgresql-role)
|
||||
(service-extension profile-service-type
|
||||
(lambda (config)
|
||||
(cons (forgejo-configuration-forgejo config)
|
||||
(forgejo-configuration-git-packages config))))
|
||||
(service-extension activation-service-type
|
||||
(const forgejo-activation))
|
||||
(service-extension shepherd-root-service-type
|
||||
@@ -392,7 +405,7 @@ test its configuration file."))
|
||||
;;; Jellyfin media system (Native, currently written for the Nix package).
|
||||
;;;
|
||||
|
||||
(define-record-type* <jellyfin-configuration>
|
||||
(define-record-type/dolly <jellyfin-configuration>
|
||||
jellyfin-configuration
|
||||
make-jellyfin-configuration
|
||||
jellyfin-configuration?
|
||||
@@ -462,9 +475,9 @@ test its configuration file."))
|
||||
(documentation
|
||||
"Extra command-line options.")))
|
||||
|
||||
(define (jellyfin-account-service config)
|
||||
(match-record config <jellyfin-configuration>
|
||||
(data-directory user group)
|
||||
(define jellyfin-account-service
|
||||
(match-record-lambda/dolly <jellyfin-configuration>
|
||||
(data-directory user group)
|
||||
(list (user-group
|
||||
(name "jellyfin")
|
||||
(id group)
|
||||
@@ -478,9 +491,9 @@ test its configuration file."))
|
||||
(shell (file-append shadow "/sbin/nologin"))
|
||||
(system? #t)))))
|
||||
|
||||
(define (jellyfin-activation-service config)
|
||||
(match-record config <jellyfin-configuration>
|
||||
(data-directory config-directory cache-directory log-directory)
|
||||
(define jellyfin-activation-service
|
||||
(match-record-lambda/dolly <jellyfin-configuration>
|
||||
(data-directory config-directory cache-directory log-directory)
|
||||
#~(let ((owner (getpwnam "jellyfin")))
|
||||
(for-each (lambda (dir)
|
||||
(mkdir-p/perms dir owner #o755))
|
||||
@@ -489,11 +502,11 @@ test its configuration file."))
|
||||
cache-directory
|
||||
log-directory)))))
|
||||
|
||||
(define (jellyfin-shepherd-service config)
|
||||
(match-record config <jellyfin-configuration>
|
||||
(jellyfin
|
||||
data-directory config-directory cache-directory log-directory
|
||||
shepherd-requirement extra-options)
|
||||
(define jellyfin-shepherd-service
|
||||
(match-record-lambda/dolly <jellyfin-configuration>
|
||||
(jellyfin
|
||||
data-directory config-directory cache-directory log-directory
|
||||
shepherd-requirement extra-options)
|
||||
(list (shepherd-service
|
||||
(documentation "Run the Jellyfin media system.")
|
||||
(provision '(jellyfin))
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (rosenthal utils contract)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (guix colors)
|
||||
#:use-module (guix diagnostics)
|
||||
#:use-module (rosenthal utils contract impl)
|
||||
#:use-module (rosenthal utils contract blame)
|
||||
#:use-module (rosenthal utils contract combinators)
|
||||
#:export (apply-contract/guix-record-field
|
||||
contract
|
||||
define/contract))
|
||||
|
||||
#|
|
||||
|
||||
Helpers to attach contracts to values and functions.
|
||||
|
||||
See (rosenthal utils contract impl) for more information.
|
||||
|
||||
|#
|
||||
|
||||
(define (src->location-str src)
|
||||
(match src
|
||||
((_ _ _)
|
||||
(let ((location (source-properties->location src)))
|
||||
(if (supports-hyperlinks? (guix-warning-port))
|
||||
(location->hyperlink location)
|
||||
(location->string location))))
|
||||
(_ #f)))
|
||||
|
||||
(define* (apply-contract contract value positive negative name location
|
||||
#:key context-limit)
|
||||
(let* ((ctc (->contract contract))
|
||||
(ctc-name (contract-name ctc))
|
||||
(checker (contract-checker ctc))
|
||||
(blame
|
||||
(make-blame*
|
||||
#:source location
|
||||
#:value name
|
||||
#:build-name (lambda () ctc-name)
|
||||
#:positive positive
|
||||
#:negative #f
|
||||
#:original? #t
|
||||
#:context-limit context-limit)))
|
||||
(cond
|
||||
(checker
|
||||
(if (checker value)
|
||||
value
|
||||
(raise-blame-error
|
||||
blame #:missing-party negative
|
||||
`(expected: "~a" got: "~s") ctc-name value)))
|
||||
(else
|
||||
(((contract-enforcer ctc) blame) value negative)))))
|
||||
|
||||
(define-syntax apply-contract/guix-record-field
|
||||
(lambda (stx)
|
||||
(syntax-case stx ()
|
||||
((_ ctc value record-name field-name)
|
||||
(with-syntax ((field-name #'(format #f "(field: ~a)" field-name))
|
||||
(location (src->location-str (syntax-source stx))))
|
||||
;; Use field-name for both positive and negative parties, to ensure the
|
||||
;; error message is always "contract violation".
|
||||
#'(apply-contract ctc value field-name field-name record-name location))))))
|
||||
|
||||
(define-syntax contract
|
||||
(lambda (stx)
|
||||
(syntax-case stx ()
|
||||
((_ ctc value positive negative name location #:context-limit context-limit)
|
||||
#'(apply-contract ctc value positive negative name location #:context-limit context-limit))
|
||||
((_ ctc value positive negative name location)
|
||||
#'(contract ctc value positive negative name location #:context-limit #f))
|
||||
((_ ctc value positive negative name)
|
||||
(with-syntax ((location (src->location-str (syntax-source stx))))
|
||||
#'(contract ctc value positive negative name location)))
|
||||
((_ ctc value positive negative)
|
||||
#'(contract ctc value positive negative positive))
|
||||
((_ ctc value)
|
||||
#'(contract ctc value 'unknown-definition 'caller)))))
|
||||
|
||||
(define-syntax define/contract
|
||||
(lambda (stx)
|
||||
(syntax-case stx ()
|
||||
((_ (name . args) ctc body ...)
|
||||
(if (null? #'(body ...))
|
||||
(syntax-violation 'define/contract "missing body" stx)
|
||||
(with-syntax ((value #'(lambda* args body ...)))
|
||||
#'(define name
|
||||
(contract ctc value '(definition: name) 'caller 'name)))))
|
||||
((_ name ctc body ...)
|
||||
(if (null? #'(body ...))
|
||||
(syntax-violation 'define/contract "missing body" stx)
|
||||
(with-syntax ((value #'(begin body ...)))
|
||||
#'(define name
|
||||
(contract ctc value '(definition: name) 'caller 'name))))))))
|
||||
@@ -0,0 +1,704 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
;;; https://github.com/racket/racket/blob/master/racket/collects/racket/contract/private/blame.rkt
|
||||
;;; Copyright © 2010-2019, 2021, 2024 Racket authors
|
||||
;;; Ported from Racket, original copyright notice below:
|
||||
;;;
|
||||
;;; Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
;;; of this software and associated documentation files (the "Software"), to
|
||||
;;; deal in the Software without restriction, including without limitation the
|
||||
;;; rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
;;; sell copies of the Software, and to permit persons to whom the Software is
|
||||
;;; furnished to do so, subject to the following conditions:
|
||||
;;;
|
||||
;;; The above copyright notice and this permission notice shall be included in
|
||||
;;; all copies or substantial portions of the Software.
|
||||
;;;
|
||||
;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
;;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
;;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
;;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
;;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
;;; IN THE SOFTWARE.
|
||||
|
||||
(define-module (rosenthal utils contract blame)
|
||||
#:use-module (ice-9 format)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 regex)
|
||||
#:use-module (ice-9 string-fun)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-9)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (srfi srfi-34)
|
||||
#:use-module (srfi srfi-35)
|
||||
#:use-module (srfi srfi-71)
|
||||
#:export (blame?
|
||||
make-blame
|
||||
blame-source
|
||||
blame-positive
|
||||
blame-negative
|
||||
blame-contract
|
||||
blame-value
|
||||
blame-original?
|
||||
blame-swapped?
|
||||
blame-swap
|
||||
blame-replace-negative ;used for indy blame
|
||||
blame-replaced-negative? ;used for indy blame
|
||||
blame-update ;used for option contract transfers
|
||||
blame-add-context
|
||||
;; blame-add-unknown-context
|
||||
blame-context
|
||||
blame-replaced-negative?
|
||||
|
||||
blame-add-missing-party
|
||||
blame-missing-party?
|
||||
;; blame-add-extra-field
|
||||
|
||||
raise-blame-error
|
||||
;; current-blame-format
|
||||
;; exn:fail:contract:blame
|
||||
;; blame-fmt->-string
|
||||
|
||||
;; invariant-assertion-party
|
||||
|
||||
;; NOTE: New interfaces.
|
||||
contract-violation?
|
||||
make-blame*))
|
||||
|
||||
#|
|
||||
|
||||
Blame provides error reporting for the contract system. This module implements
|
||||
its structure and APIs, and currently follows Racket error message conventions.
|
||||
See also:
|
||||
https://docs.racket-lang.org/reference/exns.html#(part._err-msg-conventions)
|
||||
|
||||
|
||||
Blame has a linked structure of <blame> -> <blame> -> ... -> <all-the-info>.
|
||||
|
||||
<all-the-info> records contract information and each <blame> node adds extra
|
||||
context to it. The extra context is combinator-specific (e.g. "the #1 element
|
||||
of"). For higher-order functions, it also includes whether the positive party
|
||||
and negative party are swapped.
|
||||
|
||||
|
||||
The positive party provides a definition, and the negative party uses it. For
|
||||
contracts on higher-order functions, both parties are swapped for function
|
||||
arguments.
|
||||
|
||||
For example, consider the following definition:
|
||||
|
||||
(define/contract (example f)
|
||||
(->/c (->/c number? number?) number?)
|
||||
...)
|
||||
|
||||
The positive party and negative party for ‘example’ will be ‘example’ and
|
||||
‘caller’, respectively.
|
||||
|
||||
‘f’ has a function contract ‘(->/c number? number?)’. As an argument of
|
||||
‘example’, it initially gets ‘example’ for positive and ‘caller’ for negative.
|
||||
|
||||
However the definition of ‘f’ is provided by the caller, so both parties should
|
||||
be swapped: ‘caller’ for positive, and ‘example’ for negative.
|
||||
|
||||
|##|
|
||||
|
||||
‘make-blame’ constructs a blame. (<blame> -> <all-the-info>)
|
||||
|
||||
(define b1
|
||||
(make-blame*
|
||||
#:source #f
|
||||
#:value 'my-function
|
||||
#:build-name (const "(listof/c (listof/c number?))")
|
||||
#:positive 'my-function
|
||||
#:negative 'caller
|
||||
#:original? #t))
|
||||
|
||||
b1
|
||||
=> #<<blame>
|
||||
context-frame: #f
|
||||
swapped?: #f
|
||||
and-more: #<<all-the-info> ...>
|
||||
(blame-swapped? b1)
|
||||
=> #f
|
||||
(blame-positive b1)
|
||||
=> 'my-function
|
||||
(blame-negative b1)
|
||||
=> 'caller
|
||||
(blame-context b1)
|
||||
=> '()
|
||||
(blame-contract b1)
|
||||
=> "(listof/c (listof/c number?))"
|
||||
|
||||
‘blame-add-context’ adds a new head node with extra context. (<blame> -> ...)
|
||||
|
||||
(define b2
|
||||
(blame-add-context b1 "an element of" #:swap? #t))
|
||||
|
||||
b2
|
||||
=> #<<blame>
|
||||
context-frame: "an element of"
|
||||
swapped? #t
|
||||
and-more: #<<blame>
|
||||
context-frame: #f
|
||||
swapped?: #f
|
||||
and-more: #<<all-the-info> ...>>
|
||||
(blame-swapped? b2)
|
||||
=> #t
|
||||
(blame-positive b2)
|
||||
=> 'caller
|
||||
(blame-negative b2)
|
||||
=> 'my-function
|
||||
(blame-context b2)
|
||||
=> '("an element of")
|
||||
(blame-contract b2)
|
||||
=> "(listof/c (listof/c number?))"
|
||||
|
||||
(define b3
|
||||
(blame-add-context b2 "the #1 element of" #:swap? #t))
|
||||
|
||||
b3
|
||||
=> #<<blame>
|
||||
context-frame: "the #1 element of"
|
||||
swapped? #t
|
||||
and-more: #<<blame>
|
||||
context-frame: "an element of"
|
||||
swapped? #t
|
||||
and-more: #<<blame>
|
||||
context-frame: #f
|
||||
swapped?: #f
|
||||
and-more: #<<all-the-info> ...>>
|
||||
(blame-swapped? b3)
|
||||
=> #f
|
||||
(blame-positive b3)
|
||||
=> 'my-function
|
||||
(blame-negative b3)
|
||||
=> 'caller
|
||||
(blame-context b3)
|
||||
=> '("the #1 element of" "an element of")
|
||||
(blame-contract b3)
|
||||
=> "(listof/c (listof/c number?))"
|
||||
|
||||
|#
|
||||
|
||||
|
||||
|
||||
(define-condition-type &contract-violation &message
|
||||
contract-violation?)
|
||||
|
||||
(define-record-type <important>
|
||||
(make-important name sense-swapped?)
|
||||
important?
|
||||
(name important-name) ; any/c
|
||||
(sense-swapped? important-sense-swapped?)) ; boolean?
|
||||
|
||||
(define-record-type <all-the-info>
|
||||
(make-all-the-info positive negative source value build-name important
|
||||
missing-party? context-limit replaced-negative?)
|
||||
all-the-info?
|
||||
(positive all-the-info-positive) ; (or/c #f (listof/c any/c))
|
||||
(negative all-the-info-negative) ; (or/c #f (listof/c any/c))
|
||||
(source all-the-info-source) ; (or/c #f string?)
|
||||
(value all-the-info-value) ; any/c
|
||||
(build-name all-the-info-build-name) ; (->/c string?)
|
||||
(important all-the-info-important) ; important?
|
||||
(missing-party? all-the-info-missing-party?) ; boolean?
|
||||
(context-limit all-the-info-context-limit) ; (or/c #f (and/c integer? (not/c negative?)))
|
||||
(replaced-negative? all-the-info-replaced-negative?)) ; boolean?
|
||||
|
||||
(define (all-the-info-replace-positive all-the-info new-pos)
|
||||
(make-all-the-info
|
||||
(all-the-info-positive new-pos)
|
||||
(all-the-info-negative all-the-info)
|
||||
(all-the-info-source all-the-info)
|
||||
(all-the-info-value all-the-info)
|
||||
(all-the-info-build-name all-the-info)
|
||||
(all-the-info-important all-the-info)
|
||||
(all-the-info-missing-party? all-the-info)
|
||||
(all-the-info-context-limit all-the-info)
|
||||
(all-the-info-replaced-negative? all-the-info)))
|
||||
|
||||
(define (all-the-info-replace-negative all-the-info new-neg)
|
||||
(make-all-the-info
|
||||
(all-the-info-positive all-the-info)
|
||||
(all-the-info-negative new-neg)
|
||||
(all-the-info-source all-the-info)
|
||||
(all-the-info-value all-the-info)
|
||||
(all-the-info-build-name all-the-info)
|
||||
(all-the-info-important all-the-info)
|
||||
(all-the-info-missing-party? all-the-info)
|
||||
(all-the-info-context-limit all-the-info)
|
||||
(all-the-info-replaced-negative? all-the-info)))
|
||||
|
||||
(define-record-type <blame>
|
||||
(%make-blame context-frame swapped? and-more)
|
||||
blame?
|
||||
(context-frame %blame-context-frame) ; (or/c #f string?)
|
||||
(swapped? %blame-swapped?) ; boolean?
|
||||
(and-more %blame-and-more)) ; (or/c blame? all-the-info?)
|
||||
|
||||
(define* (make-blame source value build-name positive negative original?
|
||||
#:key (context-limit #f))
|
||||
(define build/memo-name
|
||||
(let ((name (delay (build-name))))
|
||||
(lambda ()
|
||||
(force name))))
|
||||
|
||||
(define all-the-info
|
||||
(make-all-the-info
|
||||
(and positive (list positive))
|
||||
(and negative (list negative))
|
||||
source
|
||||
value
|
||||
build/memo-name
|
||||
#f
|
||||
(not (and positive negative))
|
||||
context-limit
|
||||
#f))
|
||||
|
||||
(%make-blame
|
||||
#f
|
||||
(not original?)
|
||||
all-the-info))
|
||||
|
||||
(define* (make-blame* #:key source value build-name positive negative original?
|
||||
(context-limit #f))
|
||||
(make-blame source value build-name positive negative original?
|
||||
#:context-limit context-limit))
|
||||
|
||||
(define (blame->all-the-info blame)
|
||||
(let loop ((b blame))
|
||||
(if (blame? b)
|
||||
(loop (%blame-and-more b))
|
||||
b)))
|
||||
|
||||
(define blame-source
|
||||
(compose all-the-info-source blame->all-the-info))
|
||||
(define blame-value
|
||||
(compose all-the-info-value blame->all-the-info))
|
||||
(define (blame-contract blame)
|
||||
((all-the-info-build-name (blame->all-the-info blame))))
|
||||
(define blame-important
|
||||
(compose all-the-info-important blame->all-the-info))
|
||||
(define blame-missing-party?
|
||||
(compose all-the-info-missing-party? blame->all-the-info))
|
||||
(define blame-context-limit
|
||||
(compose all-the-info-context-limit blame->all-the-info))
|
||||
(define blame-replaced-negative?
|
||||
(compose all-the-info-replaced-negative? blame->all-the-info))
|
||||
|
||||
(define (blame-get-info blame getter)
|
||||
(let loop ((b blame)
|
||||
(swapped? #f))
|
||||
(if (blame? b)
|
||||
(loop (%blame-and-more b)
|
||||
(if (%blame-swapped? b)
|
||||
(not swapped?)
|
||||
swapped?))
|
||||
(getter b swapped?))))
|
||||
|
||||
(define (blame-set-info blame setter)
|
||||
(let loop ((b blame)
|
||||
(swap? #f))
|
||||
(if (blame? b)
|
||||
(%make-blame
|
||||
(%blame-context-frame b)
|
||||
(%blame-swapped? b)
|
||||
(loop (%blame-and-more b)
|
||||
(if (%blame-swapped? b)
|
||||
(not swap?)
|
||||
swap?)))
|
||||
(setter b swap?))))
|
||||
|
||||
(define (%blame-positive blame)
|
||||
(blame-get-info
|
||||
blame
|
||||
(lambda (all-the-info swapped?)
|
||||
(if swapped?
|
||||
(all-the-info-negative all-the-info)
|
||||
(all-the-info-positive all-the-info)))))
|
||||
|
||||
(define (%blame-negative blame)
|
||||
(blame-get-info
|
||||
blame
|
||||
(lambda (all-the-info swapped?)
|
||||
(if swapped?
|
||||
(all-the-info-positive all-the-info)
|
||||
(all-the-info-negative all-the-info)))))
|
||||
|
||||
(define (show-blame accessor blame)
|
||||
(match (accessor blame)
|
||||
((x) x)
|
||||
(x x)))
|
||||
(define blame-positive
|
||||
(cut show-blame %blame-positive <>))
|
||||
(define blame-negative
|
||||
(cut show-blame %blame-negative <>))
|
||||
|
||||
(define (ensure-blame-known who blame)
|
||||
(unless (and (%blame-positive blame)
|
||||
(%blame-negative blame))
|
||||
(error who "blame info is not known; positive ~s negative ~s"
|
||||
(%blame-positive blame)
|
||||
(%blame-negative blame))))
|
||||
|
||||
(define (blame-update blame extra-positive extra-negative)
|
||||
(ensure-blame-known 'blame-update blame)
|
||||
(blame-set-info
|
||||
blame
|
||||
(lambda (all-the-info swap?)
|
||||
(if swap?
|
||||
(make-all-the-info
|
||||
(cons extra-negative
|
||||
(all-the-info-positive all-the-info))
|
||||
(cons extra-positive
|
||||
(all-the-info-negative all-the-info))
|
||||
(all-the-info-source all-the-info)
|
||||
(all-the-info-value all-the-info)
|
||||
(all-the-info-build-name all-the-info)
|
||||
(all-the-info-important all-the-info)
|
||||
(all-the-info-missing-party? all-the-info)
|
||||
(all-the-info-context-limit all-the-info)
|
||||
(all-the-info-replaced-negative? all-the-info))
|
||||
(make-all-the-info
|
||||
(cons extra-positive
|
||||
(all-the-info-positive all-the-info))
|
||||
(cons extra-negative
|
||||
(all-the-info-negative all-the-info))
|
||||
(all-the-info-source all-the-info)
|
||||
(all-the-info-value all-the-info)
|
||||
(all-the-info-build-name all-the-info)
|
||||
(all-the-info-important all-the-info)
|
||||
(all-the-info-missing-party? all-the-info)
|
||||
(all-the-info-context-limit all-the-info)
|
||||
(all-the-info-replaced-negative? all-the-info))))))
|
||||
|
||||
(define (blame-swap blame)
|
||||
(%make-blame
|
||||
(%blame-context-frame blame)
|
||||
(not (%blame-swapped? blame))
|
||||
(%blame-and-more blame)))
|
||||
|
||||
(define (blame-swapped? blame)
|
||||
(blame-get-info
|
||||
blame
|
||||
(lambda (_ swapped?) swapped?)))
|
||||
|
||||
(define blame-original?
|
||||
(negate blame-swapped?))
|
||||
|
||||
(define (blame/important-original? blame)
|
||||
(let ((important (blame-important blame)))
|
||||
(cond
|
||||
((equal? (%blame-positive blame)
|
||||
(%blame-negative blame))
|
||||
#f)
|
||||
(important
|
||||
(equal? (important-sense-swapped? important)
|
||||
(blame-original? blame)))
|
||||
(else
|
||||
(blame-original? blame)))))
|
||||
|
||||
(define (blame-replace-negative blame new-neg)
|
||||
(blame-set-info
|
||||
blame
|
||||
(lambda (all-the-info swap?)
|
||||
(if swap?
|
||||
(all-the-info-replace-positive all-the-info new-neg)
|
||||
(all-the-info-replace-negative all-the-info new-neg)))))
|
||||
|
||||
(define (blame-add-missing-party blame missing-party)
|
||||
(if missing-party
|
||||
(begin
|
||||
(unless (blame-missing-party? blame)
|
||||
(error 'blame-add-missing-party "already have the party: ~s; trying to add ~s"
|
||||
(if (blame-swapped? blame)
|
||||
(%blame-positive blame)
|
||||
(%blame-negative blame))
|
||||
missing-party))
|
||||
(blame-set-info
|
||||
blame
|
||||
(lambda (all-the-info _)
|
||||
(make-all-the-info
|
||||
(or (all-the-info-positive all-the-info)
|
||||
(list missing-party))
|
||||
(or (all-the-info-negative all-the-info)
|
||||
(list missing-party))
|
||||
(all-the-info-source all-the-info)
|
||||
(all-the-info-value all-the-info)
|
||||
(all-the-info-build-name all-the-info)
|
||||
(all-the-info-important all-the-info)
|
||||
#f
|
||||
(all-the-info-context-limit all-the-info)
|
||||
(all-the-info-replaced-negative? all-the-info)))))
|
||||
blame))
|
||||
|
||||
(define (blame-context blame)
|
||||
(let loop ((top (%blame-context-frame blame))
|
||||
(b (%blame-and-more blame)))
|
||||
(cond
|
||||
((all-the-info? b)
|
||||
(if top
|
||||
(list top)
|
||||
'()))
|
||||
(else
|
||||
(cons top
|
||||
(loop (%blame-context-frame b)
|
||||
(%blame-and-more b)))))))
|
||||
|
||||
(define* (blame-add-context blame context #:key important swap?)
|
||||
(let ((context-limit (blame-context-limit blame)))
|
||||
(if context-limit
|
||||
(cond
|
||||
((not (zero? context-limit))
|
||||
(let ((limited-blame
|
||||
dropped-swap?
|
||||
(drop-to-limit blame context-limit)))
|
||||
(%make-blame
|
||||
context
|
||||
(not (equal? dropped-swap? swap?))
|
||||
limited-blame)))
|
||||
(swap?
|
||||
(%make-blame
|
||||
(%blame-context-frame blame)
|
||||
(not (%blame-swapped? blame))
|
||||
(%blame-and-more blame)))
|
||||
(else blame))
|
||||
(%make-blame
|
||||
context
|
||||
swap?
|
||||
(if important
|
||||
(let loop ((b blame))
|
||||
(if (blame? b)
|
||||
(%make-blame
|
||||
(%blame-context-frame b)
|
||||
(%blame-swapped? b)
|
||||
(loop (%blame-and-more b)))
|
||||
(make-all-the-info
|
||||
(all-the-info-positive b)
|
||||
(all-the-info-negative b)
|
||||
(all-the-info-source b)
|
||||
(all-the-info-value b)
|
||||
(all-the-info-build-name b)
|
||||
(make-important
|
||||
important
|
||||
(if swap?
|
||||
(not (blame-original? b))
|
||||
(blame-original? b)))
|
||||
(all-the-info-missing-party? b)
|
||||
(all-the-info-context-limit b)
|
||||
(all-the-info-replaced-negative? b))))
|
||||
blame)))))
|
||||
|
||||
(define (drop-to-limit blame context-limit)
|
||||
(define short-enough?
|
||||
(let loop ((b blame)
|
||||
(n (- context-limit 1)))
|
||||
(or (all-the-info? b)
|
||||
(if (zero? n)
|
||||
#f
|
||||
(loop (%blame-and-more b)
|
||||
(- n 1))))))
|
||||
|
||||
(if short-enough?
|
||||
(values blame #f)
|
||||
(let ()
|
||||
(define swapped? #f)
|
||||
(define limited-blame
|
||||
(let outer-loop ((outer-b blame)
|
||||
(n (- context-limit 1)))
|
||||
(if (zero? n)
|
||||
(let inner-loop ((inner-b outer-b)
|
||||
(swap? #f))
|
||||
(if (blame? inner-b)
|
||||
(inner-loop (%blame-and-more inner-b)
|
||||
(if (%blame-swapped? inner-b)
|
||||
(not swap?)
|
||||
swap?))
|
||||
(begin
|
||||
(set! swapped? swap?)
|
||||
inner-b)))
|
||||
(%make-blame
|
||||
(%blame-context-frame outer-b)
|
||||
(%blame-swapped? outer-b)
|
||||
(outer-loop (%blame-and-more outer-b)
|
||||
(- n 1))))))
|
||||
(values limited-blame swapped?))))
|
||||
|
||||
(define* (raise-blame-error raw-blame #:optional x #:key (missing-party #f)
|
||||
#:rest fmt+args)
|
||||
(define blame
|
||||
(if (and (blame-original? raw-blame)
|
||||
(not missing-party))
|
||||
raw-blame
|
||||
(blame-add-missing-party raw-blame missing-party)))
|
||||
|
||||
(define start-of-message
|
||||
(let ((self-or-not
|
||||
(if (blame/important-original? blame)
|
||||
"broke its own contract"
|
||||
"contract violation")))
|
||||
(cond
|
||||
((blame-important blame)
|
||||
(format #f "~a: ~a" (important-name (blame-important blame)) self-or-not))
|
||||
((blame-value blame)
|
||||
(format #f "~a: ~a" (blame-value blame) self-or-not))
|
||||
(else
|
||||
(format #f "~a" self-or-not)))))
|
||||
|
||||
(define custom-message
|
||||
(let loop ((args fmt+args))
|
||||
(match args
|
||||
;; Keyword arguments will be added to #:rest as well, strip them.
|
||||
(((? keyword? kw) arg . rest)
|
||||
(loop rest))
|
||||
((fmt . fmt-args)
|
||||
;; When formatting outputs, please use ~s to mimic Racket ~e.
|
||||
;;
|
||||
;; XXX: ~s doesn't directly map to Racket ~e. With symbol 'x, ~s
|
||||
;; gives ‘x’ but Racket ~e gives ‘'x’, for example.
|
||||
(apply format #f (blame-fmt->string blame fmt) fmt-args)))))
|
||||
|
||||
(define context-lines
|
||||
(let ((context (blame-context blame)))
|
||||
(or (and context
|
||||
(not (null? context))
|
||||
(let loop ((ctx context)
|
||||
(idx 0)
|
||||
(res '()))
|
||||
(if (null? ctx)
|
||||
(reverse res)
|
||||
(loop (cdr ctx)
|
||||
(1+ idx)
|
||||
(cons (if (zero? idx)
|
||||
(format #f " in: ~a~%" (car ctx))
|
||||
(format #f " ~a~%" (car ctx)))
|
||||
res)))))
|
||||
'())))
|
||||
|
||||
(define contract-line
|
||||
(format #f " ~a ~a~%"
|
||||
(if (null? context-lines) "in:" " ")
|
||||
(blame-contract blame)))
|
||||
|
||||
(define from-line
|
||||
(format #f " contract from: ~a~%"
|
||||
(if (blame-original? blame)
|
||||
(last (%blame-positive blame))
|
||||
(last (%blame-negative blame)))))
|
||||
|
||||
(define on-line
|
||||
(or (and (blame-important blame)
|
||||
(blame-value blame)
|
||||
(format #f " contract on: ~a~%" (blame-value blame)))
|
||||
""))
|
||||
|
||||
(define blaming-line
|
||||
(let ((blame-parties (%blame-positive blame)))
|
||||
(match blame-parties
|
||||
((one-party)
|
||||
(format #f " blaming: ~a~%" one-party))
|
||||
((multiple-parties ...)
|
||||
(format #f " blaming multiple parties: ~{~a~%~}~%" multiple-parties)))))
|
||||
|
||||
(define assumption-line
|
||||
" (assuming the contract is correct)")
|
||||
|
||||
(define at-line
|
||||
(or (and=> (blame-source blame)
|
||||
(cut format #f "~% at: ~a" <>))
|
||||
""))
|
||||
|
||||
(raise
|
||||
(condition
|
||||
(&contract-violation
|
||||
(message
|
||||
(format #f "~%~a~a~{~a~}~a~a~a~a~a~a"
|
||||
start-of-message
|
||||
(if (string-null? custom-message) "~%" custom-message)
|
||||
context-lines
|
||||
contract-line
|
||||
from-line
|
||||
on-line
|
||||
blaming-line
|
||||
assumption-line
|
||||
at-line))))))
|
||||
|
||||
(define (blame-fmt->string blame fmt)
|
||||
(define original?
|
||||
(blame/important-original? blame))
|
||||
|
||||
(define (tag->str+newline? key val)
|
||||
(define* (kv->str key val)
|
||||
(string-append key " " val))
|
||||
|
||||
(match key
|
||||
;; Racket doesn't use ‘got’, but ‘expected’ vs ‘got’ sounds more natural
|
||||
;; considering directions.
|
||||
((or 'given: 'got:)
|
||||
(values (kv->str (if original? "produced:" "given:") val)
|
||||
#t))
|
||||
((or 'given 'got)
|
||||
(values (kv->str (if original? "produced" "given") val)
|
||||
#f))
|
||||
('expected:
|
||||
(values (kv->str (if original? "promised:" "expected:") val)
|
||||
#t))
|
||||
('expected
|
||||
(values (kv->str (if original? "promised" "expected") val)
|
||||
#f))
|
||||
('received:
|
||||
(values (kv->str (if original? "supplied:" "received:") val)
|
||||
#t))))
|
||||
|
||||
(define (normalize-continued-error-message str)
|
||||
"If STR contains newline (unless at the end), ensure there's a space next to
|
||||
it."
|
||||
(define (not-space? x)
|
||||
(not (equal? x #\space)))
|
||||
|
||||
(define str-newline-normalized
|
||||
(string-replace-substring str "~%" "\n"))
|
||||
|
||||
(if (string-contains str-newline-normalized "\n")
|
||||
(let loop ((chars (string->list str-newline-normalized))
|
||||
(result '()))
|
||||
(if (null? chars)
|
||||
(list->string (reverse result))
|
||||
(match chars
|
||||
((#\newline (? not-space? next) . rest)
|
||||
(loop rest
|
||||
(append (reverse (list #\newline #\space next))
|
||||
result)))
|
||||
((first . rest)
|
||||
(loop rest
|
||||
(cons first result))))))
|
||||
str-newline-normalized))
|
||||
|
||||
(define (build-string old new newline?)
|
||||
(if newline?
|
||||
(string-append old "\n " new)
|
||||
(let ((old (if (string-null? old) ";\n" old))
|
||||
(new (normalize-continued-error-message new)))
|
||||
(if (or (string-suffix? " " old)
|
||||
(string-match "^[\n ]" new))
|
||||
(string-append old new)
|
||||
(string-append old " " new)))))
|
||||
|
||||
(if (string? fmt)
|
||||
fmt
|
||||
(let loop ((strs fmt)
|
||||
(result ""))
|
||||
(if (null? strs)
|
||||
(if (string-null? result)
|
||||
result
|
||||
(string-append result "\n"))
|
||||
(match strs
|
||||
(((? symbol? key) (? string? val) . rest)
|
||||
(let ((str newline? (tag->str+newline? key val)))
|
||||
(loop rest
|
||||
(build-string result str newline?))))
|
||||
((str . rest)
|
||||
(loop rest
|
||||
(build-string result str #f))))))))
|
||||
@@ -0,0 +1,158 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (rosenthal utils contract combinators)
|
||||
#:use-module (ice-9 match)
|
||||
#:autoload (rnrs bytevectors) (bytevector?)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (srfi srfi-34)
|
||||
#:use-module (srfi srfi-35)
|
||||
#:use-module (guix memoization)
|
||||
#:use-module (rosenthal utils contract impl)
|
||||
#:use-module (rosenthal utils contract blame)
|
||||
#:export (any/c
|
||||
none/c
|
||||
or/c
|
||||
listof/c
|
||||
->/c
|
||||
|
||||
->contract))
|
||||
|
||||
#|
|
||||
|
||||
This module implements contract combinators. To avoid name collisions, all
|
||||
combinator names have a ‘/c’ suffix.
|
||||
|
||||
|#
|
||||
|
||||
(define any/c
|
||||
(make-contract
|
||||
#:name "any/c"
|
||||
#:checker (const #t)))
|
||||
|
||||
(define none/c
|
||||
(make-contract
|
||||
#:name "none/c"
|
||||
#:checker (const #f)))
|
||||
|
||||
(define or/c
|
||||
(memoize
|
||||
(lambda (. ctcs)
|
||||
(let* ((contracts (map ->contract ctcs))
|
||||
(enforcers (map contract-enforcer contracts))
|
||||
(name (compound-contract-name "or/c" contracts) ))
|
||||
(make-contract
|
||||
#:name name
|
||||
#:enforcer
|
||||
(lambda (blame)
|
||||
(define procs
|
||||
(map (lambda (enforcer)
|
||||
(enforcer blame))
|
||||
enforcers))
|
||||
(lambda (val neg-party)
|
||||
(let loop ((procs procs))
|
||||
(if (null? procs)
|
||||
(raise-blame-error blame #:missing-party neg-party
|
||||
'(expected: "~a" got: "~s")
|
||||
name val)
|
||||
(match procs
|
||||
((proc . rest)
|
||||
(guard (c ((contract-violation? c)
|
||||
(loop rest)))
|
||||
(proc val neg-party)))))))))))))
|
||||
|
||||
(define listof/c
|
||||
(mlambda (ctc)
|
||||
(let* ((contract (->contract ctc))
|
||||
(enforcer (contract-enforcer contract)))
|
||||
(make-contract
|
||||
#:name (compound-contract-name "listof/c" (list contract))
|
||||
#:enforcer
|
||||
(lambda (blame)
|
||||
(define proc
|
||||
(enforcer (blame-add-context blame "an element of")))
|
||||
(lambda (val neg-party)
|
||||
(unless (list? val)
|
||||
(raise-blame-error blame #:missing-party neg-party
|
||||
'(expected: "a list of ~a" got: "~s")
|
||||
(contract-name contract)
|
||||
val))
|
||||
(map (lambda (element)
|
||||
(proc element neg-party))
|
||||
val)))))))
|
||||
|
||||
;; TODO: Rewrite as a macro to support define*, multiple return values, and
|
||||
;; ‘any’.
|
||||
(define ->/c
|
||||
(memoize
|
||||
(lambda (. ctcs)
|
||||
(let* ((contracts (map ->contract ctcs))
|
||||
(domain-contracts (drop-right contracts 1))
|
||||
(range-contract (last contracts))
|
||||
(contract-arity (length domain-contracts)))
|
||||
(make-contract
|
||||
#:name (compound-contract-name "->/c" contracts)
|
||||
#:enforcer
|
||||
(lambda (blame)
|
||||
(define domain-blames
|
||||
(map (lambda (index)
|
||||
(let ((position (format #f "the #~a argument of" index)))
|
||||
(blame-add-context blame position #:swap? #t)))
|
||||
(iota contract-arity 1)))
|
||||
(define domain-enforcers
|
||||
(map contract-enforcer domain-contracts))
|
||||
(define range-proc
|
||||
(let ((range-blame (blame-add-context blame "the range of")))
|
||||
((contract-enforcer range-contract) range-blame)))
|
||||
(lambda (val neg-party)
|
||||
(unless (procedure? val)
|
||||
(raise-blame-error blame #:missing-party neg-party
|
||||
'(expected: "a procedure" got: "~s") val))
|
||||
(match (procedure-minimum-arity val)
|
||||
((required optional rest?)
|
||||
(unless (= required contract-arity)
|
||||
(raise-blame-error
|
||||
blame #:missing-party neg-party
|
||||
`(expected: "a procedure that accepts ~a non-keyword argument(s)"
|
||||
got: "~a~%"
|
||||
"which accepts ~a argument(s)")
|
||||
contract-arity
|
||||
val
|
||||
required))))
|
||||
(lambda args
|
||||
(define args*
|
||||
(map (lambda (arg blame enforcer)
|
||||
((enforcer blame) arg neg-party))
|
||||
args
|
||||
domain-blames
|
||||
domain-enforcers))
|
||||
(range-proc (apply val args*) neg-party)))))))))
|
||||
|
||||
|
||||
(define ->contract
|
||||
(mlambda (x)
|
||||
(match x
|
||||
((? contract?) x)
|
||||
((? procedure?)
|
||||
(make-contract
|
||||
#:name (format #f "~s" (or (procedure-name x) '???))
|
||||
#:checker x))
|
||||
((or (? symbol?)
|
||||
(? boolean?)
|
||||
(? keyword?))
|
||||
(make-contract
|
||||
#:name (format #f "~s" x)
|
||||
#:checker (cut eq? x <>)))
|
||||
((or (? string?)
|
||||
(? bytevector?)
|
||||
(? char?)
|
||||
+nan.0)
|
||||
(make-contract
|
||||
#:name (format #f "~s" x)
|
||||
#:checker (cut equal? x <>)))
|
||||
((? number?)
|
||||
(make-contract
|
||||
#:name (format #f "~s" x)
|
||||
#:checker (cut = x <>)))
|
||||
(_ (error (format #f "cannot use as contract: ~s" x))))))
|
||||
@@ -0,0 +1,70 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (rosenthal utils contract impl)
|
||||
#:use-module (srfi srfi-9)
|
||||
#:use-module (rosenthal utils contract blame)
|
||||
#:export (contract?
|
||||
make-contract
|
||||
contract-name
|
||||
contract-checker
|
||||
contract-enforcer
|
||||
compound-contract-name))
|
||||
|
||||
#|
|
||||
|
||||
This module provides the data representation of contracts.
|
||||
|
||||
When constructing a contract via ‘make-contract’, at least one of a checker or
|
||||
an enforcer must be specified.
|
||||
|
||||
A checker is a predicate function. An enforcer is a function that actually
|
||||
performs the check and either returns the value or raises an error with extra
|
||||
context. If only a checker is provided, an enforcer will be automatically
|
||||
created.
|
||||
|
||||
Note that checkers should only be provided when values can be checked
|
||||
immediately (e.g. checking a value is a number). Checkers don't work well for
|
||||
things like a list of numbers, since we won't know the location and context of a
|
||||
failure.
|
||||
|
||||
Contract combinators may rely on checkers' availability for optimizations.
|
||||
|
||||
Enforcers are "late neg projections" in Racket, which look like the following:
|
||||
|
||||
(lambda (blame)
|
||||
(lambda (val neg-party)
|
||||
...))
|
||||
|
||||
This allows a contract to be partially applied when it's constructed and
|
||||
attached, before the value is actually checked.
|
||||
|
||||
See also (rosenthal utils contract combinators) for more examples, and
|
||||
(rosenthal utils contract combinators) for error reporting of contracts.
|
||||
|
||||
|#
|
||||
|
||||
|
||||
(define-record-type <contract>
|
||||
(%make-contract name checker enforcer)
|
||||
contract?
|
||||
(name contract-name) ; string?
|
||||
(checker contract-checker) ; (or/c #f (->/c any/c boolean?))
|
||||
(enforcer contract-enforcer)) ; (->/c blame? (->/c any/c any/c any/c))
|
||||
|
||||
(define* (make-contract #:key name checker enforcer)
|
||||
(%make-contract
|
||||
name
|
||||
checker
|
||||
(or enforcer
|
||||
(lambda (blame)
|
||||
(lambda (val neg-party)
|
||||
(if (checker val)
|
||||
val
|
||||
(raise-blame-error blame #:missing-party neg-party
|
||||
`(expected: "~a" got: "~s") name val)))))))
|
||||
|
||||
(define (compound-contract-name name ctcs)
|
||||
(format #f "(~a ~a)"
|
||||
name
|
||||
(string-join (map contract-name ctcs) " ")))
|
||||
@@ -15,10 +15,13 @@
|
||||
#:use-module (guix build-system trivial)
|
||||
;; Guix packages
|
||||
#:autoload (gnu packages package-management) (nix)
|
||||
#:export (%nix-wrapper-default-exclude-env-paths
|
||||
#:export (;; Paramaters.
|
||||
%nix-wrapper-default-exclude-env-paths
|
||||
%nix-wrapper-profile-nixpkgs-commit
|
||||
%nix-wrapper-profile-extra-outputs
|
||||
|
||||
%nix-wrapper-shell-default-unset-env-vars
|
||||
|
||||
nix-shell-wrapper
|
||||
nix-wrapper->package nix-shell-wrapper->package
|
||||
with-nix-profile))
|
||||
@@ -69,14 +72,15 @@
|
||||
(_ (list #f)))
|
||||
(%nix-wrapper-default-exclude-env-paths))))
|
||||
|
||||
(define (%nix-wrapper-shell-default-unset-env-vars)
|
||||
"Environment variables to unset in the `nix shell' environment, used by
|
||||
`nix-shell-wrapper' by default."
|
||||
(filter-map (match-lambda
|
||||
((? string? env) env)
|
||||
(((? string? env) . _) env)
|
||||
(_ #f))
|
||||
(%nix-wrapper-default-exclude-env-paths)))
|
||||
;; Environment variables to unset in the `nix shell' environment, used by
|
||||
;; `nix-shell-wrapper' by default.
|
||||
(define-syntax %nix-wrapper-shell-default-unset-env-vars
|
||||
(identifier-syntax
|
||||
(filter-map (match-lambda
|
||||
((? string? env) env)
|
||||
(((? string? env) . _) env)
|
||||
(_ #f))
|
||||
(%nix-wrapper-default-exclude-env-paths))))
|
||||
|
||||
|
||||
;;;
|
||||
@@ -275,7 +279,7 @@ in
|
||||
(run-command '())
|
||||
(options '())
|
||||
(environment-keep #t)
|
||||
(environment-unset (%nix-wrapper-shell-default-unset-env-vars))
|
||||
(environment-unset %nix-wrapper-shell-default-unset-env-vars)
|
||||
(environment-set '())
|
||||
(nix (file-append nix "/bin/nix")))
|
||||
"Return a nix-wrapper that wraps the `nix shell' command-line utility and
|
||||
@@ -298,7 +302,7 @@ When ENVIRONMENT-KEEP (default: #t, boolean / list of strings) is set to a value
|
||||
other than #t, the environment will be cleared, keeping only specified
|
||||
environment variables.
|
||||
|
||||
ENVIRONMENT-UNSET (default: (%nix-wrapper-shell-default-unset-env-vars), list of
|
||||
ENVIRONMENT-UNSET (default: %nix-wrapper-shell-default-unset-env-vars, list of
|
||||
strings) unsets specified environment variables from the environment. It's only
|
||||
usable when ENVIRONMENT-KEEP is #t.
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (rosenthal utils others)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (rosenthal utils file)
|
||||
#:use-module (gnu packages admin)
|
||||
#:use-module (gnu packages base)
|
||||
#:use-module (gnu packages compression)
|
||||
#:use-module (gnu packages curl)
|
||||
#:use-module (gnu packages file)
|
||||
#:use-module (gnu packages gnupg)
|
||||
#:use-module (gnu packages lsof)
|
||||
#:use-module (gnu packages ncdu)
|
||||
#:use-module (gnu packages ncurses)
|
||||
#:use-module (gnu packages password-utils)
|
||||
#:use-module (gnu packages rsync)
|
||||
#:use-module (gnu packages rust-apps)
|
||||
#:use-module (gnu packages ssh)
|
||||
#:use-module (gnu packages sync)
|
||||
#:use-module (gnu packages version-control)
|
||||
#:use-module (gnu packages vim)
|
||||
#:export (%rosenthal-guix-key-dorphine
|
||||
%rosenthal-guix-key-nuporta
|
||||
%rosenthal-guix-key-bocis
|
||||
%rosenthal-guix-key-ignamma
|
||||
|
||||
%rosenthal-ssh-key-hako
|
||||
%rosenthal-ssh-key-hako-deploy
|
||||
%rosenthal-ssh-key-jonathan
|
||||
%rosenthal-ssh-key-podiki
|
||||
|
||||
%rosenthal-network-manager-ipv6-privacy
|
||||
%rosenthal-network-manager-random-mac-address
|
||||
|
||||
%rosenthal-cli-packages))
|
||||
|
||||
|
||||
;;;
|
||||
;;; Guix public keys
|
||||
;;;
|
||||
|
||||
(define %rosenthal-guix-key-dorphine
|
||||
(plain-file "dorphine.pub"
|
||||
"(public-key (ecc (curve Ed25519)
|
||||
(q #A279175682D0DAE3E11268E67E1F3FA47C38D7E509F7725567CF891E248E719F#)))"))
|
||||
|
||||
;; Nonguix head node.
|
||||
(define %rosenthal-guix-key-nuporta
|
||||
(plain-file "nuporta.pub"
|
||||
"(public-key (ecc (curve Ed25519)
|
||||
(q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#)))"))
|
||||
|
||||
;; aarch64-linux build worker.
|
||||
(define %rosenthal-guix-key-bocis
|
||||
(plain-file "bocis.pub"
|
||||
"(public-key (ecc (curve Ed25519)
|
||||
(q #7927EA1162184C1FAA62D20C111121A4604F00956E69F0FEB89EEE1721647897#)))"))
|
||||
|
||||
;; x86_64-linux + aarch64-linux build worker.
|
||||
(define %rosenthal-guix-key-ignamma
|
||||
(plain-file "ignamma.pub"
|
||||
"(public-key (ecc (curve Ed25519)
|
||||
(q #6FEEB15C4363F9975EB15C908EC911A4362E486DA642431FA2438C0B1C3D55F5#)))"))
|
||||
|
||||
|
||||
;;;
|
||||
;;; SSH public keys
|
||||
;;;
|
||||
|
||||
(define %rosenthal-ssh-key-hako
|
||||
(plain-file "hako.pub"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFcTj1N3cL/bh2Uvwh5/YubhZplPFnvGk/iVHQs3FWV2 openpgp:0x77671915\n"))
|
||||
(define %rosenthal-ssh-key-hako-deploy
|
||||
(plain-file "hako-deploy.pub"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMLWIp8y5/JGBaw+yFA5MFB5nlFpEx/tjc0q0Ij9KjTu\n"))
|
||||
|
||||
(define %rosenthal-ssh-key-jonathan
|
||||
(plain-file "jonathan.pub"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHgzHvP3BRTIZ960LVglrK8w/C0+6Z5VM8/Q5Uwa0o+Z jonathan@3700X\n"))
|
||||
|
||||
(define %rosenthal-ssh-key-podiki
|
||||
(plain-file "podiki.pub"
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDaSmW/3uq5L6ZP6gWmRw5RiTTg0es1PrbAo/x4vkPzwIKTrMFOCBCmcuH3vOCkEZJtNy3OpXbt/a3tDW+cc6dkeq2H4WpogQvyMTXreFS2phMgDTEXW2gGZIP6fA33CHERmhd9A/m0A+NH5KGAmLDQNK8QgPgIjZuseJYtYHNCnN2TCsWQYnbZtVQF5CS6iBUILpVp6p7QlSUokiCGaPjZfrjSFCm1hUPjJYSkv0NTq8TzyDfU2quqP7TBCj4WBi9HoW9+a8tN2TQ/+GYbGqlFljeNdz3vzItcHjidHOQL/42mpvzgZx7o7dtrqX9stp+mI3oBREYSD0bMyvND/dEBRWIbpFvbyYx/leMKq9yUcFNyI2lztk17ObaQkDLxlq4ClytgEtdbP6X0gua29FYK/YlAi13NptK6uy2xB2gsEIt5P4N3u+gZCNA0U3IVd7iMRSpg6PWiL1JguvhYSD5vGOnOjiXVlBCKn+ErTO9Ey/BZqwVBZMeDwynFnU1mYnkxtA+G54VI77gj24FrHw/ClOdJOdBUGAso9P3sFjdykkAJyKd4jiFzpDTOOJNs8qKhmFFzJBnJjn7nzwjElwOCZXdDKTrKqF/51WEqpNr8Za2QjRirV4m7n6FnyyD38b24InAVa+yze3qDI9yk2vjPdtFGCeLODSEjfV3U1z1hiw== cardno:11 465 639\n"))
|
||||
|
||||
|
||||
;;;
|
||||
;;; NetworkManager
|
||||
;;;
|
||||
|
||||
(define %rosenthal-network-manager-ipv6-privacy
|
||||
`("ip6-privacy.conf"
|
||||
,(ini-file "ip6-privacy.conf"
|
||||
'(("connection"
|
||||
. (("ipv6.ip6-privacy" . 2)))))))
|
||||
|
||||
;; NOTE: When using on cloud machines, refer to the terms of the provider
|
||||
;; first.
|
||||
(define %rosenthal-network-manager-random-mac-address
|
||||
`("random-mac-address.conf"
|
||||
,(ini-file "random-mac-address.conf"
|
||||
'(("connection-mac-randomization"
|
||||
. (("ethernet.cloned-mac-address" . "stable")
|
||||
("wifi.cloned-mac-address" . "stable")))))))
|
||||
|
||||
|
||||
;;;
|
||||
;;; Packages
|
||||
;;;
|
||||
|
||||
(define %rosenthal-cli-packages
|
||||
(list curl
|
||||
file
|
||||
git
|
||||
`(,git "send-email")
|
||||
glibc
|
||||
gnupg
|
||||
htop
|
||||
mosh
|
||||
ncurses
|
||||
rclone
|
||||
rsync
|
||||
unzip
|
||||
zip))
|
||||
@@ -23,7 +23,9 @@
|
||||
#:use-module (gnu packages base)
|
||||
#:replace (%patch-path
|
||||
search-patch)
|
||||
#:export (rosenthal-patches
|
||||
#:export (sri-hash
|
||||
|
||||
rosenthal-patches
|
||||
%rosenthal-package-module-path
|
||||
all-rosenthal-packages
|
||||
|
||||
@@ -39,6 +41,20 @@
|
||||
binary-package
|
||||
mapping-for-system))
|
||||
|
||||
(define-syntax sri-hash
|
||||
(lambda (stx)
|
||||
(syntax-case stx ()
|
||||
((_ str)
|
||||
(let ((str (syntax->datum #'str)))
|
||||
(and (string? str)
|
||||
(string-index str #\-)))
|
||||
(let* ((str (syntax->datum #'str))
|
||||
(dash (string-index str #\-))
|
||||
(algo (substring str 0 dash))
|
||||
(hash (substring str (1+ dash))))
|
||||
(with-syntax ((algorithm (datum->syntax #'stx (string->symbol algo))))
|
||||
#`(content-hash (base64 #,hash) algorithm)))))))
|
||||
|
||||
(define %rosenthal-root-directory
|
||||
;; This is like %distro-root-directory from (gnu packages), with adjusted
|
||||
;; paths.
|
||||
@@ -166,6 +182,7 @@ packages, excluding superseded packages."
|
||||
(define* (binary-package source-mapping p #:optional (default-system "x86_64-linux"))
|
||||
(package
|
||||
(inherit p)
|
||||
(location (package-location p))
|
||||
(version (package-version (assoc-ref source-mapping default-system)))
|
||||
(source #f)
|
||||
(arguments
|
||||
|
||||
@@ -0,0 +1,729 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2012-2026 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
|
||||
;;; Copyright © 2026 coopi <coldsideofyourpillow@disroot.org>
|
||||
|
||||
(define-module (rosenthal utils records)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-9)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 rdelim)
|
||||
#:autoload (system syntax) (syntax-local-binding)
|
||||
#:autoload (rosenthal utils contract) (apply-contract/guix-record-field)
|
||||
#:export (define-record-type/dolly
|
||||
this-record
|
||||
|
||||
match-record/dolly
|
||||
match-record-lambda/dolly))
|
||||
|
||||
(define-syntax record-error
|
||||
(syntax-rules ()
|
||||
"Report a syntactic error in use of CONSTRUCTOR."
|
||||
((_ constructor form fmt args ...)
|
||||
(syntax-violation constructor
|
||||
(format #f fmt args ...)
|
||||
form))))
|
||||
|
||||
(eval-when (expand load eval)
|
||||
;; The procedures below are needed both at run time and at expansion time.
|
||||
|
||||
(define %record-constructor-max-argument-count
|
||||
;; Maximum number of positional arguments for record constructors. This
|
||||
;; matches Guile's 'make-record-type', which uses a rest argument above
|
||||
;; that number.
|
||||
20)
|
||||
|
||||
(define (current-abi-identifier type)
|
||||
"Return an identifier unhygienically derived from TYPE for use as its
|
||||
\"current ABI\" variable."
|
||||
(let ((type-name (syntax->datum type)))
|
||||
(datum->syntax
|
||||
type
|
||||
(string->symbol
|
||||
(string-append "% " (symbol->string type-name)
|
||||
" abi-cookie")))))
|
||||
|
||||
(define (record-abi-mismatch-error type)
|
||||
(throw 'record-abi-mismatch-error 'abi-check
|
||||
"~a: record ABI mismatch; recompilation needed"
|
||||
(list type) '()))
|
||||
|
||||
(define (abi-check type cookie)
|
||||
"Return syntax that checks that the current \"application binary
|
||||
interface\" (ABI) for TYPE is equal to COOKIE."
|
||||
(with-syntax ((current-abi (current-abi-identifier type)))
|
||||
#`(unless (eq? current-abi #,cookie)
|
||||
;; The source file where this exception is thrown must be
|
||||
;; recompiled.
|
||||
(record-abi-mismatch-error #,type))))
|
||||
|
||||
(define* (report-invalid-field-specifier name bindings
|
||||
#:optional parent-form)
|
||||
"Report the first invalid binding among BINDINGS. PARENT-FORM is used for
|
||||
error-reporting purposes."
|
||||
(let loop ((bindings bindings))
|
||||
(syntax-case bindings ()
|
||||
(((field value) rest ...) ;good
|
||||
(loop #'(rest ...)))
|
||||
((weird _ ...) ;weird!
|
||||
;; WEIRD may be an identifier, thus lacking source location info, and
|
||||
;; BINDINGS is a list, also lacking source location info. Hopefully
|
||||
;; PARENT-FORM provides source location info.
|
||||
(apply syntax-violation name "invalid field specifier"
|
||||
(if parent-form
|
||||
(list parent-form #'weird)
|
||||
(list #'weird)))))))
|
||||
|
||||
(define (report-duplicate-field-specifier name ctor)
|
||||
"Report the first duplicate identifier among the bindings in CTOR."
|
||||
(syntax-case ctor ()
|
||||
((_ bindings ...)
|
||||
(let loop ((bindings #'(bindings ...))
|
||||
(seen '()))
|
||||
(syntax-case bindings ()
|
||||
(((field value) rest ...)
|
||||
(not (memq (syntax->datum #'field) seen))
|
||||
(loop #'(rest ...) (cons (syntax->datum #'field) seen)))
|
||||
((duplicate rest ...)
|
||||
(syntax-violation name "duplicate field initializer"
|
||||
#'duplicate))
|
||||
(()
|
||||
#t)))))))
|
||||
|
||||
(define-syntax map-fields
|
||||
(lambda (x)
|
||||
(syntax-case x ()
|
||||
((_ type within)
|
||||
(syntax-violation (syntax->datum #'within)
|
||||
"undefined record type"
|
||||
#'type))
|
||||
(_ (syntax-violation 'map-fields "bad use of syntactic keyword" x x)))))
|
||||
|
||||
(define-syntax-parameter this-record
|
||||
(lambda (s)
|
||||
"Return the record being defined. This macro may only be used in the
|
||||
context of the definition of a thunked field."
|
||||
(syntax-case s ()
|
||||
(id
|
||||
(identifier? #'id)
|
||||
(syntax-violation 'this-record
|
||||
"cannot be used outside of a record instantiation"
|
||||
#'id)))))
|
||||
|
||||
(define-syntax make-syntactic-constructor
|
||||
(syntax-rules ()
|
||||
"Make the syntactic constructor NAME for TYPE, that calls CTOR, and
|
||||
expects all of EXPECTED fields to be initialized. DEFAULTS is the list of
|
||||
FIELD/DEFAULT-VALUE tuples, THUNKED is the list of identifiers of thunked
|
||||
fields, DELAYED is the list of identifiers of delayed fields, and SANITIZERS
|
||||
is the list of FIELD/SANITIZER tuples.
|
||||
|
||||
ABI-COOKIE is the cookie (an integer) against which to check the run-time ABI
|
||||
of TYPE matches the expansion-time ABI."
|
||||
((_ type name ctor (expected ...)
|
||||
#:abi-cookie abi-cookie
|
||||
#:thunked thunked
|
||||
#:this-identifier this-identifier
|
||||
#:delayed delayed
|
||||
#:innate innate
|
||||
#:contracts contracts
|
||||
#:sanitizers sanitizers
|
||||
#:defaults defaults)
|
||||
(define-syntax name
|
||||
(lambda (s)
|
||||
(define (constructor-call field-values)
|
||||
(if (< (length '(expected ...))
|
||||
%record-constructor-max-argument-count)
|
||||
#`(ctor #,abi-cookie #,@field-values)
|
||||
#`(apply ctor #,abi-cookie (list #,@field-values))))
|
||||
|
||||
(define (record-inheritance orig-record field+value)
|
||||
;; Produce code that returns a record identical to ORIG-RECORD,
|
||||
;; except that values for the FIELD+VALUE alist prevail.
|
||||
(define (field-inherited-value f)
|
||||
(and=> (find (lambda (x)
|
||||
(eq? f (car (syntax->datum x))))
|
||||
field+value)
|
||||
car))
|
||||
|
||||
;; Make sure there are no unknown field names.
|
||||
(let* ((fields (map (compose car syntax->datum) field+value))
|
||||
(unexpected (lset-difference eq? fields '(expected ...))))
|
||||
(when (pair? unexpected)
|
||||
(record-error 'name s "extraneous field initializers ~a"
|
||||
unexpected)))
|
||||
|
||||
(constructor-call
|
||||
(map (lambda (field index)
|
||||
(or (field-inherited-value field)
|
||||
(if (innate-field? field)
|
||||
(wrap-field-value
|
||||
field (field-default-value field))
|
||||
#`(struct-ref #,orig-record #,index))))
|
||||
'(expected ...)
|
||||
(iota (length '(expected ...))))))
|
||||
|
||||
(define (thunked-field? f)
|
||||
(memq (syntax->datum f) 'thunked))
|
||||
|
||||
(define (delayed-field? f)
|
||||
(memq (syntax->datum f) 'delayed))
|
||||
|
||||
(define (innate-field? f)
|
||||
(memq (syntax->datum f) 'innate))
|
||||
|
||||
(define field-contract
|
||||
(let ((lst (map (match-lambda
|
||||
((f p)
|
||||
(list (syntax->datum f) p)))
|
||||
#'contracts)))
|
||||
(lambda (f)
|
||||
(or (and=> (assoc-ref lst (syntax->datum f)) car)
|
||||
#'any/c))))
|
||||
|
||||
(define field-sanitizer
|
||||
(let ((lst (map (match-lambda
|
||||
((f p)
|
||||
(list (syntax->datum f) p)))
|
||||
#'sanitizers)))
|
||||
(lambda (f)
|
||||
(or (and=> (assoc-ref lst (syntax->datum f)) car)
|
||||
#'identity))))
|
||||
|
||||
(define (field-index f)
|
||||
;; Return the index of F within the record.
|
||||
(let ((f (syntax->datum f)))
|
||||
(let loop ((fields '(expected ...))
|
||||
(index 0))
|
||||
(match fields
|
||||
(()
|
||||
;; Internal error.
|
||||
(record-error 'name s "field not found ~a" f))
|
||||
((head . rest)
|
||||
(if (eq? f head)
|
||||
index
|
||||
(loop rest (+ 1 index))))))))
|
||||
|
||||
(define (check-shadowing identifier)
|
||||
;; Warn if IDENTIFIER shadows a local binding.
|
||||
;; Note: not using (guix diagnostics) to remain independent of
|
||||
;; other Guix modules.
|
||||
(when (eq? 'lexical (syntax-local-binding identifier))
|
||||
(format (current-warning-port)
|
||||
"~a: inherited field binding '~a' of \
|
||||
record type '~a' shadows local variable~%"
|
||||
(match (syntax-source identifier)
|
||||
(#f "<unknown-location>")
|
||||
(lst (format #f "~a:~a:~a"
|
||||
(assq-ref lst 'filename)
|
||||
(and=> (assq-ref lst 'line) 1+)
|
||||
(assq-ref lst 'column))))
|
||||
(syntax->datum identifier)
|
||||
(syntax->datum #'type))))
|
||||
|
||||
(define* (wrap-field-value f value #:optional parent)
|
||||
;; Wrap VALUE, the value of field F, such that its sanitizer is
|
||||
;; called and its properties (thunked, delayed) honored. When
|
||||
;; PARENT is true, bind F to the value inherited from PARENT in the
|
||||
;; lexical scope of VALUE.
|
||||
(let* ((contract (field-contract f))
|
||||
(sanitizer (field-sanitizer f))
|
||||
(contract? (not (eq? (syntax->datum contract) 'any/c)))
|
||||
(sanitizer? (not (eq? (syntax->datum sanitizer) 'identity)))
|
||||
(value
|
||||
(cond
|
||||
((and contract? sanitizer?)
|
||||
#`(#,sanitizer
|
||||
(apply-contract/guix-record-field
|
||||
#,contract
|
||||
#,value
|
||||
#,(symbol->string (syntax->datum (record-type-name type)))
|
||||
#,(symbol->string (syntax->datum #'f)))))
|
||||
(contract?
|
||||
#`(apply-contract/guix-record-field
|
||||
#,contract
|
||||
#,value
|
||||
#,(symbol->string (syntax->datum (record-type-name type)))
|
||||
#,(symbol->string (syntax->datum f))))
|
||||
(sanitizer?
|
||||
#`(#,sanitizer #,value))
|
||||
(else value))))
|
||||
(cond ((thunked-field? f)
|
||||
(if parent
|
||||
;; Compute the value being inherited by calling the
|
||||
;; thunked field F of PARENT with a self-reference for
|
||||
;; the new record being constructed.
|
||||
(with-syntax ((inherited
|
||||
#`((struct-ref #,parent
|
||||
#,(field-index f))
|
||||
#,this-identifier)))
|
||||
(check-shadowing f)
|
||||
#`(lambda (x)
|
||||
(syntax-parameterize ((#,this-identifier
|
||||
(lambda (s)
|
||||
(syntax-case s ()
|
||||
(id
|
||||
(identifier? #'id)
|
||||
#'x)))))
|
||||
;; Bind F, the field identifier, to the value
|
||||
;; being inherited.
|
||||
(let-syntax ((#,f (identifier-syntax inherited)))
|
||||
#,value))))
|
||||
#`(lambda (x)
|
||||
(syntax-parameterize ((#,this-identifier
|
||||
(lambda (s)
|
||||
(syntax-case s ()
|
||||
(id
|
||||
(identifier? #'id)
|
||||
#'x)))))
|
||||
#,value))))
|
||||
((delayed-field? f)
|
||||
#`(delay #,value))
|
||||
(else value))))
|
||||
|
||||
(define default-values
|
||||
;; List of symbol/value tuples.
|
||||
(map (match-lambda
|
||||
((f v)
|
||||
(list (syntax->datum f) v)))
|
||||
#'defaults))
|
||||
|
||||
(define (field-default-value f)
|
||||
(car (assoc-ref default-values (syntax->datum f))))
|
||||
|
||||
(define (field-bindings field+value)
|
||||
;; Return field to value bindings, for use in 'let*' below.
|
||||
(map (lambda (field+value)
|
||||
(syntax-case field+value ()
|
||||
((field value)
|
||||
#`(field
|
||||
#,(wrap-field-value #'field #'value)))))
|
||||
field+value))
|
||||
|
||||
(define (field-bindings/inheritance parent field+value)
|
||||
;; Return field to value bindings, for use in 'let*' below.
|
||||
(map (lambda (field+value)
|
||||
(syntax-case field+value ()
|
||||
((field value)
|
||||
#`(field
|
||||
#,(wrap-field-value #'field #'value parent)))))
|
||||
field+value))
|
||||
|
||||
(syntax-case s (inherit expected ...)
|
||||
((_ (inherit orig-record) (field value) (... ...))
|
||||
#`(let* #,(field-bindings/inheritance #'orig-record
|
||||
#'((field value) (... ...)))
|
||||
#,(abi-check #'type abi-cookie)
|
||||
#,(record-inheritance #'orig-record
|
||||
#'((field value) (... ...)))))
|
||||
((_ (field value) (... ...))
|
||||
(let ((fields (map syntax->datum #'(field (... ...)))))
|
||||
(define (field-value f)
|
||||
(or (find (lambda (x)
|
||||
(eq? f (syntax->datum x)))
|
||||
#'(field (... ...)))
|
||||
(wrap-field-value f (field-default-value f))))
|
||||
|
||||
;; Pass S to make sure source location info is preserved.
|
||||
(report-duplicate-field-specifier 'name s)
|
||||
|
||||
(let ((fields (append fields (map car default-values))))
|
||||
(cond ((lset= eq? fields '(expected ...))
|
||||
#`(let* #,(field-bindings
|
||||
#'((field value) (... ...)))
|
||||
#,(constructor-call
|
||||
(map field-value '(expected ...)))))
|
||||
((pair? (lset-difference eq? fields
|
||||
'(expected ...)))
|
||||
(record-error 'name s
|
||||
"extraneous field initializers ~a"
|
||||
(lset-difference eq? fields
|
||||
'(expected ...))))
|
||||
(else
|
||||
(record-error 'name s
|
||||
"missing field initializers ~a"
|
||||
(lset-difference eq?
|
||||
'(expected ...)
|
||||
fields)))))))
|
||||
((_ bindings (... ...))
|
||||
;; One of BINDINGS doesn't match the (field value) pattern.
|
||||
;; Report precisely which one is faulty, instead of letting the
|
||||
;; "source expression failed to match any pattern" error.
|
||||
(report-invalid-field-specifier 'name
|
||||
#'(bindings (... ...))
|
||||
s))))))))
|
||||
|
||||
(define-syntax-rule (define-field-property-predicate predicate property)
|
||||
"Define PREDICATE as a procedure that takes a syntax object and, when passed
|
||||
a field specification, returns the field name if it has the given PROPERTY."
|
||||
(define (predicate s)
|
||||
(syntax-case s (property)
|
||||
((field (property values (... ...)) _ (... ...))
|
||||
#'field)
|
||||
((field _ properties (... ...))
|
||||
(predicate #'(field properties (... ...))))
|
||||
(_ #f))))
|
||||
|
||||
(define-syntax define-record-type/dolly
|
||||
(lambda (s)
|
||||
"Define the given record type such that an additional \"syntactic
|
||||
constructor\" is defined, which allows instances to be constructed with named
|
||||
field initializers, à la SRFI-35, as well as default values. An example use
|
||||
may look like this:
|
||||
|
||||
(define-record-type* <thing> thing make-thing
|
||||
thing?
|
||||
this-thing
|
||||
(name thing-name (default \"chbouib\"))
|
||||
(port thing-port
|
||||
(default (current-output-port)) (thunked))
|
||||
(loc thing-location (innate) (default (current-source-location))))
|
||||
|
||||
This example defines a macro 'thing' that can be used to instantiate records
|
||||
of this type:
|
||||
|
||||
(thing
|
||||
(name \"foo\")
|
||||
(port (current-error-port)))
|
||||
|
||||
The value of 'name' or 'port' could as well be omitted, in which case the
|
||||
default value specified in the 'define-record-type*' form is used:
|
||||
|
||||
(thing)
|
||||
|
||||
The 'port' field is \"thunked\", meaning that calls like '(thing-port x)' will
|
||||
actually compute the field's value in the current dynamic extent, which is
|
||||
useful when referring to fluids in a field's value. Furthermore, that thunk
|
||||
can access the record it belongs to via the 'this-thing' identifier.
|
||||
|
||||
A field can also be marked as \"delayed\" instead of \"thunked\", in which
|
||||
case its value is effectively wrapped in a (delay …) form.
|
||||
|
||||
A field can also have an associated \"sanitizer\", which is a procedure that
|
||||
takes a user-supplied field value and returns a \"sanitized\" value for the
|
||||
field:
|
||||
|
||||
(define-record-type* <thing> thing make-thing
|
||||
thing?
|
||||
this-thing
|
||||
(name thing-name
|
||||
(sanitize (lambda (value)
|
||||
(cond ((string? value) value)
|
||||
((symbol? value) (symbol->string value))
|
||||
(else (throw 'bad! value)))))))
|
||||
|
||||
It is possible to copy an object 'x' created with 'thing' like this:
|
||||
|
||||
(thing (inherit x) (name \"bar\"))
|
||||
|
||||
This expression returns a new object equal to 'x' except for its 'name'
|
||||
field and its 'loc' field---the latter is marked as \"innate\", so it is not
|
||||
inherited."
|
||||
|
||||
(define (rtd-identifier type)
|
||||
;; Return an identifier derived from TYPE to name its record type
|
||||
;; descriptor (RTD).
|
||||
(let ((type-name (syntax->datum type)))
|
||||
(datum->syntax
|
||||
type
|
||||
(string->symbol
|
||||
(string-append "% " (symbol->string type-name) " rtd")))))
|
||||
|
||||
(define (field-default-value s)
|
||||
(syntax-case s (default)
|
||||
((field (default val) _ ...)
|
||||
(list #'field #'val))
|
||||
((field _ properties ...)
|
||||
(field-default-value #'(field properties ...)))
|
||||
(_ #f)))
|
||||
|
||||
(define (field-contract s)
|
||||
(syntax-case s (contract)
|
||||
((field (contract ctc) _ ...)
|
||||
(list #'field #'ctc))
|
||||
((field _ properties ...)
|
||||
(field-contract #'(field properties ...)))
|
||||
(_ #f)))
|
||||
|
||||
(define (field-sanitizer s)
|
||||
(syntax-case s (sanitize)
|
||||
((field (sanitize proc) _ ...)
|
||||
(list #'field #'proc))
|
||||
((field _ properties ...)
|
||||
(field-sanitizer #'(field properties ...)))
|
||||
(_ #f)))
|
||||
|
||||
(define-field-property-predicate delayed-field? delayed)
|
||||
(define-field-property-predicate thunked-field? thunked)
|
||||
(define-field-property-predicate innate-field? innate)
|
||||
|
||||
(define (wrapped-field? s)
|
||||
(or (thunked-field? s) (delayed-field? s)))
|
||||
|
||||
(define (wrapped-field-accessor-name field)
|
||||
;; Return the name (an unhygienic syntax object) of the "real"
|
||||
;; getter for field, which is assumed to be a wrapped field.
|
||||
(syntax-case field ()
|
||||
((field get properties ...)
|
||||
(let* ((getter (syntax->datum #'get))
|
||||
(real-getter (symbol-append '% getter '-real)))
|
||||
(datum->syntax #'get real-getter)))))
|
||||
|
||||
(define (field-spec->srfi-9 field)
|
||||
;; Convert a field spec of our style to a SRFI-9 field spec of the
|
||||
;; form (field get).
|
||||
(syntax-case field ()
|
||||
((name get properties ...)
|
||||
#`(name
|
||||
#,(if (wrapped-field? field)
|
||||
(wrapped-field-accessor-name field)
|
||||
#'get)))))
|
||||
|
||||
(define (thunked-field-accessor-definition field)
|
||||
;; Return the real accessor for FIELD, which is assumed to be a
|
||||
;; thunked field.
|
||||
(syntax-case field ()
|
||||
((name get _ ...)
|
||||
(with-syntax ((real-get (wrapped-field-accessor-name field)))
|
||||
#'(define-inlinable (get x)
|
||||
;; The real value of that field is a thunk, so call it.
|
||||
((real-get x) x))))))
|
||||
|
||||
(define (delayed-field-accessor-definition field)
|
||||
;; Return the real accessor for FIELD, which is assumed to be a
|
||||
;; delayed field.
|
||||
(syntax-case field ()
|
||||
((name get _ ...)
|
||||
(with-syntax ((real-get (wrapped-field-accessor-name field)))
|
||||
#'(define-inlinable (get x)
|
||||
;; The real value of that field is a promise, so force it.
|
||||
(force (real-get x)))))))
|
||||
|
||||
(define (compute-abi-cookie field-specs)
|
||||
;; Compute an "ABI cookie" for the given FIELD-SPECS. We use
|
||||
;; 'string-hash' because that's a better hash function that 'hash' on a
|
||||
;; list of symbols.
|
||||
(syntax-case field-specs ()
|
||||
(((field get properties ...) ...)
|
||||
;; Passing (target-most-positive-fixnum) as the second argument of
|
||||
;; 'string-hash' won't have the intended effect when cross-compiling
|
||||
;; because that second argument is used to compute a modulo after the
|
||||
;; hash has been computed on an 'unsigned long'. Instead, only keep
|
||||
;; the 32 most significant bits on 64-bit platforms, unconditionally.
|
||||
;; See <https://issues.guix.gnu.org/74296>.
|
||||
(let ((hash-value
|
||||
(string-hash
|
||||
(object->string (syntax->datum #'((field properties ...) ...))))))
|
||||
(cond
|
||||
((< most-positive-fixnum (ash 1 32)) hash-value)
|
||||
((< most-positive-fixnum (ash 1 64)) (ash hash-value -32))
|
||||
(else (error "unexpected!" most-positive-fixnum)))))))
|
||||
|
||||
(syntax-case s ()
|
||||
((_ type syntactic-ctor ctor pred
|
||||
this-identifier
|
||||
(field get properties ...) ...)
|
||||
(identifier? #'this-identifier)
|
||||
(let* ((field-spec #'((field get properties ...) ...))
|
||||
(thunked (filter-map thunked-field? field-spec))
|
||||
(delayed (filter-map delayed-field? field-spec))
|
||||
(innate (filter-map innate-field? field-spec))
|
||||
(defaults (filter-map field-default-value
|
||||
#'((field properties ...) ...)))
|
||||
(contracts (filter-map field-contract
|
||||
#'((field properties ...) ...)))
|
||||
(sanitizers (filter-map field-sanitizer
|
||||
#'((field properties ...) ...)))
|
||||
(cookie (compute-abi-cookie field-spec))
|
||||
(field-count (length field-spec))
|
||||
(constructor-procedure
|
||||
(datum->syntax
|
||||
#'ctor
|
||||
(symbol-append (string->symbol " %")
|
||||
(syntax->datum #'ctor)
|
||||
'-procedure/abi-check))))
|
||||
|
||||
(define (constructor-body)
|
||||
(if (< field-count %record-constructor-max-argument-count)
|
||||
#`(case-lambda
|
||||
((actual-cookie field ...)
|
||||
(unless (eq? actual-cookie #,cookie)
|
||||
(record-abi-mismatch-error type))
|
||||
(ctor field ...))
|
||||
(_
|
||||
(record-abi-mismatch-error type)))
|
||||
#`(case-lambda
|
||||
((actual-cookie . field-values)
|
||||
(unless (and (eq? actual-cookie #,cookie)
|
||||
(= (length field-values)
|
||||
#,field-count))
|
||||
(record-abi-mismatch-error type))
|
||||
(apply ctor field-values))
|
||||
(_
|
||||
(record-abi-mismatch-error type)))))
|
||||
|
||||
(with-syntax ((ctor-procedure constructor-procedure)
|
||||
((field-spec* ...)
|
||||
(map field-spec->srfi-9 field-spec))
|
||||
((field-type ...)
|
||||
(map (match-lambda
|
||||
((? thunked-field?)
|
||||
(datum->syntax s 'thunked))
|
||||
((? delayed-field?)
|
||||
(datum->syntax s 'delayed))
|
||||
(else
|
||||
(datum->syntax s 'normal)))
|
||||
field-spec))
|
||||
((thunked-field-accessor ...)
|
||||
(filter-map (lambda (field)
|
||||
(and (thunked-field? field)
|
||||
(thunked-field-accessor-definition
|
||||
field)))
|
||||
field-spec))
|
||||
((delayed-field-accessor ...)
|
||||
(filter-map (lambda (field)
|
||||
(and (delayed-field? field)
|
||||
(delayed-field-accessor-definition
|
||||
field)))
|
||||
field-spec)))
|
||||
#`(begin
|
||||
(define-record-type #,(rtd-identifier #'type)
|
||||
(ctor field ...)
|
||||
pred
|
||||
field-spec* ...)
|
||||
|
||||
;; Rectify the vtable type name...
|
||||
(set-struct-vtable-name! #,(rtd-identifier #'type) 'type)
|
||||
(cond-expand
|
||||
(guile-3
|
||||
;; ... and the record type name.
|
||||
(struct-set! #,(rtd-identifier #'type) vtable-offset-user
|
||||
'type))
|
||||
(else #f))
|
||||
|
||||
(define-syntax type
|
||||
(lambda (s)
|
||||
"This macro lets us query record type info at
|
||||
macro-expansion time."
|
||||
(syntax-case s (map-fields)
|
||||
((_ (map-fields _ _) macro)
|
||||
#'(macro ((field field-type) ...)))
|
||||
(id
|
||||
(identifier? #'id)
|
||||
#'#,(rtd-identifier #'type)))))
|
||||
|
||||
(define #,(current-abi-identifier #'type)
|
||||
#,cookie)
|
||||
|
||||
#,@(if (free-identifier=? #'this-identifier #'this-record)
|
||||
#'()
|
||||
#'((define-syntax-parameter this-identifier
|
||||
(lambda (s)
|
||||
"Return the record being defined. This macro may
|
||||
only be used in the context of the definition of a thunked field."
|
||||
(syntax-case s ()
|
||||
(id
|
||||
(identifier? #'id)
|
||||
(syntax-violation 'this-identifier
|
||||
"cannot be used outside \
|
||||
of a record instantiation"
|
||||
#'id)))))))
|
||||
thunked-field-accessor ...
|
||||
delayed-field-accessor ...
|
||||
|
||||
(define ctor-procedure
|
||||
;; This procedure is *not* inlined, to reduce code bloat
|
||||
;; (struct initialization takes at least one instruction per
|
||||
;; field).
|
||||
#,(constructor-body))
|
||||
|
||||
(make-syntactic-constructor type syntactic-ctor ctor-procedure
|
||||
(field ...)
|
||||
#:abi-cookie #,cookie
|
||||
#:thunked #,thunked
|
||||
#:this-identifier #'this-identifier
|
||||
#:delayed #,delayed
|
||||
#:innate #,innate
|
||||
#:contracts #,contracts
|
||||
#:sanitizers #,sanitizers
|
||||
#:defaults #,defaults)))))
|
||||
((_ type syntactic-ctor ctor pred
|
||||
(field get properties ...) ...)
|
||||
;; When no 'this' identifier was specified, use 'this-record'.
|
||||
#'(define-record-type/dolly type syntactic-ctor ctor pred
|
||||
this-record
|
||||
(field get properties ...) ...)))))
|
||||
|
||||
|
||||
;;;
|
||||
;;; Pattern matching.
|
||||
;;;
|
||||
|
||||
(define-syntax lookup-field+wrapper
|
||||
(lambda (s)
|
||||
"Look up FIELD in the given list and return both an expression that represents
|
||||
its offset in the record and a procedure that wraps it to return its \"true\" value
|
||||
(for instance, FORCE is returned in the case of a delayed field). RECORD is passed
|
||||
to thunked values. Raise a syntax violation when the field is not found."
|
||||
(syntax-case s (normal delayed thunked)
|
||||
((_ record field offset ())
|
||||
(syntax-violation 'match-record
|
||||
"unknown record type field"
|
||||
;; Attach the local source data to the field.
|
||||
(datum->syntax #f (syntax->datum #'field) #:source s)))
|
||||
((_ record field offset ((head normal) tail ...))
|
||||
(free-identifier=? #'field #'head)
|
||||
#'(values offset identity))
|
||||
((_ record field offset ((head delayed) tail ...))
|
||||
(free-identifier=? #'field #'head)
|
||||
#'(values offset force))
|
||||
((_ record field offset ((head thunked) tail ...))
|
||||
(free-identifier=? #'field #'head)
|
||||
#'(values offset (cut <> record)))
|
||||
((_ record field offset (_ tail ...))
|
||||
#'(lookup-field+wrapper record field
|
||||
(+ 1 offset) (tail ...))))))
|
||||
|
||||
(define-syntax match-record-inner
|
||||
(lambda (s)
|
||||
(syntax-case s ()
|
||||
((_ record type ((field variable) rest ...) body ...)
|
||||
#'(let-syntax ((field-offset+wrapper
|
||||
(syntax-rules ()
|
||||
((_ f)
|
||||
(lookup-field+wrapper record field 0 f)))))
|
||||
(let*-values (((offset wrap)
|
||||
(type (map-fields type match-record)
|
||||
field-offset+wrapper))
|
||||
((variable)
|
||||
(wrap (struct-ref record offset))))
|
||||
(match-record-inner record type (rest ...) body ...))))
|
||||
((_ record type (field rest ...) body ...)
|
||||
;; Redirect to the canonical form above.
|
||||
#'(match-record-inner record type ((field field) rest ...) body ...))
|
||||
((_ record type () body ...)
|
||||
#'(begin body ...)))))
|
||||
|
||||
(define-syntax match-record/dolly
|
||||
(syntax-rules ()
|
||||
"Bind each FIELD of a RECORD of the given TYPE to its FIELD name.
|
||||
The order in which fields appear does not matter. A syntax error is raised if
|
||||
an unknown field is queried."
|
||||
((_ record type (fields ...) body ...)
|
||||
(if (eq? (struct-vtable record) type)
|
||||
(match-record-inner record type (fields ...) body ...)
|
||||
(throw 'wrong-type-arg "match-record"
|
||||
"Wrong type (expecting a ~a record): ~S"
|
||||
(list 'type record) (list record))))))
|
||||
|
||||
(define-syntax match-record-lambda/dolly
|
||||
(syntax-rules ()
|
||||
"Return a procedure accepting a single record of the given TYPE for which each
|
||||
FIELD will be bound to its FIELD name within the returned procedure. A syntax error
|
||||
is raised if an unknown field is queried."
|
||||
((_ type (field ...) body ...)
|
||||
(lambda (record)
|
||||
(match-record/dolly record type (field ...)
|
||||
body ...)))))
|
||||
@@ -7,11 +7,44 @@
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-35)
|
||||
;; Utilities
|
||||
#:use-module (guix diagnostics)
|
||||
#:use-module (guix i18n)
|
||||
#:use-module (guix discovery)
|
||||
#:use-module (guix ui)
|
||||
;; Guix System - services
|
||||
#:use-module (gnu services)
|
||||
#:export (modify-services/by-name))
|
||||
#:export (%rosenthal-service-module-path
|
||||
all-rosenthal-services
|
||||
|
||||
modify-services/by-name))
|
||||
|
||||
(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 %rosenthal-service-module-path
|
||||
`((,%rosenthal-root-directory . "rosenthal/services")
|
||||
(,%rosenthal-root-directory . "rosenthal/home/services")))
|
||||
|
||||
(define (all-rosenthal-services)
|
||||
(fold-service-types cons
|
||||
'()
|
||||
(all-modules %rosenthal-service-module-path
|
||||
#:warn warn-about-load-error)))
|
||||
|
||||
|
||||
;;;
|
||||
|
||||
+6
-3
@@ -1,8 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
load_path="$(dirname "$(realpath "$0")")/modules"
|
||||
TOP_DIR="$(dirname "$(realpath "$0")")"
|
||||
modules="$TOP_DIR/modules"
|
||||
scripts="$TOP_DIR/etc/scripts"
|
||||
|
||||
export GUILE_LOAD_PATH="${load_path}${GUILE_LOAD_PATH:+:}${GUILE_LOAD_PATH}"
|
||||
export GUIX_PACKAGE_PATH="${load_path}${GUIX_PACKAGE_PATH:+:}${GUIX_PACKAGE_PATH}"
|
||||
export GUILE_LOAD_PATH="${modules}${GUILE_LOAD_PATH:+:}${GUILE_LOAD_PATH}"
|
||||
export GUIX_PACKAGE_PATH="${modules}${GUIX_PACKAGE_PATH:+:}${GUIX_PACKAGE_PATH}"
|
||||
export PATH="${scripts}${PATH:+:}${PATH}"
|
||||
|
||||
exec "$@"
|
||||
Reference in new issue
Block a user