nixos-generators icon indicating copy to clipboard operation
nixos-generators copied to clipboard

Integrate into Nix?

Open davidak opened this issue 6 years ago • 11 comments

Are there ideas or plans to integrate this into Nix?

davidak avatar Aug 26 '19 13:08 davidak

Not that I know of. @Lassulus ?

zimbatm avatar Aug 26 '19 14:08 zimbatm

I think it would be cool. I will try to do it, when I get some free time again. Also people asked for it at cccamp

Lassulus avatar Aug 26 '19 18:08 Lassulus

With "Integrate into Nix" i mean include in Nix, the package manager and build tool, not package it in nixpkgs. But that's a first step.

I thought about something like:

nix build image -f channel:nixos-17.03 -c configuration.nix -f iso

It first could just use this tool but later be implemented in C++ when the design is stable.

This can then be used to build official images.

davidak avatar Sep 02 '19 20:09 davidak

Maybe it can be added to nixos-rebuild since it's nixos related. And nixos-rebuild already has the build-vm command after all.

zimbatm avatar Sep 02 '19 21:09 zimbatm

I think nixos-rebuild is one of the old commands and should be replaced by a user friendly sucessor like nixos. I don't know what the plans are there.

So the question is, do you think it makes sense to integrate this tool into official Nix/NixOS tooling longterm?

Then we can open an issue there to discuss it.

davidak avatar Sep 02 '19 22:09 davidak

Yeah why not. The important part first is to define a set of interfaces that make this work easily extensible.

For example if we stored all the profiles under <nixpkgs/nixos/profiles/images/<image-name>.nix and then had a 1:1 relationship between the image-name and the output attribute (currently hacked with formatAttr). Then it would be easy to build a tool around that.

zimbatm avatar Sep 02 '19 22:09 zimbatm

Related to that, I think all the nixos profiles should be moved under <nixpkgs/nixos/profiles> and have a profilesPath added to nixos so they become easily referencable without using the <> notation. Right now both the nixos modules and profiles are mixed under the same <nixpkgs/nixos/modules> prefix which makes them hard to distinguish (and some under <nixpkgs/maintainers/scripts>).

zimbatm avatar Sep 02 '19 22:09 zimbatm

Yes. Do you want to open an issue upstream for that?

davidak avatar Sep 02 '19 22:09 davidak

Maybe we can work on it here since it will probably be drowned with the other issues upstream. Either works for me.

zimbatm avatar Sep 02 '19 22:09 zimbatm

nixos-generator is part of nixpkgs at least.

Mic92 avatar Apr 07 '20 07:04 Mic92

  • Integrating this into nix would ensure first class support over time.
  • Packaging images, just before enlisting hosts with for example morph is a common enough bootstrapping problem when using NixOS in production.

blaggacao avatar Oct 14 '20 02:10 blaggacao