Skip to content

A nix library for render, run and manage declarative HashiCorp Vagrant config files powered by nixago and CUE Lang.

Notifications You must be signed in to change notification settings

codexlynx/nix-vagrant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nix-vagrant

Warning

This library is in an early, experimental stage and may lack complete functionality. It is intended for testing and feedback purposes only. Use at your own risk as stability is not guaranteed.

Vagrant

NixOS

A nix library for render, run and manage declarative HashiCorp Vagrant config files powered by nixago and CUE Lang.

  • Make Vagrantfiles from nix
  • Manage vagrant machine lifecycle
  • Batteries includes box runner

Usage

Make Vagrantfiles

vagrant.file.cumulus = 
  pkgs.writeShellScriptBin "result"
    (nix-vagrant.lib."${system}".make "Vagrantfile" {
      name = "machine1";
      provider = "vmware_fusion";
      box = "CumulusCommunity/cumulus-vx";
      gui = false;
    }).shellHook;

Commands

$ nix run .#vagrant.x86_64-linux.file.cumulus

Manual machine lifecycle control

vagrant.machine.windows = nix-vagrant.lib."${system}".machine {
  package = pkgs.vagrant;

  config = {
    name = "windows1";
    provider = "virtualbox";
    box = "gusztavvargadr/windows-11";
    gui = true;
  };

  init = {
    launchScript = "powershell -noninteractive -executionpolicy unrestricted - < C:/";

    script = ''
      echo Hello from Windows!
    '';
  };
};

Commands

$ nix run .#vagrant.x86_64-linux.machine.windows.up
$ nix run .#vagrant.x86_64-linux.machine.windows.ssh
$ nix run .#vagrant.x86_64-linux.machine.windows.destroy
$ nix run .#vagrant.x86_64-linux.machine.windows.ssh-config
$ nix run .#vagrant.x86_64-linux.machine.windows.provision

Box runner

packages.start = nix-vagrant.lib."${system}".runner {
  config = {
    name = "windows1";
    provider = "virtualbox";
    box = "gusztavvargadr/windows-11";
    gui = false;
  };
};

Commands

$ nix run .#start

About

A nix library for render, run and manage declarative HashiCorp Vagrant config files powered by nixago and CUE Lang.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published