diff --git a/.bash_profile b/.bash_profile index a49a138..68704bb 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,4 +1,4 @@ -# [[file:Shell.org::*=.bash_profile=][=.bash_profile=:1]] +# [[file:Console.org::*=.bash_profile=][=.bash_profile=:1]] [[ -f ~/.profile ]] && . ~/.profile [[ -f ~/.bashrc ]] && . ~/.bashrc diff --git a/.bashrc b/.bashrc index d7746a4..044e03f 100644 --- a/.bashrc +++ b/.bashrc @@ -1,23 +1,37 @@ -# [[file:Shell.org::*Startup & environment][Startup & environment:1]] -[[ $- != *i* ]] && return - -xhost +local:root > /dev/null 2>&1 - -use_fish=true +# [[file:Console.org::*Startup & environment][Startup & environment:1]] +export SHELL # Startup & environment:1 ends here -# [[file:Shell.org::*Startup & environment][Startup & environment:2]] -export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'" +# [[file:Console.org::*Startup & environment][Startup & environment:2]] +if [[ $- != *i* ]] +then + [[ -n "$SSH_CLIENT" ]] && source /etc/profile + return +fi # Startup & environment:2 ends here -# [[file:Shell.org::*Launch fish][Launch fish:1]] +# [[file:Console.org::*Startup & environment][Startup & environment:3]] +source /etc/bashrc +# Startup & environment:3 ends here + +# [[file:Console.org::*Startup & environment][Startup & environment:4]] +xhost +local:root > /dev/null 2>&1 +# Startup & environment:4 ends here + +# [[file:Console.org::*Startup & environment][Startup & environment:5]] +export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'" +# Startup & environment:5 ends here + +# [[file:Console.org::*Launch fish][Launch fish:1]] +use_fish=true + if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} ]] then exec fish fi # Launch fish:1 ends here -# [[file:Shell.org::*Colors][Colors:1]] +# [[file:Console.org::*Colors][Colors:1]] use_color=true # Set colorful PS1 only on colorful terminals. @@ -66,7 +80,7 @@ fi unset use_color safe_term match_lhs sh # Colors:1 ends here -# [[file:Shell.org::*Settings][Settings:1]] +# [[file:Console.org::*Settings][Settings:1]] complete -cf sudo # Sudo autocompletion shopt -s checkwinsize # Check windows size after each command @@ -74,22 +88,14 @@ shopt -s expand_aliases # Aliases shopt -s autocd # Cd to directory just by typing its name (without cd) # Settings:1 ends here -# [[file:Shell.org::*Settings][Settings:2]] +# [[file:Console.org::*Settings][Settings:2]] shopt -s histappend export HISTCONTROL=ignoredups:erasedups HISTSIZE= HISTFILESIZE= # Settings:2 ends here -# [[file:Shell.org::*Settings][Settings:3]] -[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion -if [ -d "/usr/share/fzf" ]; then - source /usr/share/fzf/completion.bash - source /usr/share/fzf/key-bindings.bash -fi -# Settings:3 ends here - -# [[file:Shell.org::*Aliases][Aliases:1]] +# [[file:Console.org::*Aliases][Aliases:1]] alias v="vim" alias gg="lazygit" alias ls="exa --icons" @@ -98,23 +104,6 @@ alias q="exit" alias c="clear" # Aliases:1 ends here -# [[file:Shell.org::*Anaconda][Anaconda:1]] -# >>> conda initialize >>> -# !! Contents within this block are managed by 'conda init' !! -__conda_setup="$('/home/pavel/Programs/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" -if [ $? -eq 0 ]; then - eval "$__conda_setup" -else - if [ -f "/home/pavel/Programs/miniconda3/etc/profile.d/conda.sh" ]; then - . "/home/pavel/Programs/miniconda3/etc/profile.d/conda.sh" - else - export PATH="/home/pavel/Programs/miniconda3/bin:$PATH" - fi -fi -unset __conda_setup -# <<< conda initialize <<< -# Anaconda:1 ends here - -# [[file:Shell.org::*Starship prompt][Starship prompt:1]] +# [[file:Console.org::*Starship prompt][Starship prompt:1]] eval "$(starship init bash)" # Starship prompt:1 ends here diff --git a/.config/fish/config.fish b/.config/fish/config.fish index dead4cf..96ac415 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -1,8 +1,8 @@ -# [[file:../../Shell.org::*Fish][Fish:1]] +# [[file:../../Console.org::*Fish][Fish:1]] starship init fish | source # Fish:1 ends here -# [[file:../../Shell.org::*Fish][Fish:2]] +# [[file:../../Console.org::*Fish][Fish:2]] fish_vi_key_bindings alias v="vim" @@ -13,14 +13,7 @@ alias q="exit" alias c="clear" # Fish:2 ends here -# [[file:../../Shell.org::*Fish][Fish:3]] -# >>> conda initialize >>> -# !! Contents within this block are managed by 'conda init' !! -eval /home/pavel/Programs/miniconda3/bin/conda "shell.fish" "hook" $argv | source -# <<< conda initialize <<< -# Fish:3 ends here - -# [[file:../../Shell.org::*Fish][Fish:4]] +# [[file:../../Console.org::*Fish][Fish:4]] if ! test -n "$TMUX"; and ! test -n "$IS_EMACS"; colorscript random end diff --git a/.config/starship.toml b/.config/starship.toml index 489f834..a94e3dc 100644 --- a/.config/starship.toml +++ b/.config/starship.toml @@ -1,8 +1,5 @@ # [[file:../Console.org::*Starship prompt][Starship prompt:1]] [character] -# success_symbol = "[➤](bold green)" -# vicmd_symbol = "[ᐊ](bold green)" -# error_symbol = "[](bold red)" success_symbol = "[➤ ](bold green)" error_symbol = "[ ](bold red)" vicmd_symbol = "[ᐊ ](bold green)" diff --git a/.profile b/.profile index 30b6248..e38ffc7 100644 --- a/.profile +++ b/.profile @@ -1,57 +1,34 @@ -# [[file:Shell.org::*Environment][Environment:1]] -export EDITOR=/usr/bin/vim -export BROWSER=/usr/bin/firefox +# [[file:Console.org::*Environment][Environment:1]] +# export EDITOR=/usr/bin/vim +# export BROWSER=/usr/bin/firefox export QT_QPA_PLATFORMTHEME="qt5ct" export QT_AUTO_SCREEN_SCALE_FACTOR=0 -export GTK2_RC_FILES="$HOME/.gtkrc-2.0" +# export GTK2_RC_FILES="$HOME/.gtkrc-2.0" # Environment:1 ends here -# [[file:Shell.org::*Various paths][Various paths:1]] +# [[file:Console.org::*My paths][My paths:1]] if [ -d "$HOME/bin" ] ; then export PATH="$HOME/bin:$PATH" export PATH="$HOME/bin/scripts:$PATH" fi -# Various paths:1 ends here +# My paths:1 ends here -# [[file:Shell.org::*Various paths][Various paths:2]] -if [ -d "/usr/local/texlive/2020" ]; then - export MANPATH="/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH" - export INFOPATH="/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH" - export PATH="/usr/local/texlive/2020/bin/x86_64-linux:$PATH" -fi -# Various paths:2 ends here +# [[file:Console.org::*Guix settings][Guix settings:1]] +GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles +for i in $GUIX_EXTRA_PROFILES/*; do + profile=$i/$(basename "$i") + if [ -f "$profile"/etc/profile ]; then + GUIX_PROFILE="$profile" + . "$GUIX_PROFILE"/etc/profile + fi + unset profile +done +# Guix settings:1 ends here -# [[file:Shell.org::*Various paths][Various paths:3]] -if [ -d "$HOME/.cargo" ] ; then - export PATH="$HOME/.cargo/bin:$PATH" -fi -# Various paths:3 ends here +# [[file:Console.org::*Guix settings][Guix settings:2]] +export GUIX_PACKAGE_PATH=~/guix-packages +# Guix settings:2 ends here -# [[file:Shell.org::*Various paths][Various paths:4]] -if [ -d "$HOME/.rvm" ] ; then - export PATH="$PATH:$HOME/.rvm/bin" -fi -# if [ -d "$HOME/.gem" ]; then -# export PATH="$HOME/.gem/ruby/2.7.0/bin:$PATH" -# fi -# Various paths:4 ends here - -# [[file:Shell.org::*Various paths][Various paths:5]] -if [ -d "$HOME/go" ] ; then - export PATH="$HOME/go/bin:$PATH" -fi -# Various paths:5 ends here - -# [[file:Shell.org::*Various paths][Various paths:6]] -[ -f "/home/pavel/.ghcup/env" ] && source "/home/pavel/.ghcup/env" # ghcup-env -# Various paths:6 ends here - -# [[file:Shell.org::*Various paths][Various paths:7]] -if [ -d "$HOME/perl5" ] ; then - PATH="/home/pavel/perl5/bin${PATH:+:${PATH}}" - PERL5LIB="/home/pavel/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; - PERL_LOCAL_LIB_ROOT="/home/pavel/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; - PERL_MB_OPT="--install_base \"/home/pavel/perl5\""; export PERL_MB_OPT; - PERL_MM_OPT="INSTALL_BASE=/home/pavel/perl5"; export PERL_MM_OPT; -fi -# Various paths:7 ends here +# [[file:Console.org::*XResources][XResources:1]] +xrdb ~/.Xresources +# XResources:1 ends here diff --git a/.tmux.conf b/.tmux.conf index a5fcc1b..3269048 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,26 +1,26 @@ -# [[file:Shell.org::*Term settings][Term settings:1]] +# [[file:Console.org::*Term settings][Term settings:1]] set -g default-terminal "screen-256color" set -ga terminal-overrides ",*256col*:Tc" # Term settings:1 ends here -# [[file:Shell.org::*Term settings][Term settings:2]] +# [[file:Console.org::*Term settings][Term settings:2]] set -g history-limit 20000 # Term settings:2 ends here -# [[file:Shell.org::*Keybindings][Keybindings:1]] +# [[file:Console.org::*Keybindings][Keybindings:1]] set-window-option -g mode-keys vi set-option -g xterm-keys on set-option -g mouse on set -sg escape-time 10 # Keybindings:1 ends here -# [[file:Shell.org::*Keybindings][Keybindings:2]] +# [[file:Console.org::*Keybindings][Keybindings:2]] unbind C-b set -g prefix C-a bind C-a send-prefix # Keybindings:2 ends here -# [[file:Shell.org::*Keybindings][Keybindings:3]] +# [[file:Console.org::*Keybindings][Keybindings:3]] bind h select-pane -L bind j select-pane -D bind k select-pane -U @@ -34,15 +34,15 @@ bind-key t next-window bind-key T previous-window # Keybindings:3 ends here -# [[file:Shell.org::*Keybindings][Keybindings:4]] +# [[file:Console.org::*Keybindings][Keybindings:4]] bind r source-file ~/.tmux.conf # Keybindings:4 ends here -# [[file:Shell.org::*Copy to clipboard][Copy to clipboard:1]] +# [[file:Console.org::*Copy to clipboard][Copy to clipboard:1]] bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" # Copy to clipboard:1 ends here -# [[file:Shell.org::*UI][UI:2]] +# [[file:Console.org::*UI][UI:2]] source ~/.tmux.line.conf # UI:2 ends here diff --git a/.tmux.line.conf b/.tmux.line.conf index dade644..e522bb0 100644 --- a/.tmux.line.conf +++ b/.tmux.line.conf @@ -1,4 +1,4 @@ -# [[file:Shell.org::*UI][UI:1]] +# [[file:Console.org::*UI][UI:1]] # This tmux statusbar config was created by tmuxline.vim # on Wed, 22 Jan 2020 diff --git a/Console.org b/Console.org index c4bf6c5..7ae803f 100644 --- a/Console.org +++ b/Console.org @@ -3,8 +3,8 @@ #+PROPERTY: header-args :mkdirp yes #+PROPERTY: header-args:conf-space :comments link #+PROPERTY: header-args:conf-toml :comments link -#+PROPERTY: header-args:sh :tangle-mode (identity #o755) :comments link :shebang "#!/bin/sh" -#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/bin/bash" +#+PROPERTY: header-args:sh :tangle-mode (identity #o755) :comments link :shebang "#!/usr/bin/env sh" +#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/usr/bin/env bash" * Contents :PROPERTIES: @@ -42,13 +42,13 @@ :END: ** Environment #+begin_src sh -export EDITOR=/usr/bin/vim -export BROWSER=/usr/bin/firefox +# export EDITOR=/usr/bin/vim +# export BROWSER=/usr/bin/firefox export QT_QPA_PLATFORMTHEME="qt5ct" export QT_AUTO_SCREEN_SCALE_FACTOR=0 -export GTK2_RC_FILES="$HOME/.gtkrc-2.0" +# export GTK2_RC_FILES="$HOME/.gtkrc-2.0" #+end_src -** Various paths +** My paths My script folders #+begin_src sh if [ -d "$HOME/bin" ] ; then @@ -56,9 +56,38 @@ if [ -d "$HOME/bin" ] ; then export PATH="$HOME/bin/scripts:$PATH" fi #+end_src +** Guix settings +Enable extra profiles + +#+begin_src sh +GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles +for i in $GUIX_EXTRA_PROFILES/*; do + profile=$i/$(basename "$i") + if [ -f "$profile"/etc/profile ]; then + GUIX_PROFILE="$profile" + . "$GUIX_PROFILE"/etc/profile + fi + unset profile +done +#+end_src + +Set a folder for my packages. +#+begin_src sh +export GUIX_PACKAGE_PATH=~/guix-packages +#+end_src +** XResources +| Guix dependency | +|-----------------| +| xrdb | + +#+begin_src sh +xrdb ~/.Xresources +#+end_src +** OFF (OFF) Package manager paths +Turned off for now, because probably it won't be necessary in Guix. LaTeX -#+begin_src sh +#+begin_src sh :tangle no if [ -d "/usr/local/texlive/2020" ]; then export MANPATH="/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH" export INFOPATH="/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH" @@ -67,14 +96,14 @@ fi #+end_src Cargo (Rust) -#+begin_src sh +#+begin_src sh :tangle no if [ -d "$HOME/.cargo" ] ; then export PATH="$HOME/.cargo/bin:$PATH" fi #+end_src RVM (Ruby) -#+begin_src sh +#+begin_src sh :tangle no if [ -d "$HOME/.rvm" ] ; then export PATH="$PATH:$HOME/.rvm/bin" fi @@ -84,19 +113,19 @@ fi #+end_src Go -#+begin_src sh +#+begin_src sh :tangle no if [ -d "$HOME/go" ] ; then export PATH="$HOME/go/bin:$PATH" fi #+end_src ghcup (Haskell) -#+begin_src sh +#+begin_src sh :tangle no [ -f "/home/pavel/.ghcup/env" ] && source "/home/pavel/.ghcup/env" # ghcup-env #+end_src Perl -#+begin_src sh +#+begin_src sh :tangle no if [ -d "$HOME/perl5" ] ; then PATH="/home/pavel/perl5/bin${PATH:+:${PATH}}" PERL5LIB="/home/pavel/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; @@ -119,14 +148,33 @@ fi :PROPERTIES: :header-args+: :tangle ./.bashrc :END: + +My =.bashrc=, which has pieces from the default ones in Guix & Manjaro, as well some mine settings. + *** Startup & environment -Return if not run interactively & stuff +Export 'SHELL' to child processes. Programs such as 'screen' honor it and otherwise use /bin/sh. #+begin_src bash -[[ $- != *i* ]] && return +export SHELL +#+end_src +We are being invoked from a non-interactive shell. If this is an SSH session (as in "ssh host command"), source /etc/profile so we get PATH and other essential variables. + +#+begin_src bash +if [[ $- != *i* ]] +then + [[ -n "$SSH_CLIENT" ]] && source /etc/profile + return +fi +#+end_src + +Source the system-wide file +#+begin_src bash +source /etc/bashrc +#+end_src + +Allow other users to access X server. Necessary for stuff like aw-watcher-window. +#+begin_src bash xhost +local:root > /dev/null 2>&1 - -use_fish=true #+end_src Set manpager to bat @@ -136,6 +184,8 @@ export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'" *** Launch fish Launch fish shell unless bash itself is launched from fish. #+begin_src bash +use_fish=true + if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} ]] then exec fish @@ -214,7 +264,7 @@ HISTFILESIZE= #+end_src Autocompletions -#+begin_src bash +#+begin_src bash :tangle no [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion if [ -d "/usr/share/fzf" ]; then source /usr/share/fzf/completion.bash @@ -230,13 +280,13 @@ alias ll="exa -lah --icons" alias q="exit" alias c="clear" #+end_src -*** Anaconda +*** OFF (OFF) Anaconda #+begin_quote managed by 'conda init' !!! #+end_quote Yeah, tell this to yourself -#+begin_src bash +#+begin_src bash :tangle no # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/home/pavel/Programs/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" @@ -261,6 +311,10 @@ eval "$(starship init bash)" :header-args+: :tangle ./.config/fish/config.fish :comments link :END: +| Guix dependency | Description | +|-----------------+------------------------------------------| +| fish | An alternative non POSIX-compliant shell | + [[https://fishshell.com/][Fish shell]] is a non-POSIX-compliant shell, which offers some fancy UI & UX features. Launch starship @@ -276,13 +330,17 @@ fish_vi_key_bindings #+end_src Anaconda -#+begin_src fish +#+begin_src fish :tangle no # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! eval /home/pavel/Programs/miniconda3/bin/conda "shell.fish" "hook" $argv | source # <<< conda initialize <<< #+end_src +| Guix dependency | +|-----------------| +| dt-colorscripts | + Launch a random [[https://gitlab.com/dwt1/shell-color-scripts][DT's colorscript]] unless ran inside tmux or Emacs. #+begin_src fish if ! test -n "$TMUX"; and ! test -n "$IS_EMACS"; @@ -290,6 +348,10 @@ if ! test -n "$TMUX"; and ! test -n "$IS_EMACS"; end #+end_src * Starship prompt +| Guix dependency | Description | +|-----------------+---------------------| +| rust-starship | my prompt of choice | + [[https://starship.rs/][Starship]] is a nice cross-shell prompt, written in Rust. References: @@ -376,6 +438,10 @@ symbol = " " :PROPERTIES: :header-args+: :tangle ./.tmux.conf :END: +| Guix dependency | +|-----------------| +| tmux | + [[https://github.com/tmux/tmux][tmux]] is my terminal multiplexer of choice. It provides pretty sane defaults, so the config is not too large. I rebind the prefix to =C-a= though. @@ -426,6 +492,10 @@ Reload the config. bind r source-file ~/.tmux.conf #+end_src ** Copy to clipboard +| Guix dependency | +|-----------------| +| xclip | + Make tmux copying copy to clipboard as well #+begin_src conf-space bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" @@ -466,6 +536,10 @@ source ~/.tmux.line.conf :header-args+: :tangle ./.config/alacritty/alacritty.yml :comments link :END: +| Guix dependency | +|-----------------| +| alacritty | + [[https://github.com/alacritty/alacritty][Alacritty]] is a GPU-accelerated terminal emulator. I haven't found it to be an inch faster than st, but configuration the in yml format is way more convinient than patches. Once again, we have an application which doesn't support reading Xresources, so here goes noweb. @@ -552,3 +626,25 @@ key_bindings: - { key: Minus, mods: Control, action: DecreaseFontSize } - { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } #+end_src +* Various applications +| Guix dependency | Description | +|-----------------+--------------------------------------| +| ncurses | provides stuff like ~clear~ | +| exa | ~ls~ replacement, written in Rust | +| bat | ~cat~ clone with syntax highlighting | + +| Note | Description | +|------+-----------------| +| TODO | package fselect | + +* Guix settings +#+NAME: packages +#+begin_src emacs-lisp :tangle no +(my/format-guix-dependencies) +#+end_src + +#+begin_src scheme :tangle .config/guix/manifests/console.scm :noweb yes +(specifications->manifest + '( + <>)) +#+end_src