diff options
| author | seth <[email protected]> | 2024-05-27 04:55:45 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-05-27 04:56:48 -0400 |
| commit | c69eea2f4823da476628742fbbec600ee95ac049 (patch) | |
| tree | 7cf3d87f5f202e6049ba44a06ac6fe9d3558826b /nix/static.nix | |
initial commit
Diffstat (limited to 'nix/static.nix')
| -rw-r--r-- | nix/static.nix | 34 |
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; + } |
