-
-
Notifications
You must be signed in to change notification settings - Fork 149
Archive nixos-generators in favor of nixos-rebuild build-image #434
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
base: master
Are you sure you want to change the base?
Conversation
See README.md for details
Wow, big news! I notice that your manual link links to the stable branch where Does this new method support something similar to nixos-generators Does it support a similar method for adding custom formats without having to fork nixpkgs? Sorry if the answers to these questions are obvious, but part of the reason I'm bringing them up is that one of the benefits of nixos-generators for me as a user has honestly been just the many examples in the readme.md here to pull from. I would assume the above use cases are supported, but a couple examples in the manual would go a long way to help keep parity with nixos-generators IMO. |
Yes, this won't be ready to merge before 25.05 will be released, and those links should be good. It sadly does not seem possible(?) to link to a specific release, just stable/unstable.
Thanks for the question, I should mention this in the docs here: There's an option called
you should be able to build that with either the
Ah, I think i mixed up the question and answered that one in the first and the first was actually about customization of existing "formats" ("variants" in nixpkgs)? If so, that will soon be in the manual - you can extend existing variants in the same way you declare new ones:
Hope that answers your question, happy about any feedback! |
I think and evaluation warning is better than deleting everything in case we have to undo this. It also provides more context on what is happening rather than just breaking everything. |
Thanks for the clarifications, I should try the new system out sometime soon to be sure I get it, but I think I mostly understand how it's mean to work. I don't mean to harp on this too much, but I'll just put a plug in one more time for a full worked example somewhere in the documentation whether it's in the manual, or linked to it or a flake template that the manual references or whatever. I've used nix for a few years now and I'm reasonably confident I'll be able to go through your docs in the manual and the source in nixpkgs to figure out how to make an image with this new system. But that's because even though I'm definitely not an expert, I do 1) know the nix configuration language 2) have a general (albeit incomplete) idea for how nixpkgs works 3) understand the module system and it's schema 4) understand how to setup a flake and what it's schema is 5) understand the nix CLI for building things from a flake and probably a couple other pieces of nix trivia I've picked up along the way. Learning about all those things is important and valuable, but is also a difficult on-ramp to using the new system even for motivated new users. One thing I've appreciated and learned a lot from with nixos-generators, is that there were working examples to start from and I think it would be nice to carry some of that forward if it's possible. What do you think the best way to publish an example is? Should I try to add something to the templates repo and get it linked in the manual? |
I am happy to reconsider this and just do eval warnings for at least one release. To ensure this we/I need to at least provide more in-depth documentation and examples and maybe code changes. I'll continue working on this until undrafting this PR, but i am not at all opposed to just the eval warning and can do that :) Can that eval state that nixos-generators is deprecated in favor of the upstreamed features or do you see long-term value in keeping nixos-generators? |
Please do! Now is an excellent time to pull the latest
There's now at least an example to customize an existing image (as well as a mention of the sub-command and the most important module options) in https://nixos.org/manual/nixos/unstable/#sec-image-nixos-rebuild-build-image. I am working on a full example in the manual. Happy to add a full flake example here, but I was under the impression that the nixos manual still avoids mentioning flakes? :( There's also examples for images build with nixos repart-integration as well as downstream integration with disko needed in the future.
That's a good thing! At this point it probably is still an intermediate feature.
That's a very apt description why at least custom variants are an intermediate to advanced feature. Add to that two nixos-rebuild(-ng) implementations that are currently used (one bash, one python), different ways to build images (make-disk-image.nix, systemd-repart) and a dozen heterogeneous image modules with custom options and it quickly becomes complicated to write good interfaces for it. So thanks for the feedback, happy about more!
Absolutely!
That's one thing I am not super comfortable with yet. I think it the depends on the nature of the example. I try to just integrate basic, non-flake ones straight into the nixos manual. Then maybe some more in-depth technical stuff about the options in the nixpkgs manual? I hadn't thought about the official nixos templates for flake examples yet tbh, but that could be a great place - let's discuss there! |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
@phaer Hello, I need to build a worker image for Is this functionality already implemented in |
tl;dr: replace with upstreamed implementation, drafted because manual links won't work before 25.05 is stable.
I deliberately delete the code for the last commit so that people who just run
flake update
notice the breakage. If they want to continuenixos-generators
as-is for the time being, they could pin the last commit before this PR.Starting with NixOS 25.05, most of nixos-generators has been upstreamed into nixpkgs.
So we believe it's time to retire nixos-generators, a good 7 years after its initial commit and after countless built images.
Please let us know if you run into any trouble, such as missing features, during the migration.
The main, user-visible difference is the new
nixos-rebuild build-image
command, which replaces the venerablenixos-generate
.Check its manual section or the updated README on how that works.
related upstream PRs
NixOS/nixpkgs#347275 (merged, see links in description)
NixOS/nixpkgs#398556
NixOS/nixpkgs#397330