Documentation

menu
Nix FlakesHostingIntroductionBranch HostingPull-request DeploymentsSecretsPersistenceDebuggingMultiple ServersCustom DomainsExample: Typescript & GoExample: JitsiExample: RSS BridgeExample: Tiny Tiny RSSExample: SearxGarnyaml configWhat Garnix CI doesUsing Private InputsCachingGitHub Actions IntegrationBadges

Multiple serversshare

garnix gives each version of each server it's own unique URL, based on the hash of the NixOS configuration. This makes zero-downtime deployments much easier, and has a number of other benefits. (You can read more about this idea in our blog post.

The correct way to reference one server from another is by this URL. As a helper, you can use the lib.getHashSubdomain function from garnix-lib. For example:

{
  ...
  inputs.garnix-lib.url = "github:garnix-io/garnix-lib";

  outputs = { self, nixpkgs, garnix-lib, ... }: {
    nixosConfigurations.machine1 = ...;
    nixosConfigurations.machine2 = nixpkgs.lib.nixosSystem {
      ...
      modules = [{
        ...
        myservice.otherServiceURL =
          "http://" +
          garnix-lib.lib.getHashSubdomain self.nixosConfigurations.machine1 +
          "/somepath";
      }]

    }
  }
}