#!/usr/bin/env bash SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) pushd "$SCRIPT_DIR" || exit 1 rm -rf ~/.config/fish export NIX_CONFIG="extra-experimental-features = nix-command flakes pipe-operators pipe-operator extra-substituters = https://cache-v6.junco.dev?priority=41 extra-trusted-public-keys = cache-v6:tXeE+WhO6k2OoUoNSzmQVIckjXtl14mtO+z0ZwAIork=" case "$(uname)" in Darwin) set -e artifact=$(nix shell nixpkgs#git -c nix build .#darwin/$(hostname -s) --print-out-paths --extra-experimental-features "nix-command flakes pipe-operators pipe-operator") set +e sudo "${artifact}/sw/bin/darwin-rebuild" switch --flake ~/.dotfiles --option extra-experimental-features "nix-command flakes pipe-operators pipe-operator" chsh -s /run/current-system/sw/bin/fish ;; Linux) nix run .#hm -- switch ;; *) echo "nope, unsupported platform" ;; esac