diff --git a/bootstrap-workstation.sh b/bootstrap-workstation.sh index 2d9c14c6..f5baeb64 100755 --- a/bootstrap-workstation.sh +++ b/bootstrap-workstation.sh @@ -261,6 +261,18 @@ function nix_darwin_rebuild_flake() { } # nix_darwin_rebuild_flake_function ends here +# [[file:workstation.org::install_nix_darwin_function][install_nix_darwin_function]] + +function install_nix_darwin() { + cd $WORKSTATION_DIR + nix-build https://github.com/LnL7/nix-darwin/archive/${WORKSTATION_NIX_DARWIN_VERSION}.tar.gz -A installer + ./result/bin/darwin-installer + + nix_darwin_rebuild_flake +} + +# install_nix_darwin_function ends here + info starting workstation bootstrap is_mac && { info ensuring xcode is installed @@ -343,12 +355,7 @@ is_linux && { is_mac && { info installing darwin-nix - cd $WORKSTATION_DIR - nix-build https://github.com/LnL7/nix-darwin/archive/${WORKSTATION_NIX_DARWIN_VERSION}.tar.gz -A installer - ./result/bin/darwin-installer - - nix_darwin_rebuild_flake - + install_nix_darwin info finished installing darwin-nix } diff --git a/lib/shell/setup/install_doom_emacs_no_nix.sh b/lib/shell/setup/install_doom_emacs_no_nix.sh new file mode 100755 index 00000000..4f26f1cd --- /dev/null +++ b/lib/shell/setup/install_doom_emacs_no_nix.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# [[file:../../../workstation.org::*Install doom emacs without nix][Install doom emacs without nix:2]] +source ~/workstation/lib/shell/foundation.sh + +function install_doom_emacs_no_nix() { + { + cd $WORKSTATION_EMACS_CONFIG_DIR + [[ "$(git remote get-url origin)" == 'https://github.com/hlissner/doom-emacs' ]] + } || { + 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 | $WORKSTATION_EMACS_CONFIG_DIR/bin/doom install" || exit 0 + $WORKSTATION_EMACS_CONFIG_DIR/bin/doom sync + echo FINISHED INSTALLING DOOM; + } +} +install_doom_emacs_no_nix +# Install doom emacs without nix:2 ends here diff --git a/lib/shell/setup/install_nix_darwin.sh b/lib/shell/setup/install_nix_darwin.sh new file mode 100755 index 00000000..cd1491c9 --- /dev/null +++ b/lib/shell/setup/install_nix_darwin.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# [[file:../../../workstation.org::*Install nix-darwin][Install nix-darwin:2]] +source ~/workstation/lib/shell/foundation.sh +source ~/workstation/lib/shell/setup/workstation_setup_verions.sh + +function nix_darwin_rebuild_flake() { + nix build --extra-experimental-features "nix-command flakes" \ + ~/workstation\#darwinConfigurations.${WORKSTATION_NAME}.system + ./result/sw/bin/darwin-rebuild switch --flake ~/workstation#${WORKSTATION_NAME} + + rm -rf ./result +} + +function install_nix_darwin() { + cd $WORKSTATION_DIR + nix-build https://github.com/LnL7/nix-darwin/archive/${WORKSTATION_NIX_DARWIN_VERSION}.tar.gz -A installer + ./result/bin/darwin-installer + + nix_darwin_rebuild_flake +} + +install_nix_darwin +# Install nix-darwin:2 ends here diff --git a/workstation.org b/workstation.org index 8b165186..a626a125 100644 --- a/workstation.org +++ b/workstation.org @@ -252,6 +252,8 @@ fi «nix_darwin_rebuild_flake_function» +«install_nix_darwin_function» + #+end_src *** Log that bootstrap is starting #+begin_src shell @@ -362,12 +364,7 @@ is_linux && { is_mac && { info installing darwin-nix - cd $WORKSTATION_DIR - nix-build https://github.com/LnL7/nix-darwin/archive/${WORKSTATION_NIX_DARWIN_VERSION}.tar.gz -A installer - ./result/bin/darwin-installer - - nix_darwin_rebuild_flake - + install_nix_darwin info finished installing darwin-nix } @@ -664,6 +661,38 @@ function install_doom_emacs_no_nix() { echo FINISHED INSTALLING DOOM; } } +#+end_src + +#+begin_src sh :tangle ./lib/shell/setup/install_doom_emacs_no_nix.sh :shebang "#!/usr/bin/env bash" :noweb yes +source ~/workstation/lib/shell/foundation.sh + +«install_doom_emacs_no_nix_function» +install_doom_emacs_no_nix +#+end_src + +*** Install nix-darwin +#+name: install_nix_darwin_function +#+begin_src shell + +function install_nix_darwin() { + cd $WORKSTATION_DIR + nix-build https://github.com/LnL7/nix-darwin/archive/${WORKSTATION_NIX_DARWIN_VERSION}.tar.gz -A installer + ./result/bin/darwin-installer + + nix_darwin_rebuild_flake +} + +#+end_src + +#+begin_src sh :tangle ./lib/shell/setup/install_nix_darwin.sh :shebang "#!/usr/bin/env bash" :noweb yes + +source ~/workstation/lib/shell/foundation.sh +source ~/workstation/lib/shell/setup/workstation_setup_verions.sh + +«nix_darwin_rebuild_flake_function» +«install_nix_darwin_function» +install_nix_darwin + #+end_src * Nix components ** Home Manager