home | refactor

This commit is contained in:
Don Harper 2024-01-06 14:02:54 -06:00
parent 672d71a83a
commit 73fadb981d
468 changed files with 197 additions and 210 deletions

34
home/common/bash.nix Normal file
View file

@ -0,0 +1,34 @@
{ config, pkgs, ... }:
{
imports = [ ./bash_complition.nix ];
home.file.".bash_aliases".source = files/bash/bash_aliases;
home.file.".bash_functions".source = files/bash/bash_functions;
home.file.".bash_hosts".source = files/bash/bash_hosts;
home.file.".bash_keychain".source = files/bash/bash_keychain;
home.file.".bash_logout".source = files/bash/bash_logout;
home.file.".bash_motd".source = files/bash/bash_motd;
home.file.".bash_motd_ownscript.sh".source = files/bash/bash_motd_ownscript.sh;
home.file.".bash_profile".source = files/bash/bash_profile;
home.file.".bashrc".source = files/bash/bashrc;
home.file.".bash_ssh".source = files/bash/bash_ssh;
home.file.".myapps".source = files/bash/myapps;
programs.readline = {
enable = true;
bindings = {
"\\e[A" = "history-search-backward";
"\\e[B" = "history-search-forward";
};
extraConfig = ''
set input-meta on
set output-meta on
set colored-stats On
set completion-ignore-case On
set completion-prefix-display-length 3
set mark-symlinked-directories On
set show-all-if-ambiguous On
set show-all-if-unmodified On
set visible-stats On
'';
};
}

View file

