diff options
Diffstat (limited to 'etc/guix/home.scm')
-rw-r--r-- | etc/guix/home.scm | 625 |
1 files changed, 625 insertions, 0 deletions
diff --git a/etc/guix/home.scm b/etc/guix/home.scm new file mode 100644 index 0000000..fc9f2b5 --- /dev/null +++ b/etc/guix/home.scm @@ -0,0 +1,625 @@ +(use-modules + ((ice-9 textual-ports) #:prefix textual-ports:) + ((guix licenses) #:prefix licenses:) + ((xyz euandreh heredoc) #:prefix heredoc:) + (gnu home) + (gnu home services) + (gnu home services mcron) + (gnu home services shells) + (gnu home services shepherd) + (gnu home services xdg) + (gnu packages) + (gnu packages base) + (gnu packages dunst) + (gnu packages freedesktop) + (gnu packages gnupg) + (gnu packages gpodder) + (gnu packages libreoffice) + (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 packages xdisorg) + (gnu services) + (guix build-system trivial) + (guix download) + (guix gexp) + (guix git-download) + (guix modules) + (guix packages) + (guix utils)) +(heredoc:enable-syntax) + +(define-public hunspell-iconv + (package + (inherit hunspell) + (name "hunspell-iconv") + (inputs + `(("libiconv" ,libiconv) + ,@(package-inputs hunspell))))) + +(define (hunspell-dictionary-utf8 dict-name) + (package + (name (string-append "hunspell-dict-" dict-name "-utf8")) + (version "630b34e6f8f3cbe7aa7b27b6d8ab118e27252fd1") + (source + (origin + (method git-fetch) + (uri + (git-reference + (url "https://github.com/wooorm/dictionaries") + (commit version))) + (file-name + (git-file-name "hunspell-dictionary-utf8" version)) + (sha256 + (base32 "1iknwzh5h04m067ddw9hlzc1qqj4mr9mdkcfapsnay304laaiyn5")))) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let ((source-prefix (string-append (assoc-ref %build-inputs "source") + "/dictionaries/" + ,dict-name + "/index")) + (install-prefix (string-append %output "/share/hunspell/"))) + (mkdir-p install-prefix) + (copy-file (string-append source-prefix ".aff") + (string-append install-prefix ,dict-name ".aff")) + (copy-file (string-append source-prefix ".dic") + (string-append install-prefix ,dict-name ".dic")))))) + (synopsis (string-append "Hunspell " dict-name " dictionary in UTF-8")) + (description (string-append "Hunspell " dict-name " dictionary in UTF-8")) + (license licenses:expat) + (home-page "https://github.com/wooorm/dictionaries"))) + +(define cmucl + (package + (name "cmucl-binary") + (version "21b") + (source + (origin + (method url-fetch) + (uri (string-append "https://common-lisp.net/project/cmucl/downloads/release/" + version + "/cmucl-" + version + "-x86-linux.tar.bz2")) + (sha256 + (base32 "13k3b5ygnbsq6n2i3r5i4ljw3r1qlskn2p5f4x9hrx6vfvbb3k7a")))) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let ((source (assoc-ref %build-inputs "source")) + (bin (string-append %output "/bin"))) + (mkdir-p bin) + (copy-file (string-append source "/bin/lisp") + (string-append bin "/lisp")))))) + (home-page "https://www.cons.org/cmucl/") + (synopsis "The CMU implementation of Common Lisp") + (description #"- + CMUCL is a free implementation of the Common Lisp programming language + which runs on most major Unix platforms. It mainly conforms to the + ANSI Common Lisp standard."#) + (license licenses:public-domain))) + +(define msmtp-non-hardcoded + (package + (inherit msmtp) + (name "msmtp-non-hardcoded") + (arguments + (substitute-keyword-arguments (package-arguments msmtp) + ((#:phases 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") + (("^MSMTPQ_Q=.*$") "MSMTPQ_Q=\"$Q\"\n") + (("mkdir -m 0700 \"\\$Q\"") "mkdir -p -m 0700 \"$Q\""))))))))))) + +(define gpodder-xdg + (package + (inherit gpodder) + (name "gpodder-xdg") + (arguments + (substitute-keyword-arguments (package-arguments gpodder) + ((#:phases phases '%standard-phases) + #~(modify-phases #$phases + (add-after 'install 'wrap-with-environment-variables + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (for-each + (lambda (bin) + (wrap-program (string-append out "/bin/" bin) + '("GPODDER_HOME" = ("${XDG_DATA_HOME:-$HOME/.local/share}/gPodder")) + '("GPODDER_DOWNLOAD_DIR" = ("${XDG_DOWNLOAD_DIR:-$HOME/Downloads}/gPodder")))) + '("gpo" "gpodder"))))))))))) + +(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 tmux-with-options + (with-options tmux "tmux" "-f \"$XDG_CONFIG_HOME\"/tmux/tmux.conf")) + +(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 (slurp name) + (string-trim-both + (call-with-input-file + name + textual-ports:get-string-all))) + +(define (script name content) + (package + (name name) + (version "latest") + (source #f) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let* ((bin (string-append %output "/bin")) + (prog (string-append bin "/" ,name))) + (mkdir-p bin) + (call-with-output-file prog + (lambda (port) + (format port "~a" ,content))) + (chmod prog #o755))))) + (home-page "") + (synopsis "") + (description "") + (license #f))) + +(define cronjobs + (list + #~(job "0 0 * * *" "cronjob msmtp-queue -r") + #~(job "0 0 * * *" "cronjob check") + #~(job "5 */6 * * *" "cronjob m") + #~(job "30 0 * * *" "cronjob x update AND upgrade") + #~(job "30 0 * * *" "cronjob backup -q cron"))) + +(define (home-service name package bin) + (service-type + (name name) + (extensions + (list + (service-extension home-shepherd-service-type + (lambda _ + (list + (shepherd-service + (provision (list name)) + (documentation + (format #f "Shepherd service that manages ~a." name)) + (start + #~(make-forkexec-constructor + (list #$(file-append package bin)))) + (stop #~(make-kill-destructor)))))) + (service-extension home-profile-service-type + (lambda _ (list package))))) + (default-value '()) + (description + (format #f + #"- + Service that runs ~a as a daemon under Shepherd. + + It has no configuration."# + name)))) + +(define xdg-prefix "$HOME/.usr") +(define (xdg path) + (string-append xdg-prefix "/" path)) + +(home-environment + (packages + (append + (map (compose list specification->package+output symbol->string) + '(nss-certs + bash + coreutils + findutils + diffutils + grep + sed + tar + gawk + bc + nvi + patchelf + + man-pages + man-pages-posix + + bash-completion + + git + git:send-email + git:gui + git-open + git-remote-gcrypt + git-lfs + mercurial + fossil + darcs + subversion + cvs + rcs + cssc + quilt + + gnupg + rsync + tree + diffoscope + mailutils + entr + pulseaudio + password-store + playerctl + pinentry-gtk2 + bmake + make + tup + autoconf + automake + libtool + pcre:out + pcre:bin + pcre:doc + pcre:static + pcre2 + avahi + libgcrypt + qbe + cproc + doxygen + gperf + readline + gmp + help2man + libtomcrypt + libtommath + lz4 + lokke + meson + ninja + sparse + ant + mpc + maven + pkg-config + fzf + ranger + blueman + pavucontrol + ledger + bind:utils + stunnel + netcat + siege + curl + curl:doc + xclip + cloc + strace + file@5.39 + urlscan + rlwrap + direnv + borg + khal + khard + libfaketime + qrencode + feh + sox + xset + graphviz + moreutils + shellcheck + gettext + lilypond + groff + groff:doc + grap + ghostscript + texlive + jq + recutils + units + ncurses + trash-cli + lsof + autojump + unzip + powertop + md4c + timidity++ + cmark + cmake + makefile2graph + po4a + mdpo + universal-ctags + gron + reptyr + xpdf + perf-tools + scdoc + rpm + cpio + + ;; for compiling ECL + libatomic-ops + libgc + libffi + ;; for compiling CLISP + libffcall + libsigsegv + + cryptsetup + btrfs-progs + + flatpak + xdg-desktop-portal + + sqlite + clojure + clojure-tools + leiningen + openjdk + perl + perl-dbi + perl-dbd-sqlite + perl-critic + perl-json + perl-mojolicious + perl-regexp-grammars + perl-commonmark + perl-aliased + perl-uri-escape + ruby + python + python-sphinx + python-slixmpp + python-unidecode + python-yubikey-manager + python-coverage + python-pytest + python-requests + python-beautifulsoup4 + python-docx + python-telegram-bot + ; python-docutils ; broken: conflicts with python-sphinx + python-mkdocs + valgrind + flex + bison + gcc-toolchain + clang + tcc + fuse + ; node ; broken: conflicts with archivebox + quickjs + m4 + go + xrandr + arandr + openssl + fswatch + ;; rust ; broken + ;; rust:cargo ; broken + ;; rust:rustfmt ; broken + vala + tcl + + sbcl + gcl + ecl + clisp + ccl + abcl + janet + kawa + chez-scheme + racket + chibi-scheme + ; chicken ; broken: conflicts with gcc-toolchain + gambit-c + gauche + + dash + fish + rc + es + tcsh + zsh + oksh + loksh + mksh + oil + gash + nushell + + gtk + gtk:bin + gtk:doc + glade + ; libglade ; broken: conflicts with zathura + cambalache + tk + qtbase + qtbase:debug + qtdeclarative + + st + i3status + xmessage + dmenu + httpd ;; for htpasswd + + weechat + alot + notmuch + w3m + afew + qtox + telescope + imagemagick + ffmpeg + pandoc + mktorrent + jekyll + flac + mediainfo + libnotify + espeak-ng + procps + htop + zenity + util-linux + lightning + lmdb + guile + guile-heredoc-latest + gzip + xz + bzip2 + lzip + lzop + which + libxml2 + psmisc + less + nano + patch + youtube-dl + tmux-plugin-resurrect + tmux-plugin-continuum + + ;; ArchiveBox and some of its optional dependencies + archivebox + ripgrep + + poezio + freetalk + mcabber + profanity + newsboat + mpv-mpris + vlc + hicolor-icon-theme + + keepassxc + + xbacklight + + gnote + telegram-desktop + zathura + zathura-djvu + zathura-pdf-poppler + zathura-ps + dino + poedit + transmission + transmission:gui + audacity + inkscape + libreoffice + quodlibet + ungoogled-chromium + icedove + firefox)) + (list msmtp-non-hardcoded + ;; cmucl + isync-with-options + wget-with-options + tmux-with-options + texinfo-with-options + mpv-with-options + openssh-with-options + hunspell-iconv + gpodder-xdg + (hunspell-dictionary-utf8 "en") + (hunspell-dictionary-utf8 "pt") + (hunspell-dictionary-utf8 "fr") + (hunspell-dictionary-utf8 "eo") + (script "cronjob" (slurp (string-append (getenv "XDG_CONFIG_HOME") + "/sh/cronjob.sh")))))) + (services + (list + (service (home-service 'clipmenu clipmenu "/bin/clipmenud")) + (service (home-service 'dunst dunst "/bin/dunst")) + (service (home-service 'poweralertd poweralertd "/bin/poweralertd")) + (service home-xdg-base-directories-service-type + (home-xdg-base-directories-configuration + (cache-home (xdg "var/cache")) + (config-home (xdg "etc")) + (data-home (xdg "share")) + (log-home (xdg "var/log")) + (state-home (xdg "var/state")))) + (simple-service 'my-shell-profile home-shell-profile-service-type + (list (plain-file + "my-profile" + (format #f + #"- + export XDG_PREFIX="~a" + . "$XDG_CONFIG_HOME"/sh/rc"# + xdg-prefix)))) + (service home-mcron-service-type + (home-mcron-configuration + (jobs cronjobs)))))) |