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

Pass system to darwinSystem rather than eval-config. #317

Merged
merged 1 commit into from
Sep 15, 2021
Merged

Pass system to darwinSystem rather than eval-config. #317

merged 1 commit into from
Sep 15, 2021

Conversation

dhess
Copy link
Contributor

@dhess dhess commented Apr 9, 2021

This allows us to specify what kind of darwinSystem we want to build, rather than determining it at evaluation time.

@bphenriques
Copy link

This should fix #319

@dhess
Copy link
Contributor Author

dhess commented Aug 17, 2021

FYI, I'm not quite sure why the build failed. I've been using this successfully in my fork since I submitted this PR.

@domenkozar
Copy link
Collaborator

This is a good example how NixOS/nix#3843 would simplify flakes and remove the need to hardcode system like in this case.

@domenkozar
Copy link
Collaborator

@dhess could you rebase and check if tests pass?

This allows us to specify what kind of darwinSystem we want to build,
rather than determining it at evaluation time.
@dhess
Copy link
Contributor Author

dhess commented Sep 8, 2021

Done.

@domenkozar
Copy link
Collaborator

I've added some design thoughts to NixOS/nix#3843 (comment)

@domenkozar
Copy link
Collaborator

error: anonymous function at /nix/store/nb2kapr1yf12ra2x3jmdbm2lwfh9c1pr-source/eval-config.nix:3:1 called with unexpected argument 'system'

       at /nix/store/nb2kapr1yf12ra2x3jmdbm2lwfh9c1pr-source/flake.nix:10:58:

            9|
           10|       darwinSystem = { modules, inputs ? {}, ... }@args: self.lib.evalConfig (args // {
             |                                                          ^
           11|         inputs = { inherit nixpkgs; darwin = self; } // inputs;

@dhess
Copy link
Contributor Author

dhess commented Sep 8, 2021

I'll try to take a look at this over the weekend.

@emilazy
Copy link
Collaborator

emilazy commented Sep 14, 2021

This PR worked perfectly for me, thank you! I think @domenkozar's error must be related to issues with specifying this fork in flake.nix:

  • the excerpted code darwinSystem = { modules, inputs ? {}, ... }@args: doesn't appear in the PR branch's flake.nix;
  • the /nix/store/nb2kapr1yf12ra2x3jmdbm2lwfh9c1pr-source source path matches what I get for the current upstream nix-darwin flake, whereas this PR has the source path /nix/store/b8igm25p67844z4gylbmskndi7r8r607-source (you can check with nix flake metadata …).

The error looks what you'd get passing system to the darwinSystem from current nix-darwin.

@dhess
Copy link
Contributor Author

dhess commented Sep 14, 2021

Good catch.

I'm not sure how to fix this, nor whether it's even worth bothering, given that it won't be a problem once it's merged. I'll wait to hear from @LnL7, in any case.

@emilazy
Copy link
Collaborator

emilazy commented Sep 14, 2021

FWIW, darwin.url = "github:hackworthltd/nix-darwin/darwinSystem"; was how I successfully tested this PR with flakes.

@LnL7
Copy link
Owner

LnL7 commented Sep 14, 2021

Ah I see, now the error makes sense. It seems like the nix registry override that the tests use doesn't have precedence anymore over the input defined in the flake.

@LnL7
Copy link
Owner

LnL7 commented Sep 14, 2021

@dhess I can push a fix for the tests if you allow edits from maintainers.

@dhess
Copy link
Contributor Author

dhess commented Sep 14, 2021

@dhess I can push a fix for the tests if you allow edits from maintainers.

Sorry for being dense, but how do I do that?

@LnL7
Copy link
Owner

LnL7 commented Sep 14, 2021

There should be a checkbox in the sidebar. I would expect it to be checked by default however, maybe I my push attempt was incorrect?

@dhess
Copy link
Contributor Author

dhess commented Sep 14, 2021

I don't see that option. Perhaps it's because the branch is from a repo owned by an org and not an individual?

@LnL7
Copy link
Owner

LnL7 commented Sep 14, 2021

Weird, guess it must be something like that. Well you can just cherry-pick it from https://github.com/LnL7/nix-darwin/commits/flakes-test then. 😄

@dhess
Copy link
Contributor Author

dhess commented Sep 14, 2021

Or you could just merge your branch :) I don't care either way, whatever you prefer.

@LnL7 LnL7 merged commit 738eff4 into LnL7:master Sep 15, 2021
@dhess
Copy link
Contributor Author

dhess commented Sep 15, 2021

Excellent, thanks!

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.

5 participants