portable server with embedded for musl has different feature

This commit is contained in:
Priec
2026-08-14 13:56:57 +02:00
parent da8457cd4e
commit 0e79c62511
6 changed files with 312 additions and 16 deletions

35
packaging/musl/README.md Normal file
View File

@@ -0,0 +1,35 @@
# Portable Linux server build
This build produces one `x86_64` Linux server executable with embedded
PostgreSQL. The Rust program is statically linked against musl. PostgreSQL is
compiled against musl without optional host-library dependencies and is stored
inside the executable by `postgresql_embedded`.
PostgreSQL itself remains dynamically loadable so the `btree_gist` extension
used by the migrations works. Its musl loader is included in the embedded
archive, and static launcher executables invoke every PostgreSQL tool through
that loader. Neither glibc, musl, PostgreSQL nor timezone data needs to be
installed on the target machine.
Build directly through the repository's Nix flake:
```sh
nix build '.?submodules=1#portable-server'
```
The `submodules=1` flag includes the workspace's nested Rust repositories. The
artifact is available as `result/bin/server`. The derivation initializes a
temporary cluster, creates `btree_gist`, sets the timezone to `UTC`, and checks
that the final Rust executable has no ELF interpreter.
The resulting executable is intended for 64-bit Linux kernels. Run it normally:
```sh
./result/bin/server server
```
Use the external PostgreSQL build on NixOS when preferred:
```sh
cargo build --release --package server --no-default-features
```