summaryrefslogtreecommitdiff
path: root/.config/guix/modules/base.scm
blob: 704f0ecedb353582d0bfea41677230ee0d577dca (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
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Provides a set of my preferred ;;
;; programs and services for any  ;;
;; system                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(define-module (modules base)
  #:use-module (gnu)
  #:use-module (gnu home services)
  #:use-module (gnu home services dict)
  #:use-module (gnu home services gnupg)
  #:use-module (gnu home services mcron)
  #:use-module (gnu home services shells)
  #:use-module (gnu home services shepherd)
  #:use-module (gnu home services ssh)
  #:use-module (gnu home services xdg)
  #:use-module (gnu system)
  #:use-module (guix gexp)
  #:use-module (modules emacs)
  #:export (bd-base-system-packages
            bd-base-system-services
            bd-base-home-services))

(use-service-modules admin avahi base
                     dbus desktop file-sharing
                     networking ssh)

(use-package-modules
 admin ;; netcat
 bittorrent ;; transmission
 compression ;; unzip
 cryptsetup ;; cryptsetup
 curl ;; curl
 databases ;; recutils
 fonts ;; font-terminus, font-openmoji
 fontutils ;; fontconfig
 gimp ;; gimp-next
 gnupg ;; gnupg, pinentry, pinentry-emacs
 gnuzilla ;; icecat
 image ;; flameshot
 imagemagick ;; imagemagick
 mail ;; offlineimap
 package-management ;; stow
 password-utils ;; pass-otp, password-store
 pdf ;; xpdf
 rsync ;; rsync
 texlive ;; texlive
 version-control ;; git
 video ;; ffmpeg, mpv
 video ;; yt-dlp
 vim ;; vim
 web ;; jq
 )


(define base
  (list
   gnupg
   offlineimap3
   pass-otp
   password-store
   pinentry-emacs
   transmission
   xpdf                                 ; pdftotext
   yt-dlp

   cryptsetup
   curl
   git
   jq
   netcat
   recutils
   rsync
   stow
   texlive
   unzip
   vim
   ))

(define desk
  (list
   ffmpeg
   flameshot
   fontconfig
   font-openmoji
   font-terminus
   gimp-next
   icecat
   imagemagick
   mpv
   ))

(define bd-base-system-packages
  (append!
   base
   desk
   %base-packages
   ))

(define bd-base-system-services
  `(
    ;; so that non-root users in the wheel group can
    ;; perform administrative tasks (similar to "sudo").
    ,polkit-wheel-service
    ;; The global fontconfig cache directory can sometimes contain
    ;; stale entries, possibly referencing fonts that have been GC'd,
    ;; so mount it read-only.
    ,fontconfig-file-system-service

    ,(service network-manager-service-type)
    ,(service wpa-supplicant-service-type) ; needed by NetworkManager
    ,(service modem-manager-service-type)
    ,(service usb-modeswitch-service-type)

    ;; The D-Bus clique.
    ,(service avahi-service-type)
    ,(service udisks-service-type)
    ,(service upower-service-type)
    ,(service accountsservice-service-type)
    ,(service cups-pk-helper-service-type)
    ,(service colord-service-type)
    ,(service geoclue-service-type)
    ,(service polkit-service-type)
    ,(service elogind-service-type
              (elogind-configuration
               (handle-power-key 'hibernate)
               ;;  (idle-action-seconds (* 5 60))
               ;;  (idle-action 'suspend)
               ))
    ,(service dbus-root-service-type)

    ,(service ntp-service-type)

    ,(service openssh-service-type
              (openssh-configuration
               (x11-forwarding? #t)
               (permit-root-login 'prohibit-password)
               (password-authentication? #f)))
    ,(service tor-service-type)
    ,(service transmission-daemon-service-type)

    ,@%base-services))

(define bd-base-home-services
  (list
   (service bd-home-emacs-service-type)
   (service home-shepherd-service-type)

   (service home-dicod-service-type)

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

   (service home-mcron-service-type
            (home-mcron-configuration
             (jobs
              (list
               #~(job
                  ;; twenty minutes
                  (lambda (current-time) (+ current-time (* 20 60)))
                  "~/.local/bin/sync-mail")))))

   (service home-bash-service-type
            (home-bash-configuration
             (aliases '(("cp" . "cp -i")
                        ("grep" . "grep --color=auto")
                        ("guix-rcfg" . "sudo guix system -L ${HOME}/.config/guix/ reconfigure ${HOME}/.config/guix/${HOSTNAME}.scm")
                        ("guix-new" . "guix pull --channels=$HOME/.config/guix/channels-unlocked.scm; guix describe --format=channels > $HOME/.config/guix/channels.scm")
                        ("ll" . "ls -l")
                        ("ls" . "ls -p --color=auto")
                        ("mkd" . "mkdir -pv")
                        ("mv" . "mv -i")
                        ("rm" . "rm -i")
                        ("suspend" . "sudo loginctl suspend")
                        ("vi" . "vim")
                        ("xeb" . "emacsclient -nce '(switch-to-buffer nil)'")
                        ("xet" . "emacsclient -nce '(shell)'")
                        ("ytta" . "yt-dlp --extract-audio --format bestaudio/best")
                        ("yttv" . "yt-dlp -f b")))


             (bashrc (list (plain-file "bashrc" "
# converts above aliases into eshell aliases automatically
alias | sed -E \"s/^alias ([^=]+)='(.*)'$/alias \\1 \\2 \\$*/g; s/'\\\\\\''/'/g;\" >~/.config/emacs/eshell/alias
")))
             (environment-variables
              '(
                ("BROWSER" . "icecat")

                ("VISUAL" . "emacsclient")
                ("EDITOR" . "emacsclient")

                ("PATH" . "$HOME/.local/bin:$PATH")
                ))))

   (service home-openssh-service-type
            (home-openssh-configuration
             (hosts
              (list (openssh-host (name "garm")
                                  (host-name "192.168.1.114")
                                  (user "bdunahu"))
                    (openssh-host (name "vali")
                                  (host-name "192.168.1.64")
                                  (user "bdunahu"))
                    (openssh-host (name "ivaldi")
                                  (host-name "192.168.1.250")
                                  (user "root"))
                    (openssh-host (name "heimdallr")
                                  (host-name "operationnull.com")
                                  (user "root"))))))

   (service home-xdg-user-directories-service-type
            (home-xdg-user-directories-configuration
             (desktop "$HOME")
             (documents "$HOME/dc")
             (download "$HOME/dl")
             (music "$HOME/ik/music")
             (pictures "$HOME/md/ig")
             (publicshare "$HOME")
             (templates "$HOME")
             (videos "$HOME/md/vi")))

   (service home-xdg-mime-applications-service-type
            (home-xdg-mime-applications-configuration
             (default
               '((application/x-bittorrent . torrent.desktop)
                 (x-scheme-handler/magnet  . torrent.desktop)))
             (desktop-entries
              (list
               (xdg-desktop-entry
                (file "torrent")
                (name "Torrent")
                (type 'application)
                (config '((exec . "transmission-remote -a %u"))))))))))