Skip to content
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

Add known hash for determinate-nixd 0.3.0 #1296

Closed

Conversation

onnimonni
Copy link

Hey,

I bumped into the same issue as in #1044 but for the determinate-nixd instead of the DetSys installer.

How to repeat:

  1. Install Determinate nixd from: https://docs.determinate.systems/getting-started/
  2. Try to install a nix-darwin from a flake:
$ nix run --extra-experimental-features "nix-command flakes" nix-darwin -- switch --flake .
building the system configuration...
warning: 'https://cache.flakehub.com' does not appear to be a binary cache
error: Unexpected files in /etc, aborting activation
The following files have unrecognized content and would be overwritten:

  /etc/nix/nix.conf

Please check there is nothing critical in these files, rename them by adding .before-nix-darwin to the end, and then try again.
  1. Fork this repository and clone it locally:
$ git clone https://github.com/LnL7/nix-darwin/
$ cd nix-darwin
  1. Copy the /etc/nix/nix.conf from the determinate-nixd:
cp /etc/nix/nix.conf ./doc/known-files/$(sha256sum /etc/nix/nix.conf | cut -d " " -f1)
  1. Add the known sha256 hash into modules/nix/default.nix
  2. Commit and Create the pr:
$ git add . && git commit -am "Add known hash for determinate-nixd $(determinate-nixd --version)"
$ gh pr create

@onnimonni
Copy link
Author

I tested this approach a bit and the only problem with it seems to be that relaunching the determinate nix daemon will overwrite the /etc/nix/nix.conf:

$ darwin-rebuild switch --flake .
$ sha256sum /etc/nix/nix.conf
c95ec3bbffe13f0d1c0f4964e97650f9bbb711754503525f137b7f0f54d5ccbc  /etc/nix/nix.conf
$ sudo launchctl kickstart -k system/systems.determinate.nix-daemon
$ sha256sum /etc/nix/nix.conf
8a9ebee68a25f8e1a74f510059e4690f6c2c36842e9bad065060cacb178b3670  /etc/nix/nix.conf

@onnimonni
Copy link
Author

onnimonni commented Jan 25, 2025

So it would be great if we could find a way to write the added nix configs to the included file nix.custom.conf instead of overwriting the /etc/nix/nix.conf:

$ head -n5 /etc/nix/nix.conf
# DETERMINATE NIX CONFIG
# do not modify! this file will be replaced!
# user modification can go in nix.custom.conf

!include nix.custom.conf

EDIT: fixed my stupidness

@emilazy
Copy link
Collaborator

emilazy commented Jan 30, 2025

Unfortunately this PR wouldn’t work well, as determinate-nixd takes ownership of /etc/nix/nix.conf and overwrites it whenever the daemon starts. nix-darwin’s Nix management logic also wants to take ownership of the Nix installation (in many ways, not just the configuration) and can’t interoperate well with another service doing similar tasks. #1313 should provide a better option for Determinate users once it’s merged, where Nix management can be disabled on the nix-darwin side and the rest of nix-darwin’s functionality can be used as normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants