Skip to content

Nix flake that manages my NixOS, Nix Darwin, and Nix Home Manager files.

Notifications You must be signed in to change notification settings

0xpetersatoshi/nix-config

Repository files navigation

Nix Config for 0xpetersatoshi

Nix Flakes Ready Built With Snowfall

My NixOS, Darwin, and Nix Home Manager Config.

Getting Started

Install nix (preferably) using the Determinate Systems Installer.

If running on MacOS, you'll need nix-darwin which won't initially be installed. Instructions for that are included in the next section.

Installation Methods

Using nixos-anywhere

NOTE: The architecture of the target machine must match the architecture of the local machine for this option.

  1. Use netboot or the nix usb installer to initiate the installer on the target machine
  2. Run passwd to create new password for the installer user
  3. Copy public ssh keys to the installer user
mkdir -p ~/.ssh
curl https://github.com/0xpetersatoshi.keys >> ~/.ssh/authorized_keys
  1. Note the IP address of the target machine using ip addr
  2. Test connection from local machine:
ssh -i ~/.ssh/vms.pub -v nixos@<ip>
  1. Run:
nix run github:nix-community/nixos-anywhere -- --flake '.#nixbox' -i ~/.ssh/vms.pub --target-host nixos@10.19.90.224

Using Nix on the Target Machine Directly

# New machine without git
nix-shell -p git

# Clone
git clone https://github.com/0xpetersatoshi/nix-config.git
cd nix-config

# Linux
sudo nixos-rebuild switch --flake .#<hostname>

 # MacOS
# On the first run, you'll need to install nix-darwin
nix run nix-darwin -- switch --flake .

# On subsequent runs, just run
darwin-rebuild switch --flake .

Configuring Disk Partitioning using Disko

You can optionally use disko to configure the disk partitioning by running:

sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount ./path/to/disko.nix

Then, to verify successful configuration, you can run the following commands:

mount | grep /mnt
sudo fdisk -l /dev/sda

Updating

# This only updates the `flake.lock` file but does not apply the changes
nix flake update

# Run nixos-rebuild or darwin-rebuild to apply the changes
darwin-rebuild switch --flake .

Resources

I drew heavy inspiration from the following repos:

About

Nix flake that manages my NixOS, Nix Darwin, and Nix Home Manager files.

Resources

Stars

Watchers

Forks

Releases

No releases published