(use-modules ((xyz euandreh heredoc) #:prefix heredoc:) (gnu home) (gnu home services) (gnu home services mcron) (gnu home services shells) (gnu packages) (gnu packages gnupg) (gnu packages mail) (gnu packages music) (gnu packages wget) (gnu packages lisp) (gnu packages ssh) (gnu packages texinfo) (gnu packages tmux) (gnu packages version-control) (gnu packages video) (gnu services) (guix gexp) (guix modules) (guix packages) (guix utils) ((srfi srfi-1) #:prefix s1:)) (heredoc:enable-syntax) (define msmtp-non-hardcoded (package (inherit msmtp) (name "msmtp-non-hardcoded") (arguments (substitute-keyword-arguments (package-arguments msmtp) ((#:phases phases '%standard-phases) `(modify-phases ,phases (add-after 'install-additional-files 'patch-hardcoded-paths (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out"))) (substitute* (string-append out "/bin/msmtpq") (("^LOG=.*$") "LOG=$XDG_LOG_HOME/msmtpq.log\n") (("^Q=.*$") "Q=$XDG_DATA_HOME/msmtp/queue\n") (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) (define (with-options pkg bin opts) (package (inherit pkg) (arguments (substitute-keyword-arguments (package-arguments pkg) ((#:phases phases '%standard-phases) `(modify-phases ,phases (add-after 'install 'wrap-with-flags (lambda* (#:key outputs #:allow-other-keys) (define (wrap-options prog options) (let ((wrapped-file (string-append (dirname prog) "/." (basename prog) "-orig"))) (rename-file prog wrapped-file) (call-with-output-file prog (lambda (port) (format port "#!/bin/sh~%~%exec \"~a\" ~a \"$@\"~%" (canonicalize-path wrapped-file) options))) (chmod prog #o755))) (wrap-options (string-append (assoc-ref outputs "out") "/bin/" ,bin) ,opts))))))))) (define isync-with-options (with-options isync "mbsync" "--config=\"$XDG_CONFIG_HOME\"/mbsync/config")) (define wget-with-options (with-options wget "wget" "--hsts-file=\"$XDG_STATE_HOME\"/wget-hsts")) (define sbcl-with-options (with-options sbcl "sbcl" "--userinit \"$XDG_CONFIG_HOME\"/sbcl/sbclrc.lisp")) (define tmux-with-options (with-options tmux "tmux" "-f \"$XDG_CONFIG_HOME\"/tmux/tmux.conf")) (define myrepos-with-options (with-options myrepos "mr" "-c \"$XDG_CONFIG_HOME\"/myrepos/config")) (define texinfo-with-options (with-options texinfo "info" "--init-file \"$XDG_CONFIG_HOME\"/info/infokey")) (define mpv-with-options (with-options mpv "mpv" (string-append "--script=" (getenv "HOME") "/.guix-home/profile/lib/mpris.so"))) (define openssh-with-options (with-options openssh "ssh" "-F \"$XDG_CONFIG_HOME\"/ssh/config")) (define (xdg-config-home s) (string-append (getenv "XDG_CONFIG_HOME") "/" s)) (define gitconfig (mixed-text-file "gitconfig" #"- [user] email = eu@euandre.org name = EuAndreh signingkey = 81F90EC3CD356060 [transfer] fsckobjects = true [push] default = current [commit] gpgsign = true verbose = true [init] defaultBranch = main [sendemail] assume8bitEncoding = UTF-8 smtpserveroption = -a smtpserveroption = euandreh annotate = yes confirm = never smtpserver = "# msmtp-non-hardcoded "/bin/msmtpq\n")) (define gpg-agent.conf (mixed-text-file "gpg-agent.conf" #"- default-cache-ttl 172800 default-cache-ttl-ssh 172800 max-cache-ttl 604800 max-cache-ttl-ssh 604800 enable-ssh-support pinentry-program "# pinentry-gtk2 "/bin/pinentry-gtk-2\n")) (define ssh.conf (plain-file "ssh.conf" (string-replace-substring #"- Host * UserKnownHostsFile @XDG_CONFIG_HOME@/ssh/known_hosts Include ~/dev/libre/servers/src/infrastructure/ssh.conf Include ~/dev/others/lawtech/src/infrastructure/ssh.conf "# "@XDG_CONFIG_HOME@" (getenv "XDG_CONFIG_HOME")))) (define config-files `(("gnupg/gpg-agent.conf" ,gpg-agent.conf) ("git/config" ,gitconfig) ("ssh/config" ,ssh.conf))) (define dot-config (let ((prefix-with-config (lambda (s) (string-append (substring (getenv "XDG_CONFIG_HOME") (+ 1 (string-length (getenv "HOME")))) "/" s)))) (map (lambda (t) (list (prefix-with-config (first t)) (second t))) config-files))) (define cronjobs '() #; (list ;; FIXME #~(job "* * * * *" "echo foi > ~/foi") #~(job "* * * * *" "backup -h 2>&1 > ~/bk") #~(job "* * * * *" "which backup -h 2>&1 > ~/which-bk") #~(job "* * * * *" "echo $PATH 2>&1 > ~/path") #~(job "* * * * *" "echo 123") #~(job "* * * * *" "echo 123 > k") #~(job "* * * * *" "date > ~/job"))) (home-environment (packages (append (map (compose list specification->package+output symbol->string) '(nss-certs bash coreutils findutils diffutils grep sed tar gawk bc nvi man-pages posix-man-pages bash-completion git git:send-email git:gui git-open git-remote-gcrypt mercurial fossil subversion cvs gnupg rsync tree diffoscope mailutils entr pulseaudio password-store playerctl pinentry-gtk2 bmake make fzf ranger blueman pavucontrol ledger curl xclip cloc strace file urlscan rlwrap direnv borg khal khard libfaketime qrencode feh sox xset graphviz moreutils shellcheck gettext lilypond groff jq recutils units ncurses trash-cli lsof autojump unzip powertop md4c timidity++ flatpak dunst sqlite clojure openjdk perl perl-mojolicious python python-slixmpp valgrind gcc-toolchain clang tcc node quickjs m4 go xrandr arandr st i3status xmobar ghc ghc-xmonad-contrib xmonad xmessage dmenu clipmenu weechat alot notmuch w3m afew qtox telescope imagemagick ffmpeg pandoc ;; mktorrent-latest jekyll flac mediainfo libnotify espeak-ng procps zenity util-linux guile gzip xz bzip2 lzip which libxml2 psmisc less nano patch poezio freetalk mcabber profanity newsboat mpv-mpris poweralertd keepassxc xbacklight zathura zathura-djvu zathura-pdf-poppler zathura-ps dino poedit transmission transmission:gui audacity inkscape frescobaldi libreoffice rhythmbox ungoogled-chromium firefox)) (list msmtp-non-hardcoded isync-with-options wget-with-options sbcl-with-options tmux-with-options myrepos-with-options texinfo-with-options mpv-with-options openssh-with-options))) (services (list (simple-service 'my-shell-profile home-shell-profile-service-type (list (plain-file "my-profile" ". ~/.usr/etc/bash/rc"))) (simple-service 'config-files home-files-service-type dot-config) (simple-service 'home-cron home-mcron-service-type cronjobs))))