From ef0f469a9a28ecfa7506584643545f4e21adfa12 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Fri, 23 Aug 2024 20:29:36 +0200 Subject: [PATCH] feat: add waybar, nm-applet, blueman-applet, gammastep, emacs services --- home/home-configuration.scm | 16 +- home/modules/ruther/home/dwl/scripts.scm | 5 - home/modules/ruther/home/services/kanshi.scm | 12 +- home/modules/ruther/home/services/wayland.scm | 139 +++++++++++++++++- 4 files changed, 155 insertions(+), 17 deletions(-) diff --git a/home/home-configuration.scm b/home/home-configuration.scm index 0e14fd2..6428fcf 100644 --- a/home/home-configuration.scm +++ b/home/home-configuration.scm @@ -9,6 +9,7 @@ (gnu home) (gnu packages) (gnu packages gnupg) + (gnu packages emacs) (gnu packages shellutils) (gnu services) (gnu home services fontutils) @@ -35,8 +36,7 @@ (specifications->packages (list ;; HW interactions - "blueman" "pavucontrol" - "network-manager-applet" + "pavucontrol" ;; Terminals, utilities "foot" "fbset" @@ -196,7 +196,17 @@ (service home-wayland-display-service-type) (service home-wlr-services-service-type - '(kanshi)) + '(waybar kanshi emacs gammastep + blueman-applet network-manager-applet)) + (service home-waybar-service-type + (home-waybar-configuration + (waybar waybar-mine))) + (service home-emacs-service-type + (home-emacs-configuration + (emacs emacs-pgtk))) + (service home-blueman-applet-service-type) + (service home-network-manager-applet-service-type) + (service home-gammastep-service-type) (service home-kanshi-service-type (home-kanshi-configuration (config (kanshi-configuration diff --git a/home/modules/ruther/home/dwl/scripts.scm b/home/modules/ruther/home/dwl/scripts.scm index a145a11..b3d1953 100644 --- a/home/modules/ruther/home/dwl/scripts.scm +++ b/home/modules/ruther/home/dwl/scripts.scm @@ -193,11 +193,6 @@ "WAYLAND_DISPLAY" "XDG_CURRENT_DESKTOP" "DISPLAY")) - (spawn (string-append #$network-manager-applet "/bin/nm-applet") '("nm-applet")) - (spawn (string-append #$gammastep "/bin/gammastep") '("gammastep")) - (spawn (string-append #$blueman "/bin/blueman-applet") '("blueman-applet")) - (spawn (string-append #$emacs-pgtk "/bin/emacs") '("emacs" "--daemon")) - (spawn (string-append #$waybar "/bin/waybar") '("waybar")) ; TODO: make a "target" instead, to start. ; TODO: maybe shepherd should be taken out of its service? diff --git a/home/modules/ruther/home/services/kanshi.scm b/home/modules/ruther/home/services/kanshi.scm index 6e0c1b2..40dae2e 100644 --- a/home/modules/ruther/home/services/kanshi.scm +++ b/home/modules/ruther/home/services/kanshi.scm @@ -122,19 +122,15 @@ (start #~(make-forkexec-constructor (list #$(file-append (home-kanshi-configuration-kanshi config) - "/bin/kanshi")))) + "/bin/kanshi") + "-c" + #$(serialize-kanshi-configuration (home-kanshi-configuration-config config))))) (stop #~(make-kill-destructor))))) -(define (add-home-kanshi-config-file config) - `((".config/kanshi/config" - ,(serialize-kanshi-configuration (home-kanshi-configuration-config config))))) - (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-files-service-type - add-home-kanshi-config-file))))) + home-kanshi-shepherd-services))))) diff --git a/home/modules/ruther/home/services/wayland.scm b/home/modules/ruther/home/services/wayland.scm index ed85232..1400485 100644 --- a/home/modules/ruther/home/services/wayland.scm +++ b/home/modules/ruther/home/services/wayland.scm @@ -1,13 +1,23 @@ (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)) + #: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 @@ -80,3 +90,130 @@ This should be called from a wayland compositor like this: `herd start wayland-d (extensions (list (service-extension home-shepherd-service-type wlr-services-shepherd-service))))) + +(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))))))) + +(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))))) + +(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))))))) + +(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))))) + +(define-configuration/no-serialization home-blueman-applet-configuration + (blueman (file-like blueman) "Blueman package to use, with blueman-applet binary.") + (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))))))) + +(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))))) + +(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))))))) + +(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))))) + +;; 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))))))) + +(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))))) -- 2.48.1