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 a way to pin a NixOS version within the module system. #11106

Merged
merged 1 commit into from Nov 20, 2015

Conversation

nbp
Copy link
Member

@nbp nbp commented Nov 18, 2015

This modification add a way to re-evaluate the module system with a
different version of NixOS, or with a different set of arguments.

cc @garbas

@copumpkin
Copy link
Member

@nbp does this also resolve #7467?

@nbp
Copy link
Member Author

nbp commented Nov 18, 2015

@copumpkin Yes, this solves #7467.

@copumpkin
Copy link
Member

👍

@nbp
Copy link
Member Author

nbp commented Nov 18, 2015

The latest patch add documentation for the module and a changelog entry. The only remaining part is to add the test into the test infrastructure.

@nbp
Copy link
Member Author

nbp commented Nov 18, 2015

Ok, I tested the test case locally, and it works.
I did not do a VM test as this only check the evaluation of the module system.

review? @shlevy
feedback? @garbas

@shlevy
Copy link
Member

shlevy commented Nov 18, 2015

@nbp Nice approach, looks good to me.

nixos.extraModules = [ "./${config.networking.hostname}" ]
if config.networking.hostname == "server" then
[ ./server.nix ] else [ ./client.nix ];
</programlisting>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this example correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is a mix of 2 idea, I will keep the bottom one for now.

@domenkozar
Copy link
Member

@edolstra

This modification add a way to re-evaluate the module system with a
different version of NixOS, or with a different set of arguments.
nbp added a commit that referenced this pull request Nov 20, 2015
Add a way to pin a NixOS version within the module system.
@nbp nbp merged commit 4e61fc8 into NixOS:master Nov 20, 2015
@copumpkin
Copy link
Member

🍻

@garbas
Copy link
Member

garbas commented Nov 20, 2015 via email

@offlinehacker
Copy link
Contributor

nice, thanks :)

@vcunat
Copy link
Member

vcunat commented Nov 21, 2015

Sounds useful 👍

@nbp
Copy link
Member Author

nbp commented Mar 24, 2016

These changes got reverted in commit d4636fa

@copumpkin
Copy link
Member

copumpkin commented Apr 18, 2017

@edolstra while in general the scopedImport mechanism can be similar, it's not quite the same:

  1. scopedImport still (as far as I can tell) doesn't cache loaded .nix files, which can make it potentially quite a bit slower and less deterministic than regular import. Furthermore, implementing that memoization seems tricky.
  2. If your entry point is just a configuration.nix, you don't control the actual entry point to evaluation (which is an implicit evalConfig wrapped up in nixos-rebuild somewhere), which leads to horrible hacks like my triple ### syntax for manipulating ~/.nix-channels in the EC2 (and soon other cloud providers) metadata processor. If we had something like this, we could kill the horrible ### stuff in our metadata and stay in pure Nix, which would also bring a few other advantages. The other place this applies is declarative containers, where we also don't currently have a clear entry point around evaluation of the modules. Note that I care about this because I want to version my modules just like I version my packages, so the various mechanisms like nixpkgs.overlays don't achieve any of this.

I don't know if this is the implementation we'll end up using, but do you agree that given the above this is at least something that's nice to have, even given the existence of scopedImport?

cc @grahamc given his interest in NixOS/nixops#649

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

Successfully merging this pull request may close these issues.

None yet

9 participants