mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-13 20:26:52 +00:00
113 lines
3.6 KiB
Nix
113 lines
3.6 KiB
Nix
{
|
|
inputs,
|
|
self,
|
|
...
|
|
}:
|
|
{
|
|
perSystem =
|
|
{
|
|
self',
|
|
lib,
|
|
pkgs,
|
|
inputs',
|
|
system,
|
|
craneLib,
|
|
mkToolchain,
|
|
...
|
|
}:
|
|
{
|
|
packages =
|
|
let
|
|
# These musl deps aren't in the binary cache, so they're built locally, and their
|
|
# test suites run (and break) when the builder can execute musl binaries.
|
|
#
|
|
# TODO: drop tzdata override once https://github.com/NixOS/nixpkgs/pull/582577 reaches nixos-unstable
|
|
# - tzdata: `now.ck` checks against the current date.
|
|
# TODO: drop sqlite override once https://github.com/NixOS/nixpkgs/issues/580629 is resolved
|
|
# - sqlite: its test runner fails to build `testfixture` when cross-compiling to musl.
|
|
muslOverlay =
|
|
_final: prev:
|
|
lib.genAttrs [ "tzdata" "sqlite" ] (
|
|
name:
|
|
if prev.stdenv.hostPlatform.isMusl then
|
|
prev.${name}.overrideAttrs { doCheck = false; }
|
|
else
|
|
prev.${name}
|
|
);
|
|
|
|
mkPackages =
|
|
pkgs:
|
|
let
|
|
fnx = inputs'.fenix.packages;
|
|
|
|
isStatic = pkgs.stdenv.hostPlatform.isMusl;
|
|
|
|
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain (
|
|
_:
|
|
if isStatic then
|
|
fnx.combine [
|
|
self'.packages.stable-toolchain
|
|
(mkToolchain fnx.targets.${pkgs.stdenv.hostPlatform.config}).rust-std
|
|
]
|
|
else
|
|
self'.packages.stable-toolchain
|
|
);
|
|
|
|
# extra features via `cargoExtraArgs`
|
|
cargoExtraArgs = "-F http3";
|
|
|
|
default = pkgs.callPackage ./continuwuity.nix {
|
|
inherit self craneLib;
|
|
|
|
liburing = (if isStatic then pkgs.pkgsStatic else pkgs).liburing;
|
|
rocksdb = if isStatic then null else self'.packages.rocksdb;
|
|
|
|
inherit cargoExtraArgs;
|
|
# extra RUSTFLAGS via `rustflags`
|
|
# the stuff below is required for http3
|
|
rustflags = "--cfg reqwest_unstable";
|
|
};
|
|
|
|
# users may also override this with other cargo profiles to build for other feature sets
|
|
# for features configuration see `default` package which enables http3 by default
|
|
|
|
max-perf = default.override {
|
|
# compiles slower but with more thorough optimizations
|
|
profile = "release-max-perf";
|
|
cargoExtraArgs = "${cargoExtraArgs} -F release_max_log_level";
|
|
};
|
|
|
|
max-perf-haswell = max-perf.override {
|
|
# compiles explicitly for haswell arch cpus
|
|
target_cpu = "haswell";
|
|
};
|
|
in
|
|
{
|
|
inherit default max-perf max-perf-haswell;
|
|
};
|
|
in
|
|
{
|
|
rocksdb = pkgs.callPackage ./rocksdb.nix { };
|
|
}
|
|
// (mkPackages pkgs)
|
|
// (lib.mapAttrs' (name: value: lib.nameValuePair "${name}-static-x86_64" value) (
|
|
mkPackages (
|
|
import inputs.nixpkgs {
|
|
localSystem = system;
|
|
crossSystem = "x86_64-unknown-linux-musl";
|
|
overlays = [ muslOverlay ];
|
|
}
|
|
)
|
|
))
|
|
// (lib.mapAttrs' (name: value: lib.nameValuePair "${name}-static-aarch64" value) (
|
|
mkPackages (
|
|
import inputs.nixpkgs {
|
|
localSystem = system;
|
|
crossSystem = "aarch64-unknown-linux-musl";
|
|
overlays = [ muslOverlay ];
|
|
}
|
|
)
|
|
));
|
|
};
|
|
}
|