summaryrefslogtreecommitdiff
path: root/crates/default.nix
blob: 7204dae3ec237b8794cd6908be946730e2499067 (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
{
  arches,
  fenix,
  nixpkgs,
  system,
}:

let
  toml = builtins.fromTOML (builtins.readFile ./kernel/Cargo.toml);

  mkLibKernel =
    _:
    { crossSystem, rust-target }:
    let
      pkgs = import nixpkgs {
        inherit system;
        crossSystem.config = crossSystem;
      };

      rust-toolchain = fenix.combine [
        fenix.stable.cargo
        fenix.stable.rustc
        fenix.stable.clippy
        fenix.targets.${rust-target}.stable.rust-std
      ];

      rust = pkgs.makeRustPlatform {
        cargo = rust-toolchain;
        rustc = rust-toolchain;
      };
    in

    rust.buildRustPackage {
      pname = toml.package.name;
      version = toml.package.version;
      src = ./.;
      cargoLock.lockFile = ./Cargo.lock;
      dontFixup = true;
    };
in

nixpkgs.lib.recurseIntoAttrs (builtins.mapAttrs mkLibKernel arches)