Compare commits

...

14 Commits

Author SHA1 Message Date
Michel 389aed041b Merge branch 'main' into opt 2024-04-24 11:46:00 +02:00
Michel 59928f6906 docs: Install Read Me 2024-04-16 10:07:34 +02:00
Michel db59542fe7 feat(nnn): set env vars as local 2024-04-16 09:51:20 +02:00
Michel a2d96c7305 fix: correct git-delta name 2024-03-26 14:15:42 +01:00
Michel fee26ef59c feat(kitty): update config 2024-03-26 14:10:41 +01:00
Michel cad63fc753 docs: both user & /opt in ReadMe 2024-03-11 19:23:31 +01:00
Michel ec705f2a96 feat(zsh): adapt to kicksecure 2024-03-11 19:05:52 +01:00
Michel d8826feafe feat: adapt to Debian 12 2024-02-27 09:49:37 +01:00
Michel 761f4c027a feat: User "user" 2024-02-26 16:34:22 +01:00
Michel 831521dbc1 feat: bat & nvim 2024-02-23 15:48:08 +01:00
Michel b7c5907ba0 feat: XFCE default browser 2024-02-23 15:46:19 +01:00
Michel acd9dbbae1 feat: new installation update 2024-02-22 18:37:43 +01:00
Michel 082c534e0d docs: install nnn 2024-02-13 14:59:10 +01:00
Michel 6167ebe389 feat(nnn): zsh config 2024-02-13 14:19:12 +01:00
15 changed files with 351 additions and 107 deletions

View File

