Skip to content

Nix flake build static with sqlite support #35149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

6543
Copy link
Member

@6543 6543 commented Jul 23, 2025

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

example:
image

@6543 6543 requested a review from techknowlogick July 23, 2025 13:42
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 23, 2025
@6543 6543 changed the title Nix flake build static with sqlite support WIP: Nix flake build static with sqlite support Jul 23, 2025
@6543 6543 added the pr/wip This PR is not ready for review label Jul 23, 2025
@6543
Copy link
Member Author

6543 commented Jul 24, 2025

Before, we can build (cross-compile) Gitea without CGO

@wxiaoguang now it should not break anything :)

You could probably put this env var in the nix flake though.

done ...

I suggest something like GO_BUILD_VARS ?= in the Makefile ...

well the makefile could be reworked to use less specific env vars and build things up to be collected in one var ... but I think this is some refactor to be done in another pull dedicated to it ... if one wants to

Same question, why CGO_ENABLED is needed, why -extldflags -static is needed

because if you dont build static in nixos the gitea binary just panics:

image

@6543 6543 requested a review from techknowlogick July 24, 2025 14:39
@6543 6543 changed the title WIP: Nix flake build static with sqlite support Nix flake build static with sqlite support Jul 24, 2025
@6543 6543 removed the pr/wip This PR is not ready for review label Jul 24, 2025
@6543
Copy link
Member Author

6543 commented Jul 24, 2025

image

@6543
Copy link
Member Author

6543 commented Jul 24, 2025

@techknowlogick pam needs cgo too - added :)

and it does not support static linking ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/internal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants