This repo encapsulates a range of Nix goodies that I use to declutter and bring order to my entire laptop environment, including:
- My nix-darwin and Home Manager configuration
- Shell aliases and helper scripts
You must change the following:
- Change the username and hostname to your specs in
flake.nix
and./home-manager/*.nix
. Username would be your name you have assigned to your local computer and hostname is already done but to understand what is being pulled, run the following command:hostname -s
orscutil --get LocalHostName
.
Note
For your first install, this will take around 10-15 minutes to setup so grab a drink and some popcorn as it runs it's process. To make life easier, I created a Makefile to install the pre-requisites necessary for your local workstation:
git clone https://github.com/romelBen/melo-nix-setup.git melo-nix-setup
cd melo-nix-setup
make
With Nix installed and flakes enabled, this is all that I need to run to stand up a new machine according to my exact specifications, including configuration for Vim, zsh, Visual Studio Code, Git, and more. With this approach, this will eliminate [Homebrew] in use from my machine.
You will receive an error when running the command make
:
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command'; to override
This is something I am fixing currently so this will soon be removed. To fix this issue, all that is needed to run is the following command:
echo "experimental-features = nix-command flakes" | sudo tee /etc/nix/nix.conf
Once ran, rerun make
and you should be good as new.
For testing purposes in Mac, it will be best to use UTM and setup an environment similar to your own for macOS:
- Install UTM
- Download macOS IPSW recovery file
- Create a macOS VM in UTM using the downloaded IPSW file
- Run
xcode-select --install
in the new VM - (Optional) Clone the VM to a new one for easy rollback (UTM doesn't support snapshot yet)
- Run the above commands of your choice: nix build or nix develop.
Great inspiration on utilizing Nix setup is from Luc Perkins in his blog and repository which was a great help: