From abce97d80aecb9fc378c53f63c5aaa748296b935 Mon Sep 17 00:00:00 2001 From: "Collin J. Doering" Date: Sat, 26 Mar 2022 08:55:08 -0400 Subject: [PATCH] Initial switch to guix-home * README.org: Update README to include information about setup changes now that guix home is in use. Also clarify that guix-home is only managing bash configuration currently, and more work is required to completely switch over. * home-configuration.scm: Initial home configuration, managing bash config, as well as a sherpherd redshift service. * home-manifest.scm: Home manifest was updated so there is a %home-manifest variable that can be used from home-configuration.scm * user-config/emacs/.emacs.d/config.org: Adjust ~/.guix-profile paths to ~/.guix-home * user-config/gpg/.gnupg/gpg-agent.conf: Ditto * user-config/rofi/.config/rofi/config.rasi: Ditto * user-config/sway/.config/sway/config: Ditto * user-config/xorg/.bin/startx.sh: Ditto * user-config/xorg/.xinitrc: Ditto * user-config/zsh/.zshenv: Ditto * user-config/zsh/.zshrc: Ditto * user-config/zsh/.zprofile: Ditto. Also, source ~/.profile as required by guix-home (this is needed until guix-home is used to manage zsh configuration, where this will happen automatically) --- README.org | 20 ++++-- home-configuration.scm | 76 +++++++++++++++++++++++ home-manifest.scm | 24 ++++--- user-config/emacs/.emacs.d/config.org | 12 ++-- user-config/gpg/.gnupg/gpg-agent.conf | 2 +- user-config/rofi/.config/rofi/config.rasi | 2 +- user-config/sway/.config/sway/config | 2 +- user-config/xorg/.bin/startx.sh | 2 +- user-config/xorg/.xinitrc | 11 +--- user-config/zsh/.zprofile | 5 +- user-config/zsh/.zshenv | 4 +- user-config/zsh/.zshrc | 12 ++-- 12 files changed, 127 insertions(+), 45 deletions(-) create mode 100644 home-configuration.scm diff --git a/README.org b/README.org index e668f44..12e38b6 100644 --- a/README.org +++ b/README.org @@ -14,15 +14,22 @@ Clone this repository. cd ~/.dotfiles #+end_src -Dependencies are managed using [[https://guix.gnu.org][guix]] and can be installed with the following. +Home configuration, including startup services (via userland shepherd), configuration files +and installed packages are all managed using [[https://guix.gnu.org][guix]]/[[https://guix.gnu.org/en/manual/devel/en/html_node/Home-Configuration.html][guix-home]] and can be installed with the +following. #+begin_src shell guix pull -C ~/.dotfiles/channels.scm - guix package -m ~/.dotfiles/home-manifest.scm + guix home reconfigure ~/.dotfiles/home-configuration.scm #+end_src +** TODO Legacy Configuration + Configurations for a variety of programs are available to be 'installed' by symbolically -linking them into ~$HOME~ using stow. This process is simplified by the provided ~Makefile~. +linking them into ~$HOME~ using stow. This process is simplified by the provided ~Makefile~, +however is expected to be deprecated by the switch to Guix home, which is not yet fully +completed. Currently guix home only manages bash configuration, and all other configuration +is still managed using the 'legacy' stow method described here. #+begin_src shell # See what will be installed/linked by stow @@ -32,7 +39,9 @@ linking them into ~$HOME~ using stow. This process is simplified by the provided make #+end_src -* Makefile Usage +* TODO Makefile Usage + +~Makefile~ is expected to be become unnecessary after this configuration is managed by Guix home instead of using stow. #+begin_verse make [packages] [DRY=true] [RESTOW=true] [DELETE=true] @@ -63,7 +72,6 @@ Notes: # Uninstall/unlink configuration for a subset of packages make DELETE=true bash -#+end_src * Development @@ -87,7 +95,7 @@ These updates require additional manual effort, otherwise completions don't show #+begin_src shell # Set fpath in ~/.zprofile (this is already done in the zsh configuration) - #fpath=(~/.guix-profile/share/zsh/site-functions $fpath) + #fpath=(~/.guix-home/profile/share/zsh/site-functions $fpath) rm -r ~/.zcompdump && compinit #+end_src diff --git a/home-configuration.scm b/home-configuration.scm new file mode 100644 index 0000000..1e2814d --- /dev/null +++ b/home-configuration.scm @@ -0,0 +1,76 @@ +;; This "home-environment" file can be passed to 'guix home reconfigure' +;; to reproduce the content of your profile. This is "symbolic": it only +;; specifies package names. To reproduce the exact same profile, you also +;; need to capture the channels being used, as returned by "guix describe". +;; See the "Replicating Guix" section in the manual. + +(use-modules + (gnu home) + (gnu packages) + (gnu services) + (guix profiles) + (guix transformations) + (guix gexp) + (gnu home services shells) + (gnu home services desktop)) + +(include "home-manifest.scm") + +(home-environment + (packages + (map manifest-entry-item (manifest-entries %home-manifest))) + (services + (list + (service home-bash-service-type + (home-bash-configuration + (aliases + (let ((aws-alias "aws-vault exec --no-session ${AWS_PROFILE:-default} -- aws") + (aws-shell-alias "aws-vault exec --no-session ${AWS_PROFILE:-default} -- aws-shell")) + `(("ls" . "ls --color=auto") + ("ll" . "ls -l") + ("la" . "ls -a") + ("lla" . "ls -al") + + ("grep" . "grep --color=auto") + ("fgrep" . "fgrep --color=auto") + ("egrep" . "egrep --color=auto") + ("f" . "find") + + ("b" . "bat") + ("x" . "exa") + ("xs" . "exa") + ("xl" . "exa -l") + ("xla" . "exa -la") + ("xx" . "x -alT --git") + + ("av" . "aws-vault") + ("avl" . "aws-vault login ${AWS_PROFILE:-default}") + ("ave" . "aws-vault exec ${AWS_PROFILE:-default} --") + ("aven" . "aws-vault exec --no-session ${AWS_PROFILE:-default} --") + ("aws" . ,aws-alias) + ("aws-shell" . ,aws-shell-alias) + ("unaws" . "unset AWS_{PROFILE,SECRET_ACCESS_KEY,ACCESS_KEY_ID,SDK_LOAD_CONFIG}") + ("alias-aws" . ,(string-append "alias aws=\"" aws-alias + "\"; alias aws-shell=\"" aws-shell-alias "\"")) + ("unalias-aws" . "unalias aws; unalias aws-shell") + + ("ff" . "firefox") + ("ffp" . "firefox --private-window") + + ("e" . "emacsclient -t") + ("kssh" . "kitty +kitten ssh") + + ("s" . "sudo") + ("si" . "sudo -i")))) + (environment-variables '(("PS1" . "[\\u@\\h \\W]\\$ "))))) + + (service home-redshift-service-type + (home-redshift-configuration + (location-provider 'geoclue2))) + + + ;; (service home-zsh-configuration + ;; (zshenv (list ...)) + ;; (zprofile (list ...)) + ;; (zshrc (list ...))) + ))) diff --git a/home-manifest.scm b/home-manifest.scm index 67061f0..25c7e31 100644 --- a/home-manifest.scm +++ b/home-manifest.scm @@ -339,13 +339,17 @@ "terraform-provider-aws" "terraform-wrapper"))) -(concatenate-manifests - (list - %emacs-manifest - %shell-manifest - %xorg-manifest - %wayland-manifest - %xorg-apps-manifest - %xorg-wayland-apps-manifest - %guile-manifest - %misc-manifest)) +(define %home-manifest + (concatenate-manifests + (list + %emacs-manifest + %shell-manifest + %xorg-manifest + %wayland-manifest + %xorg-apps-manifest + %xorg-wayland-apps-manifest + %guile-manifest + %misc-manifest))) + +;; Return home-manifest so this file can be used by guix commands that accept manifest files +%home-manifest diff --git a/user-config/emacs/.emacs.d/config.org b/user-config/emacs/.emacs.d/config.org index a445064..97ddc3f 100644 --- a/user-config/emacs/.emacs.d/config.org +++ b/user-config/emacs/.emacs.d/config.org @@ -1,6 +1,6 @@ #+TITLE: Emacs Configuration #+AUTHOR: [[https://www.blog.rekahsoft.ca/contact.html][Collin J. Doering]] -#+SETUPFILE: ~/.guix-profile/var/org-themes/org-html-themes/theme-readtheorg-local.setup +#+SETUPFILE: ~/.guix-home/profile/var/org-themes/org-html-themes/theme-readtheorg-local.setup #+HTML_HEAD: #+PROPERTY: header-args:emacs-lisp :tangle yes :tangle-mode (identity #o444) @@ -77,7 +77,7 @@ instead of at ~org-babel~ tangle time (which occurs during emacs startup). #+begin_src emacs-lisp (defvar is-guix-system-p (or (file-exists-p "/run/current-system/provenance") - (string-prefix-p (expand-file-name "~/.guix-profile") + (string-prefix-p (expand-file-name "~/.guix-home/profile") (locate-file "emacs" exec-path))) "Variable that is t if on a guix system, nil otherwise.") @@ -1559,7 +1559,7 @@ Setup fancy auto-complete :defer t :config (progn (if is-guix-system-p - (yas-load-directory "~/.guix-profile/share/emacs/site-lisp/yasnippet-snippets-1.0/snippets") + (yas-load-directory "~/.guix-home/profile/share/emacs/site-lisp/yasnippet-snippets-1.0/snippets") (yas-load-directory "~/.emacs.d/elpa/yasnippet-snippets-20200802.1658")) (yas-load-directory (no-littering-expand-etc-file-name "snippets")) (setq-default @@ -2844,9 +2844,9 @@ beneficial as in these languages ligatures are out of place. Upon emacs startup, the following error message appears while loading ~realgud~. #+begin_src text - Loading /home/collin/.guix-profile/share/emacs/site-lisp/realgud/common/custom... - Loading /home/collin/.guix-profile/share/emacs/site-lisp/realgud/common/custom...done - Loading /home/collin/.guix-profile/share/emacs/site-lisp/realgud/lang/java... + Loading /home/collin/.guix-home/profile/share/emacs/site-lisp/realgud/common/custom... + Loading /home/collin/.guix-home/profile/share/emacs/site-lisp/realgud/common/custom...done + Loading /home/collin/.guix-home/profile/share/emacs/site-lisp/realgud/lang/java... Error (use-package): realgud/:catch: Symbol’s value as variable is void: Info-mode-map #+end_src diff --git a/user-config/gpg/.gnupg/gpg-agent.conf b/user-config/gpg/.gnupg/gpg-agent.conf index d06eea3..6207e76 100644 --- a/user-config/gpg/.gnupg/gpg-agent.conf +++ b/user-config/gpg/.gnupg/gpg-agent.conf @@ -20,4 +20,4 @@ max-cache-ttl-ssh 10800 # PIN entry program #pinentry-program /usr/bin/pinentry-curses #pinentry-program /usr/bin/pinentry-qt4 -pinentry-program /home/collin/.guix-profile/bin/pinentry-gtk-2 +pinentry-program /home/collin/.guix-home/profile/bin/pinentry-gtk-2 diff --git a/user-config/rofi/.config/rofi/config.rasi b/user-config/rofi/.config/rofi/config.rasi index 582c76e..e7320e1 100644 --- a/user-config/rofi/.config/rofi/config.rasi +++ b/user-config/rofi/.config/rofi/config.rasi @@ -145,4 +145,4 @@ configuration { } } -@theme "/home/collin/.guix-profile/share/rofi/themes/Arc-Dark.rasi" +@theme "/home/collin/.guix-home/profile/share/rofi/themes/Arc-Dark.rasi" diff --git a/user-config/sway/.config/sway/config b/user-config/sway/.config/sway/config index 71fd927..6072f81 100644 --- a/user-config/sway/.config/sway/config +++ b/user-config/sway/.config/sway/config @@ -25,7 +25,7 @@ set $menu wofi --show run,drun ### Output configuration # You can get the names of your outputs by running: swaymsg -t get_outputs -output * res 1920x1080 bg /home/collin/.guix-profile/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill +output * res 1920x1080 bg /home/collin/.guix-home/profile/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill # Set inner window gaps gaps inner 4 diff --git a/user-config/xorg/.bin/startx.sh b/user-config/xorg/.bin/startx.sh index 0623408..be63256 100755 --- a/user-config/xorg/.bin/startx.sh +++ b/user-config/xorg/.bin/startx.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -GUIX_PROFILE=~/.guix-profile +GUIX_PROFILE=~/.guix-home/profile if [ ! -z "$GUIX_ENVIRONMENT" ]; then # When in a guix environment, extend particular environment variables diff --git a/user-config/xorg/.xinitrc b/user-config/xorg/.xinitrc index 819385e..252e611 100755 --- a/user-config/xorg/.xinitrc +++ b/user-config/xorg/.xinitrc @@ -5,7 +5,7 @@ # session-type is "full", "min", or "new"; if any other string is given, defaults to "full" # TODO: this is only useful on non-guix systems, however a similar -# thing could be done for ~/.guix-profile/etc/X11/xinit/xinitrc.d, +# thing could be done for ~/.guix-home/profile/etc/X11/xinit/xinitrc.d, # however on guix this path is empty (not provided by xinit package) # # # Runs system-wide xinitrc scripts @@ -25,15 +25,6 @@ init_full_session() { # Set random wallpaper # [ -d ~/.wallback ] && feh --randomize --bg-scale ~/.wallback/* - # TODO: guix - # # Start geoclue for use by redshift - # #/usr/lib/geoclue-2.0/demos/agent & - - # TODO: guix - # # Star redshift - # redshift -l geoclue2 & - # #redshift -l 43.4503:-80.4832 & - # TODO: guix # # Unclutter the desktop and remove mouse pointer when inactive # unclutter & diff --git a/user-config/zsh/.zprofile b/user-config/zsh/.zprofile index 19c7ae0..caa6e19 100644 --- a/user-config/zsh/.zprofile +++ b/user-config/zsh/.zprofile @@ -1,8 +1,11 @@ # Honor system-wide environment variables source /etc/profile +# Honor user ~/.profile (required for guix-home) +if [ -f ~/.profile ]; then source ~/.profile; fi + # Setup guix profile locales -export GUIX_LOCPATH=${HOME}/.guix-profile/lib/locale +export GUIX_LOCPATH=${HOME}/.guix-home/profile/lib/locale # Add local binaries to PATH export PATH="${PATH}:$HOME/.bin" diff --git a/user-config/zsh/.zshenv b/user-config/zsh/.zshenv index 2924058..dcf5cb6 100644 --- a/user-config/zsh/.zshenv +++ b/user-config/zsh/.zshenv @@ -5,8 +5,8 @@ export EDITOR="emacsclient -t" # $EDITOR should open in terminal export VISUAL="emacsclient -a emacs" # $VISUAL opens in GUI with non-daemon as alternate # TODO: this was added for guix-wsl but likely is not needed any longer -export GUILE_LOAD_PATH="${GUILE_LOAD_PATH}:$HOME/.guix-profile/share/guile/site/3.0" -export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH}:$HOME/.guix-profile/lib/guile/3.0/site-ccache" +export GUILE_LOAD_PATH="${GUILE_LOAD_PATH}:$HOME/.guix-home/profile/share/guile/site/3.0" +export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH}:$HOME/.guix-home/profile/lib/guile/3.0/site-ccache" # Use gpg-agent ssh-agent emulation export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" diff --git a/user-config/zsh/.zshrc b/user-config/zsh/.zshrc index 1751602..5295d0c 100644 --- a/user-config/zsh/.zshrc +++ b/user-config/zsh/.zshrc @@ -5,16 +5,16 @@ # # Add ~/.zsh_resources/completions to $fpath (needs to come before 'compinit') # fpath=( ~/.zsh_resources/completions "${fpath[@]}" ) -source ~/.guix-profile/bin/z.sh +source ~/.guix-home/profile/bin/z.sh precmd () { z --add "$(pwd -P)" } # Use zsh-autosuggestions (requires pacman package) -source ~/.guix-profile/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh +source ~/.guix-home/profile/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh # TODO: temporary -fpath=( ~/.guix-profile/share/zsh/site-functions "${fpath[@]}" ) +fpath=( ~/.guix-home/profile/share/zsh/site-functions "${fpath[@]}" ) # The following lines were added by compinstall zstyle ':completion:*' completer _list _expand _complete _ignored _match _correct _approximate _prefix @@ -99,8 +99,8 @@ setopt COMPLETE_ALIASES # Complete command line switches for aliases bindkey -e # Lines to add fzf fuzzy completion widgets supplied by fzf package -source ~/.guix-profile/share/fzf/key-bindings.zsh -source ~/.guix-profile/share/fzf/completion.zsh +source ~/.guix-home/profile/share/fzf/key-bindings.zsh +source ~/.guix-home/profile/share/fzf/completion.zsh # Rebind C-t for fzf-file-widget to ESC-t bindkey -r '^T' @@ -224,7 +224,7 @@ eval "$(direnv hook zsh)" # echo "UPDATESTARTUPTTY" | gpg-connect-agent > /dev/null 2>&1 # Use zsh-source-highlight -source ~/.guix-profile/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +source ~/.guix-home/profile/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # TODO: not packaged on guix # # Initialize nvm for managing node environments