feat: Simplify the dotfiles to what is useful

This commit is contained in:
Matthew Binning 2025-03-29 14:02:30 -07:00
parent 9232cf030b
commit 126d9892e2
11 changed files with 35 additions and 452 deletions

View file

@ -1,18 +0,0 @@
#!/bin/sh
# Typical verbosity and settings.
alias \
mkd='mkdir -pv' \
ffmepg='ffmpeg -hidebanner'
# Colorize when possible.
alias \
ls='ls -h -N -G --group-directories-first' \
grep='grep --color=auto'
# Shortenings
alias \
d='docker' \
h='history' \
l='less' \
s='sudo'

View file

@ -1,47 +0,0 @@
$include /etc/inputrc
set colored-stats On
set completion-prefix-display-length 6
set mark-symlinked-directories On
set bell-style none
set completion-ignore-case off
set show-all-if-ambiguous on
set menu-complete-display-prefix on
"\e[Z": menu-complete
"\e[A": history-search-backward
"\e[B": history-search-forward
# "\eOd": backward-word
# "\eOc": forward-word
#
# # for linux console
# "\e[1~": beginning-of-line
# "\e[4~": end-of-line
# "\e[5~": beginning-of-history
# "\e[6~": end-of-history
# "\e[3~": delete-char
# "\e[2~": quoted-insert
#
# # for xterm
# "\eOH": beginning-of-line
# "\eOF": end-of-line
set editing-mode vi
$if mode=vi
set show-mode-in-prompt on
set vi-ins-mode-string \1\e\[6 q\2
set vi-cmd-mode-string \1\e\[2 q\2
set keymap vi-command
Control-l: clear-screen
Control-a: beginning-of-line
set keymap vi-insert
Control-l: clear-screen
Control-a: beginning-of-line
"\C-i": menu-complete
$endif

View file

@ -1,7 +0,0 @@
CHANGELOG.md
Containerfile
.containerignore
.dockerignore
.git
.gitignore
README.md

View file

@ -1,18 +1,5 @@
[user]
email = matthew@binning.dev
email = matthewbinning@pm.me
name = Matthew Binning
[diff]
tool = vimdiff
[difftool]
prompt = false
[difftool "sdiff"]
cmd = cmddiff $LOCAL $REMOTE
[merge]
tool = fugitive
[alias]
df = difftool
sdiff = difftool --ignore-submodules --tool=sdiff
[mergetool]
prompt = false
[mergetool "fugitive"]
cmd = vim -f -c \"Gvdiff\" \"$MERGED\"
[core]
editor = vi

12
.gitignore vendored
View file

@ -1,12 +0,0 @@
.cache
.config/shell/histfile
.config/sfeed/feeds
.config/sfeed/urls
.config/when/calendar
.*history
.local/share/nvim/site/pack/gitmodules/start/er.vim/*
.local/share/nvim/site/pack/gitmodules/start/indentLine/*
.local/share/nvim/site/pack/gitmodules/start/lspconfig/*
.local/share/nvim/site/pack/gitmodules/start/lspconfig/.*
.local/share/nvim/site/pack/gitmodules/start/todo.txt-vim/*
.kube/

View file

@ -1,24 +1,32 @@
#!/usr/bin/env sh
# PS1='[\u@\h \W]\$ '
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/inputrc"
export ALIASRC="${XDG_CONFIG_HOME:-$HOME/.config}/aliasrc"
if docker --version > /dev/null 2>&1; then
PS1="\[\033[38;5;34m\]\u@\h \W]\\$\[$(tput sgr0)\] "
export PS1
else
PS1="\[\033[38;5;44m\]\u@\h \W]\\$\[$(tput sgr0)\] "
export PS1
fi
# Git should ask for a password through the command line.
unset GIT_ASKPASS
unset SSH_ASKPASS
# shellcheck source=./.config/aliasrc
[ -f "$ALIASRC" ] && . ./"$ALIASRC"
# Android development using Dioxus
JAVA_HOME="/usr/local/android-studio/jbr"
export JAVA_HOME
ANDROID_HOME="$HOME/Android/Sdk"
export ANDROID_HOME
NDK_HOME="$ANDROID_HOME/ndk/29.0.13113456"
export NDK_HOME
PATH="$PATH:$ANDROID_HOME/emulator"
export PATH
# Kubernetes Support
KUBECONFIG="$HOME"/.kube/config
export KUBECONFIG
# Shortenings
alias \
d='docker' \
g='git' \
k='kubectl' \
s='sudo'

View file

@ -1,14 +0,0 @@
ARG BASE_REGISTRY=docker.io
ARG BASE_IMAGE=alpine
ARG BASE_TAG=latest
FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} AS base
RUN apk update && \
apk upgrade && \
apk add make
FROM base as test
RUN adduser -D user
USER user
WORKDIR /home/user/dotfiles
COPY --chown=user ./ ./
ENTRYPOINT [ "make" ]

View file

@ -1,86 +0,0 @@
.POSIX:
.SUFFIXES:
COLOR_BLUE:=\033[36m
COLOR_AUTO:=\033[0m
SRC=.config/aliasrc .config/inputrc .gitconfig .*profile
TGT=$(addprefix $$HOME/, $(SRC))
.PHONY: help ## Show this help menu.
help:
@printf 'make <subcommand>\n\nsubcommand:\n'
@awk -F '(: | ## )' '/^\.PHONY:.*?## .*$$/ {\
printf("\t$(COLOR_BLUE)%s\t\t$(COLOR_AUTO)%s\n",$$2, $$3)\
}' $(MAKEFILE_LIST)
.PHONY: installcheck ## Check if the dotfiles are properly linked to home.
installcheck:
# Assert link sources match link destinations.
for link in $(SRC); do \
dst_link=$$(stat -c "%N" ~/"$$link" | cut -d ' ' -f 3); \
src_link="$$PWD/$$link"; \
if [ ! "$$dst_link" = \'"$$src_link"\' ]; then \
printf 'Destination link matches not the source link!\n'; \
fi; \
done
# RFE: Use the single suffix inference rule to enhance iteration semantics
# to actual Makefile semantics. This could probably be done by suffixing source
# links with .ln.
.PHONY: install ## Actually symlink the dotfiles to home.
install: $(SRC)
mkdir -p $(dir $(TGT))
for file in $(SRC); do $(RM) -r ~/$$file; ln -s $$PWD/$$file ~/$$file; done
.PHONY: uninstallcheck ## Check if dotfiles' symlinks were properly removed.
uninstallcheck:
# Assert destination links were removed.
for link in $(TGT); do \
[ ! -e ~/"$$link" ] || \
printf '%s%s\n' "$$link" "survived teardown!"; \
done
.PHONY: uninstall ## Remove the symlinks to dotfiles.
uninstall:
$(RM) -r $(TGT)
for file in $(TGT); do if [ -e "$$file~" ]; then mv "$$file~" "$$file"; fi; done
.PHONY: clean ## Purge cruft (not the dotfiles payload).
clean:
-docker rm check_dotfiles
-docker rmi dotfiles
# ----------------------------------------------------------------------------
# Make is not really a good system for this.
# It works with files, but this works with containers.
# Write a deployment for the test container?
.PHONY: all ## lint -> build -> check
all: lint build check
.PHONY: lint ## Lint the source repository.
lint:
docker run --rm \
-u "$(shell id -u):$(shell id -g)" \
-v "$(shell pwd):/mnt" \
-w /mnt \
mvdan/shfmt:latest -d -sr -i 4 .config/aliasrc .*profile
docker run --rm \
-u "$(shell id -u):$(shell id -g)" \
-v "$(shell pwd):/mnt" \
-w /mnt \
koalaman/shellcheck -x .config/aliasrc .*profile
.PHONY: build ## Build a container to system-test the dotfiles.
build:
docker build --target test --tag dotfiles .
.PHONY: check ## Check if (un)install works in the test container.
check: build
docker run --name="check_dotfiles" --tty -d --entrypoint sh dotfiles
docker exec check_dotfiles make install
docker exec check_dotfiles make installcheck
docker exec check_dotfiles make uninstall
docker exec check_dotfiles make uninstallcheck
docker stop check_dotfiles
# ----------------------------------------------------------------------------

View file

@ -1,20 +1,8 @@
# dotfiles
This source repository contains configuration for common Unix systems.
This uses symlinks to quickly set up a bash-based system, like NixOS or Debian.
Clone this repository into your home folder.
Then `cd ~/dotfiles && ./install.sh`.
Influences include:
- [Luke Smith's voidrice](https://github.com/lukesmithxyz/voidrice)
- [Whynothugo's dotfiles](https://git.sr.ht/~whynothugo/dotfiles)
## Install
This uses `make`.
## Test
To create a container, install the dotfiles there, check the installation, and then destroy the container, run:
```
make check
```
After first install, the symlinks will be set up.
Thereafter, `git pull` will simply bring in updates to these managed dotfiles.

View file

@ -1,219 +0,0 @@
### Project specific
.gen/**/*_pb2*.py
*_output.mpg
test-results.xml
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/

3
install.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env sh
ln -si "$HOME"/dotfiles/.gitconfig ~/.gitconfig
printf '. ~/dotfiles/.profile' > ~/.bashrc