Initialize repository with old config

This commit is contained in:
2023-06-09 11:11:23 +02:00
commit 72e4eb1262
8 changed files with 278 additions and 0 deletions

36
.bash_aliases Executable file
View File

@@ -0,0 +1,36 @@
# ---------------------------------- #
# Regularly used configuration files #
# ---------------------------------- #
alias aliases='vim ~/.bash_aliases;source ~/.bash_aliases'
alias dotfiles='/usr/bin/git --git-dir=/home/dominik/.dotfiles/ --work-tree=/home/dominik'
alias sshconf='vim ~/.ssh/config'
# ---------- #
# Shorthands #
# ---------- #
alias c='clear'
alias da='dotfiles add'
alias dp='dotfiles commit && dotfiles push'
alias ga='git add'
alias gp='git commit && git push'
alias ll='ls -la'
alias v='nvim'
alias vim='nvim'
alias yta='yt-dlp -o "~/Music/%(title)s.%(ext)s" -f bestaudio'
# ------- #
# Helpers #
# ------- #
alias now='date +"%s"' # Unix timestamp
# ------- #
# Scripts #
# ------- #
alias sysupdate='sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y'
# ---- #
# DDEV #
# ---- #
alias composer='ddev composer'
alias dep='ddev exec bin/dep'
alias typo3='ddev typo3'

117
.bashrc Normal file
View File

@@ -0,0 +1,117 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
export EDITOR=nvim
export VISUAL=$EDITOR
export PAGER=less
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=5000
HISTFILESIZE=10000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# Nitrokey configuration
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye > /dev/null

17
.config/git/config Normal file
View File

@@ -0,0 +1,17 @@
[core]
autocrlf = input
editor = nvim
[user]
email = foss@dominikdoerr.de
name = Dominik Dörr
signingkey = DE31470EFB8AF867
[init]
defaultBranch = main
[merge]
tool = vimdiff
[pull]
rebase = true
[commit]
gpgsign = true
[tag]
gpgsign = true

1
.gnupg/gpg-agent.conf Normal file
View File

@@ -0,0 +1 @@
enable-ssh-support

1
.gnupg/gpg.conf Normal file
View File

@@ -0,0 +1 @@
use-agent

22
.profile Normal file
View File

@@ -0,0 +1,22 @@
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# move most config files out of the home folder root
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi

10
LICENSE Normal file
View File

@@ -0,0 +1,10 @@
The MIT License (MIT)
Copyright © 2021 Dominik Dörr
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.

74
README.md Normal file
View File

@@ -0,0 +1,74 @@
# Dotfiles
**Dotfiles for [@dominikdoerr](https://fosstodon.org/@dominikdoerr)**
Dotfiles are user-specific configuration files. They are called dotfiles, because on linux most configuration files start with a dot (like .bashrc) to mark them as hidden. To be able to migrate or restore those configuration files without much hassle they can be committed to a git repository. Now they can quickly be installed on every system with internet access.
These are the configuration files for my linux setup (running Debian on a Thinkpad X230). Feel free to use this as inspiration or starting point for your own setup. I try to comment my settings as much as possible (as I tend to forget the more obscure settings on a regular basis).
---
## Install these dotfiles onto a new system
If you are using bash, the alias will be included in the .bash_aliases file. Add this alias to your shell configuration file, if you use another shell.
```
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
```
Clone this repository as a bare repository into your home folder.
```
git clone --bare https://gitlab.com/dominikdoerr/dotfiles $HOME/.dotfiles
# Checkout the repository to add the files to your home folder.
# Make sure to set the alias for your shell first.
# This command may fail, if you have files already present (like a .bashrc). Move or delete these files and run the command again.
dotfiles checkout
# Set the flag to only track explicitly added files.
dotfiles config --local status.showUntrackedFiles no
```
Now you are set up and can use your own dotfiles.
---
## How to create your own dotfiles
Maybe you want to create your own dotfiles but start from scratch instead of cloning and modifying this repository. My setup basically follows this [guide from Atlassian](https://www.atlassian.com/git/tutorials/dotfiles).
```
# Create a separate folder for git to track the files
git init --bare $HOME/.dotfiles
# Add an alias for your shell (I use bash).
# As I am using aliases a lot, I use a separate file instead of adding it to the .bashrc.
# We use this alias instead of the regular git command.
echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >> $HOME/.bash_aliases
# Set a flag to only show explicitly added files.
# Otherwise git will try to track all the files in our home directory.
# Note that we already use our alias. You have to source your alias file first or restart your shell to make this work.
dotfiles config --local status.showUntrackedFiles no
```
Now you can manage your dotfiles with git using the new alias. Just use 'dotfiles' instead of 'git'. For example:
```
dotfiles status
dotfiles add .bash_aliases
dotfiles commit -m "Add aliases file for bash"
dotfiles push
```
---
## Questions and contact
Got questions or feedback? Please do get in touch. I'm always looking for improvements and am happy to help if I can.
* [Visit my website](https://dominikdoerr.de)
* [Write me an email](mailto:foss@dominikdoerr.de)
* [Get in touch on Mastodon](https://fosstodon.org/@dominikdoerr)