mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	Nix flake build static with sqlite support (#35149)
with `nix develop -c $SHELL` you can enter the dev environment. now with `make clean-all generate build -j1` you will get a static linked binary that has sqlite support
This commit is contained in:
		
							
								
								
									
										60
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										60
									
								
								flake.nix
									
									
									
									
									
								
							| @@ -11,33 +11,45 @@ | ||||
|         pkgs = nixpkgs.legacyPackages.${system}; | ||||
|       in | ||||
|       { | ||||
|         devShells.default = pkgs.mkShell { | ||||
|           buildInputs = with pkgs; [ | ||||
|             # generic | ||||
|             git | ||||
|             git-lfs | ||||
|             gnumake | ||||
|             gnused | ||||
|             gnutar | ||||
|             gzip | ||||
|         devShells.default = | ||||
|           with pkgs; | ||||
|           let | ||||
|             # only bump toolchain versions here | ||||
|             go = go_1_24; | ||||
|             nodejs = nodejs_24; | ||||
|             python3 = python312; | ||||
|           in | ||||
|           pkgs.mkShell { | ||||
|             buildInputs = [ | ||||
|               # generic | ||||
|               git | ||||
|               git-lfs | ||||
|               gnumake | ||||
|               gnused | ||||
|               gnutar | ||||
|               gzip | ||||
|  | ||||
|             # frontend | ||||
|             nodejs_22 | ||||
|               # frontend | ||||
|               nodejs | ||||
|  | ||||
|             # linting | ||||
|             python312 | ||||
|             uv | ||||
|               # linting | ||||
|               python3 | ||||
|               uv | ||||
|  | ||||
|             # backend | ||||
|             go_1_24 | ||||
|             gofumpt | ||||
|             sqlite | ||||
|           ]; | ||||
|           shellHook = '' | ||||
|             export GO="${pkgs.go_1_24}/bin/go" | ||||
|             export GOROOT="${pkgs.go_1_24}/share/go" | ||||
|           ''; | ||||
|         }; | ||||
|               # backend | ||||
|               go | ||||
|               glibc.static | ||||
|               gofumpt | ||||
|               sqlite | ||||
|             ]; | ||||
|             CFLAGS = "-I${glibc.static.dev}/include"; | ||||
|             LDFLAGS = "-L ${glibc.static}/lib"; | ||||
|             GO = "${go}/bin/go"; | ||||
|             GOROOT = "${go}/share/go"; | ||||
|  | ||||
|             TAGS = "sqlite sqlite_unlock_notify"; | ||||
|             STATIC = "true"; | ||||
|           }; | ||||
|       } | ||||
|     ); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user