From 21495d83976da4945409a9c9c6c8fa7103ca9aa6 Mon Sep 17 00:00:00 2001 From: RTUnreal Date: Tue, 27 Oct 2026 17:38:03 +0100 Subject: [PATCH 1/3] add ci --- .github/workflows/test.yml | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..97c8c14 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,46 @@ +name: Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Merge main into PR branch + if: github.event_name == 'pull_request' + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git fetch origin main + if ! git merge origin/main; then + echo "Merge failed due to conflicts. Please rebase your branch on main." + exit 1 + fi + + - name: Install Nix + uses: cachix/install-nix-action@v31 + + - name: Setup Nix cache + uses: nix-community/cache-nix-action@v7 + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}- + # don't keep caches from previous CI runs around. newest main should always be enough + purge: true + purge-prefixes: nix-${{ runner.os }}- + purge-created: 0 + purge-primary-key: never + + - name: Run checks + run: nix flake check --log-format bar-with-logs From c456abc7a5daa992cf794017b21f028908aefc46 Mon Sep 17 00:00:00 2001 From: RTUnreal Date: Tue, 27 Oct 2026 17:40:15 +0100 Subject: [PATCH 2/3] fix flake inputs --- flake.lock | 18 +++++++++--------- flake.nix | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index a7d55a4..87f2743 100644 --- a/flake.lock +++ b/flake.lock @@ -119,17 +119,17 @@ ] }, "locked": { - "lastModified": 1792356557, - "narHash": "sha256-GTMhkAlEalpXquoZsmgAVmJ4IqGmIPDZFCuG3cKHRF0=", - "ref": "refs/heads/devenv", - "rev": "e6f551364ba590f44469dabbb49bcadfeb2621aa", - "revCount": 299, - "type": "git", - "url": "file:///home/trr/dev/RTUnreal/wrappers" + "lastModified": 1792487907, + "narHash": "sha256-X/+r5QLrzFmlO4Kx4WKEu2Ol/Xr6XWSjyIMd//Sl0Mo=", + "owner": "lassulus", + "repo": "wrappers", + "rev": "37d05efcab820ef96f083b251040ae2848445959", + "type": "github" }, "original": { - "type": "git", - "url": "file:///home/trr/dev/RTUnreal/wrappers" + "owner": "lassulus", + "repo": "wrappers", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index b3f6b4a..b752042 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; wrappers = { - url = "git+file:///home/trr/dev/RTUnreal/wrappers"; + url = "github:lassulus/wrappers"; inputs.nixpkgs.follows = "nixpkgs"; }; rust-overlay.url = "github:oxalica/rust-overlay"; From ddae4ed7d3ab29cd6e31067d362ff0496486a70f Mon Sep 17 00:00:00 2001 From: RTUnreal Date: Tue, 27 Oct 2026 20:22:23 +0100 Subject: [PATCH 3/3] flake/devenv: add process deps and complete adminer login --- flake.nix | 134 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 85 insertions(+), 49 deletions(-) diff --git a/flake.nix b/flake.nix index b752042..56161e5 100644 --- a/flake.nix +++ b/flake.nix @@ -31,55 +31,16 @@ pkgs, lib, system, + self', ... }: let devState = "$(pwd)/.devState"; pgPort = 5432; - - postgres-process = pkgs.writeShellApplication { - name = "postgress-process"; - runtimeInputs = [ - pkgs.postgresql - ]; - text = '' - PGDATA="${devState}/postgres/db" - export PGDATA - echo "PGDATA: $PGDATA" - echo "PGHOST: $PGHOST" - - - copyConfig() { - # TODO: this should be run every startup - cat > "$PGDATA/postgresql.conf" < "$PGDATA/postgresql.conf" < /dev/null 2>&1 + else + echo "Waiting for PostgreSQL initialization to complete..." 2>&1 + exit 1 + fi + ''; + }; + in + { + command = lib.getExe command; + readiness_probe = { + exec.command = lib.getExe check; + initial_delay_seconds = 2; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; + }; + # SIGINT requests a fast shutdown: https://www.postgresql.org/docs/current/server-shutdown.html + shutdown.signal = 2; + }; }; }; }).wrapper; @@ -151,11 +187,11 @@ ]; shellHook = '' - export PGHOST="${devState}/postgres-socket" + export PGHOST="${devState}/postgres/socket" mkdir -p "$PGHOST" - export DATABASE_URL="postgresql://app:app@$(${lib.getExe pkgs.python311} -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1], safe='''))" "$PGHOST")/app" + export DATABASE_URL="postgresql://${pgUser}:${pgPW}@$(${lib.getExe pkgs.python311} -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1], safe='''))" "$PGHOST")/${pgDB}" - echo "Adminer url: http://127.0.0.1:8100/?pgsql=$(${lib.getExe pkgs.python311} -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1], safe='''))" "$PGHOST")" + echo "Adminer url: http://127.0.0.1:8100/?pgsql=$(${lib.getExe pkgs.python311} -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1], safe='''))" "$PGHOST")&username=${pgUser}&db=${pgDB}" ''; }; };