Compare commits

...

13 Commits

16 changed files with 353 additions and 8 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.bak

View File

@@ -1,2 +1,3 @@
^/\.git.*
.*\.bak$
.*.bak$
readme.md

View File

@@ -5,8 +5,9 @@ page=1
project_dir="$HOME/projects"
base_url="https://gitea.finnvanreenen.nl/api/v1"
git_url="git@gitea.finnvanreenen.nl"
while [[ $page -lt 21 ]]
while [[ $page -lt 50 ]]
do
# echo
echo "## get repo list page $page"
@@ -30,6 +31,7 @@ do
else
url="$(echo "$clone_url" | sed "s|://|://$login:$token@|")"
git clone "$url" "$project_dir/${full_name,,}"
git -C "$project_dir/${full_name,,}" remote set-url origin "$git_url:${full_name,,}.git"
fi
done

3
git/dot-local/bin/gl Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
git log --graph --oneline --all

79
readme.md Normal file
View File

@@ -0,0 +1,79 @@
# Stew Home
This repo contains dotfiles LailaTheElf uses in the home directory. It also
contains a script (`stow/dot-local/bin/stowhome`) that uses GNU Stow to link
them from all the correct spots.
## Install
> NOTE: this is made for [ElfOS](https://gitea.finnvanreenen.nl/LailaTheElf/ElfOS.git)
> any other setup are **not** suported!
1. Install GNU Stow:
```sh
sudo pacman -Sy stow
```
2. Clone this repository to `~/.config/dotfiles`.
```sh
git clone https://gitea.finnvanreenen.nl/LailaTheElf/stowhome.git -O "$HOME/.config/dotfiles"
```
3. Install stowhome
```sh
"$HOME/.config/dotfiles/stow/dot-local/bin/stowhome" stow
```
## File structure
Of the repo, the root directory contains a folder for every package and the
following files:
- **.stow-local-ignore**: The ignore file for GNU Stow (uses [Perl regex](https://perldoc.perl.org/perlre)).
- **readme.md**: This file.
The packages is essentially a chroot of the home directory. All the files in
there are links to the corresponding place of the home directory (except the
once matching a line in the `.stow-local-ignore` file).
The `--dotfile` option is used; this means files and directories starting with
'dot-' will be prepended with a dot. So `dot-local` will become `.local`. This
is to prevent a repository full of hidden files.
## Usage
### Link the dotfiles (stewing)
```sh
stowhome <package> [<package> [<package> [...]]]
```
Where `<package>` is a directory from this repo or `all` foor all packages.
If the dotfiles already exist as normal files (not symlinks), it will skip this
file. To overwrite the file in stow, use this command:
```sh
stowhome --adopt <package> [<package> [<package> [...]]]
```
To overwrite the dotfile, you can just remove or rename the file and then run
`stowhome` again.
### Unlink the dotfiles (destewing)
```sh
stowhome -D <package> [<package> [<package> [...]]]
```
### Update dotfiles
To edit an already managed by stowhome dotfile, you can just edit it. The
changes will update in the Git repository (`$HOME/.config/dotfiles`), but no
commit will be made.
Overriding a file with one in this repo is easies by removing or renaming the
file.

3
shell/.stow-local-ignore Normal file
View File

@@ -0,0 +1,3 @@
^/\.git.*
.*.bak$
readme.md

View File

@@ -2,16 +2,43 @@
# ~/.bashrc
#
. "$HOME/.config/env"
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
alias la='ls --color=auto -plhA'
alias grep='grep --color=auto'
alias prusa-slicer='flatpak run com.prusa3d.PrusaSlicer'
PS1='\n\h \W\n\$ '
export PATH="$PATH:$HOME/.local/bin"
export EDITOR=vim
# quartus
export QSYS_ROOTDIR="$HOME/.local/intelFPGA_lite/18.1/quartus/sopc_builder/bin"
. "$HOME/.cargo/env"
# start ssh-agent
if [[ ! -f "$HOME/.ssh/agent.env" ]]
then
ssh-agent >"$HOME/.ssh/agent.env"
else
. "$HOME/.ssh/agent.env" >/dev/null
ps -p $SSH_AGENT_PID >/dev/null || ssh-agent >"$HOME/.ssh/agent.env"
fi
. "$HOME/.ssh/agent.env"
export SSH_AGENT_PID;
export SSH_AUTH_SOCK;
# rust
. "$CARGO_HOME/env"
# better tools
export FZF_CTRL_T_OPTS="
--walker-skip .git,node_modules,target,.var
--preview 'bat -n --color=always {}'
--bind 'ctrl-/:change-preview-window(down|hidden|)'"
eval "$(fzf --bash)"
eval "$(zoxide init bash --cmd cd)"
# prompt
eval "$(oh-my-posh init bash --config "$HOME/.config/oh-my-posh.toml")"

50
shell/dot-config/env Normal file
View File

@@ -0,0 +1,50 @@
export PATH="$PATH:$HOME/.local/bin"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_BIN_HOME="$HOME/.local/bin"
export XDG_MUSIC_DIR="$HOME/Music"
export XDG_DOCUMENTS_DIR="$HOME/Documents"
# export XDG_PICTURES_DIR="$HOME/Media/images"
# export XDG_VIDEOS_DIR="$HOME/Media/videos"
# fix ansible dirs
export ANSIBLE_HOME="$XDG_CONFIG_HOME/ansible/home"
export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible/ansible.cfg"
export ANSIBLE_GALAXY_CACHE_DIR="$XDG_CACHE_HOME/ansible/galaxy_cache"
#NOTE: for the tmp dir on remotes sould be configuard in ansible.cfg
# fix rust dirs
export RUSTUP_HOME="$HOME/.local/rust/rustup"
export CARGO_HOME="$HOME/.local/rust/cargo"
# fix discord dirs
# export DISCORD_USER_DATA_DIR="$XDG_DATA_HOME"
# fix docker dirs
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
# fix screen dirs
export SCREENRC="$XDG_CONFIG_HOME/screen/screenrc"
export SCREENDIR="$XDG_RUNTIME_DIR/screen"
# fix texlive dirs
export TEXMFHOME="$XDG_DATA_HOME/texmf"
export TEXMFVAR="$XDG_CACHE_HOME/texlive/texmf-var"
export TEXMFCONFIG="$XDG_CONFIG_HOME/texlive/texmf-config"
# fix wget dirs
export WGETRC="$XDG_CONFIG_HOME/wgetrc"
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
# fix npm dirs
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
# fix gnupg dirs
#TODO: test this
# export GNUPGHOME="$XDG_DATA_HOME/gnupg"
# fix java dirs
export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java"

View File

@@ -0,0 +1,32 @@
source "$HOME/.config/env"
if status is-interactive
alias ls='ls --color=auto'
alias la='ls --color=auto -plhA'
alias grep='grep --color=auto'
alias prusa-slicer='flatpak run com.prusa3d.PrusaSlicer'
export EDITOR=vim
# TODO: ssh-agent
# TODO: rust
# fuzzy find
export FZF_CTRL_T_OPTS="
--walker-skip .git,node_modules,target,.var
--preview 'bat -n --color=always {}'
--bind 'ctrl-/:change-preview-window(down|hidden|)'"
fzf --fish | source
# better cd
zoxide init fish --cmd cd | source
# prompt
oh-my-posh init fish --config "$HOME/.config/oh-my-posh.toml" | source
# desable auto seguestions
export fish_autosuggestion_enabled=0
end

View File

@@ -0,0 +1,5 @@
prefix=${XDG_DATA_HOME}/npm
cache=${XDG_CACHE_HOME}/npm
init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js
logs-dir=${XDG_STATE_HOME}/npm/logs

View File

@@ -0,0 +1,81 @@
console_title_template = '{{ .Shell }} in {{ .Folder }}'
version = 3
final_space = true
[secondary_prompt]
template = ' '
foreground = 'magenta'
background = 'transparent'
## does not work in bash
[transient_prompt]
template = ' '
foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}default{{end}}']
background = 'transparent'
[[blocks]]
type = 'prompt'
alignment = 'left'
newline = true
[[blocks.segments]]
type = 'session'
template = '{{ if .SSHSession }}⇄ {{ end }}{{ .HostName }}'
style = 'plain'
foreground_templates = ['{{if .Root }}red{{else}}magenta{{end}}']
background = 'transparent'
[[blocks.segments]]
type = 'path'
template = ' {{ .Path }}'
style = 'plain'
foreground = 'green'
background = 'transparent'
[blocks.segments.properties]
style = 'full'
[[blocks.segments]]
type = 'git'
template = ' {{ url .HEAD .UpstreamURL }}{{ if (.Working.Changed) }}*{{ end }}{{ if (.Staging.Changed) }}+{{ end }}{{ if or (gt .Behind 0) (gt .Ahead 0) }} ☁ {{ if gt .Behind 0 }}-{{ .Behind }}{{ end }}{{ if gt .Ahead 0 }}+{{ .Ahead }}{{ end }}{{ end }}'
style = 'plain'
foreground = 'magenta'
background = 'transparent'
[blocks.segments.properties]
branch_icon = ''
commit_icon = '@'
fetch_status = true
fetch_upstream_icon = true
[blocks.segments.properties.ignore_submodules]
'*' = 'none'
[[blocks]]
type = 'rprompt'
overflow = 'hidden'
[[blocks.segments]]
template = '{{ .FormattedMs }}'
foreground = 'yellow'
background = 'transparent'
type = 'executiontime'
style = 'plain'
[blocks.segments.properties]
cache_duration = 'none'
threshold = 5000
[[blocks]]
type = 'prompt'
alignment = 'left'
newline = true
[[blocks.segments]]
template = ''
background = 'transparent'
type = 'text'
style = 'plain'
foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}']
[blocks.segments.properties]
cache_duration = 'none'

View File

@@ -0,0 +1,36 @@
#!/bin/bash
function install() {
name=$1
src_dir=$2
mkdir -p /usr/share/fonts/$name
cp $src_dir/*.ttf /usr/share/fonts/$name/
chmod 0775 /usr/share/fonts/$name
chmod 0664 /usr/share/fonts/$name/*
}
function help() {
echo "$0 <font name> <sorce dir>"
}
if [[ -z "$1" ]]; then
help
exit
fi
if [[ -z "$2" ]]; then
echo "ERROR: give at least two arguments"
echo
help
exit
fi
if [[ ! -d "$2" ]]; then
echo "ERROR: $2 is not a directory"
echo
help
exit
fi
install $1 "$2"

View File

@@ -0,0 +1,7 @@
#!/bin/bash
font="$(fc-list | fzf)"
echo "$font"
display "$(echo "$font" | awk '{{ print $1 }}' | tr -d ':')"

View File

@@ -11,6 +11,8 @@ gitea.finnvanreenen.nl ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIb
kapsalon.freenen.nl ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCBr2iI34xReitjf4rp3TlD7/jcadTEZ1xe8Oos5bGSb+YFX6ib7n3MTp1PJhKCERsZZZ6F6/5qVzR3GrZ8boJY=
kapsalon.freenen.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDtpoyDT03A3WdqmnRsj1jtoIrQX2reDyZUXJau1wMuc
kapsalon.freenen.nl ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxIonJnVr+iZ00q9NT8BTRuhNcXZWnS1IgMlAT7IpksSM/1fo4n3evniW1FRqWob8TSJb0j5aCQrurW5/4SQ/FEaPF3JDu9AxYG99pmbxLHFYLv2PzJWPI9KtFTwg2buqNFw+I4s/rOX/+W9lgDvxm+oKKAL/abYtrzffkdOpw81N5iuawdPU1Q1An5Yq9y3aFBdEYOGRSWhCudV/991v5w0MgMp8Db7V3Z/UorY7CpZSL/OqMuKz6OvSzNTj53CGU/vgMKSxmWGqG1Vtsv1T4S6m6IdWyxcE3JPoCyWEv3Q7SJL4/B25KaHe7H0qgfcHSodxustgrSWamAbobgTTmmRa3LQC8d8Pl60la6eyBBLOIBMlfMij1dWDM5osUUvXbYlu6Y/GAVLdAZSzpDql6hL+TBrHUEoWjdL9EPw5Dc3KUL5Z470tWNzLEfFvU+XaqV5rxWOpJIjPYaYTUqAG5BRqWYUAgcLB8PrMMablq9mlzPUTwk/1rzRUXxBgCQPs=
[10.1.2.2]:2653 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDtpoyDT03A3WdqmnRsj1jtoIrQX2reDyZUXJau1wMuc
10.1.13.1 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIILnBX5Cctz42WLLvwPQ+S1ojEJccY8wjwOmGCD+udo9
bitbucket.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIazEu89wgQZ4bqs3d63QSMzYVa0MuJ2e2gKTKqu+UUO
bitbucket.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPIQmuzMBuKdWeF4+a2sjSSpBK0iqitSQ+5BM9KhpexuGt20JpTVM7u5BDZngncgrqDMbWdxMWWOGtZ9UgbqgZE=

View File

@@ -1,8 +1,24 @@
#!/bin/bash
function get_all_packages() {
cd "$HOME/.config/dotfiles"
find . -maxdepth 1 -type d -not -name ".git" -not -name "."
}
stow_cmd="stow --dir $HOME/.config/dotfiles --target $HOME --dotfiles"
if [ "$*" == "" ]
do
then
echo "you must supply at least one package"
echo
echo "available packages:"
get_all_packages | sed -e 's|^.\/| - |'
else
stow --dir "$HOME/.config/dotfiles" --target "$HOME" --dotfiles $*
if [ "$(echo "$*" | grep -E -e '^(.* )?all$')" != "" ]
then
all_packages=$(get_all_packages | sed -e 's|^.\/||' | tr '\n' ' ')
$stow_cmd $(echo "$*" | sed -e "s/all/$all_packages/")
else
$stow_cmd $*
fi
fi