From c69eea2f4823da476628742fbbec600ee95ac049 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 27 May 2024 04:55:45 -0400 Subject: initial commit --- nix/static.nix | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 nix/static.nix (limited to 'nix/static.nix') 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; + } -- cgit v1.2.3