Skip to content

setup nix with determinate systems installer #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
plastikfan opened this issue Feb 19, 2025 · 3 comments
Open

setup nix with determinate systems installer #1

plastikfan opened this issue Feb 19, 2025 · 3 comments
Assignees
Labels
chore Non source related, infrasture change

Comments

@plastikfan
Copy link
Contributor

plastikfan commented Feb 19, 2025

Set up Nix on macOS using flakes, nix-darwin and home-manager

@plastikfan plastikfan added the chore Non source related, infrasture change label Feb 19, 2025
@plastikfan plastikfan self-assigned this Feb 19, 2025
@plastikfan plastikfan changed the title setup nix setup nix with determinate systems installer Feb 19, 2025
@plastikfan
Copy link
Contributor Author

Ok starting again on a new host, yemaya. Install with:

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

plastikfan@yemaya ~ % curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
info: downloading installer https://install.determinate.systems/nix/tag/v0.36.2/nix-installer-aarch64-darwin
 INFO nix-installer v0.36.2
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Password:
 INFO nix-installer v0.36.2
 INFO For a more robust Nix installation, use the Determinate package for macOS: https://dtr.mn/determinate-nix

Cut the fuss with Determinate Nix?

Proceed? ([Y]es/[n]o/[e]xplain): e

Cut the fuss with Determinate Nix?
Determinate Nix is Determinate Systems' validated and secure downstream Nix distribution for enterprises. It comes bundled with Determinate Nixd, a helpful daemon that automates some otherwise-unpleasant aspects of using Nix, such as garbage collection, and enables you to easily authenticate with FlakeHub.

For more details: https://dtr.mn/determinate-nix

Proceed? ([Y]es/[n]o): y
Nix install plan (v0.36.2)
Planner: macos

Configured settings:
* determinate_nix: true

Planned actions:
* Install Determinate Nixd
* Create an encrypted APFS volume `Nix Store` for Nix on `disk3` and add it to `/etc/fstab` mounting on `/nix`
* Extract the bundled Nix (originally from /nix/store/lwn6ivba8zjf7k63v48vpj9s0dvnrvzj-nix-binary-tarball-2.26.1/nix-2.26.1-aarch64-darwin.tar.xz)
* Create a directory tree in `/nix`
* Synchronize /nix/var ownership
* Move the downloaded Nix into `/nix`
* Synchronize /nix/store ownership
* Create build users (UID 351-382) and group (GID 350)
* Configure Time Machine exclusions
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configuring zsh to support using Nix in non-interactive shells
* Create a `launchctl` plist to put Nix into your PATH
* Configure the Determinate Nix daemon
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): y
 INFO Step: Install Determinate Nixd
 INFO Step: Create an encrypted APFS volume `Nix Store` for Nix on `disk3` and add it to `/etc/fstab` mounting on `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 351-382) and group (GID 350)
 INFO Step: Configure Time Machine exclusions
 INFO Step: Configure Nix
 INFO Step: Configuring zsh to support using Nix in non-interactive shells
 INFO Step: Create a `launchctl` plist to put Nix into your PATH
 INFO Step: Configure the Determinate Nix daemon
 INFO Step: Remove directory `/nix/temp-install-dir`
Nix was installed successfully!
To get started using Nix, open a new shell or run `. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh`

plastikfan@yemaya ~ % 

@plastikfan
Copy link
Contributor Author

After having installed nix, the nix command is still not available, so something is missing.

I found this zero to nix for additional reference material;.

It turns out that my .zshrc file had overridden the PATH variable:

export PATH=/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin

... which contained no reference to nix. Removing this entirely resoved the isse, so nix is being added by some other means.

@plastikfan
Copy link
Contributor Author

plastikfan commented Feb 26, 2025

I also just discovered that brew is not available but it is installed (/opt/homebrew/bin still exists), so we need to re-apply the profile changes that are required as part of the homebrew installation process (also see: Zsh: command not found: brew. This is a very good resource, it explains very well the use of the PATH variable and where it should be defined; stuff that I thought I knew, but was a bit hazy on. ⚠️ Remember this resource.

Actually, it turns out that on an Apple Silicon mac, there are slightly different requirements....

I added

export PATH=/opt/homebrew/bin:$PATH

to ~/.zprofile

... and this worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Non source related, infrasture change
Projects
None yet
Development

No branches or pull requests

1 participant