Skip to main content
Version: Latest

On NixOS

Basic Setup

The NixOS module is the recommended method for installing and configuring NocoDB on NixOS. We advise using Flakes for this process. The NixOS module will install NocoDB and create a corresponding systemd service

{
description = "Bane's NixOS configuration";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nocodb.url = "github:nocodb/nocodb";
};

outputs = inputs@{ nixpkgs, nocodb, ... }: {
nixosConfigurations = {
hostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
nocodb.nixosModules.nocodb

{
# Enable NocoDB
services.nocodb.enable = true;
}
];
};
};
};
}

Secrets

We recommend using the services.nocodb.environmentFile option to securely pass secrets, such as NC_AUTH_JWT_SECRET, to the NixOS NocoDB instance. This approach prevents sensitive information from being committed to the NixOS repository. While it is not required, we strongly suggest using sops-nix for managing secrets in a more secure and structured manner.

Example configuration:

services.nocodb.environmentFile = "/var/lib/secrets/nocodb.env"

SSL

It is recommended to use the NixOS Nginx module with ACME for SSL certificate management. This approach ensures secure and automated handling of SSL certificates.

networking.firewall.allowedTCPPorts = [ 80 443 ];

services.nginx = {
enable = true;

recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
recommendedBrotliSettings = true;

virtualHosts."example.com" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:8080";
proxyWebsockets = true;
};
};
};

PostgreSQL

For production use recommend PostgreSQL instead of SQLite

  services.nocodb.environments = {
DB_URL="postgres:///nocodb?host=/run/postgresql";
};

services.postgresql = {
enable = true;

ensureDatabases = [ "nocodb" ];
ensureUsers = [{
name = "nocodb";
ensureDBOwnership = true;
}];

package = with pkgs; postgresql_15;
authentication = lib.mkForce ''
#type database DBuser origin-address auth-method
# unix socket
local all all trust
# ipv4
host all all 127.0.0.1/32 trust
# ipv6
host all all ::1/128 trust
'';

settings.log_timezone = config.time.timeZone;
};

On Other GNU/Linux Distributions and MacOS

If Nix is not already installed on your system, we recommend using the Determinate Systems Nix installer to install Nix. If Nix is already installed, you can skip this step.

To install Nix, run the following command:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

Once Nix is installed, you can run NocoDB using the following command:

nix run github:nocodb/nocodb