diff options
Diffstat (limited to '.config/guix/modules/services/base.scm')
-rw-r--r-- | .config/guix/modules/services/base.scm | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/.config/guix/modules/services/base.scm b/.config/guix/modules/services/base.scm new file mode 100644 index 0000000..7629bf8 --- /dev/null +++ b/.config/guix/modules/services/base.scm @@ -0,0 +1,182 @@ +(define-module (services 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 packages gnupg) + #:use-module (ice-9 rdelim) + #:use-module (gnu system) + #:use-module (guix gexp) + #:use-module (services emacs) + #:export (bd-base-system-services + bd-base-home-services)) + +(use-service-modules admin avahi base + dbus desktop file-sharing + networking ssh) + +(define (read-hosts filename) + (let ((port (open-input-file filename))) + (let loop ((lines '())) + (let ((line (read-line port))) + (if (eof-object? line) + (begin (close-input-port port) + lines) + (loop (cons line lines))))))) + +(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) + )) + ,(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) + ,(simple-service 'add-extra-hosts + hosts-service-type + (map + (lambda (x) + (host "0.0.0.0" x)) + (read-hosts "/home/bdunahu/.config/guix/assets/blocklist.txt"))) + ,@%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-bash-service-type + (home-bash-configuration + (aliases '(("auth" . "echo -e \"$PWD\n\" >> $HOME/.config/guix/shell-authorized-directories") + ("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 loginctl suspend") + ("rig-shell" . "sudo screen /dev/ttyUSB0 115200") + ("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") + + ("NETHACKOPTIONS" . "@$XDG_CONFIG_HOME/nethack/config") + + ("PATH" . "$HOME/.local/bin:$PATH") + ("ZATHURA_PLUGINS_PATH" . "/home/bdunahu/.guix-home/profile/lib/zathura") + )))) + + (service home-mcron-service-type + (home-mcron-configuration + (jobs + (list + #~(job + ;; twenty minutes + (lambda (current-time) (+ current-time (* 20 60))) + "offlineimap") + #~(job + (lambda (current-time) (+ current-time (* 5 60))) + "~/.local/bin/set-t1"))))) + + (service home-openssh-service-type + (home-openssh-configuration + (hosts + (list (openssh-host (name "garm") + (host-name "localhost") + (user "root")) + (openssh-host (name "vali") + (host-name "192.168.1.136") + (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/dl") + (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")))))))))) |