From 258bab763712ad59ef65090a709663a016064f16 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 6 Aug 2024 13:41:40 +0000 Subject: [PATCH 1/2] docs: update readme with nix cache info --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ca794fc22..fe11f5532 100644 --- a/README.md +++ b/README.md @@ -111,10 +111,23 @@ We are building the features of Firebase using enterprise-grade, open source pro [![New Sponsor](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/supabase) -## Experimental Nix Packaging of resources +## Nix Packaging of resources -There is a `/nix` folder in this repo, plus a `flake.nix` and `flake.lock` that facilitate using the Nix package management system to package supabase/postgres, and all of our extensions and wrappers. A user will need nix installed on their machine. As of 4/1/2024 the package set only builds on target machines (`x86_64-linux` and `aarch64-linux`), however work is under way to also support building and using directly on `aarch64-darwin` (macOs). As of 4/1/2024, versions of packages and extensions are synced from `/ansible/vars.yml` via a utility that can be run by executing `nix run .#sync-exts-versions` (you must have nix installed and be on the supported `x86_64-linux` and `aarch64-linux` for this command to work). The short term goal is to sync these versions as they are updated by our infrastructure and postgres teams, then to see the nix packaged versions build successfully in parallel over time, along with tests of the nix packaged versions passing. +There is a `/nix` folder in this repo, plus a `flake.nix` and `flake.lock` that facilitate using the Nix package management system to package supabase/postgres, and all of our extensions and wrappers. A user will need nix installed on their machine. -The supabase/postgres repo will continue to source it's dependencies from ansible for the short term, while we stabilize this nix build. +The package set builds on target machines (`x86_64-linux` and `aarch64-linux`) with an accompanying nix cache, however work is under way to also support building and using directly on `aarch64-darwin` (macOs). Currently, `aarch64-daarwin` will build and run, but the cache is not yet automatically updated on each PR submission to this repo. -Forthcoming PR's will include: integrating the nix work into our ansible/packer builds, building natively on aarch64-darwin (macOs), more testing +### Nix Binary Cache Configuration + +To update our nix.conf to support the binary caches used by supabase: + +1. open `/etc/nix/nix.cong` +2. Add the following lines + + ``` + substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com + trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= + ``` +3. save changes to the `/etc/nix/nix.conf` file +4. On **linux**, run `sudo systemctl restart nix-daemon.service` on **macOS** run: `sudo launchctl stop org.nixos.nix-daemon` and `sudo launchctl start org.nixos.nix-daemon` +5. verify by running nix config show | grep 'substituters\|trusted-public-keys' From ab0913aa450d304526dbbdc9b4f7c3c59b907eea Mon Sep 17 00:00:00 2001 From: samrose Date: Tue, 6 Aug 2024 10:16:34 -0400 Subject: [PATCH 2/2] Update README.md Co-authored-by: Steve Chavez --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fe11f5532..5cfd160e8 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ The package set builds on target machines (`x86_64-linux` and `aarch64-linux`) w To update our nix.conf to support the binary caches used by supabase: -1. open `/etc/nix/nix.cong` +1. open `/etc/nix/nix.conf` 2. Add the following lines ```