• Operand
  • # (b)ring mi - belles.

gram:build

> ./proceed.sh

Lenses
(coming soon!)


if [ `whoami` = "root" ]; then exit 1; fi

# proceed_branch=main
# clone_build; ( cd ~/.build; git fetch --prune; git checkout $proceed_branch --; git pull --ff-only;)
# clone_build() { [ -d ~/.build ] || git clone https://base.bingo/code/build ~/.build; }
# # replace using `wget -r ...` command.

link_nodes() {
  if [ ! -e ~/bin ]; then ln -s ~/.bin ~/bin;
  else if [ ! -s ~/bin ]; then (
    echo '~/bin already in place; please consider running:'
    for node in $HOME/bin/*; do echo "  mv $node $HOME/.bin"; done
    echo "  rmdir $HOME/bin"; echo "  ln -s $HOME/.bin $HOME/bin"; echo;);
  fi; fi;

  for node in zshrc sh.d bin config; do
    place="$HOME/.$node"; if [ -d ~/.build/$node ]; then
    [ -e $place ] || mkdir $place;
    for n in ~/.build/$node/*; do name=`basename $n`
      [ -e "$place/$name" ] && echo "already in place: $place/$name" ||
        (echo "linking: $place/$name" && ln -s "$n" "$place/$name"); done
    else [ -e $place ] || ln -s $HOME/.build/$node $place;
      fi; done;
    }

prepare_apple() { if [ "$(uname)" == "Darwin" ]; then ./prepare.apple.sh
  [ -e ~/.phoenix.js ] || ln -s ~/.build/phoenix.js ~/.phoenix.js; fi; }

make_keys() {
  if [ ! -d ~/.ssh ]; then mkdir -p ~/.ssh; ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N ""; fi
  for key in $@; do curl "$key" >> ~/.ssh/authorized_keys; done; }

link_nodes
prepare_apple
# make_keys $@

rm -rf ~/.config/nushell;
ln -s ~/.build/config/nushell ~/.config/nushell

mkdir -p ~/.config/xplr/plugins
[ ! -d ~/.config/xplr/plugins/map ] && git clone https://github.com/sayanarijit/map.xplr ~/.config/xplr/plugins/map

if [ $@ = "-slo" ]; then
  echo 'you chose `-slo` mode, so pausing here.'
else
  echo 'no `-slo`, proceeding deeper.'

  sudo echo "super user permissions enabled; proceeding."
  sudo nix-env -iA nixos.git

  echo "Pull nix channels..."
  sudo nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
  sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixos
  sudo nix-channel --add https://github.com/nixos/nixos-hardware/archive/master.tar.gz nixos-hardware
  sudo nix-channel --update

  echo "Linking $BUILD"
  BUILD=$HOME/.build
  [ -e $BUILD/nixos/mach/base.nix ] || sudo cp /etc/nixos/configuration.nix $BUILD/nixos/mach/base.nix
  [ -e $BUILD/.build/nixos/mach/hardware-configuration.nix ] || sudo cp /etc/nixos/hardware-configuration.nix $BUILD/nixos/mach/
  sudo chown $(whoami) $BUILD/nixos/mach/{base,hardware-configuration}.nix

  [ -e $BUILD/nixos/mach/base.nix ] &&\
    [ -e $BUILD/nixos/mach/hardware-configuration.nix ] &&\
    sudo rm -rf /etc/nixos && sudo ln -s $BUILD/nixos /etc/nixos
      sudo nixos-rebuild switch
fi