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 system.copySystemNixpkgs nixos option #27313
Conversation
This option copies the version of nixpkgs that was used to build the system to the system path. This is useful for two reasons: * it allows for reproducing a given system state * you can easily keep the nixpkgs version that your user uses and that the system uses in sync
fa87b08
to
444a23d
Compare
I like the idea but if it doesn't copy files it references, then that is a serious limitation which wouldn't be obvious for the unaware user either. |
@FRidh: hmm, is it common to have symlinks in your nixpkgs? Most people just build from a nixpkgs checkout with a few additional commits on top, I'd assume. And the nixpkgs repo currently contains not a single symlink. |
And what about keys and such? I think the majority of cases will have references to other files. |
@FRidh this is about copying the nixpkgs, not the configuration. So if you use |
No, I just didn't read it properly. Ignore my earlier comments! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea!
I love this! What if this also automatically added to NIX_PATH? |
@grahamc IMO, adding to
|
I don't think we should do this. It has the same problem as Also, it doesn't provide a straightforward way to revert to or modify the snapshotted configuration. You would have to manually copy My ideal solution would be to have
|
Thanks for the detailed response!
Yes, this is right. But is it actually common to have nix inputs outside of the nixpkgs repo? I think that for most users, this setting would be fine.
Also right. In my experience, this hasn't been such a big problem, other steps during nixos-rebuild often take much longer (and I have been using this code snippet in my nixpkgs revision since a long time already). Additionally, this is setting defaults to
I don't understand, why would it be necessary to make it writable? You'd have to find the system profile, but you don't need to copy it since you can just do
But is this actually feasible right now? It sounds like a lot more work, for a benefits in a corner case (perhaps it is more common to have additional inputs in large organizations? I only use NixOS on my laptops at home I've never needed any other input except my configuration + nixpkgs). Even with restricted eval, it seems like Nix doesn't have proper support for evaluation stages. So you'd probably have to do the restricted eval multiple times to discover all inputs. And, even if it is feasible, what bad happens if we introduce this optional setting? Are you just saying that there should be a bigger warning that it won't capture everything? Or do you think that if we merge this, there will be less incentive to work on a better solution? Or is it because of backwards compatibility concerns (perhaps we can design this in a forward-compatible way then?)? I'm happy to remove this option again should a better option arise. Personally, I'm using this right now, and it works well for me. Also, looks like a few others already liked this, so what harm would be caused by introducing this option? If we always wait for the perfect solution, we will never get a solution. |
So can I close this? |
This approach is not accepted, so I am closing this PR. |
This option copies the version of nixpkgs that was used to build the system to
the system path. This is useful for two reasons:
system uses in sync
If no one disagrees, I will merge this in 2 weeks (2017-25-07).