summaryrefslogtreecommitdiff
path: root/.config/guix/modules/services
diff options
context:
space:
mode:
Diffstat (limited to '.config/guix/modules/services')
-rw-r--r--.config/guix/modules/services/base.scm182
-rw-r--r--.config/guix/modules/services/xorg.scm96
2 files changed, 278 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"))))))))))
diff --git a/.config/guix/modules/services/xorg.scm b/.config/guix/modules/services/xorg.scm
new file mode 100644
index 0000000..2795c1c
--- /dev/null
+++ b/.config/guix/modules/services/xorg.scm
@@ -0,0 +1,96 @@
+(define-module (services xorg)
+ #:use-module (gnu)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services desktop)
+ #:use-module (guix gexp)
+ #:use-module (guix packages)
+ #:use-module (gnu packages suckless)
+ #:use-module (ymir)
+ #:export (bd-desktop-system-services
+ bd-desktop-home-services
+ ))
+
+(use-service-modules audio desktop networking
+ sound xorg)
+
+(define %keyboard-udev-rule
+ (udev-rule
+ "90-keyboard-hotplug.rules"
+ (string-append "ATTR{idVendor}==\"04b4\", ATTR{idProduct}==\"0510\", ACTION==\"add\", RUN+=\"/run/current-system/profile/bin/touch /tmp/keyboard_plugged\" RUN+=\"/run/current-system/profile/bin/chown " username " /tmp/keyboard_plugged\"")))
+
+(define bd-desktop-system-services
+ (list
+ (service screen-locker-service-type
+ (screen-locker-configuration
+ (name "slock")
+ (program (file-append slock "/bin/slock"))))
+
+ (service x11-socket-directory-service-type)
+ (udev-rules-service 'keyboard-hotplug %keyboard-udev-rule)
+
+ (service pulseaudio-service-type)
+ (service alsa-service-type)))
+
+(define bd-desktop-home-services
+ (list
+ (simple-service 'dotfiles
+ home-files-service-type
+ `((".Xmodmap"
+ ,(plain-file "Xmodmap" "
+clear lock
+clear control
+clear mod1
+clear mod2
+clear mod3
+clear mod4
+clear mod5
+keycode 37 = Hyper_L
+keycode 66 = Control_L
+add control = Control_L Control_R
+add mod1 = Alt_L Alt_R Meta_L
+add mod2 = Num_Lock
+add mod3 = Hyper_L
+add mod4 = Super_L Super_R
+add mod5 = Mode_switch ISO_Level3_Shift
+"))
+ (".Xresources"
+ ,(plain-file "Xresources" "
+Nsxiv.window.background: #000000
+Nsxiv.window.foreground: #FFFFFF
+Nsxiv.bar.font: Terminus:size=9
+"))
+ (".xinitrc"
+ ,(plain-file "xinitrc" "
+#!/bin/sh
+
+userresources=$HOME/.Xresources
+usermodmap=$HOME/.Xmodmap
+
+# merge in defaults and keymaps
+
+if [ -f \"$userresources\" ]; then
+
+ xrdb -merge \"$userresources\"
+
+fi
+
+if [ -f \"$usermodmap\" ]; then
+ xmodmap \"$usermodmap\"
+fi
+
+picom &
+xss-lock -- slock &
+xset r rate 250 70
+xset s 600
+touchpad-defaults
+xrandr-toggle
+xkeyboard-auto &
+exec emacs -mm"))
+ (".config/gtk-2.0/settings.ini"
+ ,(plain-file "settings.ini" "
+[Settings]
+gtk-application-prefer-dark-theme=1\n"))
+ (".config/gtk-3.0/settings.ini"
+ ,(plain-file "settings.ini" "
+[Settings]
+gtk-application-prefer-dark-theme=1\n"))))))