NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.85k stars 13.23k forks source link

Azure version of NixOS blob #36262

Open Rizary opened 6 years ago

Rizary commented 6 years ago

Hi,

I see from the https://nixos.org/nixos/download.html on the azure section that the version used is 16.03. Meanwhile, its current stable version is 17.09.

Is there any possibility to use 17.09 in azure? How can I contact the nixos azure team for any further question or to contribute in this area?

after reading this https://github.com/NixOS/nixpkgs/issues/3986, it seems that @Phreedom handle the nixos azure.

also it seems that according to the latest comment here https://github.com/Azure/WALinuxAgent/pull/135, it's been deprecated.

Does building nixos images work for 17.09?

samueldr commented 5 years ago

Cross-referencing issue:

This is done in the hope that an Azure-knowledgeable user could review that issue. (Sorry I'm not one.)

colemickens commented 5 years ago

I was using NixOS and Azure during some months this year.

I have some scripts to automate building the image and uploading it to storage as a usable Managed Disk (including creating accounts if they don't exist, etc, etc). It's meant to be "easy". https://github.com/colemickens/nixcfg/tree/master/utils/azure/vhd

Most of the scripts is just orchestrating the build/boot of an Azure machine. Actually building the VHD is basically just a single nix-build call.

The Agent version 2.0 is deprecated. There's a newer version but I don't know enough about packaging and NixOS to really take a crack at it. The old version probably works? In my opinion there's a limited amount of usefulness of the agent under NixOS anyway.

colemickens commented 5 years ago

(aka, anyone can run those two scripts and create/upload/use a new Azure VHD if they like. I'm not interested in volunteering for maintenance for Azure at this time, though)

vcunat commented 5 years ago

OK, so building the image seems easy enough, and we have some of the scripts in repo. Upload to https://nixos.blob.core.windows.net/images is probably just a matter of some credentials that someone in here has. Still, all this is probably of little value unless we do at least some basic testing before upload (even automatic tests would seem sufficient).

vcunat commented 5 years ago

So we might just settle for providing this information instead of the direct download we have now.

bbarker commented 5 years ago

Would there be any possibility of putting something up on Azure Marketplace, e.g., so it would show up with this search? https://azuremarketplace.microsoft.com/en-us/marketplace/apps?search=NixOS&page=1&filters=virtual-machine-images? Even if it is an old image (not actively maintained), it would be super easy for users to just run nixos-rebuild switch --upgrade (I guess maybe after updating one's channels, ideally). Or are there security concerns with leaving outdated images up there?

bbarker commented 5 years ago

(If @colemickens doesn't want to maintain the public images, I'd probably be happy to "maintain" them for a while, as long as I needn't be too diligent, and as long as it doesn't cost beyond minimal $ (sorry, not an Azure user yet, but likely will be soon)).

ghuntley commented 5 years ago

howdy, I'm happy to help out with maintenance as Microsoft provide me with $13k/year of Azure hosting as part their community MVP program. I've sent in https://github.com/NixOS/nixos-homepage/pull/282 which corrects the az cli instructions. This pull-request replaces https://github.com/NixOS/nixos-homepage/pull/226.

Rizary commented 5 years ago

@ghuntley hey.. that's cool.. but iirc, we still need to address this https://github.com/Azure/WALinuxAgent/pull/135 issue right?

I haven't test your above PR to create simple NixOS server though...

idontgetoutmuch commented 4 years ago
"message": "The VHD for disk 'osdisk_0fbb5e758f' with blob https://nixosvm.blob.core.windows.net/nixosvm/osdisk_0fbb5e758f.vhd has an unsupported virtual size of 30719.390625 MB. The size must be a whole number in (MBs)."
kim0 commented 4 years ago

I'm still lost after reading lots of bug reports, exactly how can I launch a nixos VM on Azure ?

idontgetoutmuch commented 4 years ago

@kim0 - I think this has the details: https://github.com/NixOS/nixpkgs/tree/master/nixos/maintainers/scripts - I got this working about 6 months ago - I had a few issues and put my notes here: https://github.com/idontgetoutmuch/nix-config#nixos-on-azure but it looks like the instructions have been updated so my notes are probabaly out of date.

colemickens commented 4 years ago

I recently wrote the new 'azure-new' version that is available in <nixpkgs/nixos/maintainers/scripts/azure-new>. The README in that directory currently has instructions on how to build and boot a custom NixOS image for Azure, and includes an asciinema demo: https://github.com/NixOS/nixpkgs/blob/45948bd56bdbbeb57dbfa76b8a25e5081c564736/nixos/maintainers/scripts/azure-new/README.md

idontgetoutmuch commented 4 years ago

@colemickens what happened to the scripts for generating your own images? I have a fork of them here: https://github.com/idontgetoutmuch/nixpkgs/commits/azure-bis but I can't find them your fork or in NixOS.

kim0 commented 4 years ago

As a user, I'm not very interested in building my own images. Will there be a way to simply copy/boot existing images soon ? Thanks!

idontgetoutmuch commented 4 years ago
error: a 'x86_64-linux' is required to build '/nix/store/d7w2i37vj6gp6q9xh5n59v3nvhijnjck-append-initrd-secrets.drv', but I am a 'x86_64-darwin'
idontgetoutmuch commented 4 years ago

I am now on ubuntu but get

sundials@sundials:~/nixpkgs/nixos/maintainers/scripts/azure-new$ ./upload-image.sh ./examples/basic/image.nix
+ image_nix=./examples/basic/image.nix
+ nix-build ./examples/basic/image.nix --out-link azure
error: The option `virtualisation.azureImage' defined in `/home/sundials/nixpkgs/nixos/maintainers/scripts/azure-new/examples/basic/system.nix' does not exist.
(use '--show-trace' to show detailed location information)
idontgetoutmuch commented 4 years ago

@kim0 I just built an image and booted up a nixos system on azure just to refresh my memory - it's not too hard :) - have courage - I worked on ubuntu and made sure I had an up to date version of the az cli

colemickens commented 4 years ago

Hi folks. I understand official images that can be easily booted are desirable. It's what I'm working towards.

Until we get official platform images, we had/have a few options:

  1. Bare minimum: Make it easy to self-build/upload/boot (prerequisite for moving forward; done).

  2. Use Shared Image Galleries, make a little service so that people can grant permission to a NixOS Gallery to their subscription, since I don't think we can make a Gallery image public. This greatly reduces friction, but it's not quite the same as being a platform image and might have implications on image availability and storage costs.

  3. Someone can write the publisher script to push the managed disk blob to storage and make it public; and the consumer script to copy the VHD blob and then make a managed disk from it. I will not be doing this as I think Azure needs to finally finish making disk scenarios work without requiring storage accounts, and I've already written enough bash here to accommodate Azure.

QUESTION: I will probably work on the Shared Image Gallery approach unless people think that's a waste of time. How important is it to you that images are available everywhere, versus maybe having to make a single HTTP request to make them show available to your tenant/subscription?

idontgetoutmuch commented 4 years ago

@colemickens the thing that works for me is this: https://github.com/idontgetoutmuch/nix-config#nixos-on-azure using https://github.com/idontgetoutmuch/nixpkgs/commits/azure-bis which is a fork of your work which I can no longer find. I think the new method ought to work for me but sadly didn't: https://github.com/NixOS/nixpkgs/issues/86005. I've destroyed my ubuntu image so I can't give you any more details without creating a new one. Ideally for me this would all work on macos so I don't have to create an ubuntu image.

My goal was to have nixos running on a GPU machine so I could use tensorflow and https://hackage.haskell.org/package/accelerate via GPU. I don't have a requirement for either of these at the moment but that could easily change.

I am very grateful for all the work you are doing on this. Let me know if I can help somehow but I should warn you I am not very skilled either at nix or azure.

idontgetoutmuch commented 4 years ago

Is the idea to have an azure tab like this?

image

(taken from https://nixos.org/download.html)

Rizary commented 4 years ago

@colemickens I think for now we have to make shared image gallery. But do we need to pay for the gallery?

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

AkechiShiro commented 1 year ago

Hey is there any news on this issue lately ? Any new efforts having NixOS on the Azure marketplace perhaps officially ? Or is this idea completely abandoned and probably won't happen anytime soon ?

colemickens commented 1 year ago

It seems that Azure, years late to the party, has finally gained support for Public Gallery images. So, it has finally become feasible for one to upload a NixOS image, and for others to trivially use it.

However, I'm still not a fan of running anything with the official Azure agent on it, haven't worked on my custom agent in probably 18 months, and am going to lose interest again quickly if Azure still lacks support for ed25519 keys.

That said, I have it on my list, somewhere. But that shouldn't stop someone else from picking it up. I'd be happy to share any of my knowledge if someone does.

AkechiShiro commented 9 months ago

Hi again @colemickens, I'd like to push forward an official NixOS image for gen 1 and 2 virtual machines, would you mind telling me what you'd believe would be requirements for that ? I need to package the Linux Azure Agent in Nixpkgs first of all and I guess make sure it works properly on images running on Azure ?