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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
;; This is a sample Guix Home configuration which can help setup your
;; home directory in the same declarative manner as Guix System.
;; For more information, see the Home Configuration section of the manual.
(define-module (guix-home-config)
#:use-module (gnu home)
#:use-module (gnu home services)
#:use-module (gnu home services shells)
#:use-module (gnu services)
#:use-module (gnu system shadow)
#:use-module (gnu packages)
#:use-module (gnu home services gnupg)
#:use-module (gnu packages gnupg)
#:use-module (guix gexp)
#:use-module (guix sets)
#:use-module (gnu home services sway)
#:use-module (gnu packages wm)
#:use-module (gnu home services sound)
#:use-module (gnu services dbus)
#:use-module (gnu system keyboard)
#:use-module (gnu home services guix)
#:use-module (guix channels)
#:use-module (gnu packages glib)
#:use-module (gnu packages terminals)
#:use-module (gnu packages xdisorg)
#:use-module (gnu home services desktop)
#:use-module (gnu home services ssh)
#:use-module (gnu home services dotfiles))
(define home-config
(home-environment
(packages
(append
(map specification->package
'("xorg-server-xwayland"
"font-google-noto"
"font-google-noto-emoji"
"font-sarasa-gothic"
"font-ibm-plex"
"flatpak"
"xdg-desktop-portal"
"xdg-desktop-portal-gtk"
"xdg-desktop-portal-wlr"
"xdg-utils" ;; For "xdg-open, etc
"xdg-dbus-proxy"
"shared-mime-info"
"xorg-server-xwayland"
"qtwayland@5"
"adwaita-icon-theme"
"hicolor-icon-theme"
"icecat"
"fuzzel"
"wl-clipboard"
"mako"
"foot"
"network-manager-applet"
"password-store"
"pass-otp"
"passff-host"
"mpv"
"mpv-mpris"
"yt-dlp"
"playerctl"
"gstreamer"
"gst-plugins-base"
"gst-plugins-good"
"gst-plugins-bad"
"gst-plugins-ugly"
"gst-libav"
"alsa-utils"
"pavucontrol"
"crawl"
"gimp"
"zathura"
"zathura-pdf-mupdf"
"ghostscript"
"syncthing-gtk"
"emacs-pgtk"
"emacs-guix"
"emacs-rainbow-delimiters"
"emacs-pinentry"
"emacs-pass"
"emacs-bluetooth"
"emacs-enwc"
"emacs-emms"
"emacs-compile-angel"
"emacs-htmlize"
"emacs-markdown-mode"
"emacs-nix-mode"
"emacs-yaml-mode"
"lowdown"
"book-sicp"
"pinentry-fuzzel"
"btop"
))))
(services
(append
(list
(service home-bash-service-type)
(simple-service 'custom-bash-service
home-bash-service-type
(home-bash-extension
(bash-profile
`(,(local-file "/home/mitch/.guix-home/profile/etc/profile.d/flatpak.sh")
,(plain-file "bash-sway-login"
(string-append
"if [ -z \"$WAYLAND_DISPLAY\" ] && [ \"$XDG_VTNR\" -eq 1 ]; then\n"
" exec dbus-run-session -- sway\n"
"fi\n"))))))
(service home-dotfiles-service-type
(home-dotfiles-configuration
(layout 'stow)
(directories '("./files"))))
(service home-gpg-agent-service-type
(home-gpg-agent-configuration
(pinentry-program
(file-append pinentry-fuzzel "/bin/pinentry-fuzzel"))
(default-cache-ttl 28800)
(max-cache-ttl 28800)))
(service home-ssh-agent-service-type)
(service home-openssh-service-type
(home-openssh-configuration
(add-keys-to-agent "yes")))
(service home-files-service-type
`((".guile" ,%default-dotguile)
(".Xdefaults" ,%default-xdefaults)))
(service home-dbus-service-type)
(service home-pipewire-service-type)
(service home-xdg-configuration-files-service-type
`(("gdb/gdbinit" ,%default-gdbinit)
("nano/nanorc" ,%default-nanorc)))
(simple-service 'extra-packages-service
home-channels-service-type
(list
(channel
(name 'nonguix)
(url "https://gitlab.com/nonguix/nonguix")
(branch "master")
(introduction
(make-channel-introduction
"897c1a470da759236cc11798f4e0a5f7d4d59fbc"
(openpgp-fingerprint
"2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))
(channel
(name 'mitch)
(url
"git://git.omnifarious.net/channel.git"))))
(simple-service 'profile-env-vars-service
home-environment-variables-service-type
'( ;; Sort hidden (dot) files first in `ls` listings
("LC_COLLATE" . "C")
;; Emacs is our editor
("VISUAL" . "emacsclient")
("EDITOR" . "emacsclient")
;; 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")))
(service home-sway-service-type
(sway-configuration
(inputs
(list (sway-input
(identifier "type:keyboard")
(layout (keyboard-layout "us" "dvorak"
#:options '("ctrl:nocaps"))))
(sway-input
(identifier "type:touchpad")
(tap #t)
(disable-while-typing #t)
(extra-content '("middle_emulation enabled"
"tap enabled"
"dwt enabled"
"natural_scroll enabled")))))
(variables `((mod . "Mod4") ; string
(term ; file-append
. ,(file-append foot "/bin/foot"))
(menu
. ,(file-append fuzzel "/bin/fuzzel"))
(up . "p")
(down . "n")
(left . "b")
(right . "f")))
(gestures
'((swipe:3:left . "workspace prev")
(swipe:3:right . "workspace next")))
(startup-programs
`("emacs"
"flatpak run com.github.wwmm.easyeffects --service-mode"
"dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway"
,#~(string-append
#$swayidle "/bin/swayidle -w \\\n "
;; 300: lock screen.
"timeout 300 '" #$swaylock "/bin/swaylock "
"--indicator-radius 75 \\\n "
"-i /home/mitch/Pictures/Backgrounds/lain-dining-room.jpg \\\n "
"-f -c 000000' \\\n "
;; 600: lock + screen off.
"timeout 600 '" #$sway "/bin/swaymsg \"output * power off\"' \\\n "
;; Resume + sleep.
"resume '" #$sway "/bin/swaymsg \"output * power on\"' \\\n "
"before-sleep '" #$swaylock "/bin/swaylock -f -c 000000'")))
(keybindings
`(($mod+return . "exec $term")
($mod+grave . "exec $menu")
(XF86AudioMute . "exec pactl set-sink-mute @DEFAULT_SINK@ toggle")
(XF86AudioLowerVolume . "exec pactl set-sink-volume @DEFAULT_SINK@ -5%")
(XF86AudioRaiseVolume . "exec pactl set-sink-volume @DEFAULT_SINK@ +5%")
(XF86AudioPlay . "exec playerctl play-pause")
(XF86AudioNext . "exec playerctl next")
(XF86AudioPrev . "exec playerctl previous")
(XF86MonBrightnessDown . "exec brightnessctl set 10%-")
(XF86MonBrightnessUp . "exec brightnessctl set 10%+")
($mod+apostrophe . "kill")
($mod+Shift+e . "exit")
($mod+Shift+c . "reload")
($mod+$left . "focus left")
($mod+$down . "focus down")
($mod+$up . "focus up")
($mod+$right . "focus right")
($mod+Left . "focus left")
($mod+Down . "focus down")
($mod+Up . "focus up")
($mod+Right . "focus right")
($mod+Shift+$left . "move left")
($mod+Shift+$down . "move down")
($mod+Shift+$up . "move up")
($mod+Shift+$right . "move right")
($mod+Shift+Left . "move left")
($mod+Shift+Down . "move down")
($mod+Shift+Up . "move up")
($mod+Shift+Right . "move right")
($mod+1 . "workspace number 1")
($mod+2 . "workspace number 2")
($mod+3 . "workspace number 3")
($mod+4 . "workspace number 4")
($mod+5 . "workspace number 5")
($mod+6 . "workspace number 6")
($mod+7 . "workspace number 7")
($mod+8 . "workspace number 8")
($mod+9 . "workspace number 9")
($mod+0 . "workspace number 10")
($mod+Shift+1 . "move container to workspace number 1")
($mod+Shift+2 . "move container to workspace number 2")
($mod+Shift+3 . "move container to workspace number 3")
($mod+Shift+4 . "move container to workspace number 4")
($mod+Shift+5 . "move container to workspace number 5")
($mod+Shift+6 . "move container to workspace number 6")
($mod+Shift+7 . "move container to workspace number 7")
($mod+Shift+8 . "move container to workspace number 8")
($mod+Shift+9 . "move container to workspace number 9")
($mod+Shift+0 . "move container to workspace number 10")
($mod+w . "layout tabbed")
($mod+e . "layout toggle split")
($mod+F11 . "fullscreen")
($mod+Shift+space . "floating toggle")))
(bar
(sway-bar
(position 'top)
(hidden-state 'hide)
(status-command
(program-file
"sway-bar-status"
#~(begin
(use-modules (ice-9 format)
(srfi srfi-19))
(let loop ()
(let* ((date (date->string
(current-date)
"~d/~m/~Y (~a) • ~H:~M:~S"))
(percent (read (open-input-file "/sys/class/power_supply/BAT1/capacity"))))
(close-port (open-input-file "/sys/class/power_supply/BAT1/capacity"))
(format #t "~a~%~!"
(string-concatenate
(list date
" | "
(number->string percent)
"%")))
(sleep 1)
(loop))))))))
(outputs
(list (sway-output
(identifier '*)
(background "/home/mitch/Pictures/Backgrounds/lain-dining-room.jpg"))
(sway-output
(identifier 'eDP-1))))
(extra-content
'("for_window [title=\".* - mpv$\"] floating enable, sticky enable, inhibit_idle fullscreen"
"for_window [app_id=\"Icecat\"] inhibit_idle fullscreen"
"for_window [app_id=\"org.jellyfin.JellyfinDesktop\"] inhibit_idle fullscreen"
"floating_modifier $mod")))))
%base-home-services))))
home-config
|