diff options
author | EuAndreh <eu@euandre.org> | 2019-04-28 13:18:49 +0000 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-04-28 13:18:49 +0000 |
commit | 4a73dca595e57751448899053cddb958c17fe75c (patch) | |
tree | 8c1a0b9d997fc4a0531559f6b7e8102deae25f74 | |
parent | Update os-installation.sh (diff) | |
parent | Split vagrant cmds. (diff) | |
download | dotfiles-4a73dca595e57751448899053cddb958c17fe75c.tar.gz dotfiles-4a73dca595e57751448899053cddb958c17fe75c.tar.xz |
Merge remote-tracking branch 'srht/master'
67 files changed, 584 insertions, 284 deletions
diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000..ee25164 --- /dev/null +++ b/.build.yml @@ -0,0 +1,13 @@ +image: nixos/unstable +repositories: + nixpkgs: https://nixos.org/channels/nixpkgs-unstable +triggers: + - condition: failure + action: email + to: EuAndreh <eu@euandre.org> +sources: + - https://git.sr.ht/~euandreh/dotfiles +tasks: + - tests: | + cd dotfiles/ + nix-build -A test diff --git a/.gitattributes b/.gitattributes index a2fa862..74fe0d5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,3 +7,5 @@ git/gitconfig.ini filter=git-crypt diff=git-crypt emacs/gnus.el filter=git-crypt diff=git-crypt emacs/not-much.el filter=git-crypt diff=git-crypt lein/deps.edn filter=git-crypt diff=git-crypt +ssh_config.conf filter=git-crypt diff=git-crypt +newsboat/urls filter=git-crypt diff=git-crypt @@ -1,2 +1,6 @@ mail/offlineimap.pyc tam_required +/result + +/scripts/node_modules/ +/scripts/package-lock.json
\ No newline at end of file @@ -1,4 +1,5 @@ * dotfiles +[[https://builds.sr.ht/~euandreh/dotfiles][file:https://builds.sr.ht/~euandreh/dotfiles.svg]] ** Instructions - setting up a new installation (NixOS) *** 1. Download NixOS image from [[https://nixos.org/][the website]]. *** 2. Follow USB ISO installation steps in =nixos/os-installation.sh= diff --git a/bash/agents.sh b/bash/agents.sh index 7ce1fef..d49757b 100644 --- a/bash/agents.sh +++ b/bash/agents.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash +# shellcheck disable=SC2015 eval "$(thefuck --alias f)" -export GPG_TTY=$(tty) +GPG_TTY=$(tty) +export GPG_TTY export SSH_ENV="$HOME/.ssh/environment" start_agent() { @@ -16,7 +18,7 @@ start_agent() { [ -f "${SSH_ENV}" ] && { . "${SSH_ENV}" > /dev/null - ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { + pgrep ^ssh-agent$ > /dev/null || { start_agent } } || start_agent diff --git a/bash/aliases.sh b/bash/aliases.sh index 07c46ea..2149d86 100644 --- a/bash/aliases.sh +++ b/bash/aliases.sh @@ -6,29 +6,39 @@ alias open="xdg-open" alias ros="rlwrap ros -l ~/.sbclrc" alias l="ls -lahp" alias ll="ls -lhp" -alias yt-dl="youtube-dl -o '$YT_TEMPLATE'" -alias copy="tr -d '\n' | xclip -sel clip" +alias yt-dl="yt_dl" +isLinux && { + alias copy="tr -d '\\n' | xclip -sel clip" +} +isMac && { + alias copy="tr -d '\\n' | pbcopy" +} +alias trim="tr -d '\\n'" +alias lowercase="tr [:upper:] [:lower:]" +alias lc="tr [:upper:] [:lower:]" alias pia-vpn="sudo openvpn --config $DOTFILES/VPN/euandreh.ovpn" # Source: https://unix.stackexchange.com/questions/25327/watch-command-alias-expansion#25329 -alias watch="watch " +alias watch="watch --color " alias mr="mr -s" alias sbcl="rlwrap sbcl" alias du="ncdu --color dark" alias perl6="rlwrap perl6" alias m="mail.sh" +alias a="atom.sh" +alias n="newsboat" + +alias gnome-control-center="XDG_CURRENT_DESKTOP=GNOME gnome-control-center" alias fim="play $DOTFILES/bash/Positive.ogg &> /dev/null" alias mux="tmuxinator" -isLinux && { - ,u() { - cd ~/annex; - git annex info --fast | grep available; - cd - > /dev/null; - } - export -f ,u +u() { + pushd ~/annex > /dev/null || exit 1; + git annex info --fast | grep available; + popd > /dev/null || exit 1; } +export -f u MY_PS1="$PS1" ps1() { @@ -36,8 +46,9 @@ ps1() { } # git -alias ,s="git status" -alias ,d="git diff" -alias ,ds="git diff --staged" +alias s="git status" +alias d="git diff" +alias ds="git diff --staged" -alias ,r="source $DOTFILES/bash/tests.sh && locked_init && source ~/.bashrc" +alias reload="source $DOTFILES/bash/tests.sh && locked_init && source ~/.bashrc" +alias r="source $DOTFILES/bash/tests.sh && locked_init && source ~/.bashrc" diff --git a/bash/bash_profile.sh b/bash/bash_profile.sh index 12ce7f9..0383eaa 100644 --- a/bash/bash_profile.sh +++ b/bash/bash_profile.sh @@ -1 +1,3 @@ -source ~/annex/dev/code/dotfiles/bash/bashrc.sh +#!/usr/bin/env bash + +source ~/dev/libre/dotfiles/bash/bashrc.sh diff --git a/bash/bashrc.sh b/bash/bashrc.sh index 9ddaf6f..2e68b80 100644 --- a/bash/bashrc.sh +++ b/bash/bashrc.sh @@ -1,4 +1,6 @@ -export DOTFILES=~/annex/dev/code/dotfiles +#!/usr/bin/env bash + +export DOTFILES=~/dev/libre/dotfiles source $DOTFILES/bash/platform.sh source $DOTFILES/bash/config.sh @@ -10,7 +12,6 @@ source $DOTFILES/bash/agents.sh source $DOTFILES/bash/init.sh source $DOTFILES/bash/symlinks.sh source $DOTFILES/bash/youtube.sh -source $DOTFILES/bash/tmuxinator-templates.sh source $DOTFILES/bash/facepalm/rotten-apple.sh source $DOTFILES/bash/npm.sh source $DOTFILES/bash/x.sh @@ -24,17 +25,19 @@ source ~/dev/nu/nucli/nu.bashcompletion env > ~/.spacemacs.env # tmp FIXME: move to mrconfig.ini -export PATH="$HOME/annex/dev/code/songbooks/cli:$PATH" +export PATH="$HOME/dev/libre/songbooks/cli:$PATH" alias sb="songbooks" -source "$(dirname $(readlink $(which autojump)))/../share/autojump/autojump.bash" - +isLinux && { + source "$(dirname "$(readlink "$(command -v autojump)")")/../share/autojump/autojump.bash" +} export PATH="$HOME/.perl6/bin:$PATH" isMac && { PATH="/usr/local/opt/make/libexec/gnubin:$PATH" + PATH="/usr/local/bin:$PATH" } export PATH="$HOME/tmp/rakudobrew/bin:$PATH" diff --git a/bash/colors.sh b/bash/colors.sh index 90cabc4..68acb06 100644 --- a/bash/colors.sh +++ b/bash/colors.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# shellcheck disable=1117 disable=1004 disable=2034 disable=2154 # Customize BASH PS1 prompt to show current GIT repository and branch. # by Mike Stewart - http://MediaDoneRight.com @@ -208,7 +209,7 @@ function lightblueb { } export -f lightblueb -function ,colors { +function colors { black "black" blackb "blackb" white "white" diff --git a/bash/config.sh b/bash/config.sh index ac9f7c2..37a4806 100644 --- a/bash/config.sh +++ b/bash/config.sh @@ -30,3 +30,5 @@ shopt -s checkwinsize isLinux && { shopt -s globstar } + +stty -ixon diff --git a/bash/env.sh b/bash/env.sh index c81cba2..a0b750f 100644 --- a/bash/env.sh +++ b/bash/env.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -export PATH="$HOME/Nextcloud/bin/:$PATH" - # # Git Annex # @@ -32,9 +30,12 @@ export PATH=~/.local/bin:$PATH export EDITOR=vi export PATH="$DOTFILES/scripts/:$PATH" export PATH="$DOTFILES/encrypted/scripts/:$PATH" -export YT_TEMPLATE="~/Downloads/yt-dl/%(uploader)s/%(upload_date)s %(title)s.%(ext)s" export INPUTRC=~/.inputrc -export CACHE_DIR="~/Nextcloud/cache" +export CACHE_DIR="$HOME/ownCloud/cache" +export PATH="$HOME/dev/libre/website/:$PATH" +export PATH="$DOTFILES/bin:$PATH" +export PATH="$HOME/dev/misc/flutter/bin:$PATH" +#export BROWSER="firefox" diff --git a/bash/facepalm/rotten-apple.sh b/bash/facepalm/rotten-apple.sh index 50d85c8..222a2b0 100644 --- a/bash/facepalm/rotten-apple.sh +++ b/bash/facepalm/rotten-apple.sh @@ -6,8 +6,8 @@ isMac && { alias limpar-derived-data="rm -rf ~/Library/Developer/Xcode/DerivedData/" alias fim="afplay $DOTFILES/bash/facepalm/Positive.mp3" - if [ -f $(brew --prefix)/etc/bash_completion ]; then - . $(brew --prefix)/etc/bash_completion + if [ -f "$(brew --prefix)/etc/bash_completion" ]; then + . "$(brew --prefix)/etc/bash_completion" fi [ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion diff --git a/bash/fake-symlinks.sh b/bash/fake-symlinks.sh index b61e798..3a5e885 100644 --- a/bash/fake-symlinks.sh +++ b/bash/fake-symlinks.sh @@ -1,12 +1,33 @@ #!/usr/bin/env bash if [[ -n "$GITHUB_TOKEN" ]]; then - cat $DOTFILES/git/gitconfig.ini | envsubst > ~/.gitconfig + envsubst < "$DOTFILES/git/gitconfig.ini" > ~/.gitconfig fi -repos=("org.euandreh.misc" "org.euandreh.http") -for repo in ${repos[@]}; do - cp "$DOTFILES/git/gitlab-ci.yml" "$DOTFILES/../$repo/.gitlab-ci.yml" - cp "$DOTFILES/git/default.nix" "$DOTFILES/../$repo/default.nix" +SRHT_REPOS=(website mentat cement pouchdb-materialized-view pires superlogin-client) +SRHT_REPOS_PATH="$HOME/dev/libre" + +for repo in "${SRHT_REPOS[@]}"; do + REPO="$repo" envsubst < "$DOTFILES/templates/sr-ht-build.yaml" > "$SRHT_REPOS_PATH/$repo/.build.yml" +done + +for repo in "${SRHT_REPOS[@]}"; do + if [[ "$repo" != "website" ]]; then + REPO="$repo" envsubst < "$DOTFILES/templates/env.sh" > "$SRHT_REPOS_PATH/$repo/env.sh" + fi done + +mkdir -p ~/.tmuxinator + +TMUXINATOR_TEMPLATES=(annex pires songbooks sosps) + +for template in "${TMUXINATOR_TEMPLATES[@]}"; do + cp "$DOTFILES/tmux/projects/$template.yml" "$HOME/.tmuxinator/$template.yml" +done + +# DHALL_BUILD_REPOS=(website) + +# for repo in "${DHALL_BUILD_REPOS[@]}"; do +# dhall 2> /dev/null <<< "./sr-ht-build.dhall \"$repo\"" | dhall-to-json --pretty > "$SRHT_REPOS_PATH/$repo/.build.yml" +# done diff --git a/bash/init.sh b/bash/init.sh index 777a322..4e0ee65 100644 --- a/bash/init.sh +++ b/bash/init.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash locked_init() { - pushd ~/ > /dev/null + pushd ~/ > /dev/null || exit 1 mkdir -p ~/.emacs.d/.cache/ - mkdir -p $(dirname "$AUTOJUMP_TXT") + mkdir -p "$(dirname "$AUTOJUMP_TXT")" touch "$AUTOJUMP_TXT" # clone all missing repos @@ -13,12 +13,12 @@ locked_init() { printf "" > /tmp/mr-repos mr inject > /dev/null - printf "(\n" > /tmp/mr-projectile + printf "(\\n" > /tmp/mr-projectile sed -E 's/\/home\/andreh/~/' /tmp/mr-repos | awk '{print "\""$1"/""\""}' >> /tmp/mr-projectile printf ")" >> /tmp/mr-projectile cp /tmp/mr-projectile ~/.emacs.d/.cache/projectile-bookmarks.eld - popd > /dev/null + popd > /dev/null || exit 1 } export -f locked_init @@ -32,7 +32,7 @@ export -f locked_init # Tests -pushd $DOTFILES > /dev/null +pushd "$DOTFILES" > /dev/null || exit 1 sizes=$(git diff-files --ignore-submodules | awk '{print $6}' | xargs du | awk '{print $1}') for size in $sizes; do @@ -42,4 +42,4 @@ for size in $sizes; do fi done -popd > /dev/null +popd > /dev/null || exit 1 diff --git a/bash/npm.sh b/bash/npm.sh index c23c074..7fbe4f7 100644 --- a/bash/npm.sh +++ b/bash/npm.sh @@ -2,9 +2,9 @@ # FIXME: port to NixOS npm_i() { - (which $1 &> /dev/null) || { + (command -v "$1" &> /dev/null) || { yellow "Installing $2" - npm i -g $2 + npm i -g "$2" } } diff --git a/bash/platform.sh b/bash/platform.sh index efa5061..eb262e9 100644 --- a/bash/platform.sh +++ b/bash/platform.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash isMac () { - [[ `uname` == 'Darwin' ]] + [[ "$(uname)" == 'Darwin' ]] } isLinux () { - [[ `uname` == 'Linux' ]] + [[ "$(uname)" == 'Linux' ]] } isMac && { diff --git a/bash/symlinks.sh b/bash/symlinks.sh index 335189a..f6adb0c 100644 --- a/bash/symlinks.sh +++ b/bash/symlinks.sh @@ -1,72 +1,84 @@ #!/usr/bin/env bash function upsert_dir_symlink() { - local readonly from="$1" - local readonly to="$2" - ([ -d "$to" ] || [ -L "$to" ]) || { + local from="$1" + local to="$2" + { [ -d "$to" ] || [ -L "$to" ]; } || { ln -s "$from" "$to" } } export -f upsert_dir_symlink -upsert_dir_symlink $DOTFILES/encrypted/borg ~/.config/borg +upsert_dir_symlink "$DOTFILES/encrypted/borg" ~/.config/borg -ln -fs $DOTFILES/bash/bashrc.sh ~/.bashrc -ln -fs $DOTFILES/bash/bash_profile.sh ~/.bash_profile -ln -fs $DOTFILES/git/gitattributes ~/.gitattributes -ln -fs $DOTFILES/git/gitignore ~/.gitignore_global -ln -fs $DOTFILES/git/bash_git.sh ~/.bash_git -ln -fs $DOTFILES/sbclrc.lisp ~/.sbclrc -ln -fs $DOTFILES/inputrc.conf ~/.inputrc -ln -fs $DOTFILES/Xmodmap.conf ~/.Xmodmap +ln -fs "$DOTFILES/bash/bashrc.sh" ~/.bashrc +ln -fs "$DOTFILES/bash/bash_profile.sh" ~/.bash_profile +ln -fs "$DOTFILES/git/gitattributes" ~/.gitattributes +ln -fs "$DOTFILES/git/gitignore" ~/.gitignore_global +ln -fs "$DOTFILES/git/bash_git.sh" ~/.bash_git +ln -fs "$DOTFILES/encrypted/nugitconfig.ini" ~/.nugitconfig +ln -fs "$DOTFILES/sbclrc.lisp" ~/.sbclrc +ln -fs "$DOTFILES/inputrc.conf" ~/.inputrc +ln -fs "$DOTFILES/Xmodmap.conf" ~/.Xmodmap isLinux && { - ln -fs $DOTFILES/nixos/npmrc.sh ~/.npmrc + ln -fs "$DOTFILES/nixos/npmrc.sh" ~/.npmrc } -ln -fs $DOTFILES/git/mrconfig.ini ~/.mrconfig +## SSH config +mkdir -p ~/.ssh +ln -fs "$DOTFILES/ssh_config.conf" ~/.ssh/config -upsert_dir_symlink $MEDIA_PREFIX/UTCLOUD ~/UTCLOUD -upsert_dir_symlink $MEDIA_PREFIX/SNEAKER ~/SNEAKER +ln -fs "$DOTFILES/git/mrconfig.ini" ~/.mrconfig + +upsert_dir_symlink "$MEDIA_PREFIX/UTCLOUD" ~/UTCLOUD +upsert_dir_symlink "$MEDIA_PREFIX/SNEAKER" ~/SNEAKER ## Clojure mkdir -p ~/.lein ~/.clojure -ln -fs $DOTFILES/lein/profiles.clj ~/.lein/profiles.clj -ln -fs $DOTFILES/lein/deps.edn ~/.clojure/deps.edn +ln -fs "$DOTFILES/lein/profiles.clj" ~/.lein/profiles.clj +ln -fs "$DOTFILES/lein/deps.edn" ~/.clojure/deps.edn ## AWS mkdir -p ~/.aws -ln -fs $DOTFILES/encrypted/aws/config ~/.aws/config -ln -fs $DOTFILES/encrypted/aws/credentials ~/.aws/credentials +ln -fs "$DOTFILES/encrypted/aws/config" ~/.aws/config +ln -fs "$DOTFILES/encrypted/aws/credentials" ~/.aws/credentials ## tmux -ln -fs $DOTFILES/tmux/tmux.conf ~/.tmux.conf -ln -fs $DOTFILES/tmux/tmux-macos.conf ~/.tmux-macos.conf -ln -fs $DOTFILES/tmux/tmux-gnu-linux.conf ~/.tmux-gnu-linux.conf +ln -fs "$DOTFILES/tmux/tmux.conf" ~/.tmux.conf +ln -fs "$DOTFILES/tmux/tmux-macos.conf" ~/.tmux-macos.conf +ln -fs "$DOTFILES/tmux/tmux-gnu-linux.conf" ~/.tmux-gnu-linux.conf + +## Newsboat +mkdir -p ~/.newsboat +ln -fs "$DOTFILES/newsboat/config" ~/.newsboat/config ## NixOS -ln -fs $DOTFILES/nixos/evince.destkop ~/.local/share/applications/evince.desktop -ln -fs $DOTFILES/nixos/firefox.destkop ~/.local/share/applications/firefox.desktop +ln -fs "$DOTFILES/nixos/evince.destkop" ~/.local/share/applications/evince.desktop +ln -fs "$DOTFILES/nixos/firefox.destkop" ~/.local/share/applications/firefox.desktop ## Emacs -mkdir -p $HOME/.emacs.d/private/layers/ -ln -fs $DOTFILES/spacemacs.el ~/.spacemacs -ln -fs $DOTFILES/emacs/gnus.el ~/.gnus.el -ln -fs $CACHE_DIR/euandreh-auto-save.el ~/.emacs.d/.cache/layouts/euandreh-auto-save +mkdir -p "$HOME/.emacs.d/private/layers/" +ln -fs "$DOTFILES/spacemacs.el" ~/.spacemacs +ln -fs "$DOTFILES/emacs/gnus.el" ~/.gnus.el +ln -fs "$CACHE_DIR/euandreh-auto-save.el" ~/.emacs.d/.cache/layouts/euandreh-auto-save ## xmonad mkdir -p ~/.xmonad -ln -fs $DOTFILES/xmonad/xsession.sh ~/.xsession -ln -fs $DOTFILES/xmonad/xmonad.hs ~/.xmonad/xmonad.hs -ln -fs $DOTFILES/xmonad/xmobar.hs ~/.xmobarrc +ln -fs "$DOTFILES/xmonad/xsession.sh" ~/.xsession +ln -fs "$DOTFILES/xmonad/xmonad.hs" ~/.xmonad/xmonad.hs +ln -fs "$DOTFILES/xmonad/xmobar.hs" ~/.xmobarrc ## Mail mkdir -p ~/mbsync/.notmuch/hooks ~/mbsync/EuAndreh ~/mbsync/Gmail ~/mbsync/Nubank -ln -fs $DOTFILES/mail/notmuch-post.sh ~/mbsync/.notmuch/hooks/post-new -ln -fs $DOTFILES/mail/mbsyncrc.ini ~/.mbsyncrc -ln -fs $DOTFILES/mail/notmuch.ini ~/.notmuch-config -ln -fs /tmp/mbsync.$(date +%Y-%m-%d).log /tmp/mbsync.log -ln -fs /tmp/notmuch.$(date +%Y-%m-%d).log /tmp/notmuch.log +ln -fs "$DOTFILES/mail/notmuch-post.sh" ~/mbsync/.notmuch/hooks/post-new +ln -fs "$DOTFILES/mail/mbsyncrc.ini" ~/.mbsyncrc +ln -fs "$DOTFILES/mail/notmuch.ini" ~/.notmuch-config +ln -fs /tmp/mbsync."$(date +%Y-%m-%d)".log /tmp/mbsync.log +ln -fs /tmp/notmuch."$(date +%Y-%m-%d)".log /tmp/notmuch.log ## GNUS -ln -fs $DOTFILES/encrypted/IMAP/authinfo.gpg ~/.authinfo.gpg +ln -fs "$DOTFILES/encrypted/IMAP/authinfo.gpg" ~/.authinfo.gpg + +## Buku +ln -fs /tmp/buku-xmonad."$(date +%Y-%m-%d)".log /tmp/buku-xmonad.log diff --git a/bash/tests.sh b/bash/tests.sh index 1fdfd79..6941614 100644 --- a/bash/tests.sh +++ b/bash/tests.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -autotime test > /dev/null +# autotime test > /dev/null diff --git a/bash/tmuxinator-templates.sh b/bash/tmuxinator-templates.sh deleted file mode 100755 index adbbb5c..0000000 --- a/bash/tmuxinator-templates.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -mkdir -p ~/.tmuxinator - -templates=(annex pires songbooks sosps) - -for template in ${templates[@]}; do - cp $DOTFILES/tmux/projects/$template.yml ~/.tmuxinator/$template.yml -done diff --git a/bash/util.sh b/bash/util.sh index 833bc9c..e29d02f 100644 --- a/bash/util.sh +++ b/bash/util.sh @@ -1,20 +1,20 @@ #!/usr/bin/env bash extract () { - if [ -f $1 ] ; then - case $1 in - *.tar.bz2) tar xvjf $1 ;; - *.tar.gz) tar xvzf $1 ;; - *.bz2) bunzip2 $1 ;; - *.rar) unrar x $1 ;; - *.gz) gunzip $1 ;; - *.tar) tar xvf $1 ;; - *.tbz2) tar xvjf $1 ;; - *.tgz) tar xvzf $1 ;; - *.zip) unzip $1 ;; - *.Z) uncompress $1 ;; - *.7z) 7z x $1 ;; - *.xz) unxz $1 ;; + if [ -f "$1" ] ; then + case "$1" in + *.tar.bz2) tar xvjf "$1" ;; + *.tar.gz) tar xvzf "$1" ;; + *.bz2) bunzip2 "$1" ;; + *.rar) unrar x "$1" ;; + *.gz) gunzip "$1" ;; + *.tar) tar xvf "$1" ;; + *.tbz2) tar xvjf "$1" ;; + *.tgz) tar xvzf "$1" ;; + *.zip) unzip "$1" ;; + *.Z) uncompress "$1" ;; + *.7z) 7z x "$1" ;; + *.xz) unxz "$1" ;; *) echo "don't know how to extract '$1'..." ;; esac else @@ -24,11 +24,11 @@ extract () { merkle-tree () { dirname="${1-.}" - pushd "$dirname" > /dev/null + pushd "$dirname" > /dev/null || exit 1 find . -type f | \ sort | \ xargs -I{} sha256sum "{}" | \ sha256sum | \ awk '{print $1}' - popd > /dev/null + popd > /dev/null || exit 1 } @@ -15,4 +15,6 @@ isLinux && { xdg-settings set default-web-browser firefox.desktop xdg-mime default firefox.desktop text/html xdg-mime default firefox.desktop text/xml + + xdg-mime default nautilus.desktop inode/directory # FIXME } diff --git a/bash/youtube.sh b/bash/youtube.sh index c732e26..275e0b8 100644 --- a/bash/youtube.sh +++ b/bash/youtube.sh @@ -2,44 +2,53 @@ export DEFAULT_PLAYLIST_END=15 export DEFAULT_INC_STEP=10 +export YT_TEMPLATE="$HOME/Downloads/yt-dl/%(uploader)s/%(upload_date)s %(title)s.%(ext)s" +# Always downloads video, doesn't look at the download-archive +yt_dl() { + youtube-dl "$1" -o "$YT_TEMPLATE" --write-description +} +export -f yt_dl download() { youtube-dl "$1" \ - --download-archive ~/Nextcloud/cache/youtube-dl-seen.conf \ - --prefer-free-formats \ - --playlist-end $2 \ - --output "~/Downloads/yt-dl/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s" + --download-archive ~/ownCloud/cache/youtube-dl-seen.conf \ + --prefer-free-formats \ + --playlist-end "$2" \ + --write-description \ + --output "$YT_TEMPLATE" } export -f download download_user() { - download "https://www.youtube.com/user/$1" ${2-$DEFAULT_PLAYLIST_END} + download "https://www.youtube.com/user/$1" "${2-$DEFAULT_PLAYLIST_END}" } export -f download_user download_channel() { - download "https://www.youtube.com/channel/$1" ${2-$DEFAULT_PLAYLIST_END} + download "https://www.youtube.com/channel/$1" "${2-$DEFAULT_PLAYLIST_END}" } export -f download_channel download_playlist() { - download "https://www.youtube.com/playlist?list=$1" ${2-$DEFAULT_PLAYLIST_END} + download "https://www.youtube.com/playlist?list=$1" "${2-$DEFAULT_PLAYLIST_END}" } export -f download_playlist - inc_download() { local fn="$1" local id="$2" local step="${3-$DEFAULT_INC_STEP}" local file="$HOME/.yt-db/$id" - local n_count="$(cat $file 2> /dev/null || printf 10)" - local n_count_new="$(($n_count + $step))" + mkdir -p "$HOME/.yt-db" + cat "$file" 2> /dev/null + local n_count + n_count="$(cat "$file" 2> /dev/null || printf 10)" + local n_count_new="$((n_count + step))" echo "$n_count_new" > "$file" diff --git a/scripts/git-blame-someone-else b/bin/git-blame-someone-else index dd71826..dd71826 100755 --- a/scripts/git-blame-someone-else +++ b/bin/git-blame-someone-else diff --git a/scripts/sleepsort b/bin/sleepsort index ea20fcb..ea20fcb 100755 --- a/scripts/sleepsort +++ b/bin/sleepsort diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..c27faff --- /dev/null +++ b/default.nix @@ -0,0 +1,34 @@ +let + pkgs = import <nixpkgs> {}; +in with pkgs; with pkgs.stdenv; rec { + subtasks = rec { + shellcheck = mkDerivation rec { + name = "dotfiles-shellcheck"; + src = ./.; + phases = "unpackPhase buildPhase"; + buildInputs = [ pkgs.shellcheck ]; + buildPhase = '' + export SHELLCHECK_OPTS="-e SC1090 -e SC1091 -e SC2139" + ignored='(encrypted|os-installation.sh|notmuch-post.sh)' + find . -type f -name '*.sh' | grep -E -v $ignored | xargs shellcheck + touch $out + ''; + }; + }; + test = mkDerivation rec { + name = "dotfiles-test"; + src = ./.; + phases = "unpackPhase buildPhase"; + buildInputs = [ + subtasks.shellcheck + ]; + buildPhase = '' + echo "Ran tests for:" + for d in ${builtins.toString buildInputs}; do + echo " $d" + done + echo "All tests passed!" + touch $out + ''; + }; +} diff --git a/encrypted/SSH/known_hosts.txt b/encrypted/SSH/known_hosts.txt Binary files differindex 79c3e9e..ec99d68 100644 --- a/encrypted/SSH/known_hosts.txt +++ b/encrypted/SSH/known_hosts.txt diff --git a/encrypted/env.sh b/encrypted/env.sh Binary files differindex af98c5c..bc1a0bf 100644 --- a/encrypted/env.sh +++ b/encrypted/env.sh diff --git a/encrypted/nu/nurc.sh b/encrypted/nu/nurc.sh Binary files differindex a8532c2..b92a178 100644 --- a/encrypted/nu/nurc.sh +++ b/encrypted/nu/nurc.sh diff --git a/encrypted/nu/tmux/projects/vpn.yml b/encrypted/nu/tmux/projects/vpn.yml Binary files differnew file mode 100644 index 0000000..0e9ead1 --- /dev/null +++ b/encrypted/nu/tmux/projects/vpn.yml diff --git a/encrypted/nugitconfig.ini b/encrypted/nugitconfig.ini Binary files differnew file mode 100644 index 0000000..53b0b86 --- /dev/null +++ b/encrypted/nugitconfig.ini diff --git a/encrypted/scripts/video-feed.sh b/encrypted/scripts/video-feed.sh Binary files differindex 38d6252..6ed5a57 100755 --- a/encrypted/scripts/video-feed.sh +++ b/encrypted/scripts/video-feed.sh diff --git a/git/gitconfig.ini b/git/gitconfig.ini Binary files differindex 879e156..f1f4d78 100644 --- a/git/gitconfig.ini +++ b/git/gitconfig.ini diff --git a/git/gitignore b/git/gitignore index 371fd16..12daa17 100644 --- a/git/gitignore +++ b/git/gitignore @@ -1,3 +1,4 @@ playground.clj req.http -.postman-ns
\ No newline at end of file +.postman-ns +*.swp
\ No newline at end of file diff --git a/git/mrconfig.ini b/git/mrconfig.ini Binary files differindex 3b4295a..053db14 100644 --- a/git/mrconfig.ini +++ b/git/mrconfig.ini diff --git a/lein/profiles.clj b/lein/profiles.clj Binary files differindex 3d52f93..5ead478 100644 --- a/lein/profiles.clj +++ b/lein/profiles.clj diff --git a/mail/mbsyncrc.ini b/mail/mbsyncrc.ini Binary files differindex c3d1bc0..a74c30e 100644 --- a/mail/mbsyncrc.ini +++ b/mail/mbsyncrc.ini diff --git a/mail/notmuch-post.sh b/mail/notmuch-post.sh Binary files differindex 9fdc57c..b874d70 100755 --- a/mail/notmuch-post.sh +++ b/mail/notmuch-post.sh diff --git a/newsboat/config b/newsboat/config new file mode 100644 index 0000000..a7998d9 --- /dev/null +++ b/newsboat/config @@ -0,0 +1 @@ +browser firefox
\ No newline at end of file diff --git a/newsboat/urls b/newsboat/urls Binary files differnew file mode 100644 index 0000000..50f2256 --- /dev/null +++ b/newsboat/urls diff --git a/nixos/configuration.nix b/nixos/configuration.nix index ba986e4..f5b38b3 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -73,12 +73,23 @@ url = "https://github.com/NixOS/nixpkgs/archive/18.03.zip"; sha256 = "0hk4y2vkgm1qadpsm4b0q1vxq889jhxzjx3ragybrlwwg54mzp4f"; }) {}; + timidityWithEvenMoreFormats = with pkgs; timidity.overrideAttrs (oldAttrs: { configureFlags = oldAttrs.configureFlags ++ [ "--enable-audio=vorbis,flac" ]; buildInputs = oldAttrs.buildInputs ++ [ libogg libvorbis flac ]; }); + + # https://github.com/nixos/nixpkgs/blob/0d202221f98e500f1df79112dc464d013eefcdae/pkgs/development/web/nodejs/v10.nix#L4 + buildNodejs = pkgs.callPackage <nixpkgs/pkgs/development/web/nodejs/nodejs.nix> {}; + nodejs-10_14_1 = buildNodejs { + enableNpm = true; + version = "10.14.1"; + sha256 = "0d5hg8hf4c1sshh77a6hy944bzm3q3ipqggbyim61q3r2szngvrx"; + # Uses HTTPS (https://github.com/nixos/nixpkgs/blob/0d202221f98e500f1df79112dc464d013eefcdae/pkgs/development/web/nodejs/nodejs.nix#L45), safer to trust the hash (unless it's already compromised :shrug:) + }; in with pkgs; [ - pkgsUnstable.nodejs-10_x + pkgsUnstable.nodejs-10_x + # nodejs-10_14_1 ## Personal data tools @@ -94,6 +105,7 @@ gnupg mr nextcloud-client + owncloud-client borgbackup git-sizer @@ -159,6 +171,7 @@ gitlab-runner sshpass zathura # for viewing Emacs PDF files + nvi cacert gtypist pandoc @@ -167,6 +180,10 @@ ncdu fd nnn + python36Packages.python-slugify + moreutils # =vipe= + bazel + graphviz # =dot= and others diffoscope # poppler_utils # used by diffoscope for comparing PDF files @@ -185,6 +202,7 @@ ## Spell checking (aspellWithDicts (ps : with ps; [ en eo fr pt_BR ])) + languagetool ## NixOS @@ -197,6 +215,8 @@ texlive.combined.scheme-full lilypond + python36Packages.python-ly + lame frescobaldi timidityWithEvenMoreFormats @@ -213,8 +233,7 @@ openjdk solc bundler - rustc - rustfmt + rustup cargo clojure # =clj= visualvm # JVM profiling tool @@ -224,7 +243,16 @@ rakudo bats ledger - + newsboat + perl + dhall + dhall-json + nodePackages.node2nix + shellcheck + (haskell.lib.justStaticExecutables haskellPackages.github-backup) + rustracer + xsel + buku ## Containers and VMs @@ -256,7 +284,9 @@ ## GUI programs + inkscape calibre + pkgsUnstable.cozy rhythmbox gpodder firefox @@ -265,13 +295,14 @@ vlc keepassx2-http yubioath-desktop - tor-browser-bundle-bin + # tor-browser-bundle-bin transmission_gtk libreoffice android-studio androidsdk_extras androidndk pkgsUnstable.patchwork-classic + # gnome3.gpaste ## Cryptocururencies @@ -283,11 +314,16 @@ ## nu specific packages + sshuttle slack chromium ]; - nixpkgs.config.allowUnfree = true; # Require for slack (unfree) derivation + nixpkgs.config = { + android_sdk.accept_license = true; + allowUnfree = true; # Require for slack (unfree) derivation + }; + # Look at # https://www.vivaolinux.com.br/topico/Off-Code-Cafe/Me-apresente-sua-distro @@ -299,7 +335,16 @@ services = { cron.enable = true; # We can see the actual generated crontab at /etc/crontab - cron.systemCronJobs = ["0 * * * * andreh /home/andreh/annex/dev/code/dotfiles/scripts/mail.sh -s"]; + cron.systemCronJobs = [ + # Sync emails with mbsync every hour + "0 * * * * andreh /home/andreh/dev/libre/dotfiles/scripts/mail.sh -s" + + # Refresh local RSS files every hour + "0 * * * * andreh /home/andreh/dev/libre/dotfiles/scripts/atom.sh" + + # Make read-only copy of TODOs.org every hour + # "0 * * * * andreh /home/andreh/dev/libre/dotfiles/scripts/cp-todos.sh -s" + ]; xserver = { enable = true; @@ -327,7 +372,7 @@ # xmodmap -e 'keycode 118 = bar Greek_lamda' sessionCommands = '' ${pkgs.haskellPackages.xmobar}/bin/xmobar ~/.xmobarrc & - ${pkgs.fvwm}/bin/xpmroot ~/Nextcloud/Images/emotion.png & + ${pkgs.fvwm}/bin/xpmroot ~/ownCloud/Images/emotion.png & ''; }; }; @@ -336,7 +381,7 @@ gnome-keyring.enable = true; seahorse.enable = true; gnome-terminal-server.enable = true; - gpaste.enable = true; # clipboard manager + # gpaste.enable = true; # clipboard manager tracker.enable = true; sushi.enable = true; # nautilus previewer gnome-online-accounts.enable = true; @@ -363,9 +408,9 @@ # https://nixos.org/nixos/options.html#ipfs ipfs = { - enable = true; - enableGC = true; - autoMount = true; + enable = false; + enableGC = false; + autoMount = false; }; }; @@ -386,7 +431,7 @@ uid = 1000; description = "EuAndreh"; extraGroups = [ "wheel" "networkmanager" "docker" ]; - passwordFile = "/home/andreh/annex/dev/code/dotfiles/encrypted/password-hash.txt"; + passwordFile = "/home/andreh/dev/libre/dotfiles/encrypted/password-hash.txt"; }; }; # From the Guix manual: diff --git a/nixos/npmrc.sh b/nixos/npmrc.sh index 2bc28dc..0bc6ecb 100644 --- a/nixos/npmrc.sh +++ b/nixos/npmrc.sh @@ -1 +1,5 @@ -prefix="~/.npm-packages" +# shellcheck disable=2148 disable=2034 +prefix=/home/andreh/.npm-packages +# Taken from: +# http://www.tomsquest.com/blog/2018/10/better-npm-ing/ +save-exact=true diff --git a/scripts/atom.js b/scripts/atom.js new file mode 100644 index 0000000..878df05 --- /dev/null +++ b/scripts/atom.js @@ -0,0 +1,22 @@ +const RSS = require('rss'); + +const feedName = process.argv[2]; +const feedSrc = process.argv[3]; + +const feed = new RSS({ + title: `Buku feed tag for '${feedName}'.`, + description: `Buku feed tag for ${feedName}`, +}); + +const items = require(feedSrc); +items.forEach(({ title, description, uri }) => { + feed.item({ + title, + description, + url: uri + }); +}); + +const xml = feed.xml({indent: true}); + +console.log(xml); diff --git a/scripts/atom.sh b/scripts/atom.sh new file mode 100755 index 0000000..6ca4110 --- /dev/null +++ b/scripts/atom.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +if [[ ! -d "node_modules" ]]; then + npm i rss +fi + +RSS_DIR="$HOME/.newsboat" +LINKS_OUT="$RSS_DIR/gen/buku.urls" + +mkdir -p "$RSS_DIR/gen" + +# Empty the text file +true > "$LINKS_OUT" + +feed() { + local tag="$1" + local tmp="/tmp/$tag.json" + buku -t "$tag" --json > "$tmp" + if [[ -s "$tmp" ]]; then + node atom.js "$tag" "$tmp" > "$RSS_DIR/gen/$1.xml" + echo "file://$RSS_DIR/gen/$1.xml" >> "$LINKS_OUT" + fi +} + +feed ril +feed simple-archive + +cat "$DOTFILES/newsboat/urls" <(echo) "$LINKS_OUT" > "$RSS_DIR/urls" diff --git a/scripts/autotime b/scripts/autotime deleted file mode 100755 index fb01392..0000000 --- a/scripts/autotime +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env perl6 - -# FIXME: stdin support with lines() -# FIXME: --help and -h support - -sub from-timestamp(Int \timestamp) { - sub formatter($_) { - sprintf '%04d-%02d-%02d %02d:%02d:%02d', - .year, .month, .day, - .hour, .minute, .second, - } - given DateTime.new(+timestamp, :&formatter) { - when .Date.DateTime == $_ { return .Date } - default { return $_ } - } -} - -sub from-date-string(Str $date, Str $time?) { - my $d = Date.new($date); - if $time { - my ( $hour, $minute, $second ) = $time.split(':'); - return DateTime.new(date => $d, :$hour, :$minute, :$second); - } else { - return $d.DateTime; - } -} - -# FIXME: add test -multi sub convert(Int \timestamp) { - from-timestamp(+timestamp); -} - -# FIXME: add test -multi sub convert(Str $date where { try Date.new($_) }, Str $time?) { - from-date-string($date, $time).posix; -} - -# FIXME: add test -#| Convert timestamp to ISO date -multi sub MAIN(Int \timestamp) { - say convert(+timestamp); -} - -# FIXME: add test -#| Convert ISO date to timestamp -multi sub MAIN(Str $date where { try Date.new($_) }, Str $time?) { - say convert($date, $time); -} - -# multi sub MAIN() { -# for lines() -> $line { - -# } -# } - -#| Run internal tests -multi sub MAIN('test') is hidden-from-USAGE { - use Test; - plan 2; - subtest 'timestamp', { - plan 2; - is-deeply from-timestamp(1450915200), Date.new('2015-12-24'), - 'Date';; - my $dt = from-timestamp(1450915201); - is $dt, "2015-12-24 00:00:01", - 'DateTime with string formatting'; - }; - subtest 'from-date-string', { - plan 2; - is from-date-string('2015-12-24').posix, 1450915200, - 'one argument'; - is from-date-string('2015-12-24', '00:00:01').posix, - 1450915201, - 'two arguments'; - }; -} diff --git a/scripts/backup.sh b/scripts/backup.sh index a33a630..f31a503 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -6,12 +6,12 @@ # if [ ! -d ~/UTCLOUD/ ]; then - red "~/UTCLOUD not attached. Backup not started." + red "$HOME/UTCLOUD not attached. Backup not started." exit 1 fi if [ ! -d ~/borgbackup/ ]; then - yellow "~/borgbackup/ repository doesn't exist. Downloading latest version from ~/UTCLOUD/borg/borgbackup/ into ~/borgbackup/" + yellow "$HOME/borgbackup/ repository doesn't exist. Downloading latest version from ~/UTCLOUD/borg/borgbackup/ into ~/borgbackup/" # The initial borg repo was created with: # $ borg init --append-only --encryption=keyfile ~/borgbackup # See also: https://borgbackup.readthedocs.io/en/stable/usage/notes.html#append-only-mode @@ -27,7 +27,7 @@ borg create \ --progress \ --compression lzma,6 \ ~/borgbackup::"{hostname}-{now}-${BACKUP_TAG}" \ - ~/Nextcloud/ \ + ~/ownCloud/ \ ~/mbsync/ # add folders to be backed up here green "Done" @@ -46,7 +46,7 @@ green "Done" # yellow "Backing up git repos" -pushd ~/ +pushd ~/ || exit 1 mr -s master mr -s status @@ -54,13 +54,13 @@ mr -s -j16 update mr -s hd mr -s -j4 rsyncnet -popd +popd || exit 1 yellow "Syncing annex" -pushd ~/annex/ +pushd ~/annex/ || exit 1 git annex sync -popd +popd || exit 1 green "Done" diff --git a/scripts/buku-add.sh b/scripts/buku-add.sh new file mode 100755 index 0000000..005adbd --- /dev/null +++ b/scripts/buku-add.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +xclip -o | xargs -I{} buku -a "{}" ril diff --git a/scripts/buku-archive.sh b/scripts/buku-archive.sh new file mode 100755 index 0000000..2a2a702 --- /dev/null +++ b/scripts/buku-archive.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +SEL="$(xclip -o | tr -d '\n')" +if [[ -z "${SEL// }" ]]; then + echo "Empty selection." + exit 1 +fi +BOOKMARK_ID= +IFS=" +" +BOOKMARKS="$(buku "$SEL" -f 1 --tacit)" + +for bookmark in $BOOKMARKS; do + echo "$bookmark" + ID="$(echo "$bookmark" | cut -d$'\t' -f 1)" + URL="$(echo "$bookmark" | cut -d$'\t' -f 2)" + if [[ "$URL" = "$SEL" ]]; then + BOOKMARK_ID="$ID" + break + fi +done + + +if [[ -n "$BOOKMARK_ID" ]]; then + echo "Archiving $BOOKMARK_ID (URL: $SEL)." + buku -u "$BOOKMARK_ID" --tag - ril + buku -u "$BOOKMARK_ID" --tag + simple-archive +else + echo "Bookmark for '$SEL' not found." + exit 1 +fi diff --git a/scripts/buku-delete.sh b/scripts/buku-delete.sh new file mode 100755 index 0000000..01de451 --- /dev/null +++ b/scripts/buku-delete.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +SEL="$(xclip -o | tr -d '\n')" +if [[ -z "${SEL// }" ]]; then + echo "Empty selection." + exit 1 +fi +BOOKMARK_ID= +IFS=" +" +BOOKMARKS="$(buku "$SEL" -f 1 --tacit)" + +for bookmark in $BOOKMARKS; do + echo "$bookmark" + ID="$(echo "$bookmark" | cut -d$'\t' -f 1)" + URL="$(echo "$bookmark" | cut -d$'\t' -f 2)" + if [[ "$URL" = "$SEL" ]]; then + BOOKMARK_ID="$ID" + break + fi +done + + +if [[ -n "$BOOKMARK_ID" ]]; then + echo "Deleting $BOOKMARK_ID (URL: $SEL)." + buku -d "$BOOKMARK_ID" --tacit +else + echo "Bookmark for '$SEL' not found." + exit 1 +fi diff --git a/scripts/bump.sh b/scripts/bump.sh deleted file mode 100755 index 86eed54..0000000 --- a/scripts/bump.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -function latest_version() { - git tag | sort -V | tail -n 1 -} - -function overflow_bump() { - IFS=".$IFS" - read a b c - if [[ "$b" == 999 ]]; then - echo $((a + 1)).0.0 - elif [[ "$c" == 999 ]]; then - echo $a.$((b + 1)).0 - else - echo $a.$b.$((c + 1)) - fi -} - -latest_version | overflow_bump - -echo "$1" | overflow_bump diff --git a/scripts/cp-todos.sh b/scripts/cp-todos.sh new file mode 100755 index 0000000..e839ae8 --- /dev/null +++ b/scripts/cp-todos.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +cp "$HOME/annex/txt/TODOs.org" "$HOME/ownCloud/Notes/org.txt" +cp "$HOME/annex/txt/TODOs.org" "$HOME/ownCloud/cache/TODOs.org" diff --git a/scripts/gc.sh b/scripts/gc.sh index 9670149..c93c948 100755 --- a/scripts/gc.sh +++ b/scripts/gc.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash disk_space() { - ,u | awk '{print $5" "$6}' + u | awk '{print $5" "$6}' } before=$(disk_space) @@ -10,8 +10,8 @@ yellow "Cleaning up the NixOS store" profiles=(per-user/root/channels per-user/andreh/profile per-user/andreh/channels system) -for p in ${profiles[@]}; do - sudo nix-env --delete-generations old -p /nix/var/nix/profiles/$p +for p in "${profiles[@]}"; do + sudo nix-env --delete-generations old -p "/nix/var/nix/profiles/$p" done # Current profile, change when installing with =nix-env -iA nixpkgs.bsdgames= @@ -28,7 +28,7 @@ guix gc yellow "Cleaning up up the Trash and /tmp folders" -rm -rf ~/.local/share/Trash/files/* +sudo rm -rf ~/.local/share/Trash/files/* # https://askubuntu.com/a/609396 sudo find /tmp -type f -atime +10 -delete @@ -36,23 +36,24 @@ sudo find /tmp -type f -atime +10 -delete yellow "Erasing docker images" echo y | docker system prune -a -docker rmi $(docker images -a -q) -docker rm $(docker ps -a -f status=exited -q) +docker rmi "$(docker images -a -q)" +docker rm "$(docker ps -a -f status=exited -q)" -docker stop $(docker ps -a -q) -docker rm $(docker ps -a -q) +docker stop "$(docker ps -a -q)" +docker rm "$(docker ps -a -q)" echo y | docker volume prune echo y | docker container prune + +# Source: https://www.reddit.com/r/emacs/comments/6wqfp3/notmuch_delete_mail/ +yellow "Clean up deleted email files" +notmuch search --output=files --exclude=false tag:deleted | xargs -I{} rm "{}" +notmuch new + after=$(disk_space) green "Done." green "Disk space before and after:" blue " before: ${before}" blue " after: ${after}" - -# Clean up deleted email files: -# Source: https://www.reddit.com/r/emacs/comments/6wqfp3/notmuch_delete_mail/ -# notmuch search --output=files --exclude=false tag:deleted | xargs -I{} rm "{}" -# notmuch new diff --git a/scripts/mail.sh b/scripts/mail.sh index a7c8208..00c111f 100755 --- a/scripts/mail.sh +++ b/scripts/mail.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + if [ "$1" = "-s" ]; then mbsync -aV &>> /tmp/mbsync.log && notmuch new &>> /tmp/notmuch.log else diff --git a/scripts/once-only-nextcloud.sh b/scripts/once-only-nextcloud.sh deleted file mode 100755 index 8400080..0000000 --- a/scripts/once-only-nextcloud.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -if [ "$(pidof nextcloud)" ] -then - echo "Nextcloud already running." -else - echo "Nextcloud not running yet. Starting it." - nextcloud & disown -fi diff --git a/scripts/once-only-owncloud.sh b/scripts/once-only-owncloud.sh new file mode 100755 index 0000000..66b3ee4 --- /dev/null +++ b/scripts/once-only-owncloud.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [ "$(pidof owncloud)" ] +then + echo "ownCloud already running." +else + echo "ownCloud not running yet. Starting it." + owncloud & disown +fi diff --git a/scripts/single-monitor.sh b/scripts/single-monitor.sh index ec6c5e2..5b0d03e 100755 --- a/scripts/single-monitor.sh +++ b/scripts/single-monitor.sh @@ -1,2 +1,2 @@ -#!/bin/sh +#!/usr/bin/env bash xrandr --output VIRTUAL1 --off --output eDP1 --primary --mode 1920x1080 --pos 640x1440 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --off --output DP2 --off diff --git a/scripts/startx b/scripts/startx index 9b1d153..cca34a2 100644..100755 --- a/scripts/startx +++ b/scripts/startx @@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash sudo systemctl restart display-manager & diff --git a/scripts/three-monitors.sh b/scripts/three-monitors.sh index d1ef7c6..d8c4e53 100755 --- a/scripts/three-monitors.sh +++ b/scripts/three-monitors.sh @@ -1,2 +1,2 @@ -#!/bin/sh +#!/usr/bin/env bash xrandr --output VIRTUAL1 --off --output eDP1 --primary --mode 1920x1080 --pos 640x1440 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --mode 2560x1440 --pos 0x0 --rotate normal --output DP2 --mode 2560x1440 --pos 2560x0 --rotate left diff --git a/spacemacs.el b/spacemacs.el index e15981b..a115c8a 100644 --- a/spacemacs.el +++ b/spacemacs.el @@ -75,6 +75,7 @@ This function should only modify configuration layer settings." ruby rust scheme + selectric shell-scripts sql swift @@ -106,6 +107,9 @@ This function should only modify configuration layer settings." dotspacemacs-additional-packages '(paredit interleave debbugs + fireplace + emidje + ob-rust ;; emacs-guix ) ;; A list of packages that cannot be updated. @@ -569,15 +573,16 @@ dump." (defvar custom-keybindings '(("→" . (lambda () (interactive) (evil-insert 1))) ("M-ç" . (lambda () (interactive) (find-file "~/annex/txt/TODOs.org"))) + ("M-p" . (lambda () (interactive) (find-file "~/annex/txt/money.ledger"))) ("M-SPC" . (lambda () (interactive) (just-one-space -1))) ("M-[" . (lambda () (interactive) (find-file "~/tmp/scratch.org"))) - ("M-]" . (lambda () (interactive) (find-file "~/Nextcloud/Notes/TODOs.txt"))) + ("M-]" . (lambda () (interactive) (find-file "~/ownCloud/Notes/TODOs.txt"))) ("M-s-q" . (lambda () (interactive) (insert "/"))) ("M-s-w" . (lambda () (interactive) (insert "?"))) ("M-s-a" . (lambda () (interactive) (insert "\\"))) ("M-s-s" . (lambda () (interactive) (insert "|"))))) -(defvar custom-el-files '("~/annex/dev/code/dotfiles/emacs/not-much.el" +(defvar custom-el-files '("~/dev/libre/dotfiles/emacs/not-much.el" "~/.quicklisp/slime-helper.el")) (defmacro measure-time (&rest body) @@ -666,6 +671,21 @@ This is the place where most of your configurations should be done. Unless it is (dolist (keybinding custom-keybindings) (global-set-key (kbd (car keybinding)) (cdr keybinding))) + (org-babel-do-load-languages + 'org-babel-load-languages + '((elixir . t) + (http . t) + (restclient . t) + (shell . t) + (clojure . t) + (ruby . t) + (python . t) + (perl . t) + (js . t) + (C . t) + (emacs-lisp . t) + (rust . t))) + (setq standard-indent 2 git-link-use-commit t vc-follow-symlinks t @@ -688,6 +708,7 @@ This is the place where most of your configurations should be done. Unless it is sh-basic-offset 2 sh-indentation 2 smie-indent-basic 2 + perl-indent-level 2 ;; Clojure cljr-warn-on-eval nil @@ -707,7 +728,7 @@ This is the place where most of your configurations should be done. Unless it is ;; - http://cachestocaches.com/2016/9/my-workflow-org-agenda ;; - http://doc.norang.ca/org-mode.html org-todo-keywords '((sequence "TODO" "NEXT" "WAITING" "INACTIVE" "CANCELLED" "MEETING" "DOING" "|" "DONE")) - org-agenda-files '("~/Nextcloud/txt/TODOs.org") + org-agenda-files '("~/ownCloud/txt/TODOs.org") org-columns-default-format "%50ITEM(Task) %10CLOCKSUM %16TIMESTAMP_IA" org-default-notes-file "~/annex/txt/TODOs.org" org-scratch-notes-file "~/annex/txt/TODOs.org" @@ -757,7 +778,7 @@ This function is called at the very end of Spacemacs initialization." ;; If there is more than one, they won't work right. '(package-selected-packages (quote - (writeroom-mode visual-fill-column yasnippet-snippets yapfify yaml-mode xterm-color ws-butler winum which-key web-mode web-beautify volatile-highlights vi-tilde-fringe uuidgen use-package unicode-fonts unfill toml-mode toc-org tide tagedit systemd symon swift-mode string-inflection sql-indent spaceline-all-the-icons smeargle slime-company slim-mode shell-pop seeing-is-believing scss-mode sass-mode rvm ruby-tools ruby-test-mode ruby-refactor ruby-hash-syntax rubocop rspec-mode robe rjsx-mode restclient-helm restart-emacs rbenv rake rainbow-delimiters racer pyvenv pytest pyenv-mode py-isort pug-mode psci psc-ide prettier-js powershell popwin pippel pipenv pip-requirements persp-mode perl6-mode pdf-tools password-generator paradox ox-reveal overseer orgit org-projectile org-present org-pomodoro org-mime org-download org-bullets org-brain open-junk-file ob-restclient ob-http ob-elixir nov nix-mode neotree nameless mwim multi-term move-text mmm-mode minitest markdown-toc magit-svn magit-gitflow lorem-ipsum livid-mode live-py-mode link-hint json-navigator js2-refactor js-doc jinja2-mode interleave insert-shebang indent-guide importmagic impatient-mode hungry-delete hlint-refactor hl-todo hindent highlight-parentheses highlight-numbers highlight-indentation helm-xref helm-themes helm-swoop helm-rtags helm-pydoc helm-purpose helm-projectile helm-org-rifle helm-notmuch helm-nixos-options helm-mode-manager helm-make helm-hoogle helm-gitignore helm-git-grep helm-flx helm-descbinds helm-css-scss helm-company helm-c-yasnippet helm-ag haskell-snippets google-translate google-c-style golden-ratio gnuplot gitignore-templates gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link git-gutter-fringe git-gutter-fringe+ gh-md geiser fuzzy font-lock+ flyspell-correct-helm flycheck-rust flycheck-rtags flycheck-pos-tip flycheck-perl6 flycheck-mix flycheck-ledger flycheck-haskell flycheck-elm flycheck-credo flycheck-bashate flx-ido fish-mode fill-column-indicator fancy-battery eyebrowse expand-region evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-org evil-numbers evil-nerd-commenter evil-matchit evil-magit evil-lisp-state evil-lion evil-ledger evil-indent-plus evil-iedit-state evil-goggles evil-exchange evil-escape evil-ediff evil-cleverparens evil-args evil-anzu eshell-z eshell-prompt-extras esh-help erlang emmet-mode elm-test-runner elm-mode elisp-slime-nav editorconfig dumb-jump dotenv-mode doom-modeline dockerfile-mode docker disaster diminish diff-hl define-word debbugs cython-mode csv-mode counsel-projectile company-web company-tern company-statistics company-shell company-rtags company-restclient company-plsense company-nixos-options company-lua company-ghci company-cabal company-c-headers company-auctex company-ansible company-anaconda common-lisp-snippets column-enforce-mode cmm-mode clojure-snippets clojure-cheatsheet clj-refactor clean-aindent-mode clang-format cider-eval-sexp-fu chruby centered-cursor-mode cargo bundler browse-at-remote auto-yasnippet auto-highlight-symbol auto-dictionary auto-compile auctex-latexmk ansible-doc ansible alchemist aggressive-indent adoc-mode ace-window ace-link ace-jump-helm-line ac-ispell)))) + (treemacs-projectile treemacs-evil treemacs ht pfuture yasnippet-snippets yapfify yaml-mode xterm-color ws-butler writeroom-mode winum which-key web-mode web-beautify volatile-highlights vi-tilde-fringe uuidgen use-package unicode-fonts unfill toml-mode toc-org tide tagedit systemd symon swift-mode string-inflection sql-indent spaceline-all-the-icons smeargle slime-company slim-mode shell-pop selectric-mode seeing-is-believing scss-mode sass-mode rvm ruby-tools ruby-test-mode ruby-refactor ruby-hash-syntax rubocop rspec-mode robe rjsx-mode restclient-helm restart-emacs rbenv rake rainbow-delimiters racer pyvenv pytest pyenv-mode py-isort pug-mode psci psc-ide prettier-js powershell popwin pippel pipenv pip-requirements persp-mode perl6-mode pdf-tools password-generator paradox ox-reveal overseer orgit org-projectile org-present org-pomodoro org-mime org-download org-bullets org-brain open-junk-file ob-rust ob-restclient ob-http ob-elixir nov nix-mode neotree nameless mwim multi-term move-text mmm-mode minitest markdown-toc magit-svn magit-gitflow lorem-ipsum livid-mode live-py-mode link-hint json-navigator js2-refactor js-doc jinja2-mode interleave insert-shebang indent-guide importmagic impatient-mode hungry-delete hlint-refactor hl-todo hindent highlight-parentheses highlight-numbers highlight-indentation helm-xref helm-themes helm-swoop helm-rtags helm-pydoc helm-purpose helm-projectile helm-org-rifle helm-notmuch helm-nixos-options helm-mode-manager helm-make helm-hoogle helm-gitignore helm-git-grep helm-flx helm-descbinds helm-css-scss helm-company helm-c-yasnippet helm-ag haskell-snippets google-translate google-c-style golden-ratio gnuplot gitignore-templates gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link git-gutter-fringe git-gutter-fringe+ gh-md geiser fuzzy font-lock+ flyspell-correct-helm flycheck-rust flycheck-rtags flycheck-pos-tip flycheck-perl6 flycheck-mix flycheck-ledger flycheck-haskell flycheck-elm flycheck-credo flycheck-bashate flx-ido fish-mode fireplace fill-column-indicator fancy-battery eyebrowse expand-region evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-org evil-numbers evil-nerd-commenter evil-matchit evil-magit evil-lisp-state evil-lion evil-ledger evil-indent-plus evil-iedit-state evil-goggles evil-exchange evil-escape evil-ediff evil-cleverparens evil-args evil-anzu eshell-z eshell-prompt-extras esh-help erlang emmet-mode emidje elm-test-runner elm-mode elisp-slime-nav editorconfig dumb-jump dotenv-mode doom-modeline dockerfile-mode docker disaster diminish diff-hl define-word debbugs cython-mode csv-mode counsel-projectile company-web company-tern company-statistics company-shell company-rtags company-restclient company-plsense company-nixos-options company-lua company-ghci company-cabal company-c-headers company-auctex company-ansible company-anaconda common-lisp-snippets column-enforce-mode cmm-mode clojure-snippets clojure-cheatsheet clj-refactor clean-aindent-mode clang-format cider-eval-sexp-fu chruby centered-cursor-mode cargo bundler browse-at-remote auto-yasnippet auto-highlight-symbol auto-dictionary auto-compile auctex-latexmk ansible-doc ansible alchemist aggressive-indent adoc-mode ace-window ace-link ace-jump-helm-line ac-ispell)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/ssh_config.conf b/ssh_config.conf Binary files differnew file mode 100644 index 0000000..2d025d6 --- /dev/null +++ b/ssh_config.conf diff --git a/templates/env.sh b/templates/env.sh new file mode 100644 index 0000000..4ff21f2 --- /dev/null +++ b/templates/env.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +export SERVER_URL=root@euandre.org +export DOCS_SERVER_PATH="/home/user-data/www/default/$REPO/" diff --git a/templates/sr-ht-build.dhall b/templates/sr-ht-build.dhall new file mode 100644 index 0000000..41b937b --- /dev/null +++ b/templates/sr-ht-build.dhall @@ -0,0 +1,47 @@ +-- let buildTemplate = + λ ( repoName + : Text + ) + → { image = + "debian/stretch" + , packages = + [ "curl" ] + , triggers = + [ { condition = + "failure" + , action = + "email" + , to = + "EuAndreh <eu@euandre.org>" + } + ] + , sources = + [ "https://git.sr.ht/~euandreh/" ++ repoName ] + , secrets = + [ "7159f943-811f-402d-bb6d-37cd764dc728" ] + , tasks = + [ { mapKey = + "setup" + , mapValue = + '' + curl https://nixos.org/nix/install | sh + echo '. $HOME/.nix-profile/etc/profile.d/nix.sh' >> $HOME/.buildenv'' + }, + { mapKey = + "test" + , mapValue = + '' + cd ${repoName}/ + nix-build -A test'' + }, + { mapKey = + "publish" + , mapValue = + '' + cd ${repoName}/ + nix-build -A publishScript + source env.sh + ./result/bin/publish.sh'' + } + ] + } diff --git a/templates/sr-ht-build.yaml b/templates/sr-ht-build.yaml new file mode 100644 index 0000000..8c55df6 --- /dev/null +++ b/templates/sr-ht-build.yaml @@ -0,0 +1,23 @@ +image: debian/stretch +packages: + - curl +triggers: + - condition: failure + action: email + to: EuAndreh <eu@euandre.org> +sources: + - https://git.sr.ht/~euandreh/$REPO +secrets: + - 7159f943-811f-402d-bb6d-37cd764dc728 +tasks: + - setup: | + curl https://nixos.org/nix/install | sh + echo '. ~/.nix-profile/etc/profile.d/nix.sh' >> ~/.buildenv + - tests: | + cd $REPO/ + nix-build -A test + - docs: | + cd $REPO/ + nix-build -A publishScript + source env.sh + ./result/bin/publish.sh diff --git a/tmux/projects/annex.yml b/tmux/projects/annex.yml index 92acafe..b6cfbcc 100644 --- a/tmux/projects/annex.yml +++ b/tmux/projects/annex.yml @@ -5,6 +5,11 @@ windows: - annex+dotfiles: layout: main-vertical panes: - - cd - - j dotfiles && git status - - git status + - misc: + - cd + - dotfiles: + - cd "$DOTFILES" && git status + - sleep 10 + - reload + - annex: + - git status diff --git a/vps/push-receive-redeploy.sh b/vps/push-receive-redeploy.sh index 87fecd5..46a65bc 100755 --- a/vps/push-receive-redeploy.sh +++ b/vps/push-receive-redeploy.sh @@ -1,6 +1,6 @@ -#!/bin/sh +#!/usr/bin/env bash -cd ~/ +cd ~/ || exit 1 docker pull registry.gitlab.com/euandreh/songbooks/prod:latest docker-compose stop songbooks_app docker-compose up -d --no-deps songbooks_app diff --git a/xmonad/xmonad.hs b/xmonad/xmonad.hs index dd46d25..97786c7 100644 --- a/xmonad/xmonad.hs +++ b/xmonad/xmonad.hs @@ -15,7 +15,7 @@ main = xmonad $ def -- Fullscreen handling: -- https://stackoverflow.com/questions/20446348/xmonad-toggle-fullscreen-xmobar - { manageHook = manageDocks <+> (isFullscreen --> doFullFloat) <+> manageHook def <+> manageScratchPad + { manageHook = manageDocks <+> (isFullscreen --> doFullFloat) <+> (className =? "trayer" --> doIgnore) <+> manageHook def , handleEventHook = handleEventHook def <+> docksEventHook -- , layoutHook = smartBorders $ lessBorders OnlyFloat $ avoidStruts $ layoutHook def , layoutHook = smartBorders $ avoidStruts $ layoutHook def @@ -26,14 +26,6 @@ main = myTerminal = "gnome-terminal" -manageScratchPad :: ManageHook -manageScratchPad = scratchpadManageHook (W.RationalRect l t w h) - where - h = 0.1 -- terminal height, 10% - w = 1 -- terminal width, 100% - t = 1 - h -- distance from top edge, 90% - l = 1 - w -- distance from left edge, 0% - myKeyBindings :: [((ButtonMask, KeySym), X())] myKeyBindings = [ -- XF86MonBrightnessUp @@ -86,22 +78,38 @@ myKeyBindings = -- xrandr single monitor setup , ((mod4Mask .|. controlMask, xK_1), - spawn "~/annex/dev/code/dotfiles/scripts/single-monitor.sh") + spawn "~/dev/libre/dotfiles/scripts/single-monitor.sh") -- xrandr three monitor setup , ((mod4Mask .|. controlMask, xK_3), - spawn "~/annex/dev/code/dotfiles/scripts/three-monitors.sh") + spawn "~/dev/libre/dotfiles/scripts/three-monitors.sh") -- restart network , ((mod4Mask, xK_x), spawn "gksudo -S systemctl restart network-manager") + + -- save selection (link) in buku + , ((mod4Mask, xK_c), + spawn "$HOME/dev/libre/dotfiles/scripts/buku-add.sh >> /tmp/buku-xmonad.log") + + -- delete selection (link) from buku + , ((mod4Mask, xK_d), + spawn "$HOME/dev/libre/dotfiles/scripts/buku-delete.sh >> /tmp/buku-xmonad.log") + + -- archive selection (link) in buku + , ((mod4Mask, xK_a), + spawn "$HOME/dev/libre/dotfiles/scripts/buku-archive.sh >> /tmp/buku-xmonad.log") + + -- toggle appearence of xmobar + -- https://stackoverflow.com/a/27646652 + , ((mod4Mask .|. shiftMask, xK_f), sendMessage ToggleStruts) ] startup :: X() startup = do spawn "xbacklight =100" spawn "xmobar ~/.xmobarrc" - spawn "killall trayer; trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --tint 0x191970 --height 17 --monitor 1" + spawn "killall trayer; trayer --edge top --align right --SetDockType false --SetPartialStrut false --expand false --width 10 --transparent true --tint 0x191970 --height 17 --monitor 1" spawn "nm-applet" - spawn "~/annex/dev/code/dotfiles/scripts/once-only-nextcloud.sh" + spawn "~/dev/libre/dotfiles/scripts/once-only-owncloud.sh" setWMName "LG3D" -- https://stackoverflow.com/questions/30742662/java-swing-gui-not-displaying-in-xmonad diff --git a/xmonad/xsession.sh b/xmonad/xsession.sh index b25a9a1..542994f 100644 --- a/xmonad/xsession.sh +++ b/xmonad/xsession.sh @@ -1 +1,3 @@ +#!/usr/bin/env bash + xmonad |