NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.87k stars 364 forks source link

github nixops: unknown resource type ‘virtualbox’, or document vbox plugin integration? #1404

Open tobiasBora opened 4 years ago

tobiasBora commented 4 years ago

I'm trying to use the nixops obtained from this repository, however when I compile this file, for example, I get an error:

$ nixops create -d nixopsonline ../supertrivial.nix
[...]
$ nixops info -d nixopsonline
[...]
nixops.deployment.UnknownBackend: unknown resource type ‘virtualbox’

File supertrivial.nix:

{ maintenance ? false }:
{
  network = {
    description = "Web server";
    enableRollback = true;
  };

  giteabackend =
    { config, pkgs, ... }:
    {
      deployment.targetEnv = "virtualbox";
      services.openssh.enable = true;
      networking.firewall.allowedTCPPorts = [ 80 22 ];
      services.nginx = {
        enable = true;
        virtualHosts."giteabackend" = {
          default = true; # makes this the default vhost if no other one matches
          locations."/" = {
            root = pkgs.writeTextDir "index.html" "Hello world!";
          };
        };
      };
    };
}

I tried to read the generated documentation, but it seems that all the documentation is gone. There is just an overview section, that does not mention any plugin/virtualbox at all. The next relevant sections seems to be Authoring a Plugin that lists some plugins, so I tried to install the plugin https://github.com/nix-community/nixops-vbox, and this plugin states that we need to run:

$ ./dev-shell --arg p "(p: [ p.plugin1 ])"

I don't have any ./dev-shell, I guess that plugin1 is in fact vbox? So I tried to enter into the nixops shell using:

$ nix-shell --arg p "(p: [ p.vbox ])"

I don't have any error while entering the shell... but then I still have the same unknown resource error.

I'm a bit lost, and documentation does not help... would it be possible to have some help on using nixops + virtualbox?

Thanks!

tewfik-ghariani commented 3 years ago

That documentation is outdated, the new method to spawn nixops-dev is as follows

nix-shell -I channel:nixos-20.09 -p poetry
poetry install
poetry shell

And there you have it! You can run this command to view the list of installed plugins

nixops list-plugins

PS : All these steps are ran while you're under the "nixops-vbox" repo

roberth commented 3 years ago

nixopsUnstable in Nixpkgs includes the virtualbox plugin.