Skip to content

My Awesome Dotfiles

License

Notifications You must be signed in to change notification settings

maxbrunet/dotfiles

Repository files navigation

My Awesome Dotfiles

My dotfiles collection for a flawless workflow. Starring zsh, nvim, tmux, and NixOS.

Screenshot

Bootstrapping NixOS

Warning

All data will be erased to install NixOS! These instructions are not indented for any users but myself (@maxbrunet), read scripts carefully!

  1. Download and boot the NixOS installer

  2. If using WiFi, connect to it:

    wpa_passphrase <ESSID> | sudo tee /etc/wpa_supplicant.conf
    sudo wpa_supplicant -B -i wlp3s0 -c /etc/wpa_supplicant.conf
  3. Run bootstrap script:

    sudo -i
    nix-env -iA nixos.git
    git clone https://github.com/maxbrunet/dotfiles.git
    cd dotfiles
    ./scripts/bootstrap.sh <HOSTNAME>
    reboot
  4. Generate SSH key:

    /etc/nixos/scripts/generate-ssh-key.sh
  5. Install Rust toolchain:

    rustup toolchain install stable --component rust-analyzer

Note

If running in VirtualBox, ensure:

  • EFI is enabled
  • 3D acceleration is enabled
  • Solid-state Drive is checked for the virtual disk

Bootstrapping macOS

At least it is not Windows.

  1. Install Homebrew

  2. Install Nix

  3. Install the dotfiles:

    mkdir -p ~/.config
    git clone https://github.com/maxbrunet/dotfiles.git ~/.config/darwin
    cd ~/.config/darwin
    git remote set-url origin git@github.com:maxbrunet/dotfiles.git
  4. Prepare system for nix-darwin:

    sudo mv /etc/bashrc /etc/bashrc.orig
    sudo mv /etc/shells /etc/shells.orig
    sudo mv /etc/zshrc /etc/zshrc.orig
    sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.orig
    printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf
    /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t
  5. Install nix-darwin:

    nix --extra-experimental-features 'flakes nix-command' build ".#darwinConfigurations.$(scutil --get LocalHostName).system"
    ./result/sw/bin/darwin-rebuild switch --flake .
  6. Change login shell to Nix's Zsh:

    chsh -s /run/current-system/sw/bin/zsh maxime
  7. Fix tmux-256color:

    /run/current-system/sw/bin/infocmp -x tmux-256color >tmux-256color.src
    /usr/bin/tic -o ~/.terminfo -x tmux-256color.src
    rm -f tmux-256color.src
  8. Configure SSH client:

    ssh-keygen -t ed25519 -a 100
    cat >>~/.ssh/config <<EOF
    Host *
      SetEnv LC_ALL=C
      UseKeychain yes
    EOF
  9. Set up Podman machine:

    sudo podman-mac-helper install
    podman machine init --cpus=4 --memory=4096 --now
    
    # https://github.com/k3d-io/k3d/issues/1082
    podman machine ssh bash -e <<EOF
    echo 'Delegate=cpuset' | sudo tee -a /etc/systemd/system/user@.service.d/delegate.conf
    sudo systemctl daemon-reload
    sudo systemctl restart user@\${UID}
    EOF
    
    cat >>~/.ssh/config <<EOF
    Host localhost
    	IdentityFile $(podman machine inspect --format='{{.SSHConfig.IdentityPath}}')
    EOF