Skip to content

Commit 9ca620b

Browse files
committed
fix: clean up nix flake and lock, drop overlay
1 parent d57e9e5 commit 9ca620b

File tree

5 files changed

+56
-87
lines changed

5 files changed

+56
-87
lines changed

flake.lock

Lines changed: 5 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
1414
git-hooks.url = "github:cachix/git-hooks.nix";
1515
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
16-
nixpkgs-go124.url = "github:Nixos/nixpkgs/3b9f00d7a7bf68acd4c4abb9d43695afb04e03a5";
17-
gatekeeper.url = "git+ssh://[email protected]/supabase/jit-db-gatekeeper?ref=sam/add-flake-parts&rev=34ba4a222c15b2480b837bbb3076508f36c9296f";
18-
gatekeeper.inputs.nixpkgs.follows = "nixpkgs";
16+
nixpkgs-go124.url = "github:Nixos/nixpkgs/d2ac4dfa61fba987a84a0a81555da57ae0b9a2b0";
1917
};
2018

2119
outputs =

nix/overlays/default.nix

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,5 @@
5151
buildPgrxExtension_0_14_3 = prev.buildPgrxExtension.override {
5252
cargo-pgrx = final.cargo-pgrx.cargo-pgrx_0_14_3;
5353
};
54-
55-
# place the gatekeeper module in the expected libpam location
56-
gatekeeper = self.packages.${final.system}.gatekeeper;
57-
linux-pam = prev.linux-pam.overrideAttrs (old: {
58-
postInstall =
59-
(old.postInstall or "")
60-
+ ''
61-
mkdir -p $out/lib/security
62-
cp ${final.gatekeeper}/lib/security/*.so $out/lib/security/
63-
'';
64-
});
6554
};
6655
}

nix/packages/default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
imports = [
44
./postgres.nix
5-
./gatekeeper.nix
5+
# ./gatekeeper.nix
66
];
77
perSystem =
88
{
@@ -37,6 +37,7 @@
3737
cleanup-ami = pkgs.callPackage ./cleanup-ami.nix { };
3838
dbmate-tool = pkgs.callPackage ./dbmate-tool.nix { inherit (self.supabase) defaults; };
3939
docs = pkgs.callPackage ./docs.nix { };
40+
gatekeeper = pkgs.callPackage ./gatekeeper.nix { inherit inputs pkgs; };
4041
supabase-groonga = pkgs.callPackage ./groonga { };
4142
local-infra-bootstrap = pkgs.callPackage ./local-infra-bootstrap.nix { };
4243
migrate-tool = pkgs.callPackage ./migrate-tool.nix { psql_15 = self'.packages."psql_15/bin"; };

nix/packages/gatekeeper.nix

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,50 @@
1-
{ inputs, ... }:
21
{
3-
perSystem =
4-
{ system, ... }:
5-
let
6-
7-
go124 = inputs.nixpkgs-go124.legacyPackages.${system}.go_1_24;
8-
in
9-
{
10-
packages.gatekeeper = inputs.gatekeeper.lib.${system}.makeGatekeeper { go = go124; };
11-
};
2+
inputs,
3+
system,
4+
pkgs,
5+
...
6+
}:
7+
let
8+
go124 = inputs.nixpkgs-go124.legacyPackages.${system}.go_1_24;
9+
# Use completely clean nixpkgs without any overlays for gatekeeper
10+
#cleanPkgs = inputs.nixpkgs.legacyPackages.${system};
11+
buildGoModule = pkgs.buildGoModule.override { go = go124; };
12+
in
13+
14+
buildGoModule {
15+
pname = "gatekeeper";
16+
version = "0.1.0";
17+
18+
src = pkgs.fetchFromGitHub {
19+
owner = "supabase";
20+
repo = "jit-db-gatekeeper";
21+
rev = "refs/heads/main";
22+
hash = "sha256-hrYh1dBxk+aN3b/J9mZqk/ZXHmWA/MIqZLVgICT7e90=";
23+
};
24+
25+
vendorHash = "sha256-G9x2TARSJMn30R6ZOlsggxEtn5t2ezWz1YtkLXdYiAE=";
26+
27+
buildInputs = [
28+
pkgs.pam
29+
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.Security ];
30+
31+
buildPhase = ''
32+
runHook preBuild
33+
go build -buildmode=c-shared -o pam_jwt_pg.so
34+
runHook postBuild
35+
'';
36+
37+
installPhase = ''
38+
runHook preInstall
39+
mkdir -p $out/lib/security
40+
cp pam_jwt_pg.so $out/lib/security/
41+
runHook postInstall
42+
'';
43+
44+
meta = with pkgs.lib; {
45+
description = "PAM module for JWT authentication with PostgreSQL backend";
46+
homepage = "https://github.com/supabase/jit-db-gatekeeper";
47+
license = licenses.mit;
48+
platforms = platforms.unix;
49+
};
1250
}

0 commit comments

Comments
 (0)