jjyr / mynix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nix Darwin Kickstarter - Minimal

A basic configuration comprising essential settings for initiating nix-darwin. It can be safely deployed to your system.

How to Start

  1. Install Nix package manager via Nix Official.
  2. Read all the files in this minimal folder, and understand what they do.
    1. If you have trouble understanding, ryan4yin/nixos-and-flakes-book is a good resource to learn nix and flakes.
  3. Install Homebrew, see https://brew.sh/
    1. Homebrew is required to install most of the GUI apps, App Store's apps, and some CLI apps that are not available in nix's package repository nixpkgs.
  4. Search TODO in this minimal folder, and complete all the TODOs.
  5. Run the following command in the root of your nix configuration to start your nix-darwin journey(please change hostname to your hostname):
     nix build .#darwinConfigurations.hostname.system \
     	--extra-experimental-features 'nix-command flakes'
    
     ./result/sw/bin/darwin-rebuild switch --flake .#hostname

To simplify the command, adding the following content by create a Makefile in the root of your nix configuration:

# please change 'hostname' to your hostname
deploy:
	nix build .#darwinConfigurations.hostname.system \
	   --extra-experimental-features 'nix-command flakes'

	./result/sw/bin/darwin-rebuild switch --flake .#hostname

Then you can run make deploy in the root of your nix configuration to deploy your configuration.

Configuration Structure

Your current nix-darwin configuration's structure should be as follows:

› tree
.
├── flake.lock  # a lock file generated by nix, you can ignore it for now
├── flake.nix   # the entry point of your nix configuration, you need to add your hostname here
├── modules     # a folder contains all your nix-darwin configuration files
│   ├── apps.nix        # contains all your homebrew & nix apps(both GUI & CLI)
│   ├── host-users.nix  # defines your hostname & all your system users
│   ├── nix-core.nix    # nix's core configuration, you can ignore it for now
│   └── system.nix      # defines your macOS's system configuration(like dock, trackpad, keyboard, finder, loginwindow, etc.)
└── README.md

Notes on Network Proxy

If you are in a network environment that requires proxy(such as China), you may need to set up proxy for nix and homebrew.

Please refer to the rich-demo folder for more details:

About


Languages

Language:Nix 88.0%Language:Python 10.5%Language:Shell 1.5%