@ -34,6 +34,13 @@ dotfiles checkout 2>&1 | egrep "\s+" | awk {'print $1'} |
dotfiles checkout
```
When the `fetch` configuration is not set, insert the following line in
`.dotfiles/config`:
```config
fetch = +refs/heads/*:refs/remotes/origin/*
```
## Install into `/etc/skel`
```sh
@ -68,10 +75,28 @@ lazygit --git-dir=$HOME/.dotfiles --work-tree=$HOME
- Note 1: Must be called from $HOME
- Note 2: Do not start <target-folder> with $HOME or ~
# Install recent versions of applications
# Every-day Tools
Recommended installation order:
- System Config
- [Debian packages](#debian)
- Qubes proxy scripts (TODO)
- dotfiles (see above)
- [ASDF](#asdf) & plugins
- Newer Debian packages: `bin/versions_check`
- [Fonts](#fonts)
- [kitty](#kitty) — `st`?
- [lazygit](#lazygit)
- [nnn](#nnn)
- [neovim](#neovim)
## Generic Tips
### Desktop Files
See <https://specifications.freedesktop.org/desktop-entry-spec/latest/>
### Github Patches
From [stackoverflow](https://stackoverflow.com/questions/28484186/apply-github-commit-pull-request-as-a-patch).
@ -81,17 +106,52 @@ wget https://github.com/jesseduffield/lazygit/pull/2604.patch
git apply --stat --apply 2604.patch
```
## Fonts
### Qubes Internet Access
- [How to install and manage fonts on Linux](https://linuxconfig.org/how-to-install-and-manage-fonts-on-linux)
- `mv folder ~/.fonts`
- `fc-cache -fv ~/.fonts`
- In _Basic_, connect to `sys-firewall`;
- In _Firewall rules_:
- check _Limit outgoing connections_;
- check _Allow full access for 25 minutes_.
## System Config
- [SysRq](https://www.kicksecure.com/wiki/SysRq)
## Debian Packages {#debian}
```sh
apt install curl fd-find fzf git grc ripgrep wget xdg-utils
dpkg-divert --divert /usr/bin/fd --rename /usr/bin/fdfind
dpkg-divert --divert /usr/share/man/man1/fd.1.gz --rename /usr/share/man/man1/fdfind.1.gz
dpkg-divert --divert /usr/share/zsh/vendor-completions/_rg --rename /usr/share/zsh/vendor-completions/rg.zsh
```
## ASDF & main plugins {#asdf}
`.zshrc` will install `asdf`.
Make sure you have the required [system dependencies](https://github.com/pyenv/pyenv/wiki#suggested-build-environment)
before installing/compiling Python.
```sh
sudo apt install --no-install-recommends XXX
asdf plugin add direnv
asdf plugin add python
cd ~/bin
asdf current
asdf install
```
## Fonts {#fonts}
- [JetBrains Mono](https://www.jetbrains.com/lp/mono/)
- Install the files **without “NL”** (i.e No Ligatures) in their names
- Install the files **without** “NL” (No Ligatures) in their names
- [Nerd Fonts](https://www.nerdfonts.com/)
- [Download](https://github.com/ryanoasis/nerd-fonts/tags)
- JetBrainsMono.tar.xz
- NerdFontsSymbolsOnly.tar.xz
- [Cheat Sheet](https://www.nerdfonts.com/cheat-sheet)
- <https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/bin/scripts/test-fonts.sh>
@ -107,19 +167,66 @@ git apply --stat --apply 2604.patch
</fontconfig>
```
## kitty
- <https://sw.kovidgoyal.net/kitty/binary/>
- Install `JetBrains Mono` (without NF) & `NerdFontsSymbolsOnly` fonts.
- Note: outside of kitty, it may be interesting to also install
_JetBrains Mono_ **with** _NF_.
### in $HOME/.fonts
```sh
sudo apt-get install kitty-terminfo
mv folder ~/.fonts
fc-cache -fv ~/.fonts
```
(kitty --version && curl https://sw.kovidgoyal.net/kitty/changelog/ | html2text) | less
See also [How to install and manage fonts on Linux](https://linuxconfig.org/how-to-install-and-manage-fonts-on-linux).
### in /opt/fonts
`/etc/fonts/conf.d/00-opt.conf`:
```xml
<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/opt/fonts</dir>
</fontconfig>
```
```sh
sudo mv folder /opt/fonts
fc-cache -fv /opt/fonts
```
## kitty {#kitty}
- <https://sw.kovidgoyal.net/kitty/binary/>
### Dependencies
- `JetBrains Mono` (without NL)
- `NerdFontsSymbolsOnly`
- Note: outside of kitty, it may be interesting to also install
_JetBrains Mono_ **with** _NL_.
- terminfo
```sh
sudo apt install kitty-terminfo
# OR:
wget 'https://salsa.debian.org/debian/kitty/-/raw/debian/sid/terminfo/x/xterm-kitty
```
### Install
```sh
# Show installed version, debian package & changelog
(ls =kitty;
kitty --version;
apt show kitty;
curl https://sw.kovidgoyal.net/kitty/changelog/ | html2text) | less
# Debian package
sudo apt install kitty
# In $HOME
sh ~/.config/kitty/installer.sh
# In /opt/kitty.app
sudo sh ~/.config/kitty/installer.sh launch=n dest=/opt
sudo update-alternatives \
--install /usr/bin/x-terminal-emulator \
x-terminal-emulator /opt/kitty.app/bin/kitty 99
@ -129,11 +236,30 @@ sudo update-alternatives \
Kitty prepends its _bin_ folder to the path.
So it is more coherent/simpler to copy this behaviour into Zsh.
## lazygit
## lazygit {#lazygit}
### Dependencies
- git-delta
- go language (when compiling)
```sh
# debian testing & unstable:
apt install git-delta
```
### From Source
```sh
mkdir -p $HOME/dev_3rd/golang
cd $HOME/dev_3rd/golang
git clone https://github.com/jesseduffield/lazygit.git
cd lazygit
path+=(/usr/lib/go-1.21/bin)
go install
```
### Binary Releases
@ -153,9 +279,10 @@ wget $LOCATION
tar xf *.tar.gz(om[1])
```
### Go
### From Go Package
```sh
go install github.com/jesseduffield/lazygit@latest
export GOPATH=/opt/go && sudo mkdir -p $GOPATH
sudo -E go install github.com/jesseduffield/lazygit@latest
```
@ -167,18 +294,7 @@ $ lazygit --version
commit=, build date=, build source=unknown, version=unversioned, os=linux, arch=amd64, git version=2.43.0
```
### Manual
```sh
mkdir -p $HOME/dev_3rd/golang
cd $HOME/dev_3rd/golang
git clone https://github.com/jesseduffield/lazygit.git
cd lazygit
go install
```
## neovim
## neovim {#neovim}
### Dependencies
@ -189,6 +305,9 @@ go install
### Binary Nightly Release
```sh
mkdir -p $HOME/.local/bin
cd $HOME/.local/bin
# ---
mkdir -p /opt/neovim/bin
cd /opt/neovim/bin
@ -202,7 +321,13 @@ nvim --version
vi --version
```
## nnn — n³
### flatpak
```sh
flatpak install flathub io.neovim.nvim
```
## nnn — n³ {#nnn}
### Dependencies
@ -220,30 +345,33 @@ vi --version
- Trash:
- `trash-cli` is a much better CLI-only solution!
Compare the outputs of `trash-cli` and `gio trash --list`
<https://github.com/andreafrancia/trash-cli>
- For `gio trash`, packages `libglib2.0` & `gvfs` are recommended.
### Source Code of Latest Release
### From source
```sh
# Download archive & extract files
# From release
URI=https://github.com/jarun/nnn
xdg-open $URI/releases/latest
ARCHIVE=$(echo $HOME/Downloads/*.gz(om[1])) && echo $ARCHIVE
tar xf $ARCHIVE
# From repository
git clone https://github.com/jarun/nnn.git
# Compile
cd nnn*(om[1])
make clean
sudo make O_GITSTATUS=1 O_NAMEFIRST=1 O_NERD=1 install
sudo make PREFIX=/opt/nnn O_GITSTATUS=1 O_NAMEFIRST=1 O_NERD=1 install
# Copy plugins
plugins/getplugs master
sudo cp -v misc/auto-completion/zsh/* /usr/local/share/zsh/site-functions
sudo chmod a+r /usr/local/share/zsh/site-functions/*
# Plugins
mv -v ~/.config/nnn/plugins plugins_$(stat -c %Y ~/.config/nnn/plugins)
mkdir -p ~/.config/nnn
cp -av plugins ~/.config/nnn
```
### From repository
```sh
git clone https://github.com/jarun/nnn.git
```
and then, as above…

View File

@ -1,5 +1,5 @@
[Desktop Entry]
Exec=/home/michel/bin/once-connected.zsh
Exec=/home/user/bin/once-connected.zsh
Icon=user
Name=once-connected.zsh
Terminal=false

View File

@ -6,4 +6,4 @@ Suites: xenial
Components: main
Architectures: amd64
Trusted: no
Signed-By: /usr/share/keyrings/signal-desktop-keyring.gpg
Signed-By: /etc/apt/keyrings/signal-desktop-keyring.gpg

View File

@ -1,2 +0,0 @@
NC_STORAGE=$HOME/NC-Michel/Linux/folder
ALT_HISTORY_FILE=$HOME/NC-Michel/Linux/another-folder/history

View File

@ -36,12 +36,13 @@ symbol_map U+e0ca Symbols Nerd Font
symbol_map U+e0cc-U+e0d4 Symbols Nerd Font
symbol_map U+e200-U+e2a9 Symbols Nerd Font
symbol_map U+e300-U+e3e3 Symbols Nerd Font
symbol_map U+e5fa-U+e6a6 Symbols Nerd Font
symbol_map U+e5fa-U+e6b1 Symbols Nerd Font
symbol_map U+e700-U+e7c5 Symbols Nerd Font
symbol_map U+ea60-U+ebeb Symbols Nerd Font
symbol_map U+f000-U+f2e0 Symbols Nerd Font
symbol_map U+f300-U+f32f Symbols Nerd Font
symbol_map U+f300-U+f372 Symbols Nerd Font
symbol_map U+f400-U+f532 Symbols Nerd Font
symbol_map U+f500-U+fd46 Symbols Nerd Font
symbol_map U+f0001-U+f1af0 Symbols Nerd Font
#: Cursor customization {{{1
@ -90,6 +91,7 @@ enabled_layouts grid, splits, stack, tall:bias=70;full_size=2
tab_bar_style fade
tab_fade 0.80 0.85 0.90 0.95
tab_bar_min_tabs 1
active_tab_foreground #000
active_tab_background #FAA
active_tab_font_style bold
@ -117,6 +119,8 @@ dynamic_background_opacity yes
#: OS specific tweaks {{{1
editor vi
#: }}}1

View File

@ -1,8 +1,5 @@
# Documentation:
# https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md
#
# To upgrade to latest binary:
# `go install github.com/jesseduffield/lazygit@latest`
customCommands:
@ -71,6 +68,9 @@ keybinding:
notARepository: 'skip'
os:
editPreset: 'nvim'
refresher:
refreshInterval: 30
fetchInterval: 3600

2
.config/xfce4/helpers.rc Normal file
View File

@ -0,0 +1,2 @@
WebBrowser=firefox
TerminalEmulator=kitty

View File

@ -1,10 +1,3 @@
# To update:
# ```
# curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage \
# --output-dir $HOME/bin &&
# chmod u+x $HOME/bin/nvim.appimage
# ```
#
[Desktop Entry]
Name=Neovim ($HOME/bin)
GenericName=Text Editor
@ -17,6 +10,3 @@ Icon=nvim
Categories=Utility;TextEditor;
StartupNotify=false
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
#
# See https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

View File

@ -0,0 +1,11 @@
[Desktop Entry]
NoDisplay=true
Version=1.0
Encoding=UTF-8
Type=X-XFCE-Helper
X-XFCE-Category=WebBrowser
X-XFCE-CommandsWithParameter=flatpak run org.mozilla.firefox -ProfileManager "%s"
Icon=firefox
Name=firefox flatpak
X-XFCE-Commands=flatpak run org.mozilla.firefox -ProfileManager

8
.xsessionrc Normal file
View File

@ -0,0 +1,8 @@
# https://wiki.debian.org/Xsession
LOG=$HOME/.xsessionrc.log
touch $LOG
export NC_STORAGE=$HOME/NC-Michel/Linux/michdell
export ALT_HISTORY_FILE=$HOME/NC-Michel/Linux/VQubes/history
export >> $LOG

104
.zshrc
View File

@ -1,18 +1,5 @@
#!/bin/zsh
###
### Debian Settings
###
# apt install bat curl fd-find fzf lsd ripgrep
# dpkg-divert --divert /usr/bin/bat --rename /usr/bin/batcat
# dpkg-divert --divert /usr/bin/fd --rename /usr/bin/fdfind
# dpkg-divert --divert /usr/share/man/man1/bat.1.gz --rename /usr/share/man/man1/batcat.1.gz
# dpkg-divert --divert /usr/share/man/man1/fd.1.gz --rename /usr/share/man/man1/fdfind.1.gz
# dpkg-divert --divert /usr/share/zsh/vendor-completions/_rg --rename /usr/share/zsh/vendor-completions/rg.zsh
###
### Zsh Configuration
###
@ -54,9 +41,13 @@ typeset -U path fpath
### Modules
###
### ASDF
### ASDF & direnv
#
# asdf plugin add direnv
# asdf install direnv latest
# asdf direnv setup --version latest
# asdf global direnv latest
#
# Line below from `asdf direnv setup --version latest`
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"
### b4b4r07/enhancd
@ -240,23 +231,22 @@ compdef hg=rg
# To choose an existing instance for nvr, use:
# `export NVIM=$(nvr --serverlist | fzf --exit-0 --select-1) && echo $NVIM`
# nnn - n³
#
# See https://github.com/jarun/nnn/wiki/Usage#configuration
export NNN_ARCHIVE='\.(7z|bz2|cbz|cbr|gz|tar|tbz|tgz|xz|zip|zst)$'
if (( ${+commands[fuse-archive]} )); then
export NNN_ARCHMNT='fuse-archive'
fi
export NNN_BMS="d:~/Downloads;q:~/QubesIncoming"
export NNN_OPENER="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
export NNN_OPTS='ABeGo'
export NNN_ORDER="t:$HOME/Downloads"
export NNN_PLUG='d:fzcd;o:-!xdg-open "$nnn"*;z:fzopen'
if (( ${+commands[trash-put]} )); then
export NNN_TRASH=1
elif (( ${+commands[gio]} )); then
export NNN_TRASH=2
fi
local nnn_plug=(
'b:-!bat --paging=always "$nnn"*'
'd:fzcd'
'z:fzopen'
'm:mimelist'
'o:-!mimeopen "$nnn"*'
'O:-!mimeopen --ask "$nnn"*'
'U:umounttree'
';:-!clear*'
# TODO Dump trash
)
n()
{
@ -265,9 +255,28 @@ n()
return
fi
export GUI=1 # plugins: nuke, xdgdefault
export LESS=${LESS/F}
export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/cd-on-quit"
local -x LESS=${LESS/F}
local -x PATH=$HOME/.config/nnn/plugins:$PATH
# See https://github.com/jarun/nnn/wiki/Usage#configuration
local -x GUI=1 # plugins: nuke, xdgdefault
local -x NNN_ARCHIVE='\.(7z|bz2|cbz|cbr|gz|tar|tbz|tgz|xz|zip|zst)$'
local -x NNN_BMS="d:~/Downloads;q:~/QubesIncoming"
local -x NNN_OPENER="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
local -x NNN_OPTS='ABeGo'
local -x NNN_ORDER="t:$HOME/Downloads"
local -x NNN_PLUG=${(j:;:)nnn_plug}
local -x NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/cd-on-quit"
if (( ${+commands[fuse-archive]} )); then
local -x NNN_ARCHMNT='fuse-archive'
fi
if (( ${+commands[trash-put]} )); then
local -x NNN_TRASH=1
elif (( ${+commands[gio]} )); then
local -x NNN_TRASH=2
fi
command nnn "$@"
if [ -f $NNN_TMPFILE ]; then
@ -279,6 +288,7 @@ n()
dirs -v
fi
}
compdef n=nnn
nnn-file-widget() {
# Extract "shell word" at cursor position (respecting quotes)
@ -323,6 +333,7 @@ zle -N nnn-file-widget
bindkey -M vicmd '\en' nnn-file-widget
bindkey -M viins '\en' nnn-file-widget
# Whiptail helper
#
# see https://stackoverflow.com/questions/1970180/whiptail-how-to-redirect-output-to-environment-variable
@ -386,6 +397,7 @@ whiptail_menu() {
return $res
}
###
### Aliases -- Global & automatic expansion
###
@ -436,6 +448,7 @@ export BROWSER=firefox
export EDITOR=vi
export LESS=-iFRS
export SYSTEMD_LESS='iFRSXMK'
export VISUAL=bat
# KeePassXC SSH Agent
[[ -v SSH_AUTH_SOCK ]] || export SSH_AUTH_SOCK=$(echo /tmp/ssh-*/agent.*(U))
@ -475,26 +488,25 @@ bindkey -M viins "^_" undo
### Zsh Options
###
## Input/Output
## Changing Directories
setopt no_auto_cd
## Expansion and Globbing
setopt equals
## Input/Output
setopt no_clobber
setopt correct
setopt interactive_comments
# Disallow `>` to overwrite existing files. Use `>|` or `>!` instead.
setopt no_clobber
setopt no_print_exit_value
## Job control
# Prevent background jobs being given a lower priority.
setopt auto_continue
setopt no_bg_nice
# Prevent status report of jobs on shell exit.
setopt no_check_jobs
# Prevent SIGHUP to jobs on shell exit.
setopt check_jobs
setopt no_hup
# Remove path duplicates
typeset -U path fpath
@ -503,7 +515,7 @@ typeset -U path fpath
### Completion Late Definitions
###
compdef bat=batcat
compdef locate=glocate
# Hide "parameters" (i.e. environment variables) when looking for a "command"
zstyle ':completion:*:-command-:*' tag-order '!parameters'

