nix: move dev outputs to subflake

This commit is contained in:
seth 2024-04-10 01:03:45 -04:00
parent 3503dda44d
commit 921540e249
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86
18 changed files with 461 additions and 331 deletions

41
nix/dev/static.nix Normal file
View file

@ -0,0 +1,41 @@
{
perSystem = {
lib,
pkgs,
inputs',
refraction',
...
}: let
targets = with pkgs.pkgsCross; {
x86_64 = musl64.pkgsStatic;
aarch64 = aarch64-multiplatform.pkgsStatic;
};
toolchain = inputs'.rust-overlay.packages.rust.minimal.override {
extensions = ["rust-std"];
targets = map (pkgs: pkgs.stdenv.hostPlatform.config) (lib.attrValues targets);
};
rustPlatforms =
lib.mapAttrs (
lib.const (pkgs:
pkgs.makeRustPlatform (
lib.genAttrs ["cargo" "rustc"] (lib.const toolchain)
))
)
targets;
buildWith = rustPlatform:
refraction'.packages.refraction.override {
inherit rustPlatform;
optimizeSize = true;
};
in {
packages =
lib.mapAttrs' (
target: rustPlatform:
lib.nameValuePair "refraction-static-${target}" (buildWith rustPlatform)
)
rustPlatforms;
};
}