Skip to content

ramytanios/nix-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

350 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My personal Nix configuration flake.

Nix configuration flake for my personal machines (macOS and NixOS).

💡Inspired by buntec's setup

Fresh NixOS install

After installing NixOS from a USB drive, follow these steps:

  1. Clone this repo and cd into it.

  2. Copy /etc/nixos/hardware-configuration.nix into ./system (OK to overwrite existing dummy file).

  3. Finally, to build and activate in one step using the apps provided by the flake

nix run .#rebuild-nixos # system configuration
nix run .#hm-switch-nixos # dotfiles and home configuration

Fresh macOS install

(Heavily inspired by this gist)

To bootstrap a fresh macOS install, follow these steps:

  1. Install Homebrew (only needed for managing GUI apps via casks)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install Nix:
curl -L https://nixos.org/nix/install | sh
  1. Enable flakes
mkdir -p ~/.config/nix
cat <<EOF > ~/.config/nix/nix.conf
experimental-features = nix-command flakes
EOF
  1. To work around this issue
sudo mv /etc/nix/nix.conf /etc/nix/.nix-darwin.bkp.nix.conf
  1. Clone this repo, cd into it, then build and activate with the following commands:
nix run .#rebuild-macbook-air-m2 # system configuration
nix run .#hm-switch-macbook-air-m2 # dotfiles and home configuration

Fresh WSL install

  1. Install WSL from PowerShell:
wsl --install
  1. Set the hostname to wsl by editing /etc/wsl.conf inside the WSL distro:
[network]
hostname=wsl
generateHosts=false

After editing /etc/wsl.conf, run wsl --shutdown from PowerShell and restart WSL for the changes to take effect.

  1. Install Nix:
curl -L https://nixos.org/nix/install | sh
  1. Enable flakes:
mkdir -p ~/.config/nix
cat <<EOF > ~/.config/nix/nix.conf
experimental-features = nix-command flakes
EOF
  1. Clone this repo and apply the configuration:
nix run .#hm-switch-wsl

Fresh Windows install (via Multipass)

  1. Clone this repo, then launch a VM (cloud-init installs Nix automatically):
multipass launch -n nix -c 2 -m 8G -d 64G --cloud-init extras\multipass-cloud-init-x86.yml
  1. Wait for cloud-init to finish, shell in, and switch to the xxx user:
multipass exec nix -- sudo su - xxx
  1. Clone this repo inside the VM and apply the configuration:
nix run .#hm-multipass-guest-x86

Migrating an existing macOS install to Nix

  1. Uninstall Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
  1. Delete everything under ~/.config and any other "dot files" in your home directory.

  2. Delete all applications that are listed as Homebrew casks in ./system/configuration-darwin.nix

  3. Follow the steps for a fresh macOS install.

About

My personal Nix configuration files ⚙️❄️

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors