Code Monkey home page Code Monkey logo

nixos-on-azure's Introduction

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
      ▟███▛ ▟▙               ▟███▛
     ▟███▛ ▟██▙             ▟███▛
    ▟███▛  ▜███▙           ▝▀▀▀▀
    ▜██▛    ▜███▙ ▜██████████████████▛
     ▜▛     ▟████▙ ▜████████████████▛
           ▟██████▙       ▜███▙
          ▟███▛▜███▙       ▜███▙
         ▟███▛  ▜███▙       ▜███▙
         ▝▀▀▀    ▀▀▀▀▘       ▀▀▀▘

nixos-on-azure's People

Contributors

rudesome avatar andrvo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.