summaryrefslogtreecommitdiffstats
path: root/guix/jd/home/services/desktop.scm
blob: 32c805957315c32cf3e3c1e2a533d518900d0be4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
(define-module (jd home services desktop)
  #:use-module (gnu packages)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages networking)
  #:use-module (gnu packages syncthing)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages gnupg)
  #:use-module (gnu services)
  #:use-module (gnu services configuration)
  #:use-module (gnu home services)
  #:use-module (gnu home services shepherd)
  #:use-module (gnu home services desktop)
  #:use-module (gnu home services sound)
  #:use-module (gnu home services xdg)
  #:use-module (gnu home services gnupg)
  #:use-module (guix gexp)

  #:use-module (jd packages fonts))

(define (desktop-profile-service config)
  (append
   (list font-terminus-ttf)
   (specifications->packages '("sway"
			       ;; "swayfx"
			       "swaylock"
			       "swayidle"
			       "swaynotificationcenter"
			       "waybar"
			       "fuzzel"
			       "foot"
			       "mako"
			       "wl-clipboard"
			       "wlsunset"
			       "grimshot"
			       "swappy"
			      
			       "udiskie"
			       ;; rest
			       "qutebrowser"
			       "ungoogled-chromium"
			       "firefox"
			       "tor-client"
			       "signal-desktop"

			       "pulsemixer"
			       "pavucontrol"
			       "alsa-utils"

			       "virt-manager"

			       "flatpak"
			       "redshift"
			       "fontmanager"

			       "polybar"

			       "blueman"

			       "nomacs"

			       "xdg-utils"
			       "xdg-dbus-proxy"
			       "xdg-desktop-portal-gtk"
			       "xdg-desktop-portal-wlr"
			       "glib:bin"
			       "gtk+:bin"
			       "gnome-keyring"
			       "shared-mime-info"
			       "libnotify"
			       "dconf"
			       "hicolor-icon-theme"

			       "dunst"

			       ; "gimp"
			       ; "inkscape"

			       "mpv"
			       "youtube-dl"

			       "pamixer"
			       "playerctl"
			       "scrot"
			       "brightnessctl"
			       "upower"
			       "tlp"
			       "feh"
			       "alacritty"

			       "curl"
			       "wget"
			       "zip"
			       "unzip"
			       "qrencode"
			       "trash-cli"
			       "pandoc"
			       "password-store"
			       "oath-toolkit"
			       ;; "pinentry"

			       "syncthing"
			       "syncthing-gtk"

			       "xmodmap"
			       "xrandr"
			       "arandr"
			       "xss-lock"
			       "libinput"
			       "xinput"
			       "xprop"
			       "rlwrap"

			       "nheko"
			       "quassel"
			       "inkscape"
			       "gimp"
			       "libreoffice"
			       "steam"))))

(define (desktop-environment-variables-service config)
  `(("GTK_THEME" . "Adwaita:dark")
    ("VISUAL" . "emacsclient")
    ("EDITOR" . "emacsclient")
    ("PATH" . "$HOME/.bin:$HOME/.npm-global/bin:$PATH")
    ("XDG_DATA_DIRS" . "$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share")
    ("SBCL_HOME" . "/run/current-system/profile/lib/sbcl/")

    ;; Set Wayland-specific environment variables (taken from RDE)
    ("XDG_CURRENT_DESKTOP" . "sway")
    ("XDG_SESSION_TYPE" . "wayland")
    ("RTC_USE_PIPEWIRE" . "true")
    ("SDL_VIDEODRIVER" . "wayland")
    ("MOZ_ENABLE_WAYLAND" . "1")
    ("CLUTTER_BACKEND" . "wayland")
    ("ELM_ENGINE" . "wayland_egl")
    ("ECORE_EVAS_ENGINE" . "wayland-egl")
    ("QT_QPA_PLATFORM" . "wayland-egl"))) ;; QT_QPA_PLATFORM=xcb

(define (desktop-xdg-mime-applications-service config)
  (home-xdg-mime-applications-configuration
   (default '((inode/directory . emacsclient.desktop)
	      (application/pdf . emacsclient.desktop)
	      (x-scheme-handler/http= . firefox.desktop)
	      (x-scheme-handler/https= . firefox.desktop)))
   ;; (desktop-entries
   ;;  (list (xdg-desktop-entry
   ;; 	     (file "emacs-desktop")
   ;; 	     (name "Emacs")
   ;; 	     (type 'application)
   ;; 	     (config
   ;; 	      '((exec . "emacsclient -a emacs %u"))))))
   ))

(define (desktop-gpg-agent-service config)
  (home-gpg-agent-configuration
   (pinentry-program
    (file-append pinentry-gnome3 "/bin/pinentry-gnome3"))
   (ssh-support? #t)
   (default-cache-ttl 28800)
   (max-cache-ttl 28800)
   (default-cache-ttl-ssh 28800)
   (max-cache-ttl-ssh 28800)))


(define-public home-desktop-service-type
  (service-type (name 'home-desktop)
                (extensions (list (service-extension home-profile-service-type
						     desktop-profile-service)
				  (service-extension home-environment-variables-service-type
          					     desktop-environment-variables-service)
				  (service-extension home-pipewire-service-type
						     (lambda (_) (home-pipewire-configuration)))
				  (service-extension home-xdg-mime-applications-service-type
					 	     desktop-xdg-mime-applications-service)
				  (service-extension home-gpg-agent-service-type
						     desktop-gpg-agent-service)
				  ))
                (default-value #f)
                (description "Runs desktop services.")))