-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shuffle some more things, establish a foundation
- Loading branch information
1 parent
c9daa5e
commit 908ae36
Showing
6 changed files
with
63 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,21 @@ set -xeuo pipefail | |
export WORKSTATION_DIR="$HOME/workstation" | ||
export WORKSTATION_HOST_SETTINGS_SRC_DIR=$WORKSTATION_DIR/hosts/$WORKSTATION_NAME | ||
export WORKSTATION_HOST_CURRENT_SETTINGS_DIR=$WORKSTATION_DIR/hosts/current | ||
export WORKSTATION_EMACS_CONFIG_DIR=~/.config/emacs | ||
export WORKSTATION_GIT_ORIGIN='[email protected]:joelmccracken/workstation.git' | ||
export WORKSTATION_GIT_ORIGIN_PUB='https://github.com/joelmccracken/workstation.git' | ||
|
||
sourceIfExists () { | ||
if [ -f "$1" ]; then | ||
source "$1" | ||
fi | ||
} | ||
|
||
if [ -z "${WORKSTATION_NAME+x}" ] ; then | ||
if [ -f "$WORKSTATION_HOST_CURRENT_SETTINGS_DIR/settings.sh" ]; then | ||
source "~/$WORKSTATION_HOST_CURRENT_SETTINGS_DIR/settings.sh" | ||
fi | ||
fi | ||
|
||
# workstation_foundation ends here | ||
# These are the various versions of things that should be installed. Keeping them | ||
|
@@ -54,11 +69,6 @@ if [ -z "${2+x}" ]; then | |
else | ||
export WORKSTATION_BOOTSTRAP_COMMIT="$2" | ||
fi | ||
# having these variables here really just makes the code a bit more DRY | ||
|
||
WS_ORIGIN='[email protected]:joelmccracken/workstation.git' | ||
WS_ORIGIN_PUB='https://github.com/joelmccracken/workstation.git' | ||
EMACS_CONFIG_DIR=~/.config/emacs | ||
# hereafter, we use many helper functions. Here they are defined up front, | ||
# as some of them are used throughout the other code. | ||
|
||
|
@@ -176,17 +186,17 @@ function clone_repo_and_checkout_at() { | |
# [[file:workstation.org::install_doom_emacs_no_nix_function][install_doom_emacs_no_nix_function]] | ||
function install_doom_emacs_no_nix() { | ||
{ | ||
cd $EMACS_CONFIG_DIR | ||
cd $WORKSTATION_EMACS_CONFIG_DIR | ||
[[ "$(git remote get-url origin)" == 'https://github.com/hlissner/doom-emacs' ]] | ||
} || { | ||
mv_dated_backup $EMACS_CONFIG_DIR | ||
time git clone --depth 1 https://github.com/doomemacs/doomemacs $EMACS_CONFIG_DIR/ | ||
mv_dated_backup $WORKSTATION_EMACS_CONFIG_DIR | ||
time git clone --depth 1 https://github.com/doomemacs/doomemacs $WORKSTATION_EMACS_CONFIG_DIR/ | ||
# alternative: use this if encounter problems | ||
# ~/.emacs.d/bin/doom -y install; | ||
# time timeout 45m bash -c 'yes | ~/.emacs.d/bin/doom install' || exit 0 | ||
# time bash -c 'yes | ~/.emacs.d/bin/doom install' || exit 0 | ||
time timeout 60m bash -c "yes | $EMACS_CONFIG_DIR/bin/doom install" || exit 0 | ||
$EMACS_CONFIG_DIR/bin/doom sync | ||
time timeout 60m bash -c "yes | $WORKSTATION_EMACS_CONFIG_DIR/bin/doom install" || exit 0 | ||
$WORKSTATION_EMACS_CONFIG_DIR/bin/doom sync | ||
echo FINISHED INSTALLING DOOM; | ||
} | ||
} | ||
|
@@ -273,9 +283,9 @@ is_linux && { | |
update_apt_install_git | ||
info finished updating apt, installing git | ||
} | ||
is_git_repo_cloned_at $WORKSTATION_DIR $WS_ORIGIN || { | ||
clone_repo_and_checkout_at $WORKSTATION_DIR $WS_ORIGIN_PUB \ | ||
$WORKSTATION_BOOTSTRAP_COMMIT $WS_ORIGIN | ||
is_git_repo_cloned_at $WORKSTATION_DIR $WORKSTATION_GIT_ORIGIN || { | ||
clone_repo_and_checkout_at $WORKSTATION_DIR $WORKSTATION_GIT_ORIGIN_PUB \ | ||
$WORKSTATION_BOOTSTRAP_COMMIT $WORKSTATION_GIT_ORIGIN | ||
} | ||
# at this point, this is hardly necessary; however, the gitignore file is handy | ||
# i may explore getting rid of this repo entirely and just having a fresh | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,15 @@ | |
export WORKSTATION_DIR="$HOME/workstation" | ||
export WORKSTATION_HOST_SETTINGS_SRC_DIR=$WORKSTATION_DIR/hosts/$WORKSTATION_NAME | ||
export WORKSTATION_HOST_CURRENT_SETTINGS_DIR=$WORKSTATION_DIR/hosts/current | ||
export WORKSTATION_EMACS_CONFIG_DIR=~/.config/emacs | ||
export WORKSTATION_GIT_ORIGIN='[email protected]:joelmccracken/workstation.git' | ||
export WORKSTATION_GIT_ORIGIN_PUB='https://github.com/joelmccracken/workstation.git' | ||
|
||
sourceIfExists () { | ||
if [ -f "$1" ]; then | ||
source "$1" | ||
fi | ||
} | ||
|
||
if [ -z "${WORKSTATION_NAME+x}" ] ; then | ||
if [ -f "$WORKSTATION_HOST_CURRENT_SETTINGS_DIR/settings.sh" ]; then | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,8 +108,8 @@ tangle: | |
Which requires a shell script: | ||
|
||
#+begin_src sh :shebang "#!/usr/bin/env bash" :tangle ./bin/tangle.sh | ||
EMACS_CONFIG_DIR=~/.config/emacs; | ||
$EMACS_CONFIG_DIR/bin/doomscript lib/emacs/tangle-file.el | ||
source ~/workstation/lib/shell/foundation.sh | ||
$WORKSTATION_EMACS_CONFIG_DIR/bin/doomscript lib/emacs/tangle-file.el | ||
#+end_src | ||
|
||
And a little emacs lisp that goes with the tangle process: | ||
|
@@ -211,15 +211,6 @@ else | |
export WORKSTATION_BOOTSTRAP_COMMIT="$2" | ||
fi | ||
#+end_src | ||
|
||
*** Setting some variables to keep things DRY | ||
#+begin_src shell | ||
# having these variables here really just makes the code a bit more DRY | ||
|
||
WS_ORIGIN='[email protected]:joelmccracken/workstation.git' | ||
WS_ORIGIN_PUB='https://github.com/joelmccracken/workstation.git' | ||
EMACS_CONFIG_DIR=~/.config/emacs | ||
#+end_src | ||
*** Helper and Component Functions | ||
#+begin_src shell :noweb yes | ||
# hereafter, we use many helper functions. Here they are defined up front, | ||
|
@@ -295,9 +286,9 @@ is_linux && { | |
#+end_src | ||
*** check out correct workstation commit | ||
#+begin_src shell :noweb yes | ||
is_git_repo_cloned_at $WORKSTATION_DIR $WS_ORIGIN || { | ||
clone_repo_and_checkout_at $WORKSTATION_DIR $WS_ORIGIN_PUB \ | ||
$WORKSTATION_BOOTSTRAP_COMMIT $WS_ORIGIN | ||
is_git_repo_cloned_at $WORKSTATION_DIR $WORKSTATION_GIT_ORIGIN || { | ||
clone_repo_and_checkout_at $WORKSTATION_DIR $WORKSTATION_GIT_ORIGIN_PUB \ | ||
$WORKSTATION_BOOTSTRAP_COMMIT $WORKSTATION_GIT_ORIGIN | ||
} | ||
#+end_src | ||
*** check out the dotfiles repository | ||
|
@@ -659,17 +650,17 @@ ensure_nix_installed | |
#+begin_src shell | ||
function install_doom_emacs_no_nix() { | ||
{ | ||
cd $EMACS_CONFIG_DIR | ||
cd $WORKSTATION_EMACS_CONFIG_DIR | ||
[[ "$(git remote get-url origin)" == 'https://github.com/hlissner/doom-emacs' ]] | ||
} || { | ||
mv_dated_backup $EMACS_CONFIG_DIR | ||
time git clone --depth 1 https://github.com/doomemacs/doomemacs $EMACS_CONFIG_DIR/ | ||
mv_dated_backup $WORKSTATION_EMACS_CONFIG_DIR | ||
time git clone --depth 1 https://github.com/doomemacs/doomemacs $WORKSTATION_EMACS_CONFIG_DIR/ | ||
# alternative: use this if encounter problems | ||
# ~/.emacs.d/bin/doom -y install; | ||
# time timeout 45m bash -c 'yes | ~/.emacs.d/bin/doom install' || exit 0 | ||
# time bash -c 'yes | ~/.emacs.d/bin/doom install' || exit 0 | ||
time timeout 60m bash -c "yes | $EMACS_CONFIG_DIR/bin/doom install" || exit 0 | ||
$EMACS_CONFIG_DIR/bin/doom sync | ||
time timeout 60m bash -c "yes | $WORKSTATION_EMACS_CONFIG_DIR/bin/doom install" || exit 0 | ||
$WORKSTATION_EMACS_CONFIG_DIR/bin/doom sync | ||
echo FINISHED INSTALLING DOOM; | ||
} | ||
} | ||
|
@@ -800,6 +791,21 @@ This is the kind of thing that sets up the "foundation" for everything else. | |
export WORKSTATION_DIR="$HOME/workstation" | ||
export WORKSTATION_HOST_SETTINGS_SRC_DIR=$WORKSTATION_DIR/hosts/$WORKSTATION_NAME | ||
export WORKSTATION_HOST_CURRENT_SETTINGS_DIR=$WORKSTATION_DIR/hosts/current | ||
export WORKSTATION_EMACS_CONFIG_DIR=~/.config/emacs | ||
export WORKSTATION_GIT_ORIGIN='[email protected]:joelmccracken/workstation.git' | ||
export WORKSTATION_GIT_ORIGIN_PUB='https://github.com/joelmccracken/workstation.git' | ||
|
||
sourceIfExists () { | ||
if [ -f "$1" ]; then | ||
source "$1" | ||
fi | ||
} | ||
|
||
if [ -z "${WORKSTATION_NAME+x}" ] ; then | ||
if [ -f "$WORKSTATION_HOST_CURRENT_SETTINGS_DIR/settings.sh" ]; then | ||
source "~/$WORKSTATION_HOST_CURRENT_SETTINGS_DIR/settings.sh" | ||
fi | ||
fi | ||
|
||
#+end_src | ||
** library of shell functions | ||
|
@@ -898,11 +904,11 @@ set +u | |
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh | ||
set -u | ||
|
||
EMACS_CONFIG_DIR=~/.config/emacs | ||
source ~/workstation/lib/shell/foundation.sh | ||
|
||
function find_emacs_init() { | ||
init_file=""; | ||
for x in "$EMACS_CONFIG_DIR/early-init.el" "$EMACS_CONFIG_DIR/init.el"; do | ||
for x in "$WORKSTATION_EMACS_CONFIG_DIR/early-init.el" "$WORKSTATION_EMACS_CONFIG_DIR/init.el"; do | ||
if [[ -f "$x" ]]; then | ||
init_file="$x" | ||
break; | ||
|