1.3 KiB
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:
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:
./result/bin/server server
Use the external PostgreSQL build on NixOS when preferred:
cargo build --release --package server --no-default-features