From 1d8f4d02b34074a773b466ab487034ee2928948a Mon Sep 17 00:00:00 2001 From: "Andrew R. M" Date: Fri, 6 Oct 2023 17:44:28 +0000 Subject: [PATCH] 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. --- apply-dotfiles | 22 +++++++++++++--------- apply-secret-dotfiles | 3 +-- install.sh | 33 +++++++++++++++++++++++++++++++++ nix-install | 7 +++++++ 4 files changed, 54 insertions(+), 11 deletions(-) create mode 100755 install.sh create mode 100755 nix-install diff --git a/apply-dotfiles b/apply-dotfiles index da6a81f..d3e45ed 100755 --- a/apply-dotfiles +++ b/apply-dotfiles @@ -1,13 +1,17 @@ -#!/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 -D -d "${directory_to_stow}" -t "${HOME}" +} -stow vim +apply_dotfile bash +apply_dotfile sh +apply_dotfile readline -stow ruby -stow python +apply_dotfile vim -stow ssh +apply_dotfile ruby +apply_dotfile python + +apply_dotfile ssh diff --git a/apply-secret-dotfiles b/apply-secret-dotfiles index 0e0d441..f9c5c6c 100755 --- a/apply-secret-dotfiles +++ b/apply-secret-dotfiles @@ -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 diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..d4d8483 --- /dev/null +++ b/install.sh @@ -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" diff --git a/nix-install b/nix-install new file mode 100755 index 0000000..6d5069f --- /dev/null +++ b/nix-install @@ -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