Make dotfiles compatible with gitpod style dotfiles
Add an install.sh that attempts to determine the OS, install stow and then call my apply-dotfiles script to use stow. The old installation process that was based on nix, has been moved to nix-install.
This commit is contained in:
parent
0a90400806
commit
a2076fd6f1
15
README.md
Normal file
15
README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Dotfiles
|
||||
|
||||
This is my personal dotfiles repository containing all my configurations (and some credentials in git-crypt). Most of these files are managed using [GNU Stow](https://www.gnu.org/software/stow/) to symlink them into place while the real files live in this repository under version control.
|
||||
|
||||
## Installation
|
||||
|
||||
To place all the configuration files in their ultimate location we use the `apply-dotfiles` bash script. This script requires both `git` and `stow` to be available so we wrap this in either `install.sh` to install it similar to [gitpod dotfiles](https://www.gitpod.io/docs/configure/user-settings/dotfiles#custom-installation-script) (which are also used for [coder](https://coder.com/) workspaces) or `nix-install` for my many machines that have either Nix or NixOS installed.
|
||||
|
||||
## Secret Management
|
||||
|
||||
I use `git-crypt` to keep some sensitive files in this repo. Namely my taskwarrior configuration which uses locally stored certificates in it's configuration as a means of authentication. While using `git-crypt` for this is pretty functional the process of moving PGP keys around is onerous enough that I haven't put a lot of effort into automating this portion of my dotfiles. It's there, there are scripts to interact with it but it's still mostly manual right now
|
||||
|
||||
### Things to watch out for
|
||||
|
||||
As anyone who maintains their own dotfiles long enough will know, your mileage will vary depending on your target OS. You have static configuration files setup against one version of software being moved to other machines that might use older/newer versions where configuration options have changed. You might end up getting annoying warnings (common in vim) or things just might not work at all. You may have to tune things for the lowest common denominator or create alternate configurations for specific operating system.
|
||||
@ -1,13 +1,26 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -p stow -i bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
stow bash
|
||||
stow sh
|
||||
stow readline
|
||||
apply_dotfile() {
|
||||
directory_to_stow="${1}"
|
||||
stow --adopt -S -t "${HOME}" "${directory_to_stow}"
|
||||
}
|
||||
|
||||
stow vim
|
||||
# Adopt will change the files in stow to match existing files.
|
||||
# We don't want this, we just want to handle existing files gracefully.
|
||||
# We simply adopt all the files and then at the end restore our git repo to undo changes
|
||||
restore_from_adoption() {
|
||||
git restore .
|
||||
}
|
||||
|
||||
stow ruby
|
||||
stow python
|
||||
apply_dotfile bash
|
||||
apply_dotfile sh
|
||||
apply_dotfile readline
|
||||
|
||||
stow ssh
|
||||
apply_dotfile vim
|
||||
|
||||
apply_dotfile ruby
|
||||
apply_dotfile python
|
||||
|
||||
apply_dotfile ssh
|
||||
|
||||
restore_from_adoption
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -p stow envsubst -i bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
envsubst -i taskwarrior/.taskrc.envsubst.template -o taskwarrior/.taskrc
|
||||
stow taskwarrior
|
||||
|
||||
33
install.sh
Executable file
33
install.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "CURRENT LOCATION: $PWD"
|
||||
|
||||
echo "Installing dotfiles..."
|
||||
if [ -f /etc/os-release ]; then
|
||||
echo "Idenitfying OS to install GNU stow..."
|
||||
if grep -q -i debian /etc/os-release; then
|
||||
echo "You've got Debian!";
|
||||
sudo apt update;
|
||||
sudo apt install -y stow;
|
||||
elif grep -q -i rhel /etc/os-release || grep -q -i fedora /etc/os-release; then
|
||||
echo "You've got RedHat (or maybe Fedora)! Which is unsupported right now sorry!";
|
||||
# sudo yum install -y stow;
|
||||
# sudo yum clean all;
|
||||
exit 1
|
||||
elif grep -q -i alpine /etc/os-release; then
|
||||
echo "You've got Alpine! Which is unsupported right now sorry!";
|
||||
exit 1;
|
||||
# apk add --no-cache jq curl;
|
||||
else
|
||||
echo "ERROR: Unable to identify OS!" 1>&2;
|
||||
exit 1;
|
||||
fi;
|
||||
else
|
||||
echo "ERROR: Unable to find '/etc/os-release' information!" 1>&2;
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# Apply the dotfiles with stow
|
||||
echo "RUNNING APPLY DOTFILES"
|
||||
./apply-dotfiles
|
||||
echo "RAN APPLY DOTFILES"
|
||||
7
nix-install
Executable file
7
nix-install
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -p stow envsubst -i bash
|
||||
|
||||
# Uses nix shell to setup the dotfiles
|
||||
./apply-dotfiles
|
||||
# Secret dotfiles need interactivity anyways, not worrying about this for now
|
||||
# ./apply-secret-dotfiles
|
||||
Loading…
x
Reference in New Issue
Block a user