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

Use meaningful name for image file

Open davidak opened this issue 4 years ago • 3 comments

It should include:

  • nixos
  • version (including commit id)
  • image format
  • ?

So you know what it is when you have just the image file!

See for example the official installer image name: nixos-graphical-19.03.173375.e02148563af-x86_64-linux.iso

Source: https://releases.nixos.org/nixos/19.03/nixos-19.03.173375.e02148563af

Current behavior:

$ for format in $(nixos-generate --list); do echo -n "$format: " ; nixos-generate -f $format; done
azure: /nix/store/9r98x8vjqhghbslp3aljsi08lcbx18rh-azure-image/disk.vhd
cloudstack: /nix/store/9li2w85xj53glzh8sxc3d4xi6cfyhz78-nixos-disk-image/nixos.qcow2
gce: /nix/store/yl90g8jabagp0jmnabl9pcpraj48a2cn-google-compute-image/nixos-image-19.03.173202.31d476b8797-x86_64-linux.raw.tar.gz
install-iso: /nix/store/0l8k0pijgxl9s3gky69qi01xx8nd8vlp-nixos-19.03.173202.31d476b8797-x86_64-linux.isonixos.iso/iso/nixos-19.03.173202.31d476b8797-x86_64-linux.isonixos.iso
iso: /nix/store/2vcykhq3d4gwjm3q0gfsg8hlwkcv0kr7-nixos.iso/iso/nixos.iso
kexec-bundle: /nix/store/fv2kb1avfj4vz5j341jv90cs821lb57d-kexec_bundle
kexec: /nix/store/9yk2d822iszn9mb8zgx8112zbb70chcr-tarball/tarball/nixos-system-x86_64-linux.tar.xz
openstack: /nix/store/35ha7hd437y08q410n4fip00mad03lra-nixos-disk-image/nixos.qcow2
qcow: /nix/store/7bchmgnd3nxx3kzxn5nnwl6yn1jbkgb0-nixos-disk-image/nixos.qcow2
raw: /nix/store/pnp1zndrzcfqn8j6ifylkijk1q4kig48-nixos-disk-image/nixos.img
sd-aarch64-installer: error: refusing to evaluate.
sd-aarch64: error: refusing to evaluate.
virtualbox: /nix/store/v2wnwgzvv1ykgf4cixar5z1hih4a8sa9-nixos-ova-19.03.173202.31d476b8797-x86_64-linux/nixos-19.03.173202.31d476b8797-x86_64-linux.ova
vm: vm-nogui: 

davidak avatar Aug 27 '19 10:08 davidak

Injecting that type of metadata into the output means that it will be rebuilt on every nixpkgs commit, even if the result doesn't change. The output is quite large so it's probably desirable to avoid unnecessary churn.

I think a better approach would be to keep a cache of commit IDs to derivation hashes outside of nix

zimbatm avatar Aug 27 '19 10:08 zimbatm

Injecting that type of metadata into the output means that it will be rebuilt on every nixpkgs commit, even if the result doesn't change. The output is quite large so it's probably desirable to avoid unnecessary churn.

OK, yes. So is that a problem on the official image too?

I think a better approach would be to keep a cache of commit IDs to derivation hashes outside of nix

Would you implement that into nixos-generators or should i just copy and rename the file after build?

davidak avatar Aug 27 '19 11:08 davidak

I could be wrong but I think that NixOS reduces the churn by only pushing the image once in a while instead of at each channel release.

It would be best to find a generic solution. It's the same issue with the dockerTools.buildImage outputs as well. But having one built in nixos-generators is also acceptable.

zimbatm avatar Aug 27 '19 13:08 zimbatm