From 9be0eabea91ac2dffc9bf139e25ba54a66209091 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 16 May 2025 07:12:14 -0500 Subject: [PATCH] adding nocodb --- flake.nix | 3 +++ modules/base.nix | 2 +- modules/nocodb.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 modules/nocodb.nix diff --git a/flake.nix b/flake.nix index 61e83aa..f3869b8 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,7 @@ nix-comfyui.url = "github:dyscorv/nix-comfyui"; deploy-rs.url = "github:serokell/deploy-rs"; simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.11"; + nocodb.url = "github:nocodb/nocodb"; }; outputs = { nixpkgs, @@ -23,6 +24,7 @@ nix-comfyui, deploy-rs, simple-nixos-mailserver, + nocodb, self, ... }: let @@ -53,6 +55,7 @@ ./system/shen/configuration.nix simple-nixos-mailserver.nixosModule home-manager.nixosModules.home-manager + nocodb.nixosModules.nocodb { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; diff --git a/modules/base.nix b/modules/base.nix index 1dfcbc7..624ca17 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -32,7 +32,7 @@ with lib; enable = true; dates = "04:40"; allowReboot = true; - flake = "${config.users.users.chris.home}/conf"; + flake = "/conf"; flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; rebootWindow = { lower = "04:40"; diff --git a/modules/nocodb.nix b/modules/nocodb.nix new file mode 100644 index 0000000..8d5a275 --- /dev/null +++ b/modules/nocodb.nix @@ -0,0 +1,45 @@ +{ config, lib, pkgs, unstable, ... }: + +let + dn = "table.tfcconnection.org"; +in +with lib; +{ + services = { + nocodb = { + enable = true; + environmentFile = /nocoenv; + }; + }; + services.nginx.virtualHosts.${dn} = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://127.0.0.1:${toString config.services.nocodb.environments.PORT}"; + proxyWebsockets = true; + }; + }; + + 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; + }; +}