Compare commits

...

8 Commits

Author SHA1 Message Date
Hilton Chain
f60c19aea3
home: services: gtk: Fix extension deduplication. 2026-04-10 16:29:42 +08:00
Hilton Chain
8967007a20
services: Inherit graphical session environment from Shepherd.
This will be utilized by an upcoming home-graphical-session-service-type.

* modules/rosenthal/services/desktop.scm (%home-blueman-applet-shepherd)
(%home-fcitx5-shepherd, %home-mako-shepherd)
(home-network-manager-applet-shepherd, %home-noctalia-shell-shepherd)
(%home-bb-auth-shepherd, %home-polkit-gnome-shepherd, %home-swaybg-shepherd)
(%home-waybar-shepherd): Use environment variables from the running environment.
2026-04-10 16:29:34 +08:00
Hilton Chain
f7604b8f00
Revert "rosenthal: Remove sops."
This reverts commit a2fee8a415.
2026-04-10 13:53:37 +08:00
Hilton Chain
2b04665af0
home: services: fcitx5: Add wayland-frontend? option.
* modules/rosenthal/services/desktop.scm (maybe-boolean?): New procedure.
(home-fcitx5-configuration) [wayland-frontend?]: New field.
[gtk-im-module?, qt-im-module?, xim?]: Deprecate fields.
(%home-fcitx5-environment-variables): Adjust accordingly.
(%home-fcitx5-profile): Install fcitx5-gtk and fcitx5-qt unconditionally.
(home-fcitx5-gtk2, home-fcitx5-gtk3): New procedures.
(home-fcitx5-service-type) [extensions]: Extend home-gtk[234]-service-type.
2026-04-10 13:02:17 +08:00
Hilton Chain
d74dd005cf
home: services: Add home-gtk[234]-service-type.
* modules/rosenthal/home/services/gtk.scm
(home-gtk2-xdg-configuration-files)
(home-gtk3-xdg-configuration-files
(home-gtk4-xdg-configuration-files): New procedures.
(home-gtk2-environment-variables)
(home-gtk2-service-type)
(home-gtk3-service-type)
(home-gtk4-service-type): New variables.
* modules/rosenthal/services/desktop.scm
(home-theme-gtk2, home-theme-gtk3): New procedures.
(%home-theme-xdg-config): Delete procedure.
(home-theme-service-type) [extensions]:
Replace home-xdg-configuration-files-service-type to these new services.
2026-04-10 13:01:45 +08:00
Hilton Chain
3bc7d1cc35
home: services: theme: Don't install qtwayland.
* modules/rosenthal/services/desktop.scm (%home-theme-profile): Remove
qtwayland.
2026-04-10 13:01:45 +08:00
Hilton Chain
1166460094
home: services: theme: Use ini-file.
* modules/rosenthal/services/desktop.scm (%home-theme-files)
(%home-theme-xdg-config): Use ini-file.
2026-04-10 13:01:45 +08:00
Hilton Chain
603d65387a
utils: file: Make computed-file non-substitutable.
* modules/rosenthal/utils/file.scm (computed-substitution-with-inputs)
(hidden-desktop-entry, ini-file, json-file, toml-file, yaml-file): Disable substitutable?.
2026-04-10 13:01:44 +08:00
4 changed files with 297 additions and 71 deletions

View File

@ -0,0 +1,81 @@
;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
(define-module (rosenthal home services gtk)
;; Guilt builtins
#:use-module (srfi srfi-1)
;; Utilities
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (rosenthal utils file)
;; Guix Home - services
#:use-module (gnu home services)
#:export (home-gtk2-service-type
home-gtk3-service-type
home-gtk4-service-type))
(define home-gtk2-environment-variables
;; https://wiki.archlinux.org/title/XDG_Base_Directory
'(("GTK2_RC_FILES" . "$XDG_CONFIG_HOME/gtk-2.0/gtkrc")))
(define (home-gtk2-xdg-configuration-files config)
`(("gtk-2.0/gtkrc"
,(computed-file "gtkrc"
#~(begin
(use-modules (ice-9 match))
(call-with-output-file #$output
(lambda (port)
(for-each (match-lambda
((key . val)
(format port "~a = ~a~%" key val)))
'#$config))))
#:options '(#:substitutable? #f)))))
(define (home-gtk3-xdg-configuration-files config)
`(("gtk-3.0/settings.ini"
,(ini-file "settings.ini" #~'(("Settings" #$@config))))))
(define (home-gtk4-xdg-configuration-files config)
`(("gtk-4.0/settings.ini"
,(ini-file "settings.ini" #~'(("Settings" #$@config))))))
(define home-gtk2-service-type
(service-type
(name 'home-gtk2)
(extensions
(list (service-extension home-environment-variables-service-type
(const home-gtk2-environment-variables))
(service-extension home-xdg-configuration-files-service-type
home-gtk2-xdg-configuration-files)))
(compose concatenate)
(extend
(lambda (config extension)
(delete-duplicates
;; Allow overriding extensions via configuration.
(append config
extension)
(lambda (a b)
(string=? (car a)
(car b))))))
(description "Set up GTK2 settings in @file{~/.config/gtk-2.0/gtkrc}")
(default-value '())))
(define home-gtk3-service-type
(service-type
(inherit home-gtk2-service-type)
(name 'home-gtk3)
(extensions
(list (service-extension home-xdg-configuration-files-service-type
home-gtk3-xdg-configuration-files)))
(description
"Set up GTK3 settings in @file{~/.config/gtk-3.0/settings.ini}")))
(define home-gtk4-service-type
(service-type
(inherit home-gtk2-service-type)
(name 'home-gtk4)
(extensions
(list (service-extension home-xdg-configuration-files-service-type
home-gtk4-xdg-configuration-files)))
(description
"Set up GTK4 settings in @file{~/.config/gtk-4.0/settings.ini}")))

View File

@ -15,3 +15,58 @@
#:use-module (guix build-system go)
;; Guix packages
#:use-module (gnu packages golang))
(define-public sops
(package
(name "sops")
(version "3.12.2")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/getsops/sops")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"01w67iv0v9hnxgaklixk871dwnhyhllm3zz36iiwqsd19d5rllfm"))))
(build-system go-build-system)
(arguments
(list #:go go-1.26
#:install-source? #f
#:import-path "./cmd/sops"
#:build-flags
#~(list (string-append
"-ldflags="
"-X github.com/getsops/sops/v3/version.Version="
#$(package-version this-package)))
#:modules
'(((guix build gnu-build-system) #:prefix gnu:)
(guix build go-build-system)
(guix build utils))
#:phases
#~(modify-phases %standard-phases
(replace 'unpack
(lambda args
(unsetenv "GO111MODULE")
(apply (assoc-ref gnu:%standard-phases 'unpack) args)
(copy-recursively
#+(this-package-native-input "vendored-go-dependencies")
"vendor")))
(replace 'install-license-files
(assoc-ref gnu:%standard-phases 'install-license-files)))))
(native-inputs
(list (origin
(method (go-mod-vendor #:go go-1.26))
(uri (package-source this-package))
(file-name "vendored-go-dependencies")
(sha256
(base32
"1gd5kpiqizrab7fbhzhwj5lm1b6wmpvwpvnrwwz0xkfn6hqwj1qy")))))
(home-page "https://getsops.io/")
(synopsis "Simple and flexible tool for managing secrets")
(description
"@acronym{SOPS, Secrets OPerationS} is an editor of encrypted files that
supports YAML, JSON, ENV, INI and binary formats and encrypts with @acronym{AWS
KMS, Amazon Web Services Key Management Service}, @acronym{GCP KMS, Google Cloud
Platform Key Management Service}, Azure Key Vault, @code{age}, and OpenPGP.")
(license license:mpl2.0)))

View File

@ -4,7 +4,9 @@
(define-module (rosenthal services desktop)
;; Utilities
#:use-module (guix deprecation)
#:use-module (guix diagnostics)
#:use-module (guix gexp)
#:use-module (guix i18n)
#:use-module (guix modules)
#:use-module (guix packages)
#:use-module (guix records)
@ -32,6 +34,7 @@
#:use-module (gnu home services desktop)
#:use-module (gnu home services shepherd)
#:use-module (gnu home services sound)
#:use-module (rosenthal home services gtk)
;; Guix packages
#:use-module (gnu packages fcitx5)
#:use-module (gnu packages fonts)
@ -107,8 +110,12 @@
(documentation "Start blueman applet.")
(provision '(blueman-applet))
(start
#~(make-forkexec-constructor
(list #$(file-append blueman "/bin/blueman-applet"))))
#~(lambda args
((make-forkexec-constructor
(list #$(file-append blueman "/bin/blueman-applet"))
;; Inherit graphical session environment.
#:environment-variables (environ))
args)))
(stop #~(make-kill-destructor))))))
(define home-blueman-applet-service-type
@ -130,6 +137,7 @@
(define list-of-file-likes?
(list-of file-like?))
(define-maybe file-like)
(define-maybe boolean)
(define-configuration/no-serialization home-fcitx5-configuration
(fcitx5
@ -144,42 +152,74 @@
(input-method-editors
(list-of-file-likes '())
"")
(wayland-frontend?
(boolean #f)
"")
;; deprecated
(gtk-im-module?
(boolean #f)
"")
maybe-boolean
""
(sanitizer
(lambda (config)
(if (maybe-value-set? config)
(warning
(G_ "'~a': option '~a' is deprecated, please use '~a' instead.~%")
"home-fcitx5-configuration"
"gtk-im-module?"
"wayland-frontend?")))))
(qt-im-module?
(boolean #f)
"")
maybe-boolean
""
(sanitizer
(lambda (config)
(if (maybe-value-set? config)
(warning
(G_ "'~a': option '~a' is deprecated, please use '~a' instead.~%")
"home-fcitx5-configuration"
"qt-im-module?"
"wayland-frontend?")))))
(xim?
(boolean #t)
""))
maybe-boolean
""
(sanitizer
(lambda (config)
(if (maybe-value-set? config)
(warning
(G_ "'~a': option '~a' is deprecated.~%")
"home-fcitx5-configuration"
"xim?"))))))
;; https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland
(define %home-fcitx5-environment-variables
(match-record-lambda <home-fcitx5-configuration>
(gtk-im-module? qt-im-module? xim?)
`(,@(if gtk-im-module?
'(("GTK_IM_MODULE" . "fcitx"))
'())
,@(if qt-im-module?
'(("QT_IM_MODULE" . "fcitx"))
'())
,@(if xim?
'(("XMODIFIERS" . "@im=fcitx"))
'()))))
(wayland-frontend?)
`(("XMODIFIERS" . "@im=fcitx")
("QT_IM_MODULE" . "fcitx")
,@(if wayland-frontend?
'(("QT_IM_MODULES" . "wayland;fcitx"))
'(("GTK_IM_MODULE" . "fcitx"))))))
(define home-fcitx5-gtk2
(match-record-lambda <home-fcitx5-configuration>
(wayland-frontend?)
(if wayland-frontend?
`(("gtk-im-module" . ,(format #f "~s" "fcitx")))
'())))
(define home-fcitx5-gtk3
(match-record-lambda <home-fcitx5-configuration>
(wayland-frontend?)
(if wayland-frontend?
`(("gtk-im-module" . "fcitx"))
'())))
(define %home-fcitx5-profile
(match-record-lambda <home-fcitx5-configuration>
(fcitx5 utilities themes input-method-editors gtk-im-module? qt-im-module?)
(append (list fcitx5)
(fcitx5 utilities themes input-method-editors wayland-frontend?)
(append (list fcitx5 fcitx5-gtk fcitx5-qt)
utilities
themes
input-method-editors
(if gtk-im-module?
(list fcitx5-gtk)
'())
(if qt-im-module?
(list fcitx5-qt)
'()))))
input-method-editors)))
(define %home-fcitx5-shepherd
(match-record-lambda <home-fcitx5-configuration>
@ -189,8 +229,12 @@
(provision '(fcitx5))
(requirement '(dbus))
(start
#~(make-forkexec-constructor
(list #$(file-append fcitx5 "/bin/fcitx5"))))
#~(lambda args
((make-forkexec-constructor
(list #$(file-append fcitx5 "/bin/fcitx5"))
;; Inherit graphical session environment.
#:environment-variables (environ))
args)))
(stop #~(make-kill-destructor))))))
(define home-fcitx5-service-type
@ -199,6 +243,12 @@
(extensions
(list (service-extension home-environment-variables-service-type
%home-fcitx5-environment-variables)
(service-extension home-gtk2-service-type
home-fcitx5-gtk2)
(service-extension home-gtk3-service-type
home-fcitx5-gtk3)
(service-extension home-gtk4-service-type
home-fcitx5-gtk3)
(service-extension home-profile-service-type
%home-fcitx5-profile)
(service-extension home-shepherd-service-type
@ -234,8 +284,12 @@
(documentation "Start mako.")
(provision '(mako))
(start
#~(make-forkexec-constructor
(list #$(file-append mako "/bin/mako"))))
#~(lambda args
((make-forkexec-constructor
(list #$(file-append mako "/bin/mako"))
;; Inherit graphical session environment.
#:environment-variables (environ))
args)))
(stop #~(make-kill-destructor))))))
(define home-mako-service-type
@ -266,8 +320,12 @@
(documentation "Start network manager applet.")
(provision '(network-manager-applet))
(start
#~(make-forkexec-constructor
(list #$(file-append network-manager-applet "/bin/nm-applet"))))
#~(lambda args
((make-forkexec-constructor
(list #$(file-append network-manager-applet "/bin/nm-applet"))
;; Inherit graphical session environment.
#:environment-variables (environ))
args)))
(stop #~(make-kill-destructor))))))
(define home-network-manager-applet-service-type
@ -338,9 +396,13 @@ compositor.")))
(provision '(noctalia-shell))
(modules '((shepherd support)))
(start
#~(make-forkexec-constructor
(list #$(file-append noctalia-shell "/bin/noctalia-shell"))
#:log-file (in-vicinity %user-log-dir "noctalia-shell.log")))
#~(lambda args
((make-forkexec-constructor
(list #$(file-append noctalia-shell "/bin/noctalia-shell"))
#:log-file (in-vicinity %user-log-dir "noctalia-shell.log")
;; Inherit graphical session environment.
#:environment-variables (environ))
args)))
(stop #~(make-kill-destructor))))))
(define home-noctalia-shell-service-type
@ -365,8 +427,12 @@ compositor.")))
(list (shepherd-service
(provision '(bb-auth))
(start
#~(make-forkexec-constructor
(list #$(file-append bb-auth "/libexec/bb-auth") "--daemon")))
#~(lambda args
((make-forkexec-constructor
(list #$(file-append bb-auth "/libexec/bb-auth") "--daemon")
;; Inherit graphical session environment.
#:environment-variables (environ))
args)))
(stop #~(make-kill-destructor)))))
(define home-bb-auth-service-type
@ -387,8 +453,12 @@ compositor.")))
(list (shepherd-service
(provision '(polkit-gnome))
(start
#~(make-forkexec-constructor
(list #$(file-append polkit-gnome "/libexec/polkit-gnome-authentication-agent-1"))))
#~(lambda args
((make-forkexec-constructor
(list #$(file-append polkit-gnome "/libexec/polkit-gnome-authentication-agent-1"))
;; Inherit graphical session environment.
#:environment-variables (environ))
args)))
(stop #~(make-kill-destructor)))))
(define home-polkit-gnome-service-type
@ -447,9 +517,13 @@ compositor.")))
(documentation "Start swaybg.")
(provision '(swaybg))
(start
#~(make-forkexec-constructor
(list #$(file-append swaybg "/bin/swaybg") "--mode" "fill"
"--image" #$background)))
#~(lambda args
((make-forkexec-constructor
(list #$(file-append swaybg "/bin/swaybg") "--mode" "fill"
"--image" #$background)
;; Inherit graphical session environment.
#:environment-variables (environ))
args)))
(stop #~(make-kill-destructor))))))
(define home-swaybg-service-type
@ -496,33 +570,35 @@ compositor.")))
(packages)
(cons* adwaita-icon-theme
hicolor-icon-theme
qtwayland
packages)))
(define %home-theme-files
(match-record-lambda <home-theme-configuration>
(icon-theme)
`((".icons/default/index.theme"
,(plain-file "index.theme"
(format #f "\
[icon theme]
Inherits = ~a~%"
icon-theme))))))
,(ini-file "index.theme"
#~'(("icon theme"
("Inherits" . #$icon-theme))))))))
(define %home-theme-xdg-config
(define home-theme-gtk2
(match-record-lambda <home-theme-configuration>
(icon-theme font cursor-theme cursor-size key-theme)
`(("gtk-3.0/settings.ini"
,(plain-file "settings.ini"
(format #f "\
[Settings]
gtk-theme-name = Adwaita
gtk-icon-theme-name = ~a
gtk-font-name = ~a
gtk-cursor-theme-name = ~a
gtk-cursor-theme-size = ~a
gtk-key-theme-name = ~a~%"
icon-theme font cursor-theme cursor-size key-theme))))))
`(("gtk-theme-name" . ,(format #f "~s" "Adwaita"))
("gtk-icon-theme-name" . ,(format #f "~s" icon-theme))
("gtk-font-name" . ,(format #f "~s" font))
("gtk-cursor-theme-name" . ,(format #f "~s" cursor-theme))
("gtk-cursor-theme-size" . ,cursor-size)
("gtk-key-theme-name" . ,(format #f "~s" key-theme)))))
(define home-theme-gtk3
(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)
("gtk-key-theme-name" . ,key-theme))))
(define home-theme-service-type
(service-type
@ -534,8 +610,12 @@ gtk-key-theme-name = ~a~%"
%home-theme-profile)
(service-extension home-files-service-type
%home-theme-files)
(service-extension home-xdg-configuration-files-service-type
%home-theme-xdg-config)))
(service-extension home-gtk2-service-type
home-theme-gtk2)
(service-extension home-gtk3-service-type
home-theme-gtk3)
(service-extension home-gtk4-service-type
home-theme-gtk3)))
(default-value (home-theme-configuration))
(description "Set up desktop themes.")))
@ -572,8 +652,12 @@ gtk-key-theme-name = ~a~%"
(documentation "Start waybar.")
(provision '(waybar))
(start
#~(make-forkexec-constructor
(list #$(file-append waybar "/bin/waybar"))))
#~(lambda args
((make-forkexec-constructor
(list #$(file-append waybar "/bin/waybar"))
;; Inherit graphical session environment.
#:environment-variables (environ))
args)))
(stop #~(make-kill-destructor))))))
(define home-waybar-service-type

View File

@ -40,7 +40,8 @@
(let ((full-path (in-vicinity candidate path)))
(if (file-exists? full-path)
full-path
(loop rest)))))))))))))
(loop rest))))))))))
#:options '(#:substitutable? #f))))
(define (file-content file)
(call-with-input-file (canonicalize-path file) get-string-all))
@ -53,7 +54,8 @@
(copy-file #$file #$output)
(substitute* #$output
(("^\\[Desktop Entry\\].*" all)
(string-append all "NoDisplay=true\n")))))))
(string-append all "NoDisplay=true\n")))))
#:options '(#:substitutable? #f)))
;;;
@ -69,7 +71,8 @@ format."
#~(begin
(use-modules (srfi srfi-26) (ini))
(call-with-output-file #$output
(cut scm->ini #$exp #:port <>))))))
(cut scm->ini #$exp #:port <>))))
#:options '(#:substitutable? #f)))
;; https://github.com/aconchillo/guile-json
(define (json-file name exp)
@ -80,7 +83,8 @@ format."
#~(begin
(use-modules (srfi srfi-26) (json))
(call-with-output-file #$output
(cut scm->json #$exp <> #:pretty #t))))))
(cut scm->json #$exp <> #:pretty #t))))
#:options '(#:substitutable? #f)))
;; https://github.com/hylophile/guile-toml
;; TODO: TOML writing support is incomplete.
@ -93,7 +97,8 @@ format."
#~(begin
(use-modules (srfi srfi-26) (toml))
(call-with-output-file #$output
(cut scm->toml #$exp <>))))))
(cut scm->toml #$exp <>))))
#:options '(#:substitutable? #f)))
;; https://gitlab.com/yorgath/guile-yamlpp
(define (yaml-file name exp)
@ -107,4 +112,5 @@ format."
(lambda (port)
(let ((emitter (make-yaml-emitter)))
(yaml-emit! emitter #$exp)
(display (yaml-emitter-string emitter) port))))))))
(display (yaml-emitter-string emitter) port))))))
#:options '(#:substitutable? #f)))