Skip to content
This repository has been archived by the owner on Nov 16, 2024. It is now read-only.

General purpose Nix configuration for macOS / NixOS

Notifications You must be signed in to change notification settings

b4lisong/nix-config-old

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

archiving this config and forking https://github.com/ryan4yin/nix-config instead

Note

This fork isn't really meant for public consumption (yet).

Check out the original from dustinlyons instead.

TODO:

  • Homebrew taps, can we define in just one place instead of two?
  • Clean up and remove parts from original fork we aren't using
  • enable x86-64 Nix packages

1. Install dependencies

xcode-select --install

2. Install Nix

Installer from Determinate Systems

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

After installation, open a new terminal session to make the nix executable available in your $PATH.

3. Initialize ~/.config/nix-config

mkdir -p ~/.config && cd ~/.config
git clone https://github.com/b4lisong/nix-config.git

4. Make apps executable

find apps/$(uname -m | sed 's/arm64/aarch64/')-darwin -type f \( -name apply -o -name build -o -name build-switch -o -name create-keys -o -name copy-keys -o -name check-keys \) -exec chmod +x {} \;

5. Setup secrets

Install keys

Before generating your first build, these keys must exist in your ~/.ssh directory.

Key Name Platform Description
id_ed25519 macOS / NixOS Download secrets from Github. Used only during bootstrap.
id_ed25519_agenix macOS / NixOS Copied over, used to encrypt and decrypt secrets.
Check keys
nix run .#check-keys

6. Install configuration

Ensure the build works before deploying the configuration, run:

nix run .#build

Note

If you're using a git repository, only files in the working tree will be copied to the Nix Store.

You must run git add . first.

Warning

You may encounter error: Unexpected files in /etc, aborting activation if nix-darwin detects it will overwrite an existing /etc/ file. The error will list the files like this:

The following files have unrecognized content and would be overwritten:

  /etc/nix/nix.conf
  /etc/bashrc

Please check there is nothing critical in these files, rename them by adding .before-nix-darwin to the end, and then try again.

Backup and move the files out of the way and/or edit your Nix configuration before continuing.

7. Make changes

Finally, alter your system with this command:

nix run .#build-switch

Note

If you needed to rename /etc/nix/nix.conf to /etc/nix/nix.conf.before-nix-darwin, the first build command needs to be:

nix --extra-experimental-features 'nix-command flakes' run .#build-switch

About

General purpose Nix configuration for macOS / NixOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nix 61.3%
  • Shell 38.7%