Skip to content

Latest commit

 

History

History
138 lines (99 loc) · 5.16 KB

README.md

File metadata and controls

138 lines (99 loc) · 5.16 KB

dotnix

Using nix to provisioning devices on Mac OSX (M-series chip). Inspect apps.json for the default set of apps / packages will be installed.

System packages also installed.

Following are extra that will be added on to current-user scope:

As mentioned, fish and zsh shells are available (asides from system provided shells).

🏗️ Install Requirements

  1. Install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install nix (as multi-user) nix-installer
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
  1. Clone this repo to ~/.setup

Notes:

  • If /etc/nix/nix.conf already existed, move it to ~/.config/nix/nix.conf

  • If /etc/shells or similar files already existed, back up and remove

  • If running into error ...ln: failed to create symbolic link '/run': Read-only file system

    sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t
  • if running to warning warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring

    sudo cp -R /nix/var/nix/profiles/per-user/<username>/channels /nix/var/nix/profiles/per-user/root/

🗂️ Setup configurations

  • Setup a public/private repo github:<username>/dotnix-config (see Example).

  • Clone to current setup as config. Checkout to the branch pertinent to the host.

  • On WSL, ensure ~/.config/nix/nix.conf is available with content

    # nix/nix.conf
    experimental-features = nix-command flakes
    
  • Commit

🏃 Run the specific script

Mac OS

nix build .#darwinConfigurations.<hostname>.system
./result/sw/bin/darwin-rebuild switch --flake .#<hostname>

Note: After initial setup, darwin-rebuild should be in PATH

darwin-rebuild switch --flake .

WSL

nix build ".#homeConfigurations.<hostname>.activationPackage" # product a result folder
./result/activate

🤡 Caveats

  • Only brews / casks that specified in ./config/apps.json will be installed. Non specified will be removed

  • Mas refers to Mac App Store apps will be installed as extra. Existing Mas id can located via mas-cli

  • Trusted uses will be current user plus all specified in system.json. Default: [<username>]

  • Allowed users will be current user plus all specified in config. Default: [*]

  • By default, git will required GPG setup to sign commits. include and includeIf are available for multiple git profiles. See git.example for details. Remove if not required.

  • On MacOSX, reset current-user shell to

      # fish
      chsh -s /run/current-system/sw/bin/fish
    
      # zsh
      chsh -s /run/current-system/sw/bin/fish
  • On WSL, it's expected to install 1P-cli in WSL under path /usr/bin/