Class: VagrantPlugins::Nixos::Provisioner

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-nix/provisioner.rb

Instance Method Summary collapse

Instance Method Details

#provisionObject

This is the method called when the actual provisioning should be done. The communicator is guaranteed to be ready at this point, and any shared folders or networks are already setup.

No return value is expected.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vagrant-nix/provisioner.rb', line 12

def provision
  conf = if @config.inline
    @config.inline
  elsif @config.path
    File.read(@config.path)
  elsif @config.expression
    "{config, pkgs, ...}: with pkgs; #{@config.expression}"
  else
    raise NixosConfigError, "Mising :path, :inline or :expression"
  end
  Nixos.write_config(machine, "vagrant-provision.nix", conf)
  Nixos.rebuild!(machine, @config)
end