Skip to content

Instantly share code, notes, and snippets.

@gustavderdrache
Last active June 24, 2020 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gustavderdrache/cb123a35b07f8152b41d0ca8323a2c3e to your computer and use it in GitHub Desktop.
Save gustavderdrache/cb123a35b07f8152b41d0ca8323a2c3e to your computer and use it in GitHub Desktop.
let
defaultRustChannel = target: pkgs.rustChannelOf {
rustToolchain = ./rust-toolchain;
targets = [ target ];
extensions = [ "rust-std" ];
targetExtensions = [ "rust-std" ];
};
binary =
{ rustTarget
, features ? configurations.${rustTarget}.features
, linking ? "dynamic"
, rustChannel ? defaultRustChannel rustTarget
, hostPkgs ? pkgs
, targetPkgs ? hostPkgs
, buildType ? "debug"
, logLevel ? "debug"
, runCheckPhase ? true
}:
let
defintion = import ./scripts/environment/definition.nix {
inherit tools hostPkgs targetPkgs rustTarget;
};
/* other code here */
rustPlatform = targetPkgs.makeRustPlatform {
inherit (rustChannel) cargo rustc;
};
in
rustPlatform.buildRustPackage packageDefinition;
in
/* other code here */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment