# home.scm -rw-r--r-- 6.0 KiB View raw
                                                                                
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
;; SPDX-License-Identifier: GPL-3.0-only

(use-modules
  (gnu home)
  (gnu home services)
  (gnu home services shells)
  (gnu packages)
  (gnu packages admin)
  (gnu packages bootloaders)
  (gnu packages build-tools)
  (gnu packages cpp)
  (gnu packages compression)
  (gnu packages fonts)
  (gnu packages freedesktop)
  (gnu packages game-development)
  (gnu packages games)
  (gnu packages gnome)
  (gnu packages gnupg)
  (gnu packages guile)
  (gnu packages image)
  (gnu packages image-viewers)
  (gnu packages linux)
  (gnu packages lisp)
  (gnu packages llvm)
  (gnu packages lua)
  (gnu packages man)
  (gnu packages minetest)
  (gnu packages moreutils)
  (gnu packages ncurses)
  (gnu packages ocaml)
  (gnu packages patchutils)
  (gnu packages password-utils)
  (gnu packages pdf)
  (gnu packages pulseaudio)
  (gnu packages pv)
  (gnu packages python)
  (gnu packages python-xyz)
  (gnu packages qt)
  (gnu packages rust-apps)
  (gnu packages shells)
  (gnu packages ssh)
  (gnu packages terminals)
  (gnu packages texinfo)
  (gnu packages text-editors)
  (gnu packages version-control)
  (gnu packages video)
  (gnu packages web-browsers)
  (gnu packages vim)
  (gnu packages web-browsers)
  (gnu packages wm)
  (gnu packages xdisorg)
  (gnu services)
  (guixrus packages aerc)
  (guixrus packages common python)
  (guixrus packages hut)
  (guixrus packages i3-autotiling)
  (guixrus packages senpai)
  (guixrus packages vim)
  (guix build-system copy)
  (guix build-system python)
  (guix download)
  (guix gexp)
  (guix git-download)
  ((guix licenses) #:prefix license:)
  (guix packages)
  (guix utils)
  (ice-9 format)
  (ice-9 match)
  (ice-9 popen)
  (ice-9 textual-ports))

(define %conf-dir
  (dirname (current-filename)))

(define* (path-join #:rest args)
  (string-join args "/"))

(define (config-file file)
  (local-file (path-join %conf-dir file)))

(define %packages
  (list aerc
        alsa-utils
        bemenu
        ccls
        clang-13
        colordiff
        efibootmgr ; for recovery purposes
        fish
        font-google-noto
        font-jetbrains-mono
        foot
        git
        (list git "send-email")
        gnupg
        grim
        grub-efi ; for recovery purposes
        guile-3.0
        hut
        i3-autotiling
        imv
        janet
        libnotify
        linux-libre-headers-5.17
        mako
        man-pages
        minetest
        moreutils
        mpv
        ncurses
        neovim
        neovim-autopairs
        neovim-autosave
        neovim-cmp
        neovim-cmp-lsp
        neovim-lspconfig
        neovim-lspsaga
        neovim-luasnip
        openssh
        pamixer
        password-store
        pinentry
        pv
        python
        python-pynvim
        qtwayland
        qutebrowser
        ripgrep
        senpai
        slurp
        smartmontools
        supertuxkart
        swayidle
        telescope
        util-linux
        vim-editorconfig-for-neovim
        vim-gas-for-neovim
        vim-hare-for-neovim
        vim-janet-for-neovim
        vim-markdown-for-neovim
        vim-paredit-for-neovim
        vim-riscv-for-neovim
        vim-solarized8-for-neovim
        waybar
        wl-clipboard
        xdg-utils
        zathura
        zathura-pdf-mupdf
        zip
        zoxide
        zstd))

(define %env-vars
  '(("EDITOR"              . "nvim")
    ("VISUAL"              . "nvim")
    ("GPG_TTY"             . "(tty)")
    ("CC"                  . "gcc")
    ("QT_QPA_PLATFORM"     . "wayland")
    ("XDG_SESSION_TYPE"    . "wayland")
    ("XDG_SESSION_DESKTOP" . "sway")
    ("XDG_CURRENT_DESKTOP" . "sway")
    ("DESKTOP_SESSION"     . "sway")
    ("LIBSEAT_BACKEND"     . "seatd")))

(define (normalize-filesystem-pair pair)
  (match pair
    ((input . output)
     (list output (if (string? input)
                    (config-file input)
                    input)))
     (output (list output (config-file (basename output))))))

(define %neovim-config
  (mixed-text-file "nvim.lua"
    #~(begin
       (use-modules (ice-9 popen)
                    (ice-9 textual-ports))
       (let* ((pipe (open-input-pipe
                     (string-append #$(file-append fennel "/bin/fennel")
                                    " --compile " #$(config-file "nvim.fnl"))))
              (output (get-string-all pipe)))
         (close-pipe pipe)
         (call-with-output-file #$output
	   (lambda (file)
	     (display output file)))))))

(define %config-files
  (map normalize-filesystem-pair
       `("aerc/aerc.conf"
         ("aerc-binds.conf" . "aerc/binds.conf")
         "fish/conf.d/hashrepo.fish"
         "fish/conf.d/vi-bindings.fish"
         "fish/conf.d/zoxide.fish"
         "fish/conf.d/colourscheme.fish"
         "fish/conf.d/prompt.fish"
         "foot/foot.ini"
         "guix/channels.scm"
         (,%neovim-config . "nvim/init.lua")
         "senpai/senpai.scfg"
         ("sway.conf" . "sway/config")
         ("waybar.json" . "waybar/config")
         ("waybar.css" . "waybar/style.css"))))

(define %home-files
  (map normalize-filesystem-pair
       '(".gnupg/gpg-agent.conf"
         ("gitconfig" . ".gitconfig"))))

(define %services
  (list (service home-files-service-type %home-files)
        (service home-xdg-configuration-files-service-type %config-files)
        (service home-fish-service-type
                 (home-fish-configuration
                  (environment-variables %env-vars)))))

(home-environment
  (services %services)
  (packages (map (lambda (pkg)
                   (if (list? pkg)
                     pkg
                     (list pkg "out")))
                 %packages)))

;;; Backtrace:
;;;            3 (primitive-load "/gnu/store/zb5wpl6a65cjajblan3wx78ywzv?")
;;; In ice-9/ports.scm:
;;;    433:17  2 (call-with-output-file _ _ #:binary _ #:encoding _)
;;; In ice-9/eval.scm:
;;;     159:9  1 (_ #(#(#<directory (guile-user) 7ffff3fd7c80>) #<outp?>))
;;; In unknown file:
;;;            0 (string-append #<unspecified>)
;;;
;;; ERROR: In procedure string-append:
;;; In procedure string-append: Wrong type (expecting string): #<unspecified>