zero/home-environments/radio.scm

424 lines
20 KiB
Scheme
Raw Normal View History

2024-03-08 14:32:05 +00:00
(define-module (home-environments radio)
#|Ice-9|#
#|M|# #:use-module (ice-9 match)
#|GNU|#
#||# #:use-module (gnu)
2024-03-08 14:32:05 +00:00
#|H|# #:use-module ((gnu home) #:select (this-home-environment))
#|H|# #:use-module ((gnu home) #:hide (this-home-environment)
#:prefix user-)
#|GNU packages|#
#|A|# #:use-module (gnu packages admin)
#|B|# #:use-module (gnu packages bittorrent)
#|C|# #:use-module (gnu packages c)
#:use-module (gnu packages calendar)
#:use-module (gnu packages curl)
#|D|# #:use-module (gnu packages disk)
#:use-module (gnu packages databases)
#|F|# #:use-module (gnu packages file)
#:use-module (gnu packages fonts)
#:use-module (gnu packages freedesktop)
#|G|# #:use-module (gnu packages games)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gnu-doc)
#:use-module (gnu packages gnupg)
#:use-module (gnu packages guile-xyz)
#|I|# #:use-module (gnu packages image-viewers)
#|L|# #:use-module (gnu packages linux)
#|M|# #:use-module (gnu packages maths)
#:use-module (gnu packages minetest)
#|P|# #:use-module (gnu packages password-utils)
#:use-module (gnu packages pdf)
#:use-module (gnu packages pulseaudio)
#|S|# #:use-module (gnu packages scheme)
#:use-module (gnu packages shells)
#:use-module (gnu packages ssh)
#:use-module (gnu packages suckless)
#|T|# #:use-module (gnu packages telegram)
#:use-module (gnu packages text-editors)
#:use-module (gnu packages tor-browsers)
#:use-module (gnu packages toys)
#|V|# #:use-module (gnu packages version-control)
#:use-module (gnu packages video)
#|W|# #:use-module (gnu packages wm)
#|X|# #:use-module (gnu packages xdisorg)
#:use-module (gnu packages xorg)
#|GNU home services|#
#||# #:use-module (gnu home services)
2024-03-08 14:32:05 +00:00
#|D|# #:use-module (gnu home services desktop)
#:use-module (gnu home services dotfiles)
#|G|# #:use-module (gnu home services guix)
#|M|# #:use-module (gnu home services mcron)
#|S|# #:use-module (gnu home services ssh)
#:use-module (gnu home services shepherd)
#:use-module (gnu home services sound)
#|Guix|#
#|C|# #:use-module (guix channels)
#|Radix|#
#|C|# #:use-module (radix combinators)
#|U|# #:use-module (radix utils)
#|Radix packages|#
#|I|# #:use-module (radix packages image-viewers)
#|F|# #:use-module (radix packages fonts)
#|P|# #:use-module (radix packages pdf)
#|S|# #:use-module (radix packages seninha)
#:use-module (radix packages syndication)
#|W|# #:use-module (radix packages wm)
#|Radix home services|#
#||# #:use-module (radix home services)
2024-03-08 14:32:05 +00:00
#|G|# #:use-module (radix home services gnupg)
#|S|# #:use-module (radix home services shells)
#|X|# #:use-module (radix home services xdg)
#:export (home-environment))
(define home-environment
(user-home-environment
(packages
(list #|admin |# neofetch netcat-openbsd
#|bittorrent |# aria2 qbittorrent
#|c |# c-intro-and-ref
#|calendar |# remind
#|curl |# curl
#|disk |# lf
#|databases |# recutils
#|file |# file
#|fonts |# font-arabic-misc font-liberation font-meslo-lg-dz
font-misc-misc font-un font-wqy-zenhei
#|freedesktop |# xdg-utils
#|games |# minetest supertuxkart xonotic
#|gnome |# adwaita-icon-theme
#|gnu-doc |# gnu-standards
#|gnupg |# gnupg pinentry
#|guile-xyz |# haunt
#|image-viewers |# imv ueberzug++
#|linux |# alsa-utils
#|math |# libqalculate
#|password-utils|# keepassxc
#|pdf |# sioyek
#|pulseaudio |# pamixer pavucontrol
#|scheme |# sicp
#|seninha |# fmutils
#|ssh |# openssh
#|suckless |# xst
#|syndication |# newsraft
#|telegram |# telegram-desktop
#|tor-browsers |# mullvadbrowser torbrowser
#|toys |# oneko
#|vesion-control|# git
#|video |# ffmpeg mpv yt-dlp
#|wm |# awesome-next
#|xdisorg |# maim wmctrl xbanish xclip xinit xsel
#|xorg |# setxkbmap xinput xf86-input-libinput xkill xmodmap
xorg-server xrdb xset))
(services
(list #|XDG services|#
(service home-xdg-user-directories-service-type
(home-xdg-user-directories-configuration
(desktop "$HOME/areas")
(documents "$HOME/areas/documents")
(download "$HOME/.local/share/downloads")
(music "$HOME/media/music")
(pictures "$HOME/media/pictures")
(videos "$HOME/media/videos")
(publicshare "")
(templates "")))
(service home-xdg-mime-applications-service-type
(home-xdg-mime-applications-configuration
(default (associate-right
('mullvadbrowser.desktop
`("text/html"
"application/xhtml+xml"
"application/x-extension-htm"
"application/x-extension-xhtml"
"application/x-extension-xht"
"x-scheme-handler/http"
"x-scheme-handler/https"))
('kak.desktop
`("text/plain"
"text/troff"
"text/xml"
"text/x-c"
"text/x-c++"
"text/x-diff"
"text/x-lisp"
"text/x-scheme"
"text/x-shellscript"
"text/x-tex"))
('lf.desktop
`("inode/directory"
"x-scheme-handler/ftp"
"x-scheme-handler/nfs"
"x-scheme-handler/smb"
"x-scheme-handler/ssh"
"application/x-directory"))
('mpv.desktop
`("image/gif"
"audio/mpeg"
"audio/ogg"
"audio/opus"
"audio/x-opus+ogg"
"video/mp4"
"video/x-matroska"
"video/webm"))
('imv.desktop
`("image/avif"
"image/bmp"
"image/jpeg"
"image/png"
"image/svg+xml"
"image/webp"))
('sioyek.desktop
`("image/vnd.djvu"
"application/pdf"
"application/epub+zip"))))))
#|Dotfiles service|#
(service home-dotfiles-service-type
(home-dotfiles-configuration
(layout 'plain)
(directories `("radio/files"))))
#|Guix service|#
(simple-service 'home-extra-channels
home-channels-service-type
(list (channel
(name 'radix)
(url "https://codeberg.org/anemofilia/radix.git")
(branch "main")
(introduction
(make-channel-introduction
"f9130e11e35d2c147c6764ef85542dc58dc09c4f"
(openpgp-fingerprint
(format #f "F164 709E 5FC7 B32B AEC7 ~
9F37 1F2E 76AC E3F5 31C8")))))))
#|Shepherd service|#
(service home-shepherd-service-type)
#|Shell services|#
(service home-fish-service-type
(home-fish-configuration
(environment-variables
`(#|GNU Privacy Guard|#
("GPG_TTY" . "(tty)")
#|Remind|#
("DOTREMINDERS" . "$XDG_DATA_HOME/reminders")
#|GTK|#
("GTK_RC_FILES" . "$XDG_CONFIG_HOME/gtk-2.0/gtkrc")
#|Ncurses|#
("TERMINFO" . "$XDG_DATA_HOME/terminfo")))
(aliases
`(#|Common aliases|#
("df" . "df -h")
("du" . "du -h")
("diff" . "diff --color=auto")
("grep" . "grep --color=auto")
("ip" . "ip --color=auto")
("ls" . ,(format #f "ls --color=auto ~
--group-directories-first ~
--classify ~
-hv"))
#|Clear terminal screen without ncurses|#
("clear" . "printf \"\\033c\"")
#|Make ln idempotent|#
("ln" . "ln -sfn")
#|Kakoune bindings for info|#
("info" . "info --init-file $XDG_CONFIG_HOME/info")
#|Easy presentation setup with xrandr|#
("present" . ,(format #f "xrandr --output LVDS-1 ~
--mode 1366x768 ~
--scale 1x1 ~
--output VGA-1 ~
--same-as LVDS-1 ~
--mode 1920x1080 ~
--scale 0.711x0.711"))
#|Display images in lf using ueberzug|#
("lf" . "$HOME/.local/bin/lf/lfrun")
#|Listen to libre music on vern's radio|#
("radio" . "https://radio.vern.cc")
#|Kakoune aliases for the shell|#
("':e'" . "kak")
("':q'" . "exit")))
(abbreviations
(let ((@ (symbol-prefix-proc '@))
(edit (partial format #f "$EDITOR~@{ ~a~}"))
(@radix (partial symbol-append '~/areas/code/scm/radix))
(@zero (partial symbol-append '~/areas/code/scm/zero)))
`(,@(map (match-lambda
((x . y) (abbreviation
(name (@ x))
(position 'anywhere)
(expansion (y x)))))
(associate-right
#|P.A.R.A.|#
((lambda (dir)
(cond ((equal? dir 'archive)
(symbol-append '~/. dir))
((equal? dir 'bookmarks)
(symbol-append '~/resources/ dir))
(else (symbol-append '~/ dir))))
'(areas bookmarks projects resources archive))
#|XDG user directories|#
((const (fish-function "xdg-user-directory"))
'(desktop documents download music pictures videos))
#|Code projects|#
((symbol-prefix-proc '~/projects/code/)
'(c clj cpp hs html kak md pl scm sh tex zig))
#|Code areas|#
((symbol-prefix-proc '~/areas/code/scm/)
'(guix radix zero))
#|Radix|#
((partial @radix '/radix/)
'(packages services home/services))
#|Zero|#
((partial @zero '/operating-systems/)
'(buer))
((partial @zero '/home-environments/)
'(radio))
((partial @zero '/home-environments/radio/)
'(files))
#|Configuration|#
((symbol-prefix-proc
'~/areas/code/scm/radix/operating-system/)
(list (string->symbol (gethostname))))
((symbol-prefix-proc
'~/areas/code/scm/radix/home-environments/)
(list (string->symbol (getlogin))))))
,@(map (match-lambda
((x . y) (abbreviation
(name x)
(expansion y))))
`(#|Download/Upload|#
(a . "aria2c -j 10 '%'")
(i . "ipfs get %")
(m . "yt-dlp --prefer-free-formats -x '%'")
(v . "yt-dlp --prefer-free-formats '%'")
(z . "curl -F file=@% https://0x0.st | xsel -b")))
,@(map (match-lambda
((x . y) (abbreviation
(name x)
(position 'anywhere)
(expansion y))))
`(#|Shell history|#
(!! . ,(fish-function "bang-bang"))
(!$ . ,(fish-function "bang-dollar"))
(!* . ,(fish-function "bang-star"))
#|Guix|#
(!dgen . "guix % delete-generations 2w")
(!repair . "doas guix build --repair")
(!pull . "guix pull")
(!home . "guix home reconfigure ~/.config/guix/home.scm")
(!system . "doas guix system reconfigure /etc/config.scm")
#|Processes|#
(tf . "setsid -f %>/dev/null 2>&1 & disown")
#|Quick edit|#
(:e . ,(edit))
(:system . ,(edit "/etc/config.scm"))
(:home . ,(edit "~/.config/guix/home.scm"))
(:todo . ,(edit "~/areas/meta/todo")))))))))
2024-03-08 14:32:05 +00:00
#|Environment variables services|#
(simple-service 'shell-environment-variables
home-environment-variables-service-type
`(("PATH" . "$HOME/.local/bin:$PATH")
("ENV" . "$XDG_CONFIG_HOME/dash/init.sh")
("INPUTRC" . "$XDG_CONFIG_HOME/readline/inputrc")
("XINITRC" . "$XDG_CONFIG_HOME/x11/xinitrc")))
(simple-service 'guile-environment-variables
home-environment-variables-service-type
`(("GUILE_WARN_DEPRECATED" . "detailed")
("GUILE_HISTORY" . "$XDG_CACHE_HOME/guile/history")
("GUILE_LOAD_PATH"
. ,(format #f "~?~?"
"~@{:$HOME/areas/code/scm/~a~}"
'(ajatt
radix
zero
zero/operating-systems
zero/home-environments)
2024-03-08 14:32:05 +00:00
"~@{:~a/share/guile/site/3.0~}"
'($HOME/.guix-home/profile
$XDG_CONFIG_HOME/guix/current
/run/current-system/profile)))))
(simple-service 'language-environment-variables
home-environment-variables-service-type
`(("LANG" . "en_US.UTF-8")
("LANGUAGE" . "en_US.UTF-8")
("LC_COLLATE" . "C")))
(simple-service 'defaut-applications-environment-variables
home-environment-variables-service-type
`(("BROWSER" . "mullvadbrowser")
("EDITOR" . "kak")
("FCEDIT" . "kak")
("PAGER" . "less")
("READER" . "sioyek")
("SHELL" . "fish")
("TERMINAL" . "xst")
("VISUAL" . "kak")
("WM" . "awesome")))
#|SSH service|#
(service home-openssh-service-type
(home-openssh-configuration
(hosts (list (openssh-host
(name "codeberg.org")
(host-name "codeberg.org")
(user "git")
(identity-file "~/.ssh/codeberg"))
(openssh-host
(name "github.com")
(host-name "github.com")
(user "git")
(identity-file "~/.ssh/github"))))
(authorized-keys #f)))
#|GPG agent service|#
(service home-gpg-agent-service-type
(home-gpg-agent-configuration
(gnupghome ".local/share/gnupg")
(pinentry-program
(file-append pinentry "/bin/pinentry-curses"))))
#|Session services|#
(service home-dbus-service-type)
#|Sound services|#
(service home-pipewire-service-type)
#|Mcron service|#
(service home-mcron-service-type
(home-mcron-configuration
(jobs (list #~(job "30 5 * * *"
"mpv --shuffle ~/media/music")))))))))
home-environment