nixcloud/nixcloud-webservices

documentation: add remote repo inclusion recipe (as preferred installation method?)

Opened this issue · 0 comments

As a nix noob I (unnecessarily) struggled with this one, although it's arguably the most logical use case to directly start using nixcloud: a "zero install" method by just referring to the remote repo in the .nix file using nixcloud.

I.e. I would have expected that a solution that does the below is actually documented as the first and preferred "installation" method, since it makes the most sense for remote declarative deployments.

After some trial and horror I ended up with:

{
  imports = [ "${fetchGit https://github.com/nixcloud/nixcloud-webservices}/modules/" ];
  nixcloud.tests.enable = false;
  # only now can you start using nixcloud.... options
}

which arguably doesn't support referring to a specific tag or commit and would therefore be less robust upon rebuilds.

An alternative which also appeared to work is the following, which doesn't have the above problem but is much more convoluted (it could maybe be simplified?):

  let
    ncws = (import <nixpkgs> {}).fetchFromGitHub {
          owner = "nixcloud";
          repo = "nixcloud-webservices";
          rev = "7e421fed1cb6dc460468d5917bb93b559606c7b6";
          sha256 = "sha256:0y3kpajq10ixh5xnijfsq2aqpf9f7yij5bxl7ynh3n9dj44ksflb";
    };
  in {
    imports = [ "${ncws}" {} ];
    nixcloud.tests.enable = false;