nixos configs
1#!/bin/bash
2set -eux -o pipefail
3
4# bash <(curl https://raw.githubusercontent.com/iff/dotfiles/master/sh)
5
6install_nix() {
7 curl -L https://nixos.org/nix/install | sh
8 mkdir -p $HOME/.config/nix/
9 echo "extra-experimental-features = nix-command flakes" >> $HOME/.config/nix/nix.conf
10}
11
12which nix || install_nix
13
14mkdir -p $HOME/.ssh
15hostname=$(hostname)
16[ ! -f $HOME/.ssh/${hostname} ] && ssh-keygen -t ed25519 -C "iff@yvesineichen.com" -f $HOME/.ssh/${hostname} -N ''
17echo "IdentityFile $HOME/.ssh/${hostname}" >> $HOME/.ssh/config
18
19# TODO does this persist to non-nix shell?
20# https://cli.github.com/manual/gh_auth_login
21# https://cli.github.com/manual/gh_repo_clone
22nix-shell -p gh --command gh auth login --hostname GitHub.com
23git clone git@github.com:iff/dotfiles.git $HOME/.dotfiles
24cd $HOME/.dotfiles && nix run . switch -- --flake .#${hostname}