mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-05-09 16:29:45 +00:00
* nix: parameterize build flags with named args
Expose `enablePostgres`, `enableNimDebugDlOpen`, and `chroniclesLogLevel`
as arguments on `nix/default.nix`. Defaults preserve today's hardcoded
behavior, so `nix build .#liblogosdelivery` with no overrides is a
no-op change.
Consume the package via `callPackage` in `flake.nix` so consumers can
use `.override { ... }` without extra wrapping.
* nix: link libstdc++ on Linux so consumers don't need patchelf
Append `stdenv.cc.cc.lib` to `buildInputs` on Linux and add `-lstdc++`
to the Nim `--passL` flags. Nix stdenv's fixupPhase will auto-inject
`${stdenv.cc.cc.lib}/lib` into the output's RUNPATH, so downstream
consumers can drop their patchelf step.
macOS resolves the C++ stdlib via dyld/libc++ and is unaffected.
* nix: bundle librln into the output for a self-contained package
Copy the librln shared library (`librln.so` / `librln.dylib`) from the
zerokit input into `$out/lib` and rewrite the internal reference in
`liblogosdelivery`:
- Darwin: set librln's install name to `@rpath/librln.dylib`, change the
consumer's reference to match, and add `@loader_path` as an rpath.
- Linux: add `$ORIGIN` to the rpath so `librln.so` resolves from the
sibling directory, preserving the gcc-lib entry injected by the stdenv
fixupPhase for libstdc++.
The installed `liblogosdelivery` no longer carries a `/nix/store/...`
absolute path to zerokit, so downstream consumers can ship the bundle
as-is.
84 lines
2.3 KiB
Nix
84 lines
2.3 KiB
Nix
{
|
|
description = "logos-delivery nim build flake";
|
|
|
|
nixConfig = {
|
|
extra-substituters = [ "https://nix-cache.status.im/" ];
|
|
extra-trusted-public-keys = [
|
|
"nix-cache.status.im-1:x/93lOfLU+duPplwMSBR+OlY4+mo+dCN7n0mr4oPwgY="
|
|
];
|
|
};
|
|
|
|
inputs = {
|
|
# Pinning the commit to use same commit across different projects.
|
|
# A commit from nixpkgs 25.11 release: https://github.com/NixOS/nixpkgs/tree/release-25.11
|
|
nixpkgs.url = "github:NixOS/nixpkgs?rev=23d72dabcb3b12469f57b37170fcbc1789bd7457";
|
|
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# External flake input: Zerokit pinned to a specific commit.
|
|
# Update the rev here when a new zerokit version is needed.
|
|
zerokit = {
|
|
url = "github:vacp2p/zerokit/53b18098e6d5d046e3eb1ac338a8f4f651432477";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, rust-overlay, zerokit }:
|
|
let
|
|
systems = [
|
|
"x86_64-linux" "aarch64-linux"
|
|
"x86_64-darwin" "aarch64-darwin"
|
|
"x86_64-windows"
|
|
];
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs systems;
|
|
|
|
nimbleOverlay = final: prev: {
|
|
nimble = prev.nimble.overrideAttrs (_: {
|
|
version = "0.22.3";
|
|
src = prev.fetchFromGitHub {
|
|
owner = "nim-lang";
|
|
repo = "nimble";
|
|
rev = "v0.22.3";
|
|
sha256 = "sha256-f7DYpRGVUeSi6basK1lfu5AxZpMFOSJ3oYsy+urYErg=";
|
|
};
|
|
});
|
|
};
|
|
|
|
pkgsFor = system: import nixpkgs {
|
|
inherit system;
|
|
overlays = [ (import rust-overlay) nimbleOverlay ];
|
|
};
|
|
in {
|
|
packages = forAllSystems (system:
|
|
let
|
|
pkgs = pkgsFor system;
|
|
liblogosdelivery = pkgs.callPackage ./nix/default.nix {
|
|
inherit pkgs;
|
|
src = ./.;
|
|
zerokitRln = zerokit.packages.${system}.rln;
|
|
};
|
|
in {
|
|
inherit liblogosdelivery;
|
|
default = liblogosdelivery;
|
|
}
|
|
);
|
|
|
|
devShells = forAllSystems (system:
|
|
let
|
|
pkgs = pkgsFor system;
|
|
in {
|
|
default = pkgs.mkShell {
|
|
nativeBuildInputs = with pkgs; [
|
|
nim-2_2
|
|
nimble
|
|
];
|
|
};
|
|
}
|
|
);
|
|
};
|
|
}
|