feat(nix): nix and back again

I tried Nix, but it had too many downsides so I removed it.

1. Didn't like that all files are immutable and simple config changes
need a complete rebuild.
2. Setting up a new Mac didn't work as smoothly as promised. Not worth
the effort.
3. It sucked a lot to always have to type in the password twice on each
darwin-rebuild
4. It solves problems I never had.
This commit is contained in:
Stefan Imhoff
2024-08-05 20:55:54 +02:00
parent 2d3988b7e6
commit a41290c297
285 changed files with 6965 additions and 2517 deletions

View File

@@ -1,6 +1,4 @@
# Nix Dotfiles
This is my dotfile setup, using [Nix](https://nixos.org/), [nix-darwin](https://github.com/LnL7/nix-darwin), and [home-manager](https://github.com/nix-community/home-manager).
# Dotfiles
## Install Dependencies
@@ -16,67 +14,39 @@ xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
## Install Nix
Install Nix using the [Determinate Systems installer](https://github.com/DeterminateSystems/nix-installer):
## Install Initial Software
```sh
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
brew install stow
brew install --cask proton-pass
brew install --cask secretive
```
### Prepare Configuration for Installation
## Setup SSH
Log into the password manager, start and configure [Secretive](https://github.com/maxgoedjen/secretive) to setup SSH keys. Add the public key to GitHub and export the `SSH_AUTH_SOCK` (temporary) to be able to clone with SSH:
```sh
sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.before-nix-darwin
export SSH_AUTH_SOCK="$HOME/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh"
```
## Install the Nix Flake
> [!IMPORTANT]
> Make sure your Terminal has full disk access in the Security & Privacy settings.
### First-time Installation
#### Install from GitHub
To install and use this configuration directly from GitHub without cloning:
## Setup Hostname
```sh
nix --extra-experimental-features nix-command --extra-experimental-features flakes run nix-darwin -- switch --flake github:kogakure/dotfiles
sudo scutil --set HostName <hostname>
```
#### Clone and Install
Clone the repository:
## Clone Dotfiles
```sh
git clone git@github.com:kogakure/dotfiles.git ~/.dotfiles
```
For the initial setup, run:
## Install Script
Log in with your Apple ID to be able to install app store apps. Run the install script to setup the computer:
```sh
nix --extra-experimental-features nix-command --extra-experimental-features flakes run nix-darwin -- switch --flake ~/.dotfiles
cd ~/.dotfiles
./install.sh
```
This command installs nix-darwin and applies your configuration.
### Selecting a Specific Configuration
By default the `$hostname` that matches the current machine is used, but it is possible to manually load one by running:
```sh
nix --extra-experimental-features nix-command --extra-experimental-features flakes run nix-darwin -- switch --flake ~/.dotfiles#mac-mini
```
## Updating Configuration
After making changes to your configuration, apply them with:
```sh
darwin-rebuild switch --flake ~/.dotfiles
```
## Inspiration
My setup is inspired by [davishs Nix Setup](https://github.com/davish/setup) and by a lot of talking to [Claude 3.5](https://claude.ai/). 😅