nix: naersk
/fenix
-> rustPlatform
/rust-overlay
This commit is contained in:
parent
6bd5db7208
commit
3c4cf67bbf
9 changed files with 164 additions and 242 deletions
41
nix/deployment/static.nix
Normal file
41
nix/deployment/static.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
perSystem = {
|
||||
lib,
|
||||
pkgs,
|
||||
inputs',
|
||||
self',
|
||||
...
|
||||
}: 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:
|
||||
self'.packages.refraction.override {
|
||||
inherit rustPlatform;
|
||||
lto = true;
|
||||
};
|
||||
in {
|
||||
packages =
|
||||
lib.mapAttrs' (
|
||||
target: rustPlatform:
|
||||
lib.nameValuePair "refraction-static-${target}" (buildWith rustPlatform)
|
||||
)
|
||||
rustPlatforms;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue