Skip to content

trskop/dot.config

Repository files navigation

User configuration files (dot–files)

TODO:

Installation

Some dependencies need to be installed. On Debian it is:

sudo apt install haskell-stack curl libtinfo-dev zlib1g-dev

We are expecting that there are some files already present in your ~/.config/ directory. This installation process will leave them untouched, but you may need to resolve issues with files that exist both locally and in the repository.

cd ~/.config/
git init
git remote add origin git@github.com:trskop/dot.config.git
git fetch --all
git checkout -b master origin/master

If installing on a clean system then ~/.config directory may not exist, in which case it becomes a little bit easier. We'll be using HTTPS protocol instead of SSH, since SSH key for accessing GitHub may not be present on a pristine system. Just reconfigure remote URL afterwards.

git clone https://github.com/trskop/dot.config.git ~/.config

Make sure to use ~/.local/bin for your executables instead of ~/bin:

cd ~
mkdir -p ~/.local/bin
if [ -e ~/bin ]; then mv ~/bin/* ~/.local/bin/; fi
rmdir bin

For backward compatibility it is possible to do this:

ln -s .local/bin bin

Now make sure that ~/.profile and ~/.bash_profile add ~/.local/bin into your $PATH instead of ~/bin.

Make sure that stack installed through the system package is sufficiently new. If not then run:

stack upgrade

To avoid long bootstrapping sequence when calling Haskell scripts it may be a good idea to run:

stack setup 8.10.4

Where 8.10.4 is GHC version used by ~/.config/dot.config.init.hs. Please check the Stackage LTS version specified in it to be sure as this documentation may be out of date.

Now we need to install everything:

~/.config/dot.config.init.hs bootstrap
yx this -Uusin

Version-controlled Host-specific Configuration

Host-specific configuration is stored in ~/.local/src/localhost repository with following directory structure:

~/.local/src/localhost/
├── ${host}/
│   ├── dot.config/   <── Private configuration that would normally go to
│   │   │                 ${XDG_CONFIG_HOME:-${HOME}/.config}
│   │   └── ...
│   │
│   └── notes/        <── Notes about the hardware, installation specifics, etc.
│       │                 Basically anything that is easily forgotten once the
│       │                 system is installed and configured.
│       └── ...
│
├── this -> ${host}
└── dot.config -> this/dot.config

Where ${host} is the result of hostname --fqdn. This allows us to reuse/share the repository for multiple machines. One such example is when one machine dies, and new one has to be installed. Copying over existing repository can serve as a nice starting point.

Script scripts/init-host-specific-config-repo.bash is provided to create the repository with the above structure. It can be invoked as:

bash ~/.config/scripts/init-host-specific-config-repo.bash

Scripts

Other Resources