summaryrefslogtreecommitdiff
path: root/nix/static.nix
blob: c5e3c577e1ac409b97c9eb5ac4cfe08bbac370aa (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
35
{
  lib,
  fenix,
  pkgsCross,
  nixpkgs-tracker-bot,
}: let
  crossPkgsFor = with pkgsCross; {
    x86_64 = musl64.pkgsStatic;
    aarch64 = aarch64-multiplatform;
  };

  rustcTargetFor = lib.mapAttrs (lib.const (pkgs: pkgs.stdenv.hostPlatform.rust.rustcTarget)) crossPkgsFor;
  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)
        ))
    )
    crossPkgsFor;
in
  {arch}:
    nixpkgs-tracker-bot.override {
      rustPlatform = crossPlatformFor.${arch};
      inherit (crossPkgsFor.${arch}) openssl;
      optimizeSize = true;
    }