Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codexlynx/nix-vagrant
A nix library for render, run and manage declarative HashiCorp Vagrant config files powered by nixago and CUE Lang.
https://github.com/codexlynx/nix-vagrant
cue cuelang hashicorp nix nix-flake nixago nixos vagrant vagrantfile
Last synced: 29 days ago
JSON representation
A nix library for render, run and manage declarative HashiCorp Vagrant config files powered by nixago and CUE Lang.
- Host: GitHub
- URL: https://github.com/codexlynx/nix-vagrant
- Owner: codexlynx
- Created: 2024-09-07T16:43:23.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-11-16T21:36:43.000Z (about 1 month ago)
- Last Synced: 2024-11-16T22:26:30.298Z (about 1 month ago)
- Topics: cue, cuelang, hashicorp, nix, nix-flake, nixago, nixos, vagrant, vagrantfile
- Language: Nix
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.
A [nix](https://zero-to-nix.com/concepts/nix-language) library for render, run and manage declarative HashiCorp [Vagrant](https://www.vagrantup.com/) config files powered by nixago and [CUE Lang](https://cuelang.org/).
* Make Vagrantfiles from nix
* Manage vagrant machine lifecycle
* Batteries includes box runner## Usage
### Make Vagrantfiles
```nix
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
```commandline
$ nix run .#vagrant.x86_64-linux.file.cumulus
```### Manual machine lifecycle control
```nix
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
```commandline
$ 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
```nix
packages.start = nix-vagrant.lib."${system}".runner {
config = {
name = "windows1";
provider = "virtualbox";
box = "gusztavvargadr/windows-11";
gui = false;
};
};
```#### Commands
```commandline
$ nix run .#start
```