summaryrefslogtreecommitdiff
path: root/nix/static.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/static.nix')
-rw-r--r--nix/static.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/nix/static.nix b/nix/static.nix
new file mode 100644
index 0000000..f79de47
--- /dev/null
+++ b/nix/static.nix
@@ -0,0 +1,34 @@
+{
+ lib,
+ arch,
+ nixpkgs-tracker-bot,
+ fenix,
+ pkgsCross,
+}: let
+ crossTargetFor = with pkgsCross; {
+ x86_64 = musl64.pkgsStatic;
+ aarch64 = aarch64-multiplatform;
+ };
+
+ rustcTargetFor = lib.mapAttrs (lib.const (pkgs: pkgs.stdenv.hostPlatform.rust.rustcTarget)) crossTargetFor;
+ rustStdFor = lib.mapAttrs (lib.const (rustcTarget: fenix.targets.${rustcTarget}.stable.rust-std)) rustcTargetFor;
+
+ toolchain = with fenix;
+ combine (
+ [stable.cargo stable.rustc]
+ ++ lib.attrValues rustStdFor
+ );
+
+ crossPlatformFor =
+ lib.mapAttrs (
+ lib.const (pkgs:
+ pkgs.makeRustPlatform (
+ lib.genAttrs ["cargo" "rustc"] (lib.const toolchain)
+ ))
+ )
+ crossTargetFor;
+in
+ nixpkgs-tracker-bot.override {
+ rustPlatform = crossPlatformFor.${arch};
+ optimizeSize = true;
+ }