guix

my guix configs
git clone git://git.jakekoroman.com/guix
Log | Files | Refs | README

home.scm (11270B)


      1 (define-module (systems work home)
      2   #:use-module (jrk packages all)
      3 
      4   #:use-module (gnu home)
      5   #:use-module (gnu home services)
      6   #:use-module (gnu home services desktop)
      7   #:use-module (gnu home services gnupg)
      8   #:use-module (gnu home services mail)
      9   #:use-module (gnu home services shells)
     10   #:use-module (gnu home services shepherd)
     11   #:use-module (gnu home services sound)
     12   #:use-module (gnu home services sway)
     13 
     14   #:use-module (gnu packages base)
     15   #:use-module (gnu packages commencement)
     16   #:use-module (gnu packages dns)
     17   #:use-module (gnu packages emacs)
     18   #:use-module (gnu packages emacs-xyz)
     19   #:use-module (gnu packages engineering)
     20   #:use-module (gnu packages gdb)
     21   #:use-module (gnu packages gimp)
     22   #:use-module (gnu packages gnome)
     23   #:use-module (gnu packages gnupg)
     24   #:use-module (gnu packages image)
     25   #:use-module (gnu packages image-viewers)
     26   #:use-module (gnu packages linux)
     27   #:use-module (gnu packages llvm)
     28   #:use-module (gnu packages mail)
     29   #:use-module (gnu packages man)
     30   #:use-module (gnu packages mate)
     31   #:use-module (gnu packages music)
     32   #:use-module (gnu packages ncurses)
     33   #:use-module (gnu packages pkg-config)
     34   #:use-module (gnu packages pulseaudio)
     35   #:use-module (gnu packages terminals)
     36   #:use-module (gnu packages tmux)
     37   #:use-module (gnu packages version-control)
     38   #:use-module (gnu packages video)
     39   #:use-module (gnu packages web)
     40   #:use-module (gnu packages wm)
     41   #:use-module (gnu packages xdisorg)
     42   #:use-module (gnu packages xorg)
     43 
     44   #:use-module (gnu services)
     45   #:use-module (gnu system shadow)
     46 
     47   #:use-module (guix gexp)
     48 
     49   #:export (work-home-config)
     50   )
     51 
     52 (define shell-aliases
     53   '(("ip" . "ip --color=auto")
     54     ("grep" . "grep --color=auto")
     55     ("diff" . "diff --color=auto")
     56     ("ls" . "ls -hN --color=auto --group-directories-first")
     57     ("l" . "ls -l")
     58     ("ll" . "ls -la")
     59     ("f" . "fossil")
     60     ("v" . "$EDITOR")
     61     ("vv" . "$SUDO $EDITOR")
     62     ("nt" . "$BROWSER --new-tab")
     63     ("nw" . "$BROWSER --new-window")
     64     ("cp" . "cp -iv")
     65     ("mv" . "mv -iv")
     66     ("rm" . "rm -vI")
     67     ("be" . "v $MENULAUNCHER_DIR/bookmarks")
     68     ("mkdir" . "mkdir -pv")
     69     ("yt" . "yt-dlp --embed-metadata --embed-chapters --sponsorblock-remove sponsor -i")
     70     ("yta" . "yt-dlp -f bestaudio -x --audio-format mp3 --sponsorblock-remove sponsor -i")
     71     ("mpv" . "mpv --script=~/.guix-home/profile/lib/mpris.so")))
     72 
     73 (define shell-environment-variables
     74   '(("SUDO" . "sudo")
     75     ("TERMINAL" . "st")
     76     ("BROWSER" . "firefox")
     77     ("EDITOR" . "emacsclient -c -a 'emacs -nw'")
     78     ("XDG_CONFIG_HOME" . "$HOME/.config")
     79     ("XDG_DATA_HOME" . "$HOME/.local/share")
     80     ("XDG_CACHE_HOME" . "$HOME/.cache")
     81     ("XDG_DATA_DIRS" . "$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share")
     82     ("ZDOTDIR" . "$XDG_CONFIG_HOME/zsh")
     83     ("WINEPREFIX" . "$XDG_DATA_HOME/wineprefixes/default")
     84     ("GOPATH" . "$XDG_DATA_HOME/go")
     85     ("RUSTUP_HOME" . "$XDG_DATA_HOME/rustup")
     86     ("PASSWORD_STORE_DIR" . "$XDG_DATA_HOME/pass")
     87     ("PYTHON_HISTORY" . "$XDG_DATA_HOME/python/history")
     88     ("NPM_CONFIG_USERCONFIG" . "$XDG_CONFIG_HOME/npm/npmrc")
     89     ("NOTMUCH_CONFIG" . "$XDG_CONFIG_HOME/notmuch-config")
     90     ("CARGO_HOME" . "$XDG_DATA_HOME/cargo")
     91     ("WGETRC" . "$XDG_CONFIG_HOME/wgetrc")
     92     ("MENULAUNCHER_DIR" . "$XDG_DATA_HOME/menulaunchers")
     93     ("MBSYNCRC" . "$XDG_CONFIG_HOME/mbsync/config")
     94     ("MANPATH" . "$MANPATH:$XDG_DATA_HOME/man")
     95     ("_JAVA_AWT_WM_NONREPARENTING" . "1")
     96     ("GUILE_LOAD_PATH" . "$HOME/.config/guix/current/share/guile/site/3.0:$GUILE_LOAD_PATH")
     97     ("PATH" . "$CARGO_HOME/bin:$HOME/.local/bin:$HOME/scripts:$PATH")))
     98 
     99 (define bash-aliases-service
    100   (simple-service 'bash-aliases
    101                   home-bash-service-type
    102                   (home-bash-extension
    103                    (aliases shell-aliases))))
    104 
    105 (define bash-environment-variables-service
    106   (simple-service 'bash-aliases
    107                   home-bash-service-type
    108                   (home-bash-extension
    109                    (environment-variables shell-environment-variables))))
    110 
    111 (define bash-profile
    112   "")
    113 
    114 (define bashrc
    115   "
    116 # Export 'SHELL' to child processes.  Programs such as 'screen'
    117 # honor it and otherwise use /bin/sh.
    118 export SHELL
    119 
    120 if [[ $- != *i* ]]
    121 then
    122     # We are being invoked from a non-interactive shell.  If this
    123     # is an SSH session (as in \"ssh host command\"), source
    124     # /etc/profile so we get PATH and other essential variables.
    125     [[ -n \"$SSH_CLIENT\" ]] && source /etc/profile
    126 
    127     # Don't do anything else.
    128     return
    129 fi
    130 
    131 # Source the system-wide file.
    132 [ -f /etc/bashrc ] && source /etc/bashrc
    133 
    134 # Setup eat integration
    135 [ -n \"$EAT_SHELL_INTEGRATION_DIR\" ] && \
    136   source \"$EAT_SHELL_INTEGRATION_DIR/bash\"
    137 
    138 PS1='\\u@\\h \\w${GUIX_ENVIRONMENT:+ [env]}\\$ '
    139 #PS1='\\w \\e[1;31m>${GUIX_ENVIRONMENT:+>}\\e[1;0m '
    140 ")
    141 
    142 (define (home-davmail-shepherd-service config)
    143   (list
    144    (shepherd-service
    145     (documentation "Davmail exchange server for work emails")
    146     (provision '(davmail))
    147     (respawn? #t)
    148     (start #~(make-forkexec-constructor
    149               (list (string-append
    150                      (getenv "HOME")
    151                      "/opt/davmail/start_davmail.sh"))))
    152     (stop #~(make-kill-destructor)))))
    153 
    154 (define home-davmail-service-type
    155   (service-type
    156    (name 'davmail)
    157    (description "Davmail exchange server for work emails")
    158    (extensions
    159     (list (service-extension
    160            home-shepherd-service-type
    161            home-davmail-shepherd-service)))
    162    (default-value #f)))
    163 
    164 (define (home-emacs-daemon-shepherd-service config)
    165   (list
    166    (shepherd-service
    167     (documentation "Emacs Daemon")
    168     (provision '(emacs-server))
    169     (respawn? #f)
    170     (modules '((srfi srfi-1)))
    171     (start #~(make-forkexec-constructor
    172               (list
    173                #$(file-append
    174                   emacs
    175                   "/bin/emacs")
    176                "--fg-daemon")
    177               #:environment-variables (cons*
    178                                         (string-append "GUILE_LOAD_PATH="
    179                                                        (getenv "HOME") "/.config/guix/current/share/guile/site/3.0"
    180                                                        ":"
    181                                                        (getenv "GUILE_LOAD_PATH"))
    182                                         (string-append "PATH="
    183                                                        (getenv "HOME") "/scripts"
    184                                                        ":"
    185                                                        (getenv "PATH"))
    186                                         (remove (lambda (var)
    187                                                        (or
    188                                                         (string-prefix? "GUILE_LOAD_PATH=" var)
    189                                                         (string-prefix? "PATH=" var)))
    190                                                 (default-environment-variables)))))
    191     (stop #~(make-kill-destructor)))))
    192 
    193 (define home-emacs-daemon-service-type
    194   (service-type
    195    (name 'emacs-server)
    196    (description "Starts Emacs Server")
    197    (extensions
    198     (list (service-extension
    199            home-shepherd-service-type
    200            home-emacs-daemon-shepherd-service)))
    201    (default-value #f)))
    202 
    203 (define %theme-packages
    204   (list mate-icon-theme-faenza adwaita-icon-theme))
    205 
    206 (define %media-packages
    207   (list mpv mpv-mpris yt-dlp playerctl gimp pavucontrol wireplumber))
    208 
    209 (define %emacs-packages
    210   (list emacs emacs-dumb-jump emacs-geiser emacs-geiser-guile
    211         emacs-dash emacs-meow emacs-guix emacs-modus-themes
    212         emacs-ef-themes emacs-minions emacs-olivetti emacs-zenburn-theme
    213         emacs-eat emacs-vertico emacs-orderless emacs-marginalia emacs-company
    214         emacs-yasnippet emacs-magit emacs-go-mode emacs-lua-mode emacs-rust-mode
    215         emacs-zig-mode emacs-glsl-mode emacs-htmlize emacs-org-bullets emacs-notmuch
    216         emacs-elfeed))
    217 
    218 (define %dev-packages
    219   (list fossil ncurses gdb gf
    220         man-pages-posix man-pages man-db
    221         tmux jq
    222         (list ldns "drill")))
    223 
    224 (define %misc-packages
    225   (list xset flameshot xrandr arandr autorandr xwallpaper sxhkd freecad
    226         nsxiv notmuch isync jrk-st))
    227 
    228 (define-public work-home-config
    229   (home-environment
    230    (packages (append %misc-packages
    231                      %theme-packages
    232                      %media-packages
    233                      %dev-packages
    234                      %emacs-packages))
    235    (services
    236     (list
    237      (service home-bash-service-type
    238               (home-bash-configuration
    239                (guix-defaults? #f)
    240                (bashrc (list (plain-file "bashrc" bashrc)))
    241                (bash-profile (list (plain-file "bash_profile" bash-profile)))))
    242      bash-aliases-service
    243      bash-environment-variables-service
    244 
    245      (service home-emacs-daemon-service-type)
    246      (service home-davmail-service-type)
    247 
    248      ;; (service home-sway-service-type
    249      ;;          (sway-configuration
    250      ;;           (variables `((mod . "Mod4")
    251      ;;                        (left . "n")
    252      ;;                        (right . "o")
    253      ;;                        (down . "e")
    254      ;;                        (up . "i")
    255      ;;                        (term . ,(file-append foot "/bin/foot"))))
    256      ;;           (outputs
    257      ;;            (list (sway-output
    258      ;;                   (identifier '*)
    259      ;;                   (background (file-append sway
    260      ;; "/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png")))))))
    261 
    262      (service home-msmtp-service-type
    263               (home-msmtp-configuration
    264                (accounts
    265                 (list
    266                  (msmtp-account
    267                   (name "work")
    268                   (configuration
    269                    (msmtp-configuration
    270                     (host "localhost")
    271                     (from "koromanj@miltonhydro.com")
    272                     (port 1025)
    273                     (tls-starttls? #f)
    274                     (tls? #f)
    275                     (extra-content "auth plain")
    276                     (user "koromanj@miltonhydro.com")
    277                     (password-eval "pass koromanj@miltonhydro.com"))))
    278                  (msmtp-account
    279                   (name "personal")
    280                   (configuration
    281                    (msmtp-configuration
    282                     (host "smtp.purelymail.com")
    283                     (from "jake@jakekoroman.com")
    284                     (port 465)
    285                     (tls-starttls? #f)
    286                     (tls? #t)
    287                     (auth? #t)
    288                     (user "jake@jakekoroman.com")
    289                     (password-eval "pass jake@jakekoroman.com"))))))))
    290 
    291      (service home-pipewire-service-type)
    292      (service home-dbus-service-type)
    293 
    294      (service home-shepherd-transient-service-type)
    295 
    296      (service home-gpg-agent-service-type
    297               (home-gpg-agent-configuration
    298                (pinentry-program (file-append pinentry-rofi "/bin/pinentry-rofi"))
    299                (ssh-support? #t)
    300                (default-cache-ttl 86400)
    301                (max-cache-ttl 86400)))
    302 
    303      (service home-files-service-type
    304               `((".guile" ,%default-dotguile)
    305                 (".Xdefaults" ,%default-xdefaults)))
    306 
    307      (service home-xdg-configuration-files-service-type
    308               `(("gdb/gdbinit" ,%default-gdbinit)
    309                 ("nano/nanorc" ,%default-nanorc)))))))
    310 
    311 work-home-config