@ -0,0 +1,437 @@
{ pkgs, ... }: {
home.file = {
doascomplete = {
enable = true;
target = ".bash_completion.d/doas.sh";
text = ''
_doas()
{
local cur prev words cword split
_init_completion -s || return
local i mode=normal
[[ ''$1 == *doasedit ]] && mode=edit
[[ ''$mode == normal ]] &&
for ((i = 1; i <= cword; i++)); do
if [[ ''${words[i]} != -* ]]; then
local PATH=''$PATH:/sbin:/usr/sbin:/usr/local/sbin
local root_command=''${words[i]}
_command_offset ''$i
return
fi
[[ ''${words[i]} == -@(!(-*)[uUgCp]) ]] &&
((i++))
done
case "''$prev" in
-u)
COMPREPLY=(''$(compgen -u -- "''$cur"))
return
;;
esac
''$split && return
if [[ ''$cur == -* ]]; then
local opts=''$(_parse_help "''$1")
COMPREPLY=(''$(compgen -W ' ''${opts:-''$(_parse_usage "''$1")}' -- "''$cur"))
[[ ''${COMPREPLY-} == *= ]] && compopt -o nospace
return
fi
if [[ ''$mode == edit ]]; then
_filedir
fi
} &&
complete -F _doas doas
'';
};
taskcomplete = {
enable = true;
target = ".bash_completion.d/task.sh";
text = ''
################################################################################
#
# Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# http://www.opensource.org/licenses/mit-license.php
#
################################################################################
#
# The routines will do completion of:
#
# *) task subcommands
# *) project names
# *) tag names
# *) aliases
#
# To use these routines:
#
# 1) Copy this file to somewhere (e.g. ~/.bash_completion.d/task.sh).
# 2) Add the following line to your .bashrc:
# source ~/.bash_completion.d/task.sh
#
# OR
#
# 3) Copy the file to /etc/bash_completion.d
# 4) source /etc/bash_completion
#
# To submit patches/bug reports:
#
# *) Go to the project's website at
#
# http://taskwarrior.org
#
################################################################################
#the following variable is substituted for by ../../test/bash_completion.t
taskcommand='task rc.verbose:nothing rc.confirmation:no rc.hooks:off'
_task_get_tags() {
''$taskcommand _tags
}
_task_get_config() {
''$taskcommand _config
}
_task_offer_priorities() {
COMPREPLY=( ''$(compgen -W "L M H" -- ''${cur/*:/}) )
}
_task_offer_projects() {
COMPREPLY=( ''$(compgen -W "''$(''$taskcommand _projects)" -- ''${cur/*:/}) )
}
_task_offer_contexts() {
COMPREPLY=( ''$(compgen -W "''$(''$taskcommand _context) define delete list none show" -- ''$cur) )
}
_task_context_alias=''$(''$taskcommand show | grep alias.*context | cut -d' ' -f1 | cut -d. -f2)
_task()
{
local cur prev opts base
COMPREPLY=()
cur="''${COMP_WORDS[COMP_CWORD]}"
prev="''${COMP_WORDS[COMP_CWORD-1]}"
if [ ''${#COMP_WORDS[*]} -gt 2 ]
then
prev2="''${COMP_WORDS[COMP_CWORD-2]}"
else
prev2=""
fi
# useful for debugging:
# echo -e "\ncur='''$cur'"
# echo "prev='''$prev'"
# echo "prev2='''$prev2'"
abbrev_min=''$(''$taskcommand show | grep "abbreviation.minimum" | awk {'print ''$2'})
commands_aliases=''$(echo ''$(''$taskcommand _commands; ''$taskcommand _aliases) | tr " " "\n"|sort|tr "\n" " ")
opts="''$commands_aliases ''$(''$taskcommand _columns)"
case "''${prev}" in
''$_task_context_alias|cont|conte|contex|context)
_task_offer_contexts
return 0
;;
:)
case "''${prev2}" in
pri|prior|priori|priorit|priority)
if [ ''${#prev2} -ge ''$abbrev_min ]; then
_task_offer_priorities
fi
return 0
;;
pro|proj|proje|projec|project)
if [ ''${#prev2} -ge ''$abbrev_min ]; then
_task_offer_projects
fi
return 0
;;
rc)
# not activated when only "rc:" but is activated if anything after "rc:"
_filedir
return 0
;;
rc.data.location)
_filedir -d
return 0
;;
esac
;;
*)
case "''${cur}" in
pro:*|proj:*|proje:*|projec:*|project:*)
_task_offer_projects
return 0
;;
:)
case "''${prev}" in
pri|prior|priori|priorit|priority)
if [ ''${#prev} -ge ''$abbrev_min ]; then
_task_offer_priorities
fi
return 0
;;
pro|proj|proje|projec|project)
if [ ''${#prev} -ge ''$abbrev_min ]; then
_task_offer_projects
fi
return 0
;;
rc)
# activated only when "rc:"
cur="" # otherwise ":" is passed.
_filedir
return 0
;;
rc.data.location)
cur=""
_filedir -d
return 0
;;
esac
;;
+*)
local tags=''$(_task_get_tags | sed 's/^/+/')
COMPREPLY=( ''$(compgen -W "''${tags}" -- ''${cur}) )
return 0
;;
-*)
local tags=''$(_task_get_tags | sed 's/^/-/')
COMPREPLY=( ''$(compgen -W "''${tags}" -- ''${cur}) )
return 0
;;
rc.*)
local config=''$(_task_get_config | sed -e 's/^/rc\./' -e 's/''$/:/')
COMPREPLY=( ''$(compgen -W "''${config}" -- ''${cur}) )
return 0
;;
*)
case "''${prev}" in
import)
COMPREPLY=( ''$(compgen -o "default" -- ''${cur}) )
return 0
;;
esac
;;
esac
;;
esac
COMPREPLY=( ''$(compgen -W "''${opts}" -- ''${cur}) )
return 0
}
complete -o nospace -F _task task
complete -o nospace -F _task t
'';
};
timecomplete = {
enable = true;
target = ".bash_completion.d/timew.sh";
text = ''
# Bash completion for TimeWarrior
#
# Copyright (C) 2017 - 2021, Thomas Lauf
#
function __get_commands()
{
echo "annotate cancel config continue day delete diagnostics export extensions gaps get help join lengthen modify month move report resize shorten show split start stop summary tag tags track undo untag week"
}
function __get_subcommands()
{
case "''${1}" in
modify)
echo -e "end start"
;;
*)
echo ""
;;
esac
}
function __get_help_items()
{
echo -e "''$( __get_commands ) interval hints date duration dom"
}
function __get_options()
{
echo -e "--help --verbose --version"
}
function __get_ids()
{
local count
count="''$( timew get dom.tracked.count )"
if [[ "''${count}" -eq "0" ]] ; then
echo ""
else
seq -f "@%g" 1 "''${count}"
fi
}
function __get_tags()
{
timew tags | tail -n +4 -- | sed -e "s|[[:space:]]*-''$||"
}
function __get_extensions()
{
timew extensions | awk '{if(NR>6)print ''$1}'
}
function __has_entered_id()
{
for word in "''${COMP_WORDS[@]}" ; do
if [[ "''${word}" =~ ^@[0-9] ]] ; then
return 0
fi
done
return 1
}
function __has_entered_subcommand()
{
local subcommands=''$( __get_subcommands "''${1}" )
for word in "''${COMP_WORDS[@]}" ; do
for cmd in ''${subcommands} ; do
if [[ "''${word}" == "''${cmd}" ]] ; then
return 0
fi
done
done
return 1
}
function __has_entered_help_item()
{
local items=''$( __get_help_items )
for word in "''${COMP_WORDS[@]:2}" ; do
for item in ''${items} ; do
if [[ "''${word}" == "''${item}" ]] ; then
return 0
fi
done
done
return 1
}
function __is_entering_id()
{
if [[ "''${COMP_WORDS[COMP_CWORD]}" =~ @[0-9]* ]] ; then
return 0
else
return 1
fi
}
function __complete_tag()
{
COMPREPLY=()
cur="''${COMP_WORDS[COMP_CWORD]}"
local line wordlist
declare -a wordlist
while IFS=''$'\n' read -r line ; do
wordlist+=( "''${line}" )
done <<< "''$( __get_tags )"
declare -a completions
while read -r line ; do
completions+=( "''${line}" )
done < <( compgen -W "''$(printf '%q ' "''${wordlist[@]}")" -- "''${cur}" 2>/dev/null )
for completion in "''${completions[@]}" ; do
COMPREPLY+=( "''$(printf "%q" "''${completion}")" )
done
}
function _timew()
{
local cur first wordlist
COMPREPLY=()
cur="''${COMP_WORDS[COMP_CWORD]}"
first="''${COMP_WORDS[1]}"
case "''${first}" in
cancel|config|diagnostics|day|extensions|get|month|show|undo|week)
wordlist=""
;;
annotate|continue|delete|join|lengthen|move|resize|shorten|split)
wordlist=''$( __get_ids )
;;
export|gaps|start|stop|summary|tags|track)
__complete_tag
return
;;
modify)
if __has_entered_subcommand "''${first}" ; then
wordlist=''$( __get_ids )
else
wordlist=''$( __get_subcommands "''${first}" )
fi
;;
tag|untag)
if __is_entering_id ; then
wordlist=''$( __get_ids )
elif __has_entered_id ; then
__complete_tag
return
else
wordlist=''$( __get_ids )
fi
;;
report)
wordlist=''$( __get_extensions )
;;
help)
if __has_entered_help_item ; then
wordlist=""
else
wordlist=''$( __get_help_items )
fi
;;
-*)
wordlist=''$( __get_options )
;;
*)
wordlist=''$( __get_commands )
;;
esac
COMPREPLY=(''$( compgen -W "''${wordlist}" -- "''${cur}" ))
}
complete -F _timew timew
complete -F _timew tt
'';
};
};
}

12
home/common/btop.nix Normal file
View file

@ -0,0 +1,12 @@
{ config, pkgs, ... }:
{
#home.packages = with pkgs; [ btop ];
programs.btop = {
enable = true;
settings = {
color_theme = "dracula";
theme_background = true;
proc_gradient = false;
};
};
}

101
home/common/bufferline.nix Normal file
View file

@ -0,0 +1,101 @@
{ pkgs, ... }:
{
programs.neovim = {
plugins = with pkgs.vimPlugins; [
{
plugin = bufferline-nvim;
type = "lua";
config = ''
require("bufferline").setup({
options = {
close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
},
highlights = {
fill = {
fg = "#ff0000",
bg = { attribute = "bg", highlight = "TabLine" },
},
background = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
buffer_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
close_button = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
close_button_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
tab_selected = {
fg = { attribute = "fg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},
tab = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
tab_close = {
fg = { attribute = "fg", highlight = "TabLineSel" },
bg = { attribute = "bg", highlight = "Normal" },
},
duplicate_selected = {
fg = { attribute = "fg", highlight = "TabLineSel" },
bg = { attribute = "bg", highlight = "TabLineSel" },
italic = true,
},
duplicate_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
italic = true,
},
duplicate = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
italic = true,
},
modified = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
modified_selected = {
fg = { attribute = "fg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},
modified_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
separator = {
fg = { attribute = "bg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
separator_selected = {
fg = { attribute = "bg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},
indicator_selected = {
fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
bg = { attribute = "bg", highlight = "Normal" },
},
},
})
'';
}
];
};
}
# vim: shiftwidth=2 tabstop=2 expandtab

88
home/common/default.nix Normal file
View file

@ -0,0 +1,88 @@
{ config, pkgs, ... }:
{
imports = [
./bash.nix
./btop.nix
./git.nix
./gnupg.nix
./khal.nix
./khard.nix
./lf.nix
./liquidprompt.nix
./listadmin.nix
./mail.nix
./mopidy.nix
./neovim.nix
./newsboat.nix
./taskwarrior.nix
./topgrade.nix
./tmux.nix
./vifm.nix
];
home.packages = with pkgs; [
bc
bitwarden-cli
bottom
cargo
diff-so-fancy
exiftool
fbterm
ffmpeg
figlet
file
fzf
gdu
gitui
gh
gmailctl
gnumake
gnupg
gping
gtop
htop
hugo
immich-cli
jq
keychain
keyutils
lazygit
links2
liquidprompt
lunarvim
moreutils
mosh
mutt-ics
ncdu
neofetch
neomutt
nmap
nodejs_21
notmuch
pandoc
pinentry
ps_mem
psmisc
ranger
socat
sqlite
syncthing
tailscale
tig
tmux-cssh
toot
topgrade
tut
units
unzip
urlscan
vdirsyncer
vlock
wget
zip
];
services = {
syncthing = {
tray.enable = true;
};
};
}

View file

@ -0,0 +1,30 @@
alias x="myX"
alias build="notify-send 'Build complete' || notify-send 'Build failed'"
alias tbuild='/usr/share/doc/Xdialog-2.0.6/samples/Xmessage "Build in `pwd` completed at `date`" || /usr/share/doc/Xdialog-2.0.6/samples/Xmessage "Build in `pwd` failed at `date`"'
alias mroe=more
alias moer=more
alias ls="ls -hCF"
alias l="ls -l"
alias df="df -h -x squashfs"
alias du="du -h"
if [ -x /home/don/.local/bin/dotdrop ]
then
alias dotdrop="/home/don/.local/bin/dotdrop -c ~/.dotfiles/config.yaml"
else
alias dotdrop="/usr/bin/dotdrop -c ~/.dotfiles/config.yaml"
fi
test -x /usr/bin/bat && alias cat='bat'
alias ip='COLORFGBG=";0" ip -c '
# Taskwarrior
alias t=task
alias ttoday="task +TODAY or +OVERDUE -BLOCKED"
alias ttom="task +OVERDUE or +TOMORROW -BLOCKED"
alias to="task list +OVERDUE"
alias turl="task nnext | urlscan -c -d"
alias tfollow="task list +followup"
alias tnext="task list +nextactions"
alias open=xdg-open
alias tt=timew
alias top=btop
alias tnixos="tmuxinator start nixos"

View file

@ -0,0 +1,203 @@
#!/usr/bin/env bash
#===============================================================================
#
# FILE: .bash_functions
#
# USAGE: source ~/.bash_functions
#
# DESCRIPTION: bash functions for interactive shell
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Don Harper (), duckunix@gmail.com
# COMPANY: Don Harper
# VERSION: 1.2
# CREATED: 06/11/2007 11:17:14 PM CDT
# REVISION: ---
#===============================================================================
function nssh ()
{
. ~/.bash_ssh
ssh-keygen -R "${1}"
ssh "${@}"
}
function ss ()
{
tmux neww -n "${1}" ". ~/.bash_ssh ; ssh ${*}"
}
function mss ()
{
tmux neww -n "${1}" ". ~/.bash_ssh ; mosh ${*}"
}
function nss ()
{
ssh-keygen -R "${1}"
tmux neww -n "${1}" ". ~/.bash_ssh ; ssh ${*}"
}
function pss ()
{
tmux split-window -h ". ~/.bash_ssh ; ssh ${*}"
}
function pnss ()
{
ssh-keygen -R "${1}"
tmux split-window -h ". ~/.bash_ssh ; ssh ${*}"
}
function yay ()
{
echo "$(pwd) : yay $*" | plod
unset LOGFILE
/usr/bin/yay "$@"
}
function doas ()
{
echo "$(pwd) : doas $*" | plod
unset LOGFILE
/usr/bin/env doas "$@"
}
function sudo ()
{
echo "$(pwd) : sudo $*" | plod
unset LOGFILE
/usr/bin/env sudo "$@"
}
function pushnew ()
{
plod Pushing configs to "${1}"
cd "${HOME}" || exit
if [ -z "${1}" ]
then
echo "usage: pushnew <host> <user>"
return
fi
if [ -z "${2}" ]
then
echo "usage: pushnew <host> <user>"
return
fi
ssh-copy-id "${2}"@"${1}"
ssh "${2}"@"${1}" mkdir -p .ssh Nextcloud/bin Nextcloud/lib Nextcloud/dotfiles .config
scp .ssh/{authorized_keys,config,id_*} "${2}"@"${1}":.ssh
scp -r .dotfilesrc .myapps .tmux.conf "${2}"@"${1}":
ssh "${2}"@"${1}" which rsync
if [ $? == 1 ]
then
echo "${1} needs rsync. Press enter when installed"
read foo
fi
rsync -avt .config/polybar "${2}"@"${1}":.config
rsync -avt Nextcloud/bin "${2}"@"${1}":Nextcloud
rsync -avt Nextcloud/lib "${2}"@"${1}":Nextcloud
rsync -avt Nextcloud/dotfiles "${2}"@"${1}":Nextcloud
rsync -avt Nextcloud/sigs "${2}"@"${1}":Nextcloud
rsync -avt Nextcloud/ansible "${2}"@"${1}":Nextcloud
ssh "${2}"@"${1}" 'for dir in bin lib web sigs ansible; do ln -s ${HOME}/Nextcloud/${dir} ${HOME}/${dir};done'
}
function crontab ()
{
CRONFILE=$HOME/lib/crontab/$HOSTNAME_SHORT
if which fcrontab > /dev/null 2>&1
then
CTEXEC=$(which fcrontab)
elif which crontab > /dev/null 2>&1
then
CTEXEC=$(which crontab)
fi
case "${1}" in
-e)
"${CTEXEC}" -e ; "${CTEXEC}" -l >| "${CRONFILE}"
;;
*)
cat "${CRONFILE}"
;;
esac
}
function add_cxoffice_path ()
{
if test -d ~/.cxoffice
then
OLDLANG=$LANG
export LANG=C
for cxdir in ~/.cxoffice/[A-Za-z]*/{desktopdata/cxmenu/StartMenu*/Programs,drive_c/users/*/Start*/Programs}
do
for dir in $(find "$cxdir" -type f -exec dirname {} \;)
do
buildpath PATH "$dir"
done
done
export LANG=$OLDLANG
fi
}
cd_func ()
{
local x2 the_new_dir adir index
local -i cnt
if [[ "${1}" == "--" ]]; then
dirs -v
return 0
fi
the_new_dir="${1}"
[[ -z "${1}" ]] && the_new_dir=$HOME
if [[ ${the_new_dir:0:1} == '-' ]]; then
#
# Extract dir N from dirs
index=${the_new_dir:1}
[[ -z $index ]] && index=1
adir=$(dirs +$index)
[[ -z $adir ]] && return 1
the_new_dir=$adir
fi
#
# '~' has to be substituted by ${HOME}
[[ ${the_new_dir:0:1} == '~' ]] && the_new_dir="${HOME}${the_new_dir:1}"
#
# Now change to the new dir and add to the top of the stack
pushd "${the_new_dir}" > /dev/null
[[ $? -ne 0 ]] && return 1
the_new_dir=$(pwd)
#
# Trim down everything beyond 11th entry
popd -n +21 2>/dev/null 1>/dev/null
#
# Remove any other occurence of this dir, skipping the top of the stack
for ((cnt=1; cnt <= 20; cnt++)); do
x2=$(dirs +${cnt} 2>/dev/null)
[[ $? -ne 0 ]] && return 0
[[ ${x2:0:1} == '~' ]] && x2="${HOME}${x2:1}"
if [[ "${x2}" == "${the_new_dir}" ]]; then
popd -n +$cnt 2>/dev/null 1>/dev/null
cnt=$((cnt-1))
fi
done
return 0
}
alias cd=cd_func
tgrep ()
{
task info ${*} | egrep '(Parent|Due|Last)'
}

View file

@ -0,0 +1 @@
${1}

View file

@ -0,0 +1 @@
test -x /usr/local/bin/keychain && /usr/local/bin/keychain -q ~/.ssh/id_dsa && . ~/.keychain/$HOSTNAME-sh

View file

@ -0,0 +1,11 @@
# ~/.bash_logout: executed by bash(1) when login shell exits.
# when leaving the console clear the screen to increase privacy
if [ "$SHLVL" = 1 ]; then
if [ -x /usr/bin/clear_console ]; then
/usr/bin/clear_console -q
else
clear
fi
fi

View file

@ -0,0 +1,617 @@
#!/bin/sh
# shellcheck disable=SC1090,SC1091
BAR_ELEMENT="-"
BAR_HEALTHY_COLOR="32"
BAR_WARNING_THRESHOLD=70
BAR_WARNING_COLOR="33"
BAR_CRITICAL_THRESHOLD=90
BAR_CRITICAL_COLOR="31"
BANNER_KERNEL_ICON="#"
BANNER_KERNEL_COLOR="33"
BANNER_UPTIME_ICON="#"
BANNER_UPTIME_COLOR="94"
BANNER_DEBIAN_ICON="#"
BANNER_DEBIAN_COLOR="95"
BANNER_FEDORA_ICON="#"
BANNER_FEDORA_COLOR="34"
BANNER_ARCH_ICON="#"
BANNER_ARCH_COLOR="95"
BANNER_FONTPATH="standard"
BANNER_TEXT="$(hostnamectl | awk -F: '$1=/Static hostname/{print $2}' | sed 's/^ //')"
PROCESSOR_LOADAVG_ICON="#"
PROCESSOR_LOADAVG_HEALTHY_COLOR="32"
PROCESSOR_LOADAVG_WARNING_THRESHOLD=2
PROCESSOR_LOADAVG_WARNING_COLOR="33"
PROCESSOR_LOADAVG_CRITICAL_THRESHOLD=4
PROCESSOR_LOADAVG_CRITICAL_COLOR="31"
PROCESSOR_MODEL_ICON="#"
MEMORY_ICON="#"
SWAP_ICON="#"
DISKSPACE_ICON="#"
SERVICES_UP_ICON="#"
SERVICES_UP_COLOR="32"
SERVICES_DOWN_ICON="#"
SERVICES_DOWN_COLOR="31"
SERVICES_FILE=".bashrc_motd_services.txt"
PODMAN_VERSION_ICON="#"
PODMAN_IMAGES_ICON="#"
PODMAN_RUNNING_ICON="#"
PODMAN_RUNNING_COLOR="32"
PODMAN_OTHER_ICON="#"
PODMAN_OTHER_COLOR="90"
DOCKER_VERSION_ICON="#"
DOCKER_IMAGES_ICON="#"
DOCKER_RUNNING_ICON="#"
DOCKER_RUNNING_COLOR="32"
DOCKER_OTHER_ICON="#"
DOCKER_OTHER_COLOR="90"
UPDATES_ZERO_ICON="#"
UPDATES_ZERO_COLOR="32"
UPDATES_AVAILIABLE_ICON="#"
UPDATES_AVAILIABLE_COLOR="33"
UPDATES_SECURITY_ICON="#"
UPDATES_SECURITY_COLOR="31"
LETSENCRYPT_VALID_ICON="#"
LETSENCRYPT_VALID_COLOR="32"
LETSENCRYPT_WARNING_ICON="#"
LETSENCRYPT_WARNING_COLOR="33"
LETSENCRYPT_INVALID_ICON="#"
LETSENCRYPT_INVALID_COLOR="31"
LETSENCRYPT_CERTPATH="/etc/letsencrypt/live"
LOGIN_LOGIN_ICON="#"
LOGIN_LOGOUT_ICON="#"
LOGIN_IP_ICON="#"
INCLUDE_FILE=".bash_motd_ownscript.sh"
generate_unit_byte() {
# 1 - unit in M
if [ "$1" -ge 1024 ]; then
unit_symbol="G"
unit_value=$(echo "$1/1024" | bc -l | LANG=C xargs printf "%.1f\n")
else
unit_symbol="M"
unit_value=$1
fi
echo "$unit_value$unit_symbol"
}
generate_space() {
# 1 - already used
# 2 - total
space_fill=$(( $2 - ${#1} ))
space_chars=""
while [ $space_fill -ge 0 ]; do
space_chars="$space_chars "
space_fill=$(( space_fill - 1 ))
done
echo "$space_chars"
}
generate_bar() {
# 1 - icon
# 2 - total
# 3 - used_1
# 4 - [ used_2 ]
bar_percent=$(( $3 * 100 / $2 ))
bar_separator=$(( $3 * 100 * 10 / $2 / 25 ))
if [ $bar_percent -ge "$BAR_WARNING_THRESHOLD" ]; then
bar_color=$BAR_WARNING_COLOR
elif [ $bar_percent -ge "$BAR_CRITICAL_THRESHOLD" ]; then
bar_color=$BAR_CRITICAL_COLOR
else
bar_color=$BAR_HEALTHY_COLOR
fi
printf " %s \\033[%dm" "$1" "$bar_color"
if [ -z "$4" ] ; then
bar_piece=0
while [ $bar_piece -le 40 ]; do
if [ "$bar_piece" -ne "$bar_separator" ]; then
printf "%s" "$BAR_ELEMENT"
else
printf "%s\\033[1;30m" "$BAR_ELEMENT"
fi
bar_piece=$(( bar_piece + 1 ))
done
else
bar_cached_val=$(( $3 + $4 ))
bar_cached_separator=$(( bar_cached_val * 100 * 10 / $2 / 25 ))
bar_piece=0
while [ $bar_piece -le 40 ]; do
if [ $bar_piece -eq $bar_separator ]; then
printf "%s\\033[1;36m" "$BAR_ELEMENT"
elif [ $bar_piece -eq $bar_cached_separator ]; then
printf "%s\\033[1;30m" "$BAR_ELEMENT"
else
printf "%s" "$BAR_ELEMENT"
fi
bar_piece=$(( bar_piece + 1 ))
done
fi
printf "\\033[0m\\n"
}
generate_bar_memory() {
# 1 - icon
# 2 - total memory in M
# 3 - used memory in M
# 4 - cached memory in M
bar_memory_used=$(generate_unit_byte "$3")
bar_memory_cached=$(generate_unit_byte "$4")
bar_memory_available=$(generate_unit_byte $(( $2 - $3 )) )
printf " %s used / %s cached / %s available\\n" "$bar_memory_used" "$bar_memory_cached" "$bar_memory_available"
generate_bar "$1" "$2" "$3" "$4"
}
generate_bar_swap() {
# 1 - icon
# 2 - total swap in M
# 3 - used swap in M
bar_swap_used=$(generate_unit_byte "$3")
bar_swap_available=$(( $2 - $3 ))
bar_swap_available=$(generate_unit_byte "$bar_swap_available")
printf " %s used / %s available\\n" "$bar_swap_used" "$bar_swap_available"
generate_bar "$1" "$2" "$3"
}
generate_bar_disk() {
# 1 - icon
# 2 - total size in M
# 3 - used space in M
# 4 - mount path
bar_disk_mount="$4$(generate_space "$4" 10)"
bar_disk_used=$(generate_unit_byte "$3")
bar_disk_used="$(generate_space "$bar_disk_used" 5)$bar_disk_used used"
bar_disk_available=$(( $2 - $3 ))
bar_disk_available="$(generate_unit_byte "$bar_disk_available") available"
printf " %s %s / %s\\n" "$bar_disk_mount" "$bar_disk_used" "$bar_disk_available"
generate_bar "$1" "$2" "$3"
}
print_banner() {
printf "\\n%s\\n" "$(figlet -t -f "$BANNER_FONTPATH" " $BANNER_TEXT")"
if [ -f /etc/os-release ]; then
. /etc/os-release
if [ "$ID" = "debian" ]; then
banner_distro_icon=$BANNER_DEBIAN_ICON
banner_distro_color=$BANNER_DEBIAN_COLOR
banner_distro_name="Debian"
banner_distro_version=$(cat /etc/debian_version)
elif [ "$ID" = "ubuntu" ]; then
banner_distro_icon=$BANNER_DEBIAN_ICON
banner_distro_color=$BANNER_DEBIAN_COLOR
banner_distro_name="Ubuntu"
banner_distro_version=$VERSION_ID
elif [ "$ID" = "fedora" ]; then
banner_distro_icon=$BANNER_FEDORA_ICON
banner_distro_color=$BANNER_FEDORA_COLOR
banner_distro_name="Fedora"
banner_distro_version=$VERSION_ID
elif [ "$ID" = "arch" ] || [ "$ID_LIKE" = "arch" ]; then
banner_distro_icon=$BANNER_ARCH_ICON
banner_distro_color=$BANNER_ARCH_COLOR
banner_distro_name="Arch-Based"
banner_distro_version=$BUILD_ID
elif [ "$ID" = "nixos" ] || [ "$ID_LIKE" = "nixos" ]; then
banner_distro_icon=$BANNER_ARCH_ICON
banner_distro_color=$BANNER_ARCH_COLOR
banner_distro_name="NixOS"
banner_distro_version=$BUILD_ID
else
banner_distro_icon="?"
banner_distro_color="0"
banner_distro_name="Unknown"
banner_distro_version="?"
fi
banner_distro_space=$(generate_space "$banner_distro_name" 13)
printf " \\033[%sm%s %s\\033[0m%s%s\\n" "$banner_distro_color" "$banner_distro_icon" "$banner_distro_name" "$banner_distro_space" "$banner_distro_version"
printf " \\033[%sm%s Linux\\033[0m %s\\n\\n" "$BANNER_KERNEL_COLOR" "$BANNER_KERNEL_ICON" "$(cut -d ' ' -f 3 < /proc/version)"
printf " \\033[%sm%s Uptime\\033[0m %s\\n" "$BANNER_UPTIME_COLOR" "$BANNER_UPTIME_ICON" "$(awk '{printf("%d days, %d hours, %d minutes \n",($1/60/60/24),($1/60/60%24),($1/60%60))}' /proc/uptime)"
fi
}
print_processor() {
printf "\\n"
printf " \\033[1;37mProcessor:\\033[0m\\n"
processor_loadavg="$(cut -d " " -f 1,2,3 < /proc/loadavg)"
if [ "$(echo "$processor_loadavg" | cut -d "." -f 1)" -ge "$PROCESSOR_LOADAVG_CRITICAL_THRESHOLD" ]; then
processor_loadavg_color=$PROCESSOR_LOADAVG_CRITICAL_COLOR
elif [ "$(echo "$processor_loadavg" | cut -d "." -f 1)" -ge "$PROCESSOR_LOADAVG_WARNING_THRESHOLD" ]; then
processor_loadavg_color=$PROCESSOR_LOADAVG_WARNING_COLOR
else
processor_loadavg_color=$PROCESSOR_LOADAVG_HEALTHY_COLOR
fi
processor_info=$(cat /proc/cpuinfo)
processor_arch=$(uname -m)
if [ "$processor_arch" = "x86_64" ]; then
processor_model="$(echo "$processor_info" | grep "model name" | sort -u | cut -d ':' -f 2)"
processor_count=$(echo "$processor_info" | grep "physical id" | sort -u | wc -l)
processor_cores=$(echo "$processor_info" | grep "cpu cores" | sort -u | cut -d ':' -f 2)
processor_threads=$(( $(echo "$processor_info" | grep "siblings" | tail -n 1 | cut -d ':' -f 2) ))
if [ ! "$processor_cores" -eq $processor_threads ]; then
processor_threads=", $processor_threads Threads"
else
processor_threads=""
fi
elif [ "$processor_arch" = "mips64" ]; then
processor_model="$(echo "$processor_info" | grep "cpu model" | sort -u | cut -d ':' -f 2)"
processor_count=$(echo "$processor_info" | grep "package" | sort -u | wc -l)
processor_cores=$(echo "$processor_info" | grep -c processor)
processor_threads=""
else
processor_model="?"
processor_count=0
processor_cores=0
processor_threads=0
fi
processor_model=$(echo "$processor_model" | sed "s/(R)//g")
processor_model=$(echo "$processor_model" | sed "s/(tm)//g")
processor_model=$(echo "$processor_model" | sed "s/ @/,/")
processor_model=$(echo "$processor_model" | sed "s/ CPU//")
processor_model=$(echo "$processor_model" | sed "s/ / /")
processor_model=$(echo "$processor_model" | sed "s/^ //g")
processor_cores=$(( processor_cores * processor_count ))
if [ "$processor_count" -gt 1 ]; then
processor_count="$processor_count""x "
else
processor_count=""
fi
printf " %s \\033[%dm%s\\033[0m\\n" "$PROCESSOR_LOADAVG_ICON" "$processor_loadavg_color" "$processor_loadavg"
printf " %s %s%s = %s Cores%s\\n" "$PROCESSOR_MODEL_ICON" "$processor_count" "$processor_model" "$processor_cores" "$processor_threads"
}
print_memory() {
printf "\\n"
printf " \\033[1;37mMemory:\\033[0m\\n"
memory_usage=$(LANG=C free --mega | grep "Mem:")
memory_total=$(echo "$memory_usage" | awk '{ print $2 }')
memory_used=$(echo "$memory_usage" | awk '{ print $3 }')
memory_cached=$(echo "$memory_usage" | awk '{ print $6 }')
generate_bar_memory "$MEMORY_ICON" "$memory_total" "$memory_used" "$memory_cached"
}
print_swap() {
swap_usage=$(LANG=C free --mega | grep "Swap:")
swap_total=$(echo "$swap_usage" | awk '{ print $2 }')
swap_used=$(echo "$swap_usage" | awk '{ print $3 }')
if [ "$swap_total" -ne 0 ]; then
printf "\\n"
printf " \\033[1;37mSwap:\\033[0m\\n"
generate_bar_swap "$SWAP_ICON" "$swap_total" "$swap_used"
fi
}
print_diskspace() {
printf "\\n"
printf " \\033[1;37mDiskspace:\\033[0m\\n"
diskspace_partitions=$(df -tvfat -text4 -tbtrfs -tzfs -B M -P | sed -e "s/M//g" | grep -v "^Filesystem")
diskspace_index=0
echo "$diskspace_partitions" | while read -r line; do
diskspace_disk_mount="$(echo "$line" | awk '{ print $1 }')"
diskspace_disk_size="$(echo "$line" | awk '{ print $2 }')"
diskspace_disk_used="$(echo "$line" | awk '{ print $3 }')"
if [ "$diskspace_index" -ne 0 ]; then
printf "\\n"
fi
diskspace_index=$(( diskspace_index + 1 ))
generate_bar_disk "$DISKSPACE_ICON" "$diskspace_disk_size" "$diskspace_disk_used" "$diskspace_disk_mount"
done
}
print_services() {
if [ -f $SERVICES_FILE ] && [ "$(wc -l < $SERVICES_FILE )" != 0 ]; then
printf "\\n"
printf " \\033[1;37mServices:\\033[0m \\033[1;37mVersion:\\033[0m\\n"
while read -r line; do
service_description=$(echo "$line" | cut -d ';' -f 1)
service_name=$(echo "$line" | cut -d ';' -f 2)
service_package=$(echo "$line" | cut -d ';' -f 3)
if [ -n "$service_description" ] && [ -n "$service_name" ]; then
if systemctl is-active --quiet "$service_name".service; then
service_icon=$SERVICES_UP_ICON
service_color=$SERVICES_UP_COLOR
else
service_icon=$SERVICES_DOWN_ICON
service_color=$SERVICES_DOWN_COLOR
fi
service_space=$(generate_space "$service_description" 34)
if [ -n "$service_package" ]; then
if [ -f /usr/bin/apt ]; then
package_version=$(dpkg -s "$service_package" | grep '^Version:' | cut -d ' ' -f 2 | cut -d ':' -f 2 | cut -d '-' -f 1)
elif [ -f /usr/bin/rpm ]; then
package_version=$(rpm -q --queryformat '%{VERSION}' "$service_package")
else
package_version="?"
fi
else
package_version="--"
fi
fi
printf " \\033[%sm%s\\033[0m %s%s%s\\n" "$service_color" "$service_icon" "$service_description" "$service_space" "$package_version"
done < $SERVICES_FILE | grep -v '#'
fi
}
print_podman() {
if ! which podman >> /dev/null 2>&1
then
return
fi
printf "\\n"
printf " \\033[1;37mPodman:\\033[0m\\n"
podman_version=$(podman version --format json | jq -r '.Client.Version')
podman_space=$(generate_space "$podman_version" 23)
podman_images=$(podman images --format json | jq '. | length')
printf " %s Version %s%s%s %s Images\\n\\n" "$PODMAN_VERSION_ICON" "$podman_version" "$podman_space" "$PODMAN_IMAGES_ICON" "$podman_images"
podman_list=$(podman pod ls --sort name --format json)
podman_pods=$(echo "$podman_list" | jq -r '.[] .Name')
echo "$podman_pods" | while read -r pod; do
if [ "$(echo "$podman_list" | jq -r ".[] | select(.Name == \"$pod\") | .Status")" = "Running" ]; then
pod_space=$(generate_space "$pod" 34)
pod_container_running="$(echo "$podman_list" | jq -r ".[] | select(.Name == \"$pod\") | .Containers[] | select(.Status == \"running\") | .Status" | wc -l)"
if [ "$pod_container_running" -ne 0 ]; then
pod_container_running=$(printf "\\033[%um%u Running\\033[0m" "$PODMAN_RUNNING_COLOR" "$pod_container_running")
fi
pod_container_other="$(echo "$podman_list" | jq -r ".[] | select(.Name == \"$pod\") | .Containers[] | select(.Status != \"running\") | .Status" | wc -l)"
if [ "$pod_container_other" -ne 0 ]; then
pod_container_other=$(printf ", \\033[%um%u Other\\033[0m" "$PODMAN_OTHER_COLOR" "$pod_container_other")
else
pod_container_other=""
fi
pod_status="$pod_container_running$pod_container_other"
printf " \\033[%um%s\\033[0m %s%s%s\\n" "$PODMAN_RUNNING_COLOR" "$PODMAN_RUNNING_ICON" "$pod" "$pod_space" "$pod_status"
else
printf " \\033[%um%s\\033[0m \\033[%um%s\\033[0m\\n" "$PODMAN_OTHER_COLOR" "$PODMAN_OTHER_ICON" "$PODMAN_OTHER_COLOR" "$pod"
fi
done
}
print_docker() {
if [ "$(systemctl is-active docker.service)" = "active" ]; then
printf "\\n"
printf " \\033[1;37mDocker:\\033[0m\\n"
docker_info=$(sudo curl -sf --unix-socket /var/run/docker.sock http:/v1.40/info)
docker_version=$(echo "$docker_info" | jq -r '.ServerVersion')
docker_space=$(generate_space "$docker_version" 23)
docker_images=$(echo "$docker_info" | jq -r '.Images')
printf " %s Version %s%s%s %s Images\\n\\n" "$DOCKER_VERSION_ICON" "$docker_version" "$docker_space" "$DOCKER_IMAGES_ICON" "$docker_images"
docker_list=$(sudo curl -sf --unix-socket /var/run/docker.sock "http://v1.40/containers/json?all=true" | jq -c ' .[]')
echo "$docker_list" | while read -r line; do
container_name="$(echo "$line" | jq -r '.Names[]' | sed 's/\///')"
container_status="$(echo "$line" | jq -r '.Status' | sed 's/.*/\l&/')"
container_space=$(generate_space "$container_name" 34)
if [ "$(echo "$line" | jq -r '.State')" = "running" ]; then
printf " \\033[%um%s\\033[0m %s%s%s\\n" "$DOCKER_RUNNING_COLOR" "$DOCKER_RUNNING_ICON" "$container_name" "$container_space" "$container_status"
else
printf " \\033[%um%s\\033[0m \\033[%um%s\\033[0m%s\\033[%um%s\\033[0m\\n" "$DOCKER_OTHER_COLOR" "$DOCKER_OTHER_ICON" "$DOCKER_OTHER_COLOR" "$container_name" "$container_space" "$DOCKER_OTHER_COLOR" "$container_status"
fi
done
fi
}
print_updates() {
if [ -f /usr/bin/apt ]; then
printf "\\n"
printf " \\033[1;37mUpdates:\\033[0m\\n"
updates_count_regular=$(apt-get upgrade -s | grep -c ^Inst)
updates_count_security=$(apt-get upgrade -s | grep ^Inst | grep -c Security)
if [ -n "$updates_count_regular" ] && [ "$updates_count_regular" -ne 0 ]; then
if [ -n "$updates_count_security" ] && [ "$updates_count_security" -ne 0 ]; then
updates_icon=$UPDATES_SECURITY_ICON
updates_color=$UPDATES_SECURITY_COLOR
updates_message="$updates_count_regular packages can be updated, $updates_count_security are security updates."
else
updates_icon=$UPDATES_AVAILIABLE_ICON
updates_color=$UPDATES_AVAILIABLE_COLOR
updates_message="$updates_count_regular packages can be updated."
fi
else
updates_icon=$UPDATES_ZERO_ICON
updates_color=$UPDATES_ZERO_COLOR
updates_message="Everything is up to date!"
fi
printf " \\033[%sm%s\\033[0m %s\\n" "$updates_color" "$updates_icon" "$updates_message"
elif [ -f /usr/bin/dnf ]; then
printf "\\n"
printf " \\033[1;37mUpdates:\\033[0m\\n"
updates_count=$(dnf updateinfo -C -q --list)
updates_count_regular=$(echo "$updates_count" | wc -l)
updates_count_security=$(echo "$updates_count" | grep -c "Important/Sec")
if [ -n "$updates_count_regular" ] && [ "$updates_count_regular" -ne 0 ]; then
if [ -n "$updates_count_security" ] && [ "$updates_count_security" -ne 0 ]; then
updates_icon=$UPDATES_SECURITY_ICON
updates_color=$UPDATES_SECURITY_COLOR
updates_message="$updates_count_regular packages can be updated, $updates_count_security are security updates."
else
updates_icon=$UPDATES_AVAILIABLE_ICON
updates_color=$UPDATES_AVAILIABLE_COLOR
updates_message="$updates_count_regular packages can be updated."
fi
else
updates_icon=$UPDATES_ZERO_ICON
updates_color=$UPDATES_ZERO_COLOR
updates_message="Everything is up to date!"
fi
printf " \\033[%sm%s\\033[0m %s\\n" "$updates_color" "$updates_icon" "$updates_message"
fi
}
print_letsencrypt() {
if [ -d $LETSENCRYPT_CERTPATH ] && [ "$(ls -a $LETSENCRYPT_CERTPATH)" ]; then
printf "\\n"
printf " \\033[1;37mSSL / lets encrypt:\\033[0m\\n"
cert_list=$(sudo find $LETSENCRYPT_CERTPATH -name cert.pem)
for cert_file in $cert_list; do
sudo openssl x509 -checkend $((25 * 86400)) -noout -in "$cert_file" >> /dev/null
result=$?
cert_name=$(echo "$cert_file" | rev | cut -d '/' -f 2 | rev)
if [ "$result" -eq 0 ]; then
printf " \\033[%sm%s\\033[0m %s\\n" "$LETSENCRYPT_VALID_COLOR" "$LETSENCRYPT_VALID_ICON" "$cert_name"
else
sudo openssl x509 -checkend $((0 * 86400)) -noout -in "$cert_file" >> /dev/null
result=$?
if [ "$result" -eq 0 ]; then
printf " \\033[%sm%s\\033[0m %s\\n" "$LETSENCRYPT_WARNING_COLOR" "$LETSENCRYPT_WARNING_ICON" "$cert_name"
else
printf " \\033[%sm%s\\033[0m %s\\n" "$LETSENCRYPT_INVALID_COLOR" "$LETSENCRYPT_INVALID_ICON" "$cert_name"
fi
fi
done
fi
}
print_login() {
login_last=$(last -n 2 -a -d --time-format iso "$(whoami)" | head -n 2 | tail -n 1)
if [ "$( echo "$login_last" | awk '{ print $1 }')" = "$(whoami)" ]; then
login_ip=$(echo "$login_last" | awk '{ print $7 }')
login_login=$(date -d "$(echo "$login_last" | awk '{ print $3 }' | cut -d '+' -f 1 | sed "s/T/ /")" "+%a, %d.%m.%y %H:%M")
login_space=$(generate_space "$login_login" 25)
if [ "$(echo "$login_last" | awk '{ print $4 }')" = "still" ]; then
login_logout="still connected"
else
login_logout=$(date -d "$(echo "$login_last" | awk '{ print $5 }' | cut -d '+' -f 1 | sed "s/T/ /")" "+%a, %d.%m.%y %H:%M")
fi
printf "\\n"
printf " \\033[1;37mLast login for %s:\\033[0m\\n" "$(echo "$login_last" | awk '{ print $1 }')"
printf " %s %s%s%s %s\\n" "$LOGIN_LOGIN_ICON" "$login_login" "$login_space" "$LOGIN_LOGOUT_ICON" "$login_logout"
printf " %s %s\\n" "$LOGIN_IP_ICON" "$login_ip"
fi
}
print_include() {
. $INCLUDE_FILE
}
bash_motd() {
for module in "$@"; do
if [ "$module" = "--banner" ]; then
print_banner
elif [ "$module" = "--processor" ]; then
print_processor
elif [ "$module" = "--memory" ]; then
print_memory
elif [ "$module" = "--swap" ]; then
print_swap
elif [ "$module" = "--diskspace" ]; then
print_diskspace
elif [ "$module" = "--services" ]; then
print_services
elif [ "$module" = "--podman" ]; then
print_podman
elif [ "$module" = "--docker" ]; then
print_docker
elif [ "$module" = "--updates" ]; then
print_updates
elif [ "$module" = "--letsencrypt" ]; then
print_letsencrypt
elif [ "$module" = "--login" ]; then
print_login
elif [ "$module" = "--include" ]; then
print_include
fi
done
printf "\\n"
}

View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash -
#===============================================================================
#
# FILE: .bash_motd_ownscript.sh
#
# USAGE: ./.bash_motd_ownscript.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Don Harper (dmh), duck@duckland.org
# ORGANIZATION: duckland.org
# CREATED: 01/28/2022 21:23
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
if [ "$(pgrep -c tailscaled)" = "1" ]
then
printf "\\n"
printf " \\033[1;37mTailScale:\\033[0m\\n"
tailscale status | while read -r line
do
printf " %s\n" "${line}"
done
fi

View file

@ -0,0 +1,29 @@
PATH="/run/wrappers/bin:${HOME}/.nix-profile/bin:/etc/profiles/per-user/${USER}/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:${HOME}/bin:${HOME}/go/bin"
export PATH
umask 006
if [ ! -z "${PS1}" ]
then
if [ "$TERM" = "linux" ]; then
echo -en "\e]P021222C" #black
echo -en "\e]P8282a36" #darkgrey
echo -en "\e]P1803232" #darkred
echo -en "\e]P9ff5555" #red
echo -en "\e]P25b762f" #darkgreen
echo -en "\e]PA50fa7b" #green
echo -en "\e]P3aa9943" #brown
echo -en "\e]PBf1fa8c" #yellow
echo -en "\e]P4324c80" #darkblue
echo -en "\e]PCbd93f9" #blue
echo -en "\e]P5627sa4" #darkmagenta
echo -en "\e]PDbd93f9" #magenta
echo -en "\e]P692b19e" #darkcyan
echo -en "\e]PE8be9fd" #cyan
echo -en "\e]P7ffffff" #lightgrey
echo -en "\e]PFf8f8f2" #white
clear #for background artifacting
fi
. ~/.bash_motd && bash_motd --banner --processor --memory --diskspace --podman --docker
fi
cd "${HOME}"
source "${HOME}"/.bashrc

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
ARGS="-q --eval --systemd --agents ssh --nocolor --ignore-missing --quick git id_dsa id_ed25519 id_rsa 56913AD86A18257132AA9F03928BC0B78C1BF5AA"
#SSH_ASKPASS=/usr/bin/qt4-ssh-askpass
#export SSH_ASKPASS
eval $(keychain ${ARGS} )
. ~/.keychain/"${HOSTNAME_SHORT}"-sh
ssh-add -l | grep -q ED25519 || ssh-add

172
home/common/files/bash/bashrc Executable file
View file

@ -0,0 +1,172 @@
#!/usr/bin/env bash
#===============================================================================
#
# FILE: .bashrc
#
# DESCRIPTION: Main bash init file
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Don Harper (), duckunix@gmail.com
# COMPANY: Don Harper
# VERSION: 1.0
# CREATED: 06/11/2007 11:30:25 PM CDT
# REVISION: ---
#===============================================================================
# set some global stuff first
# colors
GREEN=''
YELLOW=''
RED=''
NONE=''
export NONE GREEN YELLOW RED
PATH="/run/wrappers/bin:${HOME}/.nix-profile/bin:/etc/profiles/per-user/${USER}/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:${HOME}/bin:${HOME}/go/bin:${HOME}/.local/bin"
export PATH
export GOPATH="${HOME}/go"
if [ -f ${HOME}/.nix-profile/etc/profile.d/hm-session-vars.sh ]
then
. ${HOME}/.nix-profile/etc/profile.d/hm-session-vars.sh
fi
HOSTNAME_SHORT=$(hostnamectl | awk -F: '$1=/Static hostname/{print $2}' | sed 's/^ //')
while [ "${HOSTNAME_SHORT}" == "localhost" ]
do
echo "${RED}@${GREEN}-,---${NONE}"
sleep 1
HOSTNAME_SHORT=$(hostnamectl | awk -F: '$1=/Static hostname/{print $2}' | sed 's/^ //')
done
export HOSTNAME_SHORT
HISTNAME=$LOGNAME
if [ $EUID == 0 ];then HISTNAME=root;fi
HISTFILE="${HOME}/.bash_history.${HISTNAME}.${HOSTNAME_SHORT}.$(tty|cut -c10-)"
export HISTFILE
test -f "${HOME}/.bash_ssh" && source "${HOME}/.bash_ssh"
# set coredump size to 0
ulimit -c 0
umask 0007
if [ "$LOGNAME" ]; then
USER=$LOGNAME
fi
OS_SYS=$(uname -s)
OS_REL=$(uname -r)
OS_CPU=$(uname -m)
OS_TYPE="$OS_SYS.$OS_REL"
export OS_SYS OS_REL OS_TYPE OS_CPU LESS
# Set up path
test -f "${HOME}/.bash_functions" && source "${HOME}/.bash_functions"
test -d "${HOME}/bin/${HOSTNAME_SHORT}" && PATH="${PATH}:${HOME}/bin/${HOSTNAME_SHORT}"
test -d "${HOME}/bin/${OS_CPU}" && PATH="${PATH}:${HOME}/bin/${OS_CPU}"
test -d "${HOME}/bin" && PATH="${PATH}:${HOME}/bin"
test -d "${HOME}/.local/bin" && PATH="${PATH}:${HOME}/.local/bin"
test -d "${HOME}/.cargo/bin" && PATH="${PATH}:${HOME}/.cargo/bin"
test -d "${HOME}/.local/share/gem" && PATH="${PATH}:${HOME}/.local/share/gem/ruby/latest/bin"
test -d /usr/local/sbin && PATH="${PATH}:/usr/local/sbin"
test -d /usr/local/bin && PATH="${PATH}:/usr/local/bin"
test -d /sbin && PATH="${PATH}:/sbin"
test -d /usr/sbin && PATH="${PATH}:/usr/sbin"
test -d /usr/bin && PATH="${PATH}:/usr/bin"
test -d /bin && PATH="${PATH}:/bin"
export PATH
test -f "${HOME}/.bash_ssh" && . ${HOME}/.bash_ssh
#interactive login ?
#####################################
######### #########
######## Interactive stuff ########
######### #########
#####################################
if [ "${PS1}" ];
then
unset i
set -o noclobber
set -o notify
set bell-style visible
set nobeep
shopt -s autocd
shopt -s cdspell
shopt -s checkjobs
shopt -s checkwinsize
shopt -s dotglob
shopt -s extglob
shopt -s histappend
shopt -s histreedit
PAGER=less
LESS="-s"
EXINIT="set wrapmargin=8 sh=$SHELL sw=4 report=2 tabstop=8"
export EXINIT EDITOR PAGER
EDITOR=vi
if [ -x /usr/bin/vim ]
then
EDITOR=vim
alias vi=/usr/bin/vim
elif [ -x /usr/local/bin/vim ]
then
EDITOR=vim
alias vi=/usr/local/bin/vim
elif [ $(which nvim 2>&1 >> /dev/null) ]
then
EDITOR=nvim
fi
export EDITOR
unset COMPHOSTS
export COMPHOSTS=()
unset pathmunge
# set up man path
MANPATH="${MANPATH}:${HOME}/man:${HOME}/share/man"
export MANPATH
test -f $(ls -1 /nix/store/*bash-completion-*/etc/profile.d/bash_completion.sh | tail -n1) && \
source $(ls -1 /nix/store/*bash-completion-*/etc/profile.d/bash_completion.sh | tail -n1)
export LOCKPRG=${HOME}/bin/myLock
export HISTCONTROL=ignoreboth
export HISTIGNORE='pwd:exit:clear:history'
[ -f /etc/profile.d/bash-completion.sh ] && source /etc/profile.d/bash-completion.sh
[ -f /usr/local/share/bash-completion/bash_completion.sh ] && source/usr/local/share/bash-completion/bash_completion.sh
[ -f /usr/share/bash-completion/bash_completion ] && source /usr/share/bash-completion/bash_completion
[ ! -v ${BASH_COMPLETION_VERSINFO} -a -d ${HOME}/.bash_completion.d ] && for i in $(\ls -1 ${HOME}/.bash_completion.d/*.sh); do source $i; done
export PROMPT_COMMAND='history -a' # Always append history files
PS1='\u@\h:\w> '
test -f "${HOME}/.bash_aliases" && . ${HOME}/.bash_aliases
test -f "${HOME}/.bash_local" && . ${HOME}/.bash_local
file=$(\ls -1d /nix/store/*-$(\ls -1d /nix/store/*-liquidprompt-* | grep -v drv | awk -F- '{printf("%s-%s\n",$2,$3)}' | tail -n1) | tail -n1)
test -f ${file}/bin/liquidprompt && . ${file}/bin/liquidprompt
# git completion
if [ ! -v BASH_COMPLETION_VERSINFO -a -f /usr/local/share/git-completion/git-completion.bash ]; then
source /usr/local/share/git-completion/git-completion.bash
fi
export NVM_DIR="/usr/local/share/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ ! -v BASH_COMPLETION_VERSINFO -a -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export SASL_PATH=/usr/local/lib/sasl2
#complete -C "${GOPATH}/bin/bitcomplete" bit
test -f "${HOME}/.bash_${HOSTNAME_SHORT}" && . ${HOME}/.bash_$HOSTNAME_SHORT
# BEGIN_KITTY_SHELL_INTEGRATION
if test -n "$KITTY_INSTALLATION_DIR" -a -e "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; then source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; fi
# END_KITTY_SHELL_INTEGRATION
complete -o nospace -F _task t
fi

View file

@ -0,0 +1,15 @@
MAILTERMPROG=kitty
#TERMPROG=kitty
TERMPROG=footclient
MUSIC=sublime-music
hostname=`hostname`
WEB=qutebrowser
TEXTWEB=links
MAILPROG=neomutt
CALENDAR="myweb http://www.google.com/calendar"
RSSREADER=rssview
TWITTER="twitter"
IM=mcabber
IRC=xchat
NM="nm-applet"
PDFVIEWER="pdfview"

View file

@ -0,0 +1,6 @@
# /home/don/.config/tmuxinator/test.yml
name: don
root: ~/
windows:
- main:
- second:

View file

@ -0,0 +1,12 @@
name: duckland
root: ~/src/WWW/sites/duckland.org
windows:
- main:
layout: ef4d,274x68,0,0{80x68,0,0,12,193x68,81,0,13}
panes:
- hugo serve:
- hugo serve -D -F
- code:
- cd ~/src/WWW/sites/duckland.org/content
- git status

View file

@ -0,0 +1,15 @@
# /home/don/.config/tmuxinator/test.yml
name: eve
root: ~/
windows:
- main:
- second:
- mua:
layout: 5ae0,213x55,0,0{73x55,0,0[73x27,0,0,3,73x27,0,28,4],139x55,74,0,5}
panes:
- domailtask.sh
- domailcal.sh
- neomutt
- harper: mosh harper
- rss: newsboat
- fred: mosh fred

View file

@ -0,0 +1,9 @@
# /home/don/.config/tmuxinator/test.yml
name: don
root: ~/
windows:
- docker:
- cd ripper
- docker-compose logs -f
- second:
- cd ripper/rips/Ripper/DVD/finished

View file

@ -0,0 +1,16 @@
# /home/don/.config/tmuxinator/test.yml
name: loki
root: ~/
startup_window: mua
windows:
- main:
- second:
- mua:
layout: 5ae0,213x55,0,0{73x55,0,0[73x27,0,0,3,73x27,0,28,4],139x55,74,0,5}
panes:
- domailtask.sh
- domailcal.sh
- neomutt
- harper: mosh harper
- rss: newsboat
- fred: mosh fred

View file

@ -0,0 +1,11 @@
name: nix-cs
root: ~/
on_project_start: tmux setw synchronize-panes
windows:
- nix:
layout: tiled
panes:
- mosh loki.tail
- mosh eve.tail
- mosh smaug.tail
- mosh dragon.tail

View file

@ -0,0 +1,11 @@
# /home/don/.config/tmuxinator/nixos.yml
name: nixos
root: ~/nixos
windows:
- nixos:
- git:
- cd ~/nixos
- lazygit

View file

@ -0,0 +1,9 @@
# /home/don/.config/tmuxinator/test.yml
name: pinetab
root: ~/
startup_window: mua
windows:
- main:
- second:
- mua: neomutt
- rss: newsboat

310
home/common/git.nix Normal file
View file

@ -0,0 +1,310 @@
{ pkgs, config, ... }:
{
programs.git = {
enable = true;
aliases = {
co = "checkout";
br = "branch";
ci = "commit";
st = "status";
last = "cat-file commit HEAD";
};
diff-so-fancy = {
enable = true;
};
extraConfig = {
core = {
user = "Don Harper";
email = "duck@duckland.org";
editor = "${pkgs.neovim}/bin/nvim";
};
status = {
submoduleSummary = "true";
short = "true";
};
user = {
name = "Don Harper";
email = "duck@duckland.org";
};
push = {
default = "simple";
};
pull = {
rebase = "false";
};
git-extras = {
github-personal-access-token = "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";
};
fetch = {
prune = "true";
};
init = {
defaultBranch = "main";
};
credential = {
"https://github.com" = {
helper = "!${pkgs.gh}/bin/gh auth git-credential";
};
"https://gist.github.com" = {
helper = "!${pkgs.gh}/bin/gh auth git-credential";
};
};
};
};
xdg.configFile."tig/config".text = ''
set blame-view = date:default author:full file-name:auto id:yes line-number:no,interval=5 text
set grep-view = file-name:no line-number:yes,interval=1 text
set main-view = line-number:no,interval=5 id:no date:default author:full commit-title:yes,graph,refs,overflow=no
set refs-view = line-number:no id:no date:default author:full ref commit-title
set stash-view = line-number:no,interval=5 id:no date:default author:full commit-title
set status-view = line-number:no,interval=5 status:short file-name
set tree-view = line-number:no,interval=5 mode author:full file-size date:default id:no file-name
set pager-view = line-number:no,interval=5 text
set stage-view = line-number:no,interval=5 text
set log-view = line-number:no,interval=5 text
set blob-view = line-number:no,interval=5 text
set diff-view = line-number:no,interval=5 text:yes,commit-title-overflow=no
set show-changes = yes # Show changes commits in the main view?
set wrap-lines = no # Wrap long lines in pager views?
set tab-size = 8 # Number of spaces to use when expanding tabs
set line-graphics = default # Enum: ascii, default, utf-8
set truncation-delimiter = ~ # Character drawn for truncations, or "utf-8"
set reference-format = [branch] <tag> {remote} ~replace~
set commit-order = auto # Enum: auto, default, topo, date, reverse (main)
set status-show-untracked-dirs = yes # Show files in untracked directories? (status)
set status-show-untracked-files = yes # Show untracked files?
set ignore-space = no # Enum: no, all, some, at-eol (diff)
set show-notes = yes # When non-bool passed as `--show-notes=...` (diff)
set refresh-mode = auto # Enum: manual, auto, after-command, periodic
set refresh-interval = 10 # Interval in seconds between refreshes
set ignore-case = no # Enum: no, yes, smart-case
set wrap-search = yes # Wrap around to top/bottom of view when searching
set focus-child = yes # Move focus to child view when opened?
set horizontal-scroll = 50% # Number of columns to scroll as % of width
set split-view-height = 67% # Height of the bottom view for horizontal splits
set vertical-split = auto # Enum: horizontal, vertical, auto; Use auto to
set split-view-width = 50% # Width of right-most view for vertical splits
set editor-line-number = yes # Automatically pass line number to editor? Used
set history-size = 500 # Size of persistent history, 0 to disable
set mouse = no # Enable mouse support?
set mouse-scroll = 3 # Number of lines to scroll via the mouse
set mouse-wheel-cursor = no # Prefer moving the cursor to scrolling the view?
bind main C ?git cherry-pick %(commit)
bind status C !git commit
bind stash A ?git stash apply %(stash)
bind stash P ?git stash pop %(stash)
bind stash ! ?git stash drop %(stash)
bind refs C ?git checkout %(branch)
bind refs ! ?git branch -D %(branch)
bind generic m view-main
bind generic d view-diff
bind generic l view-log
bind generic t view-tree
bind generic f view-blob
bind generic b view-blame
bind generic r view-refs
bind generic p view-pager
bind generic h view-help
bind generic s view-status
bind generic S view-status # Compat binding to avoid going crazy!
bind generic c view-stage
bind generic y view-stash
bind generic g view-grep
bind generic <Enter> enter # Enter and open selected entry
bind generic <Lt> back # Go back to the previous view state
bind generic <Down> next # Move to next
bind generic <C-N> next
bind generic J next
bind generic <Up> previous # Move to previous
bind generic <C-P> previous
bind generic K previous
bind generic , parent # Move to parent
bind generic <Tab> view-next # Move focus to the next view
bind generic R refresh # Reload and refresh view
bind generic <F5> refresh
bind generic O maximize # Maximize the current view
bind generic q view-close # Close the current view
bind generic Q quit # Close all views and quit
bind generic <C-C> quit # Close all views and quit
bind status u status-update # Stage/unstage changes in file
bind status ! status-revert # Revert changes in file
bind status M status-merge # Open git-mergetool(1)
bind stage u status-update # Stage/unstage current diff (c)hunk
bind stage 1 stage-update-line # Stage/unstage current line
bind stage ! status-revert # Revert current diff (c)hunk
bind stage \ stage-split-chunk # Split current diff (c)hunk
bind stage @ :/^@@ # Jump to next (c)hunk
bind stage [ :toggle diff-context -1 # Decrease the diff context
bind stage ] :toggle diff-context +1 # Increase the diff context
bind diff @ :/^@@ # Jump to next (c)hunk
bind diff [ :toggle diff-context -1
bind diff ] :toggle diff-context +1
bind main G :toggle commit-title-graph # Toggle revision graph visualization
bind main F :toggle commit-title-refs # Toggle reference display (tags/branches)
bind generic j move-down
bind generic k move-up
bind generic <C-D> move-half-page-down
bind generic <C-U> move-half-page-up
bind generic <PgDown> move-page-down
bind generic <Space> move-page-down
bind generic <PgUp> move-page-up
bind generic - move-page-up
bind generic <Home> move-first-line
bind generic <End> move-last-line
bind generic | scroll-first-col
bind generic <Left> scroll-left
bind generic <Right> scroll-right
bind generic <Ins> scroll-line-up
bind generic <C-Y> scroll-line-up
bind generic <Del> scroll-line-down
bind generic <C-E> scroll-line-down
bind generic <SBack> scroll-page-up
bind generic <SFwd> scroll-page-down
bind generic / search
bind generic ? search-back
bind generic n find-next
bind generic N find-prev
bind search <Down> find-next
bind search <C-N> find-next
bind search <C-J> find-next
bind search <Up> find-prev
bind search <C-P> find-prev
bind search <C-K> find-prev
bind search <C-C> view-close
bind generic o options # Open the options menu
bind generic I :toggle sort-order # Toggle ascending/descending sort order
bind generic i :toggle sort-field # Toggle field to sort by
bind generic <Hash> :toggle line-number # Toggle line numbers
bind generic D :toggle date # Toggle date display
bind generic A :toggle author # Toggle author display
bind generic ~ :toggle line-graphics # Toggle (line) graphics mode
bind generic F :toggle file-name # Toggle file name display
bind generic W :toggle ignore-space # Toggle ignoring whitespace in diffs
bind generic X :toggle id # Toggle commit ID display
bind generic $ :toggle commit-title-overflow
bind generic % :toggle file-filter
bind generic e edit # Open in editor
bind generic : prompt # Open the prompt
bind generic <C-L> screen-redraw # Redraw the screen
bind generic z stop-loading # Stop all loading views
bind generic v show-version # Show Tig version
color "---" default default
color "diff --" default default
color "--- " default default
color "+++ " default default
color "@@" default default
color "+" default default
color " +" default default
color "-" default default
color " -" default default
color "index " default default
color "old file mode " default default
color "new file mode " default default
color "deleted file mode " default default
color "copy from " default default
color "copy to " default default
color "rename from " default default
color "rename to " default default
color "similarity " default default
color "dissimilarity " default default
color "diff-tree " default default
color "Author: " default default
color "Commit: " default default
color "Tagger: " default default
color "Merge: " default default
color "Date: " default default
color "AuthorDate: " default default
color "CommitDate: " default default
color "TaggerDate: " default default
color "Refs: " default default
color "Reflog: " default default
color "Reflog message: " default default
color "stash@{" default default
color "commit " default default
color "parent " default default
color "tree " default default
color "author " default default
color "committer " default default
color " Signed-off-by" default default
color " Acked-by" default default
color " Tested-by" default default
color " Reviewed-by" default default
color default default default normal
color cursor yellow default bold
color status default default
color delimiter default default
color date default default
color mode default default
color id default default
color overflow default default
color header default default
color section default default
color directory default default
color file default default
color grep.file default default
color file-size default default
color line-number default default
color title-blur default default
color title-focus default default bold
color main-commit default default
color main-tag default default bold
color main-local-tag default default
color main-remote default default
color main-replace default default
color main-tracked default default bold
color main-ref default default
color main-head default default bold
color stat-none default default
color stat-staged default default
color stat-unstaged default default
color stat-untracked default default
color help-group default default
color help-action default default
color diff-stat default default
color diff-add-highlight default default standout
color diff-del-highlight default default standout
color palette-0 default default
color palette-1 default default
color palette-2 default default
color palette-3 default default
color palette-4 default default
color palette-5 default default
color palette-6 default default
color palette-7 default default bold
color palette-8 default default bold
color palette-9 default default bold
color palette-10 default default bold
color palette-11 default default bold
color palette-12 default default bold
color palette-13 default default bold
color graph-commit default default
color search-result default default
set git-colors = \
branch.current=main-head \
branch.local=main-ref \
branch.plain=main-ref \
branch.remote=main-remote \
\
diff.meta=diff-header \
diff.meta=diff-index \
diff.meta=diff-oldmode \
diff.meta=diff-newmode \
diff.frag=diff-chunk \
diff.old=diff-del \
diff.new=diff-add \
\
diff-highlight.oldHighlight=diff-del-highlight \
diff-highlight.newHighlight=diff-add-highlight \
\
grep.filename=grep.file \
grep.linenumber=grep.line-number \
grep.separator=grep.delimiter \
\
status.branch=status.header \
status.added=stat-staged \
status.updated=stat-staged \
status.changed=stat-unstaged \
status.untracked=stat-untracked
'';
}

18
home/common/gnupg.nix Normal file
View file

@ -0,0 +1,18 @@
{ ... }:
{
programs.gpg = {
enable = true;
settings = {
keyserver = "hkp://keys.gnupg.net";
cert-digest-algo = "SHA256";
no-emit-version = "";
#no-comments = "";
personal-cipher-preferences = "AES AES256 AES192 CAST5";
personal-digest-preferences = "SHA256 SHA512 SHA384 SHA224";
#ignore-time-conflict = "";
#allow-freeform-uid = "";
#utf8-strings
auto-key-locate = "local";
};
};
}

357
home/common/icons Normal file
View file

@ -0,0 +1,357 @@
# vim:ft=conf
# These examples require Nerd Fonts or a compatible font to be used.
# See https://www.nerdfonts.com for more information.
# default values from lf (with matching order)
# ln l # LINK
# or l # ORPHAN
# tw t # STICKY_OTHER_WRITABLE
# ow d # OTHER_WRITABLE
# st t # STICKY
# di d # DIR
# pi p # FIFO
# so s # SOCK
# bd b # BLK
# cd c # CHR
# su u # SETUID
# sg g # SETGID
# ex x # EXEC
# fi - # FILE
# file types (with matching order)
ln  # LINK
or  # ORPHAN
tw t # STICKY_OTHER_WRITABLE
ow  # OTHER_WRITABLE
st t # STICKY
di  # DIR
pi p # FIFO
so s # SOCK
bd b # BLK
cd c # CHR
su u # SETUID
sg g # SETGID
ex  # EXEC
fi  # FILE
# file extensions (vim-devicons)
*.styl 
*.sass 
*.scss 
*.htm 
*.html 
*.slim 
*.haml 
*.ejs 
*.css 
*.less 
*.md 
*.mdx 
*.markdown 
*.rmd 
*.json 
*.webmanifest 
*.js 
*.mjs 
*.jsx 
*.rb 
*.gemspec 
*.rake 
*.php 
*.py 
*.pyc 
*.pyo 
*.pyd 
*.coffee 
*.mustache 
*.hbs 
*.conf 
*.ini 
*.yml 
*.yaml 
*.toml 
*.bat 
*.mk 
*.jpg 
*.jpeg 
*.bmp 
*.png 
*.webp 
*.gif 
*.ico 
*.twig 
*.cpp 
*.c++ 
*.cxx 
*.cc 
*.cp 
*.c 
*.cs 󰌛
*.h 
*.hh 
*.hpp 
*.hxx 
*.hs 
*.lhs 
*.nix 
*.lua 
*.java 
*.sh 
*.fish 
*.bash 
*.zsh 
*.ksh 
*.csh 
*.awk 
*.ps1 
*.ml λ
*.mli λ
*.diff 
*.db 
*.sql 
*.dump 
*.clj 
*.cljc 
*.cljs 
*.edn 
*.scala 
*.go 
*.dart 
*.xul 
*.sln 
*.suo 
*.pl 
*.pm 
*.t 
*.rss 
'*.f#' 
*.fsscript 
*.fsx 
*.fs 
*.fsi 
*.rs 
*.rlib 
*.d 
*.erl 
*.hrl 
*.ex 
*.exs 
*.eex 
*.leex 
*.heex 
*.vim 
*.ai 
*.psd 
*.psb 
*.ts 
*.tsx 
*.jl 
*.pp 
*.vue 
*.elm 
*.swift 
*.xcplayground 
*.tex 󰙩
*.r 󰟔
*.rproj 󰗆
*.sol 󰡪
*.pem 
# file names (vim-devicons) (case-insensitive not supported in lf)
*gruntfile.coffee 
*gruntfile.js 
*gruntfile.ls 
*gulpfile.coffee 
*gulpfile.js 
*gulpfile.ls 
*mix.lock 
*dropbox 
*.ds_store 
*.gitconfig 
*.gitignore 
*.gitattributes 
*.gitlab-ci.yml 
*.bashrc 
*.zshrc 
*.zshenv 
*.zprofile 
*.vimrc 
*.gvimrc 
*_vimrc 
*_gvimrc 
*.bashprofile 
*favicon.ico 
*license 
*node_modules 
*react.jsx 
*procfile 
*dockerfile 
*docker-compose.yml 
*rakefile 
*config.ru 
*gemfile 
*makefile 
*cmakelists.txt 
*robots.txt 󰚩
# file names (case-sensitive adaptations)
*Gruntfile.coffee 
*Gruntfile.js 
*Gruntfile.ls 
*Gulpfile.coffee 
*Gulpfile.js 
*Gulpfile.ls 
*Dropbox 
*.DS_Store 
*LICENSE 
*React.jsx 
*Procfile 
*Dockerfile 
*Docker-compose.yml 
*Rakefile 
*Gemfile 
*Makefile 
*CMakeLists.txt 
# file patterns (vim-devicons) (patterns not supported in lf)
# .*jquery.*\.js$ 
# .*angular.*\.js$ 
# .*backbone.*\.js$ 
# .*require.*\.js$ 
# .*materialize.*\.js$ 
# .*materialize.*\.css$ 
# .*mootools.*\.js$ 
# .*vimrc.* 
# Vagrantfile$ 
# file patterns (file name adaptations)
*jquery.min.js 
*angular.min.js 
*backbone.min.js 
*require.min.js 
*materialize.min.js 
*materialize.min.css 
*mootools.min.js 
*vimrc 
Vagrantfile 
# archives or compressed (extensions from dircolors defaults)
*.tar 
*.tgz 
*.arc 
*.arj 
*.taz 
*.lha 
*.lz4 
*.lzh 
*.lzma 
*.tlz 
*.txz 
*.tzo 
*.t7z 
*.zip 
*.z 
*.dz 
*.gz 
*.lrz 
*.lz 
*.lzo 
*.xz 
*.zst 
*.tzst 
*.bz2 
*.bz 
*.tbz 
*.tbz2 
*.tz 
*.deb 
*.rpm 
*.jar 
*.war 
*.ear 
*.sar 
*.rar 
*.alz 
*.ace 
*.zoo 
*.cpio 
*.7z 
*.rz 
*.cab 
*.wim 
*.swm 
*.dwm 
*.esd 
# image formats (extensions from dircolors defaults)
*.jpg 
*.jpeg 
*.mjpg 
*.mjpeg 
*.gif 
*.bmp 
*.pbm 
*.pgm 
*.ppm 
*.tga 
*.xbm 
*.xpm 
*.tif 
*.tiff 
*.png 
*.svg 
*.svgz 
*.mng 
*.pcx 
*.mov 
*.mpg 
*.mpeg 
*.m2v 
*.mkv 
*.webm 
*.ogm 
*.mp4 
*.m4v 
*.mp4v 
*.vob 
*.qt 
*.nuv 
*.wmv 
*.asf 
*.rm 
*.rmvb 
*.flc 
*.avi 
*.fli 
*.flv 
*.gl 
*.dl 
*.xcf 
*.xwd 
*.yuv 
*.cgm 
*.emf 
*.ogv 
*.ogx 
# audio formats (extensions from dircolors defaults)
*.aac 
*.au 
*.flac 
*.m4a 
*.mid 
*.midi 
*.mka 
*.mp3 
*.mpc 
*.ogg 
*.ra 
*.wav 
*.oga 
*.opus 
*.spx 
*.xspf 
# other formats
*.pdf 

55
home/common/khal.nix Normal file
View file

@ -0,0 +1,55 @@
{ pkgs, ... }: {
home.packages = with pkgs; [ khal ];
xdg.configFile."khal/config".text = ''
[calendars]
[[work]]
path = ~/.config/vdirsyncer/storage/calendar/rcplvhbgfi42es2l1kgfar2hmo@group.calendar.google.com
color = white
[[main]]
path = ~/.config/vdirsyncer/storage/calendar/duckunix@gmail.com
color = yellow
[[family]]
path = ~/.config/vdirsyncer/storage/calendar/family13380466864639850162@group.calendar.google.com
color = light cyan
[[tripit-ro]]
path = ~/.config/vdirsyncer/storage/calendar/1kkbntebu29p6iismq18bafsmkho96s7@import.calendar.google.com
color = white
[[vicky]]
path = ~/.config/vdirsyncer/storage/calendar/afcmom@gmail.com
color = dark cyan
[[vicky-work]]
path = ~/.config/vdirsyncer/storage/calendar/victoriatempleharper@gmail.com
color = dark cyan
[[birthdays-ro]]
path = ~/.config/vdirsyncer/storage/calendar/c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual
color = white
[[Canvas-ro]]
path = ~/.config/vdirsyncer/storage/calendar/26ggdee4akcrik9dd3d0912t4mudfu91@import.calendar.google.com
color = light red
[[Dinner]]
path = ~/.config/vdirsyncer/storage/calendar/ms2k7ip06mk1ftnekd4l9l1ink@group.calendar.google.com
color = light blue
[highlight_days]
color = light green
default_color = white
[locale]
timeformat = %I:%M %p
dateformat = %Y-%m-%d
longdateformat = %Y-%m-%d
datetimeformat = %Y-%m-%d %I:%M %p
longdatetimeformat = %Y-%m-%d %I:%M %p
local_timezone = America/Chicago
default_timezone = America/Chicago
[keybindings]
save = ctrl w
external_edit = ctrl E
[default]
timedelta = 3d
[view]
agenda_day_format = {name:=^40s}
agenda_event_format = {calendar-color}{cancelled}{start-time} - {end-time} | {title}{repeat-symbol}{description-separator}{reset}
dynamic_days = True
event_view_always_visible = True
theme = dark
'';
}

36
home/common/khard.nix Normal file
View file

@ -0,0 +1,36 @@
{ config, pkgs, ... }:
{
programs.khard = {
enable = true;
settings = {
general = {
default_action = "list";
editor = "${pkgs.neovim}/bin/nvim";
merge_editor = [ "${pkgs.neovim}/bin/nvim" "-d" ];
};
"contact table" = {
display = "first_name";
group_by_addressbook = "no";
reverse = "no";
show_nicknames = "no";
show_uids = "no";
sort = "last_name";
localize_dates = "yes";
preferred_phone_number_type = [ "pref" "cell" "home" ];
preferred_email_address_type = [ "pref" "work" "home" ];
};
vcard = {
private_objects = [ "Jabber" "Skype" "Twitter" "Mastodon" ];
preferred_version = "3.0";
search_in_source_files = "no";
skip_unparsable = "no";
};
};
};
accounts.contact.accounts = {
contacts = {
khard.enable = true;
local.path = "~/.config/vdirsyncer/storage/contacts/default";
};
};
}

74
home/common/lf.nix Normal file
View file

@ -0,0 +1,74 @@
{ pkgs, config, ... }:
{
xdg.configFile."lf/icons".source = ./icons;
programs.lf = {
enable = true;
commands = {
editor-open = ''$$EDITOR $f'';
mkdir = ''
''${{
printf "Directory Name: "
read DIR
mkdir $DIR
}}
'';
};
keybindings = {
"\\\"" = "";
o = "";
c = "mkdir";
"." = "set hidden!";
"`" = "mark-load";
"\\'" = "mark-load";
"<enter>" = "open";
"g~" = "cd";
gh = "cd";
"g/" = "/";
e = "editor-open";
# ...
};
settings = {
preview = true;
hidden = true;
drawbox = true;
icons = true;
ignorecase = true;
};
extraConfig =
let
previewer =
pkgs.writeShellScriptBin "pv.sh" ''
file=$1
w=$2
h=$3
x=$4
y=$5
if [[ "$( ${pkgs.file}/bin/file -Lb --mime-type "$file")" =~ ^image ]]; then
${pkgs.kitty}/bin/kitty +kitten icat --silent --stdin no --transfer-mode file --place "''${w}x''${h}@''${x}x''${y}" "$file" < /dev/null > /dev/tty
exit 1
fi
${pkgs.pistol}/bin/pistol "$file"
'';
cleaner = pkgs.writeShellScriptBin "clean.sh" ''
${pkgs.kitty}/bin/kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty
'';
in
''
set cleaner ${cleaner}/bin/clean.sh
set previewer ${previewer}/bin/pv.sh
'';
};
# ...
}

View file

@ -0,0 +1,129 @@
{ pkgs, ... }: {
home.packages = with pkgs; [ liquidprompt ];
xdg.configFile."liquidpromptrc".text = ''
source ~/.config/liquidprompt.theme
LP_BATTERY_THRESHOLD=75
LP_DISABLED_VCS_PATH=""
LP_ENABLE_BATT=1
LP_ENABLE_BZR=0
LP_ENABLE_DIRSTACK=0
LP_ENABLE_FOSSIL=0
LP_ENABLE_FQDN=0
LP_ENABLE_GIT=1
LP_ENABLE_HG=0
LP_ENABLE_JOBS=1
LP_ENABLE_LOAD=1
LP_ENABLE_PERM=1
LP_ENABLE_PROXY=0
LP_ENABLE_RUNTIME=1
LP_ENABLE_SCLS=0
LP_ENABLE_SCREEN_TITLE=1
LP_ENABLE_SHLVL=0
LP_ENABLE_SHORTEN_PATH=1
LP_ENABLE_SSH_COLORS=1
LP_ENABLE_SUDO=0
LP_ENABLE_SVN=0
LP_ENABLE_TEMP=0
LP_ENABLE_TIME=1
LP_ENABLE_TITLE=0
LP_ENABLE_VCS_ROOT=0
LP_ENABLE_VIRTUALENV=1
LP_HOSTNAME_ALWAYS=1
LP_HOSTNAME_METHOD=short
LP_LOAD_THRESHOLD=0.60
LP_PATH_KEEP=2
LP_PATH_LENGTH=35
LP_PERCENTS_ALWAYS=1
LP_RUNTIME_THRESHOLD=2
LP_TEMP_THRESHOLD=60
LP_TIME_ANALOG=0
LP_TIME_FORMAT="%_I:%M %p"
LP_USER_ALWAYS=1
LOCAL_RCFILE=$HOME/.config/liquidpromptrc.local
[ -f "$LOCAL_RCFILE" ] && source "$LOCAL_RCFILE"
'';
xdg.configFile."liquidprompt.theme".text = ''
if [[ "$(locale -k LC_CTYPE | sed -n 's/^charmap="\(.*\)"/\1/p')" == *"UTF-8"* ]]; then
LP_MARK_BATTERY="" # in front of the battery charge
LP_MARK_ADAPTER="" # displayed when plugged
LP_MARK_LOAD="" # in front of the load
LP_MARK_TEMP="θ" # in front of the temp
LP_MARK_PROXY="" # indicate a proxy in use
LP_MARK_HG="" # prompt mark in hg repositories
LP_MARK_SVN="" # prompt mark in svn repositories
LP_MARK_GIT="±" # prompt mark in git repositories
LP_MARK_FOSSIL="" # prompt mark in fossil repositories
LP_MARK_DISABLED="" # prompt mark in directory with disabled VCS info
LP_MARK_UNTRACKED="*" # if git has untracked files
LP_MARK_STASH="+" # if git has stashs
LP_MARK_SHORTEN_PATH=" " # prompt mark in shortened paths
LP_MARK_PERM=":" # separator between host and path
else
LP_MARK_BATTERY="b"
LP_MARK_ADAPTER="p"
LP_MARK_LOAD="c"
LP_MARK_TEMP="T"
LP_MARK_PROXY="^"
LP_MARK_HG="m"
LP_MARK_SVN="="
LP_MARK_GIT="+"
LP_MARK_FOSSIL="f"
LP_MARK_DISABLED="!"
LP_MARK_UNTRACKED="*"
LP_MARK_STASH="+"
LP_MARK_SHORTEN_PATH=" ... "
LP_MARK_PERM=":"
fi
LP_MARK_BRACKET_OPEN="[" # open bracket
LP_MARK_BRACKET_CLOSE="]" # close bracket
LP_MARK_PREFIX=" " # prompt mark prefix
LP_PS1_PREFIX=""
LP_PS1_POSTFIX=""
LP_COLOR_PATH="$BOLD" # as normal user
LP_COLOR_PATH_ROOT="$BOLD_YELLOW" # as root
LP_COLOR_PROXY="$BOLD_BLUE"
LP_COLOR_JOB_D="$YELLOW" # Detached (aka screen sessions)
LP_COLOR_JOB_R="$BOLD_YELLOW" # Running (xterm &)
LP_COLOR_JOB_Z="$BOLD_YELLOW" # Sleeping (Ctrl-Z)
LP_COLOR_ERR="$PURPLE"
LP_COLOR_MARK="$BOLD" # as user
LP_COLOR_MARK_ROOT="$BOLD_RED" # as root
LP_COLOR_MARK_SUDO="$BOLD_RED" # when sudo credentials are cached
LP_COLOR_USER_LOGGED="" # user who logged in
LP_COLOR_USER_ALT="$BOLD" # user but not the one who logged in
LP_COLOR_USER_ROOT="$BOLD_YELLOW" # root
LP_COLOR_HOST="" # local host
LP_COLOR_SSH="$BLUE" # connected via SSH
LP_COLOR_SU="$BOLD_YELLOW" # connected remotely but in new environment through su/sudo
LP_COLOR_TELNET="$WARN_RED" # connected via telnet
LP_COLOR_X11_ON="$GREEN" # connected with X11 support
LP_COLOR_X11_OFF="$YELLOW" # connected without X11 support
LP_COLOR_WRITE="$GREEN" # have write permission
LP_COLOR_NOWRITE="$RED" # do not have write permission
LP_COLOR_UP="$GREEN" # repository is up to date / a push have been made
LP_COLOR_COMMITS="$YELLOW" # some commits have not been pushed
LP_COLOR_COMMITS_BEHIND="$BOLD_RED" # some commits have not been pushed
LP_COLOR_CHANGES="$RED" # there is some changes to commit
LP_COLOR_DIFF="$PURPLE" # number of lines impacted by current changes
LP_COLOR_CHARGING_ABOVE="$GREEN" # charging and above threshold
LP_COLOR_CHARGING_UNDER="$YELLOW" # charging but under threshold
LP_COLOR_DISCHARGING_ABOVE="$YELLOW" # discharging but above threshold
LP_COLOR_DISCHARGING_UNDER="$RED" # discharging and under threshold
LP_COLOR_TIME="$BOLD_WHITE"
LP_COLOR_IN_MULTIPLEXER="$BOLD_BLUE"
LP_COLOR_VIRTUALENV="$CYAN"
LP_COLOR_RUNTIME="$YELLOW"
LP_COLORMAP=(
""
"$GREEN"
"$BOLD_GREEN"
"$YELLOW"
"$BOLD_YELLOW"
"$RED"
"$BOLD_RED"
"$WARN_RED"
"$CRIT_RED"
"$DANGER_RED"
)
'';
}

21
home/common/listadmin.nix Normal file
View file

@ -0,0 +1,21 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ listadmin ];
home.file."listadmin.ini" = {
enable = true;
target = ".listadmin.ini";
text = ''
password "duck69"
adminurl http://lists.{domain}/admindb.cgi/{list}-{domain}
dumpdir /home/don/tmp/listadmin
log /home/don/.list.log
default discard
spamlevel 1
discard_if_from ^(postmaster|mailer(-daemon)?|listproc|no-reply)@
#lists
ex-psa@duckland.org
techies@duckland.org
'';
};
}

76
home/common/mail.nix Normal file
View file

@ -0,0 +1,76 @@
{ config, pkgs, ... }:
{
accounts.email.accounts = {
"don@donharper.org" = {
primary = true;
realName = "Don Harper";
userName = "don";
address = "don@donharper.org";
#secondaries = [ "duck@duckland.org" "duckunix@gmail.com" ];
notmuch.enable = true;
};
};
programs.notmuch = {
enable = true;
new = {
tags = [ "unread" ];
ignore = [ ".mbsyncstate" ".uidvalidity" "Sent Mail" "Trash" ".mbsyncstate.journal" ".mbsyncstate.new" ".mbsyncstate.lock" ];
};
extraConfig = {
database = {
path = "/home/don/Mail";
};
};
};
home.file.".signature".text = ''
--
Don Harper
'';
systemd.user = {
timers.mbsync = {
Timer = {
OnUnitActiveSec = "5m";
AccuracySec = "1m";
};
Install = {
WantedBy = ["timers.target"];
};
};
services.mbsync = {
Service = {
ExecStart = "/home/don/bin/mbsync";
Environment = "PATH=/run/current-system/sw/bin";
Type = "oneshot";
};
Install = {
WantedBy = [ "mbsync.timer" ];
};
};
services."mbsync-all" = {
Service = {
ExecStart = "/home/don/bin/mbsync gmail";
Environment = "PATH=/run/current-system/sw/bin";
Type = "oneshot";
};
Install = {
WantedBy = ["mbsync-all.timer"];
};
};
timers."mbsync-all" = {
Timer = {
AccuracySec = "1m";
OnUnitActiveSec = "14m";
};
Install = {
WantedBy = ["timers.target"];
};
};
};
}

33
home/common/mopidy.nix Normal file
View file

@ -0,0 +1,33 @@
{ pkgs, config, ... }:
{
services = {
mopidy = {
enable = true;
extensionPackages = with pkgs; [
mopidy-mpd
mopidy-subidy
mopidy-moped
];
settings = {
http = {
enabled = true;
hostname = "127.0.0.1";
port = "6680";
zeroconf = "Mopidy HTTP server on loki";
csrf_protection = true;
default_app = "mopidy";
};
jellyfin = {
hostname = "jelly.duckland.org";
username = "don";
password = "D4u5c3k!@";
albumartistsort = false;
};
mpd = {
enabled = true;
};
};
};
};
}

66
home/common/neovim.nix Normal file
View file

@ -0,0 +1,66 @@
{ config, pkgs, ... }:
{
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraConfig =
''
colorscheme dracula
set backspace="indent,eol,start"
set autoindent
set expandtab
set tabstop=2
set shiftwidth=2
set history=50
set ruler
set showcmd
set incsearch
set hlsearch
set nospell
set modeline
set wildmode=longest:full
set wildmenu
set scrolloff=2
set number
set list
"set listchars="eol:,tab:·,trail:,nbsp:"
set background=dark
set laststatus=2
set t_Co=256
let g:ale_linters = { 'nix': ['statix']}
let g:vimwiki_list = [{'path': '~/org/', 'syntax': 'markdown', 'ext': '.md'}]
let g:vimwiki_global_ext = 0
let g:vimwiki_fold_blank_lines = 0
'';
plugins = with pkgs.vimPlugins; [
CheckAttach
Recover-vim
Shade-nvim # color
SpaceCamp # color
#YouCompleteMe
ale
ansible-vim
aurora # color
dracula-nvim
tabular
vim-airline
vim-airline-themes
vim-bufferline
vim-fugitive
vim-gitgutter
vim-github-dashboard
vim-markdown
vim-misc
vim-nix
vim-tmux
vim-tmux-navigator
vimwiki
vimux
];
};
imports = [
./bufferline.nix
];
}

49
home/common/newsboat.nix Normal file
View file

@ -0,0 +1,49 @@
{ config, pkgs, ... }:
{
programs.newsboat = {
enable = true;
autoReload = true;
browser = "~/bin/myweb";
reloadThreads = 4;
reloadTime = 45;
extraConfig =
''
article-sort-order date
bind-key D mark-feed-read
bind-key J next-feed
bind-key K prev-feed
bind-key N toggle-article-read
bind-key SPACE open
bind-key a mark-feed-read
bind-key d toggle-article-read
bind-key i quit
bind-key j next
bind-key k prev
cleanup-on-quit yes
confirm-exit yes
delete-read-articles-on-quit yes
display-article-progress yes
download-full-page yes
error-log "~/.config/newsboat/error.log"
external-url-viewer "urlscan -c -d"
feed-sort-order firsttag
freshrss-login "don"
freshrss-password "Qz77ALbnEl*I2!%QZhs9K"
freshrss-show-special-feeds "no"
freshrss-url "https://rss.duckland.org/api/greader.php"
refresh-on-startup yes
show-read-articles no
show-read-feeds no
urls-source "freshrss"
# Theme Dracula
color listnormal color117 default
color listfocus color84 default
color info color136 color235
color background color244 color234
color article color231 default
color listnormal_unread color117 default
color listfocus_unread color84 default
highlight article "^(Title):.*$" color231 black
'';
};
}

238
home/common/taskwarrior.nix Normal file
View file

@ -0,0 +1,238 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [ taskwarrior tasksh vit timewarrior ];
programs.taskwarrior = {
enable = true;
colorTheme = "dark-green-256";
dataLocation = "~/.task";
config = {
weekstart = "Monday";
burndown = {
cumulative = 0;
};
journal = {
info = "no";
time = "yes";
};
default = {
project = "inbox";
command = "nnext";
width = 140;
};
alias = {
burn = "burndown";
cal = "calendar";
copy = "duplicate";
cp = "duplicate";
tom = "tomorrow";
};
report = {
_reviewed = {
columns = "uuid";
description = "Tasksh review report. Adjust the filter to your needs.";
filter = "( reviewed.none: or reviewed.before:now-4weeks ) and ( +PENDING or +WAITING ) and -someday and project.not:books";
sort = "reviewed+,modified+";
};
mine = {
columns = "description.count,id";
description = "strip";
filter = "-COMPLETED -DELETED -PARENT";
labels = "desc,ID";
sort = "description ";
};
next.filter = " status:pending limit:page -BLOCKED -someday -WAITING";
inbox = {
columns = " id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency";
description = "list inbox items";
filter = " status:pending limit:10 -BLOCKED -someday -WAITING proj:inbox";
labels = " ID,Active,Age,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg";
sort = " urgency-";
context = " 0";
};
waiting = {
columns = " id,start.age,entry.age,depends,priority,project,tags,recur,wait,due,until.remaining,description,urgency";
description = "Waiting";
filter = " status.not:deleted status.not:completed -BLOCKED -someday +WAITING";
labels = " ID,Active,Age,Deps,P,Project,Tag,Recur,Wait til,Due,Until,Description,Urg";
sort = " wait";
};
nnext = {
columns = " id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency";
description = "Next 10 list";
filter = " status:pending limit:10 -BLOCKED -someday -WAITING";
labels = " ID,Active,Age,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg";
sort = " urgency-";
};
title = {
columns = " id,project,description.count";
description = "title only, please";
filter = " status:pending limit:10 ";
#filter = " status:pending limit:10 -BLOCKED -WAITING";
labels = " ID,Project,Description";
sort = " description+";
};
anext = {
columns = " id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency";
description = "Next 10 list";
filter = " status:pending limit:10 -BLOCKED -WAITING";
labels = " ID,Active,Age,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg";
sort = " urgency-";
};
last = {
columns = " id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency";
description = "Oldest 10 list";
filter = " status:pending limit:10 -BLOCKED -someday -WAITING";
labels = " ID,Active,Age,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg";
sort = " entry+";
};
inboxdash = {
columns = " id,project,description.count";
description = "Inbox for dashboards";
filter = " status:pending limit:10 -BLOCKED -someday -WAITING proj:inbox";
labels = " ID,Project,Description";
sort = " urgency-";
};
dash = {
columns = " id,project,description.count";
description = "For dashboards";
filter = " status:pending limit:10 -BLOCKED -someday -WAITING";
labels = " ID,Project,Description";
sort = " urgency-";
};
mail = {
columns = " id,priority,project,due.relative,until.remaining,description.count,urgency";
description = "Next 5 list";
filter = " status:pending limit:5 -BLOCKED -someday -WAITING";
labels = " ID,P,Project,Due,Until,Description,Urg";
sort = " urgency-";
};
followup = {
columns = " id,start.age,entry.age,priority,project,description";
description = "Someday list";
filter = " status.not:completed status.not:deleted -BLOCKED +followup";
labels = " ID,Active,Age,P,Project,Description";
sort = " project,urgency-";
context = " 0";
};
someday = {
columns = " id,start.age,entry.age,priority,project,description,urgency";
description = "Someday list";
filter = " status:pending -BLOCKED +someday limit:page -WAITING";
labels = " ID,Active,Age,P,Project,Description,Urg";
sort = " project,urgency-";
context = " 0";
};
};
taskd = {
ca = "/home/don/.task/ca.cert.pem";
certificate = "/home/don/.task/don_harper.cert.pem";
credentials = "duckland.org/Don Harper/de27c234-6217-4e8b-83c1-2ea840bac55f";
key = "/home/don/.task/don_harper.key.pem";
server = "task.duckland.org:53589";
recurrence = "on";
};
uda = {
priority = {
label = "Priority";
type = "string";
values = "H,M,,L";
};
reviewed = {
label = "Reviewed";
type = "date";
};
notes = {
type = "string";
label = "Notes";
};
blocks = {
type = "string";
label = "Blocks";
};
};
urgency = {
blocking.coefficient = 2;
uda = {
recur.coefficient = 4;
priority = {
H.coefficient = 5;
L.coefficient = -0.5;
M.coefficient = 3.9;
};
};
user = {
project = {
blogging.coefficient = 3;
books.coefficient = -0.5;
family.coefficient = 5;
fashion.coefficient = -0.5;
job.coefficient = 7;
photo.coefficient = 4;
selfhosted.fix.coefficient = 2;
};
tag = {
next.coefficient = 3;
breakgoals.coefficient = 10;
GTD.coefficient = 5;
};
};
};
context = {
selfhost = "project:selfhosted";
gtd.read = "+GTD";
gtd.write = "+GTD";
job.read = "proj:job";
job.write = "proj:job";
selfhosted.read = "proj:selfhosted";
selfhosted.write = "proj:selfhosted";
work.read = "proj:work";
work.write = "proj:work";
review.read = "-someday -WAITING project.not:books";
review.write = "-someday -WAITING project.not:books";
};
color.project.weekly-review = "on rgb510";
news.version = "2.6.0";
};
};
# FIXME need to convert harper over before this will work
#home.file."timewarrior.cfg" = {
# enable = true;
# target = ".timewarrior/timewarrior.cfg";
# text = ''
# tags.nixos.description = Working on NixOS
# '';
#};
home.file."vit-config.ini" = {
enable = true;
target = ".vit/config.ini";
text = ''
[taskwarrior]
taskrc = ~/.config/task/taskrc
[vit]
default_keybindings = vi
theme = default
confirmation = True
wait = True
mouse = True
[report]
default_report = nnext
default_filter_only_report = nnext
indent_subprojects = True
row_striping = True
[marker]
uda.notes.label = (N)
enabled = True
[color]
[keybinding]
o = :!wr onenote {TASK_UUID}<Enter>
'';
};
}

151
home/common/tmux.nix Normal file
View file

@ -0,0 +1,151 @@
{ pkgs, ... }:
{
programs.tmux = {
enable = true;
aggressiveResize = true;
sensibleOnTop = false;
historyLimit = 2000;
tmuxinator.enable = true;
mouse = false;
baseIndex = 1;
disableConfirmationPrompt = true;
#shell = "${pkgs.bash}/bin/bash";
terminal = "tmux-256color";
keyMode = "vi";
plugins = [
# Add tmux-tasks
pkgs.tmuxPlugins.resurrect
pkgs.tmuxPlugins.continuum
pkgs.tmuxPlugins.battery
pkgs.tmuxPlugins.cpu
pkgs.tmuxPlugins.vim-tmux-navigator
{
plugin = pkgs.tmuxPlugins.online-status;
extraConfig =
''
set -g @online_icon "ok"
set -g @offline_icon "offline!"
'';
}
{
plugin = pkgs.tmuxPlugins.dracula;
extraConfig =
''
set -g @dracula-plugins "cpu-usage network battery weather time"
set -g @dracula-border-contrast true
set -g @dracula-refresh-rate 10
set -g @dracula-show-left-icon session
set -g @dracula-border-contrast true
set -g @dracula-show-powerline true
set -g @dracula-synchronize-panes-label "Sync"
set -g @dracula-show-flags true
set -g @dracula-show-timezone false
set -g @dracula-fixed-location "Katy, Texas"
set -g @dracula-show-location false
'';
}
];
extraConfig =
''
bind '~' split-window "exec ytop"
bind - split-window -v -c "#{pane_current_path}"
bind -n C-1 select-window -t 11
bind -n C-2 select-window -t 12
bind -n C-3 select-window -t 13
bind -n C-4 select-window -t 14
bind -n C-left swap-window -t -1
bind -n C-right swap-window -t +1
bind -n S-down new-window
bind -n S-left prev
bind -n S-right next
bind 0 select-window -t 10
bind 1 select-window -t 1
bind 2 select-window -t 2
bind 3 select-window -t 3
bind 4 select-window -t 4
bind 5 select-window -t 5
bind 6 select-window -t 6
bind 7 select-window -t 7
bind 8 select-window -t 8
bind 9 select-window -t 9
bind C-0 select-window -t 20
bind C-5 select-window -t 15
bind C-6 select-window -t 16
bind C-7 select-window -t 17
bind C-8 select-window -t 18
bind C-9 select-window -t 19
bind C-c run "tmux show-buffer | wl-copy"
bind C-i neww -n khal "exec ikhal"
bind C-t neww -n vit "exec vit"
bind C-v run "tmux set-buffer -- \"$(wl-paste)\"; tmux paste-buffer"
bind F1 select-window -t 11
bind F10 select-window -t 20
bind F2 select-window -t 12
bind F3 select-window -t 13
bind F4 select-window -t 14
bind F5 select-window -t 15
bind F6 select-window -t 16
bind F7 select-window -t 17
bind F8 select-window -t 18
bind F9 select-window -t 19
bind K split-window -h "exec ikhal"
bind S split-window -v -l 5
bind Tab choose-window
bind ^b last-window
bind e setw synchronize-panes
bind g select-layout tiled
bind o select-pane -t :.-
bind | split-window -h -c "#{pane_current_path}"
bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "urlscan" '$SHELL -c "urlscan -c -d < /tmp/tmux-buffer"'
set -g bell-action any
set -g buffer-limit 9
set -g display-panes-active-colour red
set -g display-panes-colour blue
set -g display-panes-time 1000
set -g display-time 750
set -g focus-events on
set -g lock-after-time 120
set -g lock-command 'tty | grep -q "^/dev/tty" && vlock'
set -g renumber-windows off
set -g set-titles on
set -g set-titles-string "#S:#I:#W - "#T""
set -g status on
set -g status-interval 0
set -g status-interval 15
set -g status-justify left
set -g status-position top
set -g visual-activity off
set -g visual-bell off
set -sa terminal-features ',tmux-256color:RGB'
set -sa terminal-overrides ",tmux-256color:RGB"
set -sg escape-time 0
'';
};
xdg.configFile."tmuxinator" = {
recursive = true;
source = ./files/tmuxinator;
target = "tmuxinator";
};
home.file = {
tmux-css = {
enable = true;
target = ".tmux-cssh";
text = ''
vps:-sc www.tail -sc nuwww.tail
local:-sc harper.tail -sc mini.tail -sc display.tail -sc harper2.tail -sc pihole.tail -sc fred.tail
server:-cs vps -cs local
laptop:-sc loki.tail -sc dragon.tail
arch:-sc harper.tail -sc pocket2.tail -sc pihole.tail -sc nuwww.tail -sc display.tail -sc fred.tail
nix:-sc loki.tail -sc eve.tail -sc dragon.tail -sc smaug.tail
nix-all:-sc loki.tail -sc eve.tail -sc dragon.tail -sc smaug.tail -sc ace.tail -sc pocket2.tail
ubuntu:-sc mini.tail -sc www.tail -sc harper2.tail
vm:-sc vm1 -sc vm2
all-laptop:-cs laptop -sc smaug.tail -sc dragon.tail -sc pocket2.tail -sc ace.tail -sc eve.tail
# -sc pine.tail
#all:-cs server -cs laptop
all:-cs server -cs all-laptop
test:-cs all -cs vm
'';
};
};
}

42
home/common/topgrade.nix Normal file
View file

@ -0,0 +1,42 @@
{ config, pkgs, ... }:
{
programs.topgrade = {
enable = true;
settings = {
misc = {
assume_yes = true;
no_retry = true;
skip_notify = true;
disable = [
"atom"
"cargo"
"emacs"
"flatpak"
"home_manager"
"pip3"
"ruby_gems"
"shell"
"snap"
"stack"
"tmux"
];
set_title = false;
cleanup = true;
#commands = {
#"Run garbage collection on Nix store" = "nix-collect-garbage";
#};
};
git = {
max_concurrency = 5;
repos = [
"~/.dotfiles"
"~/bin"
"~/nixos"
"~/src/Systems/ansible"
"~/src/WWW/sites/donaldharper.com"
"~/src/WWW/sites/duckland.org"
];
};
};
};
}

63
home/common/vifm.nix Normal file
View file

@ -0,0 +1,63 @@
{ pkgs, ... }: {
home.packages = with pkgs; [ vifm-full ];
xdg.configFile."vifm/vifmrc".text = ''
" vim: filetype=vifm :
set runexec
colorscheme dracula
set timefmt=%Y-%m-%d\ %H:%M
set hlsearch
set statusline=" Hint: %z%= %A %10u:%-7g %15s %20d "
" :mark mark /full/directory/path [filename]
mark b ~/bin/
mark h ~/
mark d ~/Downloads
nnoremap gd :cd ~/Downloads<cr>
'';
xdg.configFile."vifm/colors/dracula.vifm".text = ''
" VIFM COLORS
" dracula
" based on: https://github.com/istib/dotfiles/blob/master/vifm/vifm-colors
" Default = -1 = None, can be used for transparency or default color
" Black = 0
" Red = 1
" Green = 2
" Yellow = 3
" Blue = 4
" Magenta = 5
" Cyan = 6
" White = 7
" STYLES
" bold
" underline
" reverse or inverse
" standout
" none
highlight clear
highlight Win cterm=none ctermfg=default ctermbg=none
highlight TopLine cterm=none ctermfg=blue ctermbg=none
highlight TopLineSel cterm=none ctermfg=magenta ctermbg=none
highlight StatusLine cterm=none ctermfg=blue ctermbg=none
highlight Border cterm=none ctermfg=blue ctermbg=none
highlight Selected cterm=bold ctermfg=magenta ctermbg=default
highlight CurrLine cterm=bold ctermfg=236 ctermbg=blue
highlight WildMenu cterm=none,reverse ctermfg=blue ctermbg=236
highlight CmdLine cterm=none ctermfg=255 ctermbg=236
highlight ErrorMsg cterm=none ctermfg=red ctermbg=black
highlight Directory cterm=none ctermfg=blue ctermbg=default
highlight Link cterm=none ctermfg=cyan ctermbg=default
highlight BrokenLink cterm=none ctermfg=red ctermbg=default
highlight Socket cterm=none ctermfg=magenta ctermbg=black
highlight Device cterm=none ctermfg=red ctermbg=default
highlight Fifo cterm=none ctermfg=yellow ctermbg=black
highlight Executable cterm=none ctermfg=green ctermbg=default
'';
}