Files
flynn/docs/deployment/NIX.md
T
2026-02-15 18:26:10 -08:00

1.2 KiB

Nix Deployment

This repo ships a Nix flake with:

  • nix run support (runs flynn)
  • nix develop dev shell (Node 22 + pnpm)
  • A package that builds dist/ and preserves dist/gateway/ui adjacency
  • An optional NixOS module (services.flynn)

Quick Start

# Dev shell
nix develop

# Run (prints CLI help)
nix run . -- --help

# Build package
nix build .#

First Build: Update pnpmDepsHash

The Nix package uses buildPnpmPackage, which requires a fixed dependency hash.

On the first nix build, Nix will fail with a message containing the expected hash (looks like got: sha256-...). Copy that value into nix/package.nix as pnpmDepsHash, then rebuild.

NixOS Module

The flake exports nixosModules.flynn.

Example:

{
  inputs.flynn.url = "github:will666/flynn";

  outputs = { self, nixpkgs, flynn, ... }: {
    nixosConfigurations.myHost = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        flynn.nixosModules.flynn
        {
          services.flynn = {
            enable = true;
            configFile = "/etc/flynn/config.yaml";
            dataDir = "/var/lib/flynn";
          };
        }
      ];
    };
  };
}