Skip to content

ATALLC/nixos-on-azure

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NixOS on Azure

Run NixOS on an Azure Gen 2 VM


Preparation

  1. Set your username in the flake.nix file
  2. use direnv or run nix develop
  3. run az login and login with your Azure credentials
  4. Create an RSA SSH key pair (id_rsa) - ed25519 keys are not supported by Azure

Upload image

it can take a while to upload the .vhd (for me it is +/- 50 min),
if the upload time-out; you may want to change the token duration.
also don't look at the azcopy log file, it spams 500 errors but these can be ignored..

./upload-image.sh --resource-group images --image-name nixos-gen2

Create VM

./boot-vm.sh --resource-group vms --image nixos-gen2 --vm-name nixos

Build image (only)

nix build .#azure-image --impure

SSH into server

ssh -i ~/.ssh/id_rsa <username>@<public_ip>
  • username you have set in the flake.nix file
  • public IP will be printed with running the boot-vm.sh script

❯ neofetch
          ▗▄▄▄       ▗▄▄▄▄    ▄▄▄▖            rudesome@nixos 
          ▜███▙       ▜███▙  ▟███▛            -------------- 
           ▜███▙       ▜███▙▟███▛             OS: NixOS 23.11.20240215.c68a9fc (Tapir) x86_64
            ▜███▙       ▜██████▛              Host: Microsoft Corporation Virtual Machine
     ▟█████████████████▙ ▜████▛     ▟▙        Kernel: 6.7.4
    ▟███████████████████▙ ▜███▙    ▟██▙       Uptime: 45 secs
           ▄▄▄▄▖           ▜███▙  ▟███▛       Packages: 368 (nix-system), 798 (nix-user)
          ▟███▛             ▜██▛ ▟███▛        Shell: zsh 5.9
         ▟███▛               ▜▛ ▟███▛         Terminal: /dev/pts/0
▟███████████▛                  ▟██████████▙   CPU: Intel Xeon Platinum 8171M (1) @ 2.095GHz
▜██████████▛                  ▟███████████▛   Memory: 384MiB / 3424MiB
      ▟███▛ ▟▙               ▟███▛
     ▟███▛ ▟██▙             ▟███▛
    ▟███▛  ▜███▙           ▝▀▀▀▀
    ▜██▛    ▜███▙ ▜██████████████████▛
     ▜▛     ▟████▙ ▜████████████████▛
           ▟██████▙       ▜███▙
          ▟███▛▜███▙       ▜███▙
         ▟███▛  ▜███▙       ▜███▙
         ▝▀▀▀    ▀▀▀▀▘       ▀▀▀▘

Credits

About

Run nixos on Azure GEN 2 VM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 74.1%
  • Nix 25.9%