summaryrefslogtreecommitdiff
path: root/nix/static.nix
blob: 86a1cc34cbeddc1ffd12e658d2894fb5709594c6 (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
36
37
38
39
40
41
42
43
44
45
{
  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;
}