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


(define-module (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 shells)
  #:use-module (gnu home services shepherd)
  #:use-module (gnu home services ssh)
  #:use-module (gnu home services xdg)
  #:use-module (emacs)
  #:use-module (gnu system)
  #:use-module (guix gexp)
  #:export (bd-base-system-packages
            bd-base-system-services
            bd-base-home-services))

(use-service-modules base file-sharing
                     networking ssh)

(use-package-modules gnupg mail password-utils
                     bittorrent pdf video
                     cryptsetup curl emacs
                     version-control web admin
                     databases rsync
                     package-management
                     texlive compression vim)


(define comm
  (list
   gnupg
   notmuch
   offlineimap3
   pass-otp
   password-store
   pinentry
   transmission
   xpdf                                 ; pdftotext
   yt-dlp
   ))

(define dev
  (list
   cryptsetup
   curl
   emacs
   git
   jq
   netcat
   recutils
   rsync
   stow
   texlive
   unzip
   vim
   ))

(define bd-base-system-packages
  (append!
   comm
   dev
   %base-packages
   ))

(define bd-base-system-services
  `(,(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 "/bin/pinentry"))
             (max-cache-ttl 43200)
             (ssh-support? #t)))

   (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/modules/ reconfigure ${HOME}/.config/guix/${HOSTNAME}.scm")
                        ("ll" . "ls -l")
                        ("ls" . "ls -p --color=auto")
                        ("mkd" . "mkdir -pv")
                        ("mv" . "mv -i")
                        ("rm" . "rm -i")
                        ("suspend" . "sudo bash -c 'echo mem > /sys/power/state'")
                        ("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 "hati")
                                  (host-name "192.168.1.76")
                                  (user "bdunahu"))
                    (openssh-host (name "vali")
                                  (host-name "192.168.1.64")
                                  (user "bdunahu"))
                    (openssh-host (name "ivaldi")
                                  (host-name "192.168.1.98")
                                  (user "bdunahu"))
                    (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"))))))))))