66 flake-utils . url = "github:numtide/flake-utils" ;
77 } ;
88
9- outputs = { self , nixpkgs , flake-utils } :
9+ outputs =
10+ {
11+ self ,
12+ nixpkgs ,
13+ flake-utils ,
14+ } :
1015 let
1116 systems = [
1217 "x86_64-linux"
1722
1823 forAllSystems = f : nixpkgs . lib . genAttrs systems ( system : f system ) ;
1924
20- mkAuthConfig = system :
25+ mkAuthConfig =
26+ system :
2127 let
2228 pkgs = nixpkgs . legacyPackages . ${ system } ;
2329 lib = pkgs . lib ;
2733 pname = "supabase-auth" ;
2834 version = "0.1.0" ;
2935 src = ./. ;
30-
36+
3137 vendorHash = "sha256-QBQUUFWT3H3L7ajFV8cgi0QREXnm0ReIisD+4ACfLZQ=" ;
32-
33- buildFlags = [ "-tags" "netgo" ] ;
38+
39+ buildFlags = [
40+ "-tags"
41+ "netgo"
42+ ] ;
3443 doCheck = false ;
3544
3645 # Specify the main package
3746 subPackages = [ "." ] ;
38-
47+
3948 # Specify the output binary name
4049 postInstall = ''
4150 mv $out/bin/auth $out/bin/supabase-auth
8897 authConfigOutput = pkgs . stdenv . mkDerivation {
8998 name = "auth-config" ;
9099 src = ./. ;
91- buildInputs = [ pkgs . bash auth-service ] ;
100+ buildInputs = [
101+ pkgs . bash
102+ auth-service
103+ ] ;
92104
93105 buildPhase = ''
94106 mkdir -p $out/etc $out/bin $out/lib/systemd/system
95107
96108 # Write the auth configuration
97109 cat > $out/etc/auth.env <<EOF
98110 # Auth configuration generated by Nix
99- ${ lib . concatStringsSep "\n " ( lib . mapAttrsToList ( name : value : "${ name } =${ value } " ) config . config . auth . settings ) }
111+ ${ lib . concatStringsSep "\n " (
112+ lib . mapAttrsToList ( name : value : "${ name } =${ value } " ) config . config . auth . settings
113+ ) }
100114 EOF
101115
102116 # Write the systemd unit file
128142 # Write a script to manage the auth service
129143 cat > $out/bin/manage-auth <<EOF
130144 #!/bin/sh
131-
145+
132146 case "\$1" in
133147 start)
134148 echo "Starting auth service..."
135149 ${ auth-service } /bin/supabase-auth -c $out/etc/auth.env
136150 # Execute steps if enabled
137- ${ lib . optionalString config . config . steps . enable ( lib . concatStringsSep "\n " config . config . steps . commands ) }
151+ ${ lib . optionalString config . config . steps . enable (
152+ lib . concatStringsSep "\n " config . config . steps . commands
153+ ) }
138154 ;;
139155 stop)
140156 echo "Stopping auth service..."
244260 default = authConfigOutput ;
245261 } ;
246262 devShells . default = pkgs . mkShell {
247- buildInputs = [
248- pkgs . bash
263+ buildInputs = [
264+ pkgs . bash
249265 auth-service
250266 pkgs . go
251267 pkgs . gopls
268284 {
269285 packages = forAllSystems ( system : ( mkAuthConfig system ) . packages ) ;
270286 devShells = forAllSystems ( system : ( mkAuthConfig system ) . devShells ) ;
287+ formatter = forAllSystems ( system : nixpkgs . legacyPackages . ${ system } . nixfmt-tree ) ;
271288 } ;
272- }
289+ }
0 commit comments