summaryrefslogtreecommitdiff
path: root/nix/static.nix
blob: f79de47d1c95a679bfc831beb8749dc680c2de4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
  }