From 826e86ee7c3bcaed88389defe684af60c27d9332 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sat, 14 Sep 2024 14:59:52 +0200 Subject: [PATCH] feat: move home service modules to guix-exprs channel --- home/home-configuration.scm | 2 +- home/modules/ruther/home/editors.scm | 3 - home/modules/ruther/home/services/dconf.scm | 133 ---------- home/modules/ruther/home/services/gtk.scm | 149 ----------- home/modules/ruther/home/services/kanshi.scm | 83 ------ home/modules/ruther/home/services/wayland.scm | 246 ------------------ .../home/services/xdg-desktop-portals.scm | 74 ------ home/modules/ruther/home/themes.scm | 136 ---------- 8 files changed, 1 insertion(+), 825 deletions(-) delete mode 100644 home/modules/ruther/home/editors.scm delete mode 100644 home/modules/ruther/home/services/dconf.scm delete mode 100644 home/modules/ruther/home/services/gtk.scm delete mode 100644 home/modules/ruther/home/services/kanshi.scm delete mode 100644 home/modules/ruther/home/services/wayland.scm delete mode 100644 home/modules/ruther/home/services/xdg-desktop-portals.scm delete mode 100644 home/modules/ruther/home/themes.scm diff --git a/home/home-configuration.scm b/home/home-configuration.scm index ec4c8dc..70c66bb 100644 --- a/home/home-configuration.scm +++ b/home/home-configuration.scm @@ -24,7 +24,7 @@ (gnu home services) (ruther home dwl wm) (ruther home dwl scripts) - (ruther home themes) + (ruther home packages themes) (ruther home services gtk) (ruther home services xdg-desktop-portals) (ruther home services wayland) diff --git a/home/modules/ruther/home/editors.scm b/home/modules/ruther/home/editors.scm deleted file mode 100644 index 1208e7d..0000000 --- a/home/modules/ruther/home/editors.scm +++ /dev/null @@ -1,3 +0,0 @@ -(define-module (ruther home editors) - ;; #:use-module () - ) diff --git a/home/modules/ruther/home/services/dconf.scm b/home/modules/ruther/home/services/dconf.scm deleted file mode 100644 index d2ade3a..0000000 --- a/home/modules/ruther/home/services/dconf.scm +++ /dev/null @@ -1,133 +0,0 @@ -(define-module (ruther home services dconf) - #:use-module (guix gexp) - #:use-module (guix modules) - #:use-module (guix monads) - #:use-module (guix store) - - #:use-module (gnu packages gnome) - #:use-module (gnu services) - #:use-module (gnu services configuration) - #:use-module (gnu home services) - - #:use-module (srfi srfi-1) - - #:use-module (rde serializers ini) - - #:export (home-dconf-configuration - home-dconf-service-type)) - -;; The state will be a scm file. -;; Create a file under the home folder that will - -(define-configuration home-dconf-configuration - (dconf (file-like dconf) "The dconf package to use for loading environment") - (config - (ini-config '()) - "The configuration of dconf to load. Stuff that's not -declared here is not touched. The stuff that was declared in previous -generation, and got removed, will also be removed from dconf. - -The config is fed into dconf load. The ini sections should point to the -location in dconf settings, ie. org/gnome/desktop/interface, and -the values in there refer to values to set, ie. cursor-theme='my-pretty-cursors'.")) - -(define home-dconf-settings-file "state/dconf-settings.scm") - -(define (update-dconf-settings-script dconf dconf-config) - (program-file - "update-dconf-settings" - #~(begin - (define (get-dconf-keys config) - (apply - append - (apply - append - (map - (lambda (section) - (let ((section-name (symbol->string (car section)))) - (map - (lambda (section-fields) - (map - (lambda (section-field) - (string-append "/" section-name "/" (symbol->string (car section-field)))) - section-fields)) - (cdr section)))) - config)))) - - (define (get-deleted-dconf-keys old-config new-config) - (let ((old-keys (get-dconf-keys old-config)) - (new-keys (get-dconf-keys new-config))) - (filter - (lambda (key) - (not (member key new-keys))) - old-keys))) - - (use-modules (ice-9 popen)) - - (let* ((dconf #$(file-append dconf "/bin/dconf")) - - (new-home (getenv "GUIX_NEW_HOME")) - (old-home (getenv "GUIX_OLD_HOME")) - (new-home-dconf-file (string-append new-home "/" #$home-dconf-settings-file)) - (old-home-dconf-file (when old-home - (string-append old-home "/" #$home-dconf-settings-file))) - (new-dconf-settings (with-input-from-file new-home-dconf-file read)) - (old-dconf-settings (if old-home-dconf-file - (with-input-from-file old-home-dconf-file read) - '())) - - (deleted-dconf-keys (get-deleted-dconf-keys old-dconf-settings new-dconf-settings)) - - (dconf-ini #$(apply string-append - (serialize-ini-config dconf-config - #:equal-string "=")))) - ;; Remove settings that are not managed anymore - (display "Removing old dconf keys...") - (newline) - (for-each - (lambda (deleted-key) - (system* dconf "reset" deleted-key)) - deleted-dconf-keys) - ;; Load the dconf settings - (display "Loading dconf...") - (newline) - (let ((dconf-load-pipe (open-output-pipe (string-append dconf - " load /")))) - (display dconf-ini dconf-load-pipe) - (close-pipe dconf-load-pipe)) - (display "Configured dconf.") - (newline))))) - -(define (dconf-activation config) - #~(primitive-load #$(update-dconf-settings-script (home-dconf-configuration-dconf config) - (home-dconf-configuration-config config)))) - -(define (dconf-entry config) - (with-monad %store-monad - (return `((,home-dconf-settings-file - ,(computed-file - "dconf-settings.scm" - #~(call-with-output-file #$output - (lambda (port) - (write '#$(home-dconf-configuration-config config) port))))))))) - -(define (home-dconf-extensions original-config sections) - (home-dconf-configuration - (inherit original-config) - (config - (append - (home-dconf-configuration-config original-config) - sections)))) - -(define home-dconf-service-type - (service-type - (name 'home-dconf) - (description "A service to populate dconf settings by given configuration.") - (extend home-dconf-extensions) - (compose concatenate) - (extensions - (list (service-extension home-service-type - dconf-entry) - (service-extension home-activation-service-type - dconf-activation))) - (default-value (home-dconf-configuration)))) diff --git a/home/modules/ruther/home/services/gtk.scm b/home/modules/ruther/home/services/gtk.scm deleted file mode 100644 index 75da1f3..0000000 --- a/home/modules/ruther/home/services/gtk.scm +++ /dev/null @@ -1,149 +0,0 @@ -(define-module (ruther home services gtk) - #:use-module (gnu services configuration) - #:use-module (gnu services) - #:use-module (guix packages) - #:use-module (guix gexp) - #:use-module (guix build-system trivial) - #:use-module (gnu home services) - #:use-module (ruther home services dconf) - #:export (home-gtk-configuration - gtk-theme-configuration - home-gtk-service-type)) - -(define (maybe-string? str) - (or (nil? str) - (string? str))) -(define (maybe-package? pkg) - (or (nil? pkg) - (package? pkg))) - -(define-configuration/no-serialization gtk-theme-configuration - (package (maybe-package #f) "The package to add to profile, including theme {name}") - (name (maybe-string #f) "Name of the theme") - (size (integer 16) "Size of the pointer. Applies only for cursor-theme")) - -(define-configuration/no-serialization home-gtk-configuration - (gtk-theme - (gtk-theme-configuration (gtk-theme-configuration)) - "The theme") - (icon-theme - (gtk-theme-configuration (gtk-theme-configuration)) - "The icon theme") - (cursor-theme - (gtk-theme-configuration (gtk-theme-configuration)) - "The cursor theme") - (font-name - (maybe-string #f) - "Name of the font to use")) - -(define* (serialize-field name value #:key (gtk2? #f)) - (if gtk2? - (format #f "~a = \"~a\"~%" name value) - (format #f "~a = ~a~%" name value))) - -(define* (serialize-cons field #:key (gtk2? #f)) - (serialize-field (car field) (cdr field) #:gtk2? gtk2?)) - -(define (gtk4-css-import-file theme-package theme-name) - `("gtk.css" - "@import url(\"file://" ,theme-package "/share/themes/" ,theme-name "/gtk-4.0/gtk.css\");")) - -(define (map-gtk-configuration-to-gtk-config config) - (filter (lambda (x) (not (nil? (cdr x)))) - `((gtk-theme-name . ,(gtk-theme-configuration-name (home-gtk-configuration-gtk-theme config))) - (gtk-icon-theme-name . ,(gtk-theme-configuration-name (home-gtk-configuration-icon-theme config))) - (gtk-cursor-theme-name . ,(gtk-theme-configuration-name (home-gtk-configuration-cursor-theme config))) - (gtk-cursor-theme-size . ,(gtk-theme-configuration-size (home-gtk-configuration-cursor-theme config))) - (gtk-font-name . ,(home-gtk-configuration-font-name config))))) - -(define* (serialize-gtk-config config #:key (gtk2? #f)) - (let* ((mapped (map-gtk-configuration-to-gtk-config config)) - (serialized (map (lambda (x) (serialize-cons x #:gtk2? gtk2?)) mapped))) - (if gtk2? - serialized - (cons* "[Settings]\n" - serialized)))) - -(define (add-gtk-theme-packages config) - (filter - (lambda (x) (not (nil? x))) - (list - (gtk-theme-configuration-package (home-gtk-configuration-gtk-theme config)) - (gtk-theme-configuration-package (home-gtk-configuration-icon-theme config)) - (gtk-theme-configuration-package (home-gtk-configuration-cursor-theme config)) - (if (nil? (gtk-theme-configuration-name (home-gtk-configuration-cursor-theme config))) - '() - (package - (name "default-icon-inherits") - (version "0.0.0") - (source #f) - (build-system trivial-build-system) - (home-page #f) - (synopsis #f) - (description #f) - (license #f) - (arguments - (list - #:builder - (with-imported-modules - '((guix build utils)) - #~(begin - (use-modules (guix build utils)) - (mkdir-p (string-append #$output "/share/icons/default")) - (call-with-output-file (string-append #$output "/share/icons/default/index.theme") - (lambda (port) - (format port - "[Icon Theme]~%Name=Default~%Comment=Default cursor theme~%Inherits=~a~%" - #$(gtk-theme-configuration-name (home-gtk-configuration-cursor-theme config)))))))))))))) - -(define (add-xcursor-environment config) - (let* ((cursor-theme (home-gtk-configuration-cursor-theme config)) - (cursor-name (gtk-theme-configuration-name cursor-theme)) - (cursor-package (gtk-theme-configuration-package cursor-theme)) - (cursor-size (gtk-theme-configuration-size cursor-theme))) - (if (nil? cursor-name) - '() - `(("GTK2_RC_FILES" . "$HOME/.gtkrc-2.0") - ("XCURSOR_THEME" . ,cursor-name) - ("XCURSOR_SIZE" . ,(format #f "~a" cursor-size)))))) ;; TODO: this path should not be hardcoded here - -(define (add-gtk-config-file config) - (append - `((".gtkrc-2.0" - ,(apply mixed-text-file (cons* "gtkrc-2.0" (serialize-gtk-config config #:gtk2? #t)))) - (".config/gtk-3.0/settings.ini" - ,(apply mixed-text-file (cons* "settings.ini" (serialize-gtk-config config)))) - (".config/gtk-4.0/settings.ini" - ,(apply mixed-text-file (cons* "settings.ini" (serialize-gtk-config config))))) - (if (nil? (gtk-theme-configuration-package (home-gtk-configuration-gtk-theme config))) - '() - `((".config/gtk-4.0/gtk.css" - ,(apply mixed-text-file (gtk4-css-import-file - (gtk-theme-configuration-package (home-gtk-configuration-gtk-theme config)) - (gtk-theme-configuration-name (home-gtk-configuration-gtk-theme config))))))))) - -(define (add-gtk-dconf-config config) - (let* ((data `((font-name . ,(home-gtk-configuration-font-name config)) - (gtk-theme . ,(gtk-theme-configuration-name (home-gtk-configuration-gtk-theme config))) - (cursor-theme . ,(gtk-theme-configuration-name (home-gtk-configuration-cursor-theme config))) - (icon-theme . ,(gtk-theme-configuration-name (home-gtk-configuration-icon-theme config))))) - (filtered-data (filter (lambda (x) (not (nil? (cdr x)))) data))) - `((org/gnome/desktop/interface - ,filtered-data)))) - -(define-public home-gtk-service-type - (service-type (name 'home-gtk) - (extensions - (list (service-extension - home-files-service-type - add-gtk-config-file) - (service-extension - home-dconf-service-type - add-gtk-dconf-config) - (service-extension - home-profile-service-type - add-gtk-theme-packages) - (service-extension - home-environment-variables-service-type - add-xcursor-environment))) - (description "Create gtk theme configuration files for gtk2 and gtk3"))) diff --git a/home/modules/ruther/home/services/kanshi.scm b/home/modules/ruther/home/services/kanshi.scm deleted file mode 100644 index 13bde87..0000000 --- a/home/modules/ruther/home/services/kanshi.scm +++ /dev/null @@ -1,83 +0,0 @@ -(define-module (ruther home services kanshi) - #:use-module (guix gexp) - #:use-module (gnu packages freedesktop) - #:use-module (gnu services) - #:use-module (gnu services configuration) - #:use-module (gnu services shepherd) - #:use-module (srfi srfi-26) - #:use-module (srfi srfi-1) - #:use-module (gnu home services) - #:use-module (gnu home services shepherd) - #:use-module (ruther home services wayland) - #:export (home-kanshi-configuration - home-swayidle-configuration)) - -(define-public (serialize-kanshi-configuration config) - (apply - mixed-text-file - "config" - ((@@ (rde home services wm) serialize-sway-config) config))) - -(define-public (serialize-swayidle-configuration config) - (apply - mixed-text-file - "config" - ((@@ (rde home services wm) serialize-sway-config) config))) - -(define sway-config? (@ (rde home services wm) sway-config?)) - -(define-configuration/no-serialization home-kanshi-configuration - (kanshi (file-like kanshi) "Kanshi package to use.") - (config sway-config "Configuration of the kanshi program itself. Goes into .config/kanshi/config. See `man 5 kanshi`")) - -(define (home-kanshi-shepherd-services config) - (list - (shepherd-service - (documentation "Run the kanshi daemon for managing outputs.") - (provision '(kanshi)) - (requirement '(wayland-display)) - (start #~(make-forkexec-constructor - (list #$(file-append - (home-kanshi-configuration-kanshi config) - "/bin/kanshi") - "-c" - #$(serialize-kanshi-configuration (home-kanshi-configuration-config config))))) - (stop #~(make-kill-destructor))))) - -(define-public home-kanshi-service-type - (service-type - (name 'home-kanshi) - (description "A service for configuring and running kanshi through Shepherd") - (extensions - (list (service-extension home-shepherd-service-type - home-kanshi-shepherd-services) - (service-extension home-wayland-display-service-type - (const #f)))))) - -(define-configuration/no-serialization home-swayidle-configuration - (swayidle (file-like swayidle) "Swayidle package to use.") - (config sway-config "Configuration of the swayidle program itself. Goes into .config/swayidle/config. See `man 5 swayidle`")) - -(define (home-swayidle-shepherd-services config) - (list - (shepherd-service - (documentation "Run the swayidle daemon for managing commands executed when idle.") - (provision '(swayidle)) - (requirement '(wayland-display)) - (start #~(make-forkexec-constructor - (list #$(file-append - (home-swayidle-configuration-swayidle config) - "/bin/swayidle") - "-wC" - #$(serialize-swayidle-configuration (home-swayidle-configuration-config config))))) - (stop #~(make-kill-destructor))))) - -(define-public home-swayidle-service-type - (service-type - (name 'home-swayidle) - (description "A service for configuring and running swayidle through Shepherd") - (extensions - (list (service-extension home-shepherd-service-type - home-swayidle-shepherd-services) - (service-extension home-wayland-display-service-type - (const #f)))))) diff --git a/home/modules/ruther/home/services/wayland.scm b/home/modules/ruther/home/services/wayland.scm deleted file mode 100644 index 8fd3cdd..0000000 --- a/home/modules/ruther/home/services/wayland.scm +++ /dev/null @@ -1,246 +0,0 @@ -(define-module (ruther home services wayland) - #:use-module (guix gexp) - #:use-module (gnu packages wm) - #:use-module (gnu packages emacs) - #:use-module (gnu packages gnome) - #:use-module (gnu packages networking) - #:use-module (gnu packages xdisorg) - #:use-module (gnu services) - #:use-module (gnu services configuration) - #:use-module (gnu services shepherd) - #:use-module (srfi srfi-26) - #:use-module (srfi srfi-1) - #:use-module (gnu home services) - #:use-module (gnu home services shepherd) - - #:export (home-emacs-configuration - home-network-manager-applet-configuration - home-blueman-applet-configuration - home-waybar-configuration - home-gammastep-configuration)) - -(define (wayland-display-shepherd-service config) - (list - (shepherd-service - (documentation "Sets WAYLAND_DISPLAY to argument passed in. -This should be called from a wayland compositor like this: `herd start wayland-display $WAYLAND_DISPLAY`") - (provision '(wayland-display)) - (auto-start? #f) - (start #~(lambda (wayland-display) - (setenv "WAYLAND_DISPLAY" wayland-display) - wayland-display)) - (stop #~(lambda (_) - (unsetenv "WAYLAND_DISPLAY") - #f))))) - -(define-public home-wayland-display-service-type - (service-type - (name 'home-wayland-display) - (description "A service to set WAYLAND_DISPLAY environment variable inside of the shepherd process.") - (default-value #f) - (extensions - (list (service-extension home-shepherd-service-type - wayland-display-shepherd-service))))) - - -(define (wlr-services-shepherd-service services) - (list - (shepherd-service - (documentation "Service for starting WLR services.") - (provision '(wlr-services)) - (auto-start? #f) - (start - #~(lambda* (#:optional (wayland-display #f)) - (use-modules (shepherd service) - (shepherd support)) - - (let ((display-service (lookup-service 'wayland-display))) - (when (and wayland-display - (service-stopped? display-service)) - (start-service display-service - wayland-display)) - - (if (service-running? display-service) - (for-each (lambda (service) - (start-service (lookup-service service))) - '#$services) - (begin - ((@ (shepherd support) local-output) - ((@ (shepherd support) l10n) - "Cannot start wlr-services, because wayland-display is not running and WAYLAND_DISPLAY argument has not been supplied.")) - #f))))) - (stop #~(lambda* (running-value #:optional (stop-display "yes")) - (use-modules (shepherd service) - (shepherd support)) - - (for-each (lambda (service) - (stop-service (lookup-service service))) - '#$services) - - (when (equal? stop-display "yes") - ((@ (shepherd support) local-output) ((@ (shepherd support) l10n) "Stopping wayland-display as well.")) - (stop-service (lookup-service 'wayland-display))) - #f))))) - -(define-public home-wlr-services-service-type - (service-type - (name 'home-wayland-display) - (description "A service to start a list of services, meant for wlr.") - (default-value '()) - (extensions - (list (service-extension home-shepherd-service-type - wlr-services-shepherd-service) - (service-extension home-wayland-display-service-type - (const #f)))))) - -(define-configuration/no-serialization home-emacs-configuration - (emacs (file-like emacs) "Emacs package to use.") - (extra-arguments (list-of-strings '()) "Extra arguments to emacs daemon command.")) - -(define (home-emacs-shepherd-service config) - (list - (shepherd-service - (documentation "Emacs daemon") - (requirement '(wayland-display)) - (provision '(emacs)) - (start #~(make-forkexec-constructor - (cons* #$(file-append - (home-emacs-configuration-emacs config) - "/bin/emacs") - "--fg-daemon" - '#$(home-emacs-configuration-extra-arguments config)))) - (stop #~(make-kill-destructor))))) - -(define-public home-emacs-service-type - (service-type - (name 'home-emacs) - (description "A service to start emacs daemon") - (default-value (home-emacs-configuration)) - (extensions - (list (service-extension home-shepherd-service-type - home-emacs-shepherd-service) - (service-extension home-wayland-display-service-type - (const #f)))))) - -(define-configuration/no-serialization home-network-manager-applet-configuration - (network-manager-applet (file-like network-manager-applet) "Network manager applet package to use.") - (extra-arguments (list-of-strings '()) "Extra arguments to nm-applet daemon command.")) - -(define (home-network-manager-applet-shepherd-service config) - (list - (shepherd-service - (documentation "Network Manager Applet daemon") - (requirement '(wayland-display)) - (provision '(network-manager-applet)) - (start #~(make-forkexec-constructor - (cons* #$(file-append - (home-network-manager-applet-configuration-network-manager-applet config) - "/bin/nm-applet") - '#$(home-network-manager-applet-configuration-extra-arguments config)))) - (stop #~(make-kill-destructor))))) - -(define-public home-network-manager-applet-service-type - (service-type - (name 'home-network-manager-applet) - (description "A service to start network-manager-applet daemon") - (default-value (home-network-manager-applet-configuration)) - (extensions - (list (service-extension home-shepherd-service-type - home-network-manager-applet-shepherd-service) - (service-extension home-wayland-display-service-type - (const #f)))))) - -(define-configuration/no-serialization home-blueman-applet-configuration - (blueman (file-like blueman) "Blueman package to use, with blueman-applet binary.") - (blueman-in-profile? (boolean #t) "Whether to add blueman to profile. -This is required for the applet to work properly, -ie. to get manager running when applet is clicked on.") - (extra-arguments (list-of-strings '()) "Extra arguments to blueman-applet daemon command.")) - -(define (home-blueman-applet-shepherd-service config) - (list - (shepherd-service - (documentation "Blueman applet daemon") - (requirement '(wayland-display)) - (provision '(blueman-applet)) - (start #~(make-forkexec-constructor - (cons* #$(file-append - (home-blueman-applet-configuration-blueman config) - "/bin/blueman-applet") - '#$(home-blueman-applet-configuration-extra-arguments config)))) - (stop #~(make-kill-destructor))))) - -(define (home-blueman-applet-profile config) - (if (home-blueman-applet-configuration-blueman-in-profile? config) - (list blueman) - '())) - -(define-public home-blueman-applet-service-type - (service-type - (name 'home-blueman-applet) - (description "A service to start blueman-applet daemon") - (default-value (home-blueman-applet-configuration)) - (extensions - (list (service-extension home-shepherd-service-type - home-blueman-applet-shepherd-service) - (service-extension home-profile-service-type - home-blueman-applet-profile) - (service-extension home-wayland-display-service-type - (const #f)))))) - -(define-configuration/no-serialization home-waybar-configuration - (waybar (file-like waybar) "Waybar package to use, with waybar binary.") - (extra-arguments (list-of-strings '()) "Extra arguments to waybar daemon command.")) - -(define (home-waybar-shepherd-service config) - (list - (shepherd-service - (documentation "Waybar daemon") - (requirement '(wayland-display)) - (provision '(waybar)) - (start #~(make-forkexec-constructor - (cons* #$(file-append - (home-waybar-configuration-waybar config) - "/bin/waybar") - '#$(home-waybar-configuration-extra-arguments config)))) - (stop #~(make-kill-destructor))))) - -(define-public home-waybar-service-type - (service-type - (name 'home-waybar) - (description "A service to start waybar daemon") - (default-value (home-waybar-configuration)) - (extensions - (list (service-extension home-shepherd-service-type - home-waybar-shepherd-service) - (service-extension home-wayland-display-service-type - (const #f)))))) - -;; TODO configuration -(define-configuration/no-serialization home-gammastep-configuration - (gammastep (file-like gammastep) "Gammastep package to use, with gammastep binary.") - (extra-arguments (list-of-strings '()) "Extra arguments to gammastep daemon command.")) - -(define (home-gammastep-shepherd-service config) - (list - (shepherd-service - (documentation "Gammastep daemon") - (requirement '(wayland-display)) - (provision '(gammastep)) - (start #~(make-forkexec-constructor - (cons* #$(file-append - (home-gammastep-configuration-gammastep config) - "/bin/gammastep") - '#$(home-gammastep-configuration-extra-arguments config)))) - (stop #~(make-kill-destructor))))) - -(define-public home-gammastep-service-type - (service-type - (name 'home-gammastep) - (description "A service to start gammastep daemon") - (default-value (home-gammastep-configuration)) - (extensions - (list (service-extension home-shepherd-service-type - home-gammastep-shepherd-service) - (service-extension home-wayland-display-service-type - (const #f)))))) diff --git a/home/modules/ruther/home/services/xdg-desktop-portals.scm b/home/modules/ruther/home/services/xdg-desktop-portals.scm deleted file mode 100644 index 1ec20e5..0000000 --- a/home/modules/ruther/home/services/xdg-desktop-portals.scm +++ /dev/null @@ -1,74 +0,0 @@ -(define-module (ruther home services xdg-desktop-portals) - #:use-module (srfi srfi-1) - - #:use-module (guix gexp) - #:use-module (guix packages) - #:use-module (guix build-system copy) - - #:use-module (rde serializers ini) - #:use-module (gnu services) - #:use-module (gnu home services) - #:use-module (gnu packages freedesktop) - #:use-module (gnu services configuration) - - #:export (xdg-desktop-portals-conf - xdg-desktop-portal-configuration)) - -(define-configuration/no-serialization xdg-desktop-portals-conf - (name string "Name of the portals configuration, like sway. -Set your XDG_CURRENT_DESKTOP to this name to use this config") - (config ini-config "Configuration for the given x-portals.conf.")) - -(define (list-of-xdg-portals-conf? lst) - (every xdg-desktop-portals-conf? lst)) - -(define (list-of-file-like? lst) - (every file-like? lst)) - -(define-configuration/no-serialization xdg-desktop-portal-configuration - (xdg-desktop-portal (file-like xdg-desktop-portal) "The xdg-desktop-portal to add to the home profile.") - (implementations list-of-file-like "The implementations of xdg-desktop-portal interfaces to add to the home profile.") - (configs - list-of-xdg-portals-conf - "Configurations to provide for xdg portals.confs")) - -(define (xdg-desktop-portals-conf-files config) - (computed-file - "union-of-portals.conf" - (with-imported-modules '((guix build utils)) - #~(begin - (use-modules (guix build utils)) - (mkdir-p (string-append #$output "/share/xdg-desktop-portal")) - (for-each - (lambda (portals-conf) - (call-with-output-file (string-append - #$output - "/share/xdg-desktop-portal/" - (car portals-conf) "-portals.conf") - (lambda (port) - (display (apply string-append (cdr portals-conf)) port)))) - '#$(map - (lambda (x) (cons (xdg-desktop-portals-conf-name x) - (serialize-ini-config (xdg-desktop-portals-conf-config x) - #:equal-string "="))) - (xdg-desktop-portal-configuration-configs config))))))) - -(define (add-xdg-desktop-portals-packages config) - (cons* (xdg-desktop-portal-configuration-xdg-desktop-portal config) - (package - (name "union-of-portals.conf") - (version "0.0.0") - (source (xdg-desktop-portals-conf-files config)) - (build-system copy-build-system) - (synopsis "Union of portals.conf files") - (description "Union of portals.conf files") - (license #f) - (home-page #f)) - (xdg-desktop-portal-configuration-implementations config))) - -(define-public home-xdg-desktop-portal-service-type - (service-type - (name 'xdg-desktop-portal-service) - (description "A service to provide xdg-desktop-portal config files, and add implementations to the home profile.") - (extensions (list (service-extension home-profile-service-type - add-xdg-desktop-portals-packages))))) diff --git a/home/modules/ruther/home/themes.scm b/home/modules/ruther/home/themes.scm deleted file mode 100644 index e09d0f8..0000000 --- a/home/modules/ruther/home/themes.scm +++ /dev/null @@ -1,136 +0,0 @@ -(define-module (ruther home themes) - #:use-module ((guix licenses) #:prefix license:) - #:use-module (gnu packages) - #:use-module (gnu packages gnome) - #:use-module (gnu packages web) - #:use-module (gnu packages inkscape) - #:use-module (gnu packages xorg) - #:use-module (guix packages) - #:use-module (guix utils) - #:use-module (guix build utils) - #:use-module (guix gexp) - #:use-module (guix build-system gnu) - #:use-module (guix download) - #:use-module (guix git-download) - - #:export (make-graphite-gtk-theme - make-tela-circle-icon-theme - make-catppuccin-cursors)) - -(define* (make-graphite-gtk-theme #:key - theme - (color "standard") - (size "standard")) - (package - (name (string-append "graphite-" theme "-" color "-" size "-theme")) - (version "2024-07-15") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/vinceliuice/Graphite-gtk-theme") - (commit version))) - (sha256 - (base32 "1fmbfyf5j9mi31r84x8vb1z82jfg9cqcg27q7n579l65n3zybpck")))) - (build-system gnu-build-system) - (inputs - (list gnome-themes-extra)) - (native-inputs - (list sassc)) - (properties - `((theme-name . ,(string-append "Graphite-" theme "-" (string-titlecase color))))) - (arguments - `(#:phases (modify-phases %standard-phases - (delete 'configure) - (delete 'build) - (delete 'check) - (replace 'install - (lambda* (#:key inputs outputs #:allow-other-keys) - (invoke - "bash" - "install.sh" - "-t" ,theme - "-c" ,color - "-d" (string-append (assoc-ref %outputs "out") "/share/themes"))))))) - (synopsis "Graphite gtk theme") - (description "Graphite gtk theme") - (home-page "https://github.com/vinceliuice/Graphite-gtk-theme") - (license license:gpl3))) - -(define* (make-tela-circle-icon-theme #:key (variant "standard")) - (package - (name (string-append "tela-circle-" variant "-icon-theme")) - (version "2024-04-19") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/vinceliuice/Tela-circle-icon-theme") - (commit version))) - (sha256 - (base32 "1w7m6wqc205y5v3lrwd2a27df0hfhp3xv4sgz12kv5qih2g2dldy")) - (snippet - #~(begin (use-modules (guix build utils)) - (substitute* "install.sh" - (("gtk-update-icon-cache.*") "")))))) - (build-system gnu-build-system) - (inputs - (list gnome-themes-extra)) - (properties - `((icon-theme-name . ,(string-append "Tela-circle-" variant)) - (dark-icon-theme-name . ,(string-append "Tela-circle-" variant "-dark")) - (light-icon-theme-name . ,(string-append "Tela-circle-" variant "-light")))) - (arguments - `(#:phases (modify-phases %standard-phases - (delete 'configure) - (delete 'build) - (delete 'check) - (replace 'install - (lambda* (#:key inputs outputs #:allow-other-keys) - (invoke - "bash" - "install.sh" - "-c" ,variant - "-d" (string-append (assoc-ref %outputs "out") "/share/icons"))))))) - (synopsis "Tela icon theme") - (description "Tela icon theme") - (home-page "https://github.com/vinceliuice/Tela-circle-icon-theme") - (license #f))) - -(define* (make-catppuccin-cursors #:key flavor accent) - (package - (name (string-append "cattpuccin-cursors-" flavor "-" accent)) - (version "0.3.1") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/catppuccin/cursors") - (commit (string-append "v" version)))) - (sha256 - (base32 "0pb393jlsrjfz8jhrgydhmv4hygf5wjs5jbc5m5628nixzlc7v0a")))) - (build-system gnu-build-system) - (native-inputs - (list inkscape xcursorgen)) - (properties - `((cursor-theme-name . ,(string-append "catppuccin-" flavor "-" accent "-cursors")))) - (arguments - `(#:phases (modify-phases %standard-phases - (delete 'configure) - (delete 'check) - (replace 'build - (lambda* _ - (invoke - "bash" - "build" - "-f" ,flavor - "-a" ,accent))) - (replace 'install - (lambda* _ - (copy-recursively - "dist" - (string-append (assoc-ref %outputs "out") "/share/icons"))))))) - (synopsis "Catppuccin cursors") - (description "Catppuccin cursors") - (home-page "https://github.com/catppuccin/cursors/tree/main") - (license license:gpl2))) -- 2.48.1