10
bin/.envrc Normal file
View File

@ -0,0 +1,10 @@
# See `direnv stdlib` for special functions provided by _direnv_.
use asdf
# Python virtual env
layout python3
if (($(echo $(direnv_layout_dir)/python* | wc --words) > 1)); then
log_error "Found several python environments"
du -sh .direnv/*
fi

2
bin/.tool-versions Normal file
View File

@ -0,0 +1,2 @@
python 3.11.8
direnv 2.33.0

21
bin/requirements.txt Normal file
View File

@ -0,0 +1,21 @@
lastversion==3.5.0
appdirs==1.4.4
beautifulsoup4==4.12.3
CacheControl==0.12.11
certifi==2024.2.2
charset-normalizer==3.3.2
distro==1.9.0
feedparser==6.0.11
idna==3.6
lockfile==0.12.2
msgpack==1.0.7
packaging==23.2
python-dateutil==2.8.2
PyYAML==6.0.1
requests==2.31.0
sgmllib3k==1.0.0
six==1.16.0
soupsieve==2.5
tqdm==4.66.2
urllib3==1.26.18

58
bin/versions_check Executable file
View File

@ -0,0 +1,58 @@
#!/bin/zsh
#
# asdf, direnv, python & lastversion
#
# - https://github.com/dvershinin/lastversion
#
cd $(dirname $0)
eval $(asdf exec direnv export zsh)
# zsh colors
#
autoload colors && colors
machine=amd64
function debian
{
program=$1
repository=$2
echo -n "${bg[green]}${fg[black]}\n>>>> ${program}${reset_color}\n\n"
# TODO debian package
if (( ${+commands[$program]} )); then
${program} --version
\ls -lh =${program}
current_version=$(lastversion format "$(${program} --version)")
last_version=$(lastversion ${repository} --newer-than ${current_version})
if [[ $? -eq 0 ]]; then
echo -n ${repository}/releases
echo "${fg[cyan]}"
lastversion ${repository} --filter="${machine}\.deb" --assets
else
echo "\n${fg[green]}up to date."
fi
else
echo "${fg[yellow]}...not found.\n"
echo -n "${fg[cyan]}"
lastversion ${repository} --filter="${machine}\.deb" --assets
fi
echo -n ${reset_color}
}
###
debian bat "https://github.com/sharkdp/bat"
debian delta "https://github.com/dandavison/delta"
debian lsd "https://github.com/lsd-rs/lsd"