Skip to content
/ system Public

my `nix`, `nixpkgs`, `nix-darwin`, and `home-manager`-based reproducible system configuration for macOS

License

Notifications You must be signed in to change notification settings

4cm4k1/system

Repository files navigation

system

my nix, nixpkgs, nix-darwin, and home-manager-based reproducible system configuration for macOS

The idea here is to migrate as much as possible of my dotfiles (e.g., .zshrc), package managers (e.g., brew), and macOS system configuration to a setup that can be easily, predictably, idempotently, and recoverably declared using nix, nixpkgs, nix-darwin, and home-manager. Currently, my effort in that regard exists as 4cm4k1/dotfiles. This will better organize all of these things and take advantage of the /nix/store, enable speedy system bootstrapping, rollbacks, and recovery, and lay a foundation for defining my own Nix expressions when developing.

inspired in large part by prior art such as kclejeune/system

Table of Contents

Installation

Prereqs: macOS

With no other prereqs, run the following bash snippet to pull down this repo to wherever you would like to keep your local Git repos (e.g., cd ~/Code, then this repo will exist at ~/Code/system with a symbolic link to it at ~/.nixpkgs):

#! /usr/bin/env bash

# `curl` this repo's tarball
#    - `s`: in silent mode
#    - `S`: show errors
#    - `L`: follow redirects
#    - `|`: pipe `stdout`
curl -sSL https://github.com/4cm4k1/system/archive/main.tar.gz |
  # use `tar`
  #    - `s`: apply substitution pattern
  #    - `x`: in extract mode
  #    - `/^system-main/system/`: pattern
  #    - `-`: from `stdin`
  tar sx /^system-main/system/ - &&
  # `cd` into `system`
  cd system &&
  # `use `ln`
  #    - `f`: overwrite destination
  #    - `s`: make symbolic link
  #    - `$(pwd -P)`: target, current working directory, `P`: ignoring symlinks
  #    - `~/.nixpkgs`: destination
  ln -fs "$(pwd -P)" ~/.nixpkgs

Then, install nix, nix-darwin, and home-manager:

#! /usr/bin/env bash

if [[ $(uname -s) == 'Darwin' ]]; then
  # `nix`
  sh <(curl -L https://nixos.org/nix/install) --daemon --darwin-use-unencrypted-nix-store-volume
  # `nix-darwin`
  nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
  ./result/bin/darwin-installer
  # add channels
  nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz home-manager
  nix-channel --add https://nixos.org/channels/nixpkgs-20.09-darwin nixpkgs-20.09-darwin
  nix-channel --update
  # `home-manager`
  nix-shell '<home-manager>' -A install
else
  echo 'This is intended for macOS!'
fi

Development

# install `volta`
curl https://get.volta.sh | bash

# install `node` and `npm`
volta install node@15 npm@7

Usage

# tbd

Contributors

Name Website
Anthony Maki https://anthony.app

About

my `nix`, `nixpkgs`, `nix-darwin`, and `home-manager`-based reproducible system configuration for macOS

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published