rust-template/Cargo.nix

71 lines
2.1 KiB
Nix
Raw Permalink Normal View History

2024-09-03 09:08:58 +00:00
# This file was @generated by cargo2nix 0.11.0.
# It is not intended to be manually edited.
2024-09-05 08:12:13 +00:00
args @ {
2024-09-03 09:08:58 +00:00
release ? true,
rootFeatures ? [
"rust-template/default"
],
rustPackages,
buildRustPackages,
hostPlatform,
hostPlatformCpu ? null,
hostPlatformFeatures ? [],
target ? null,
codegenOpts ? null,
profileOpts ? null,
cargoUnstableFlags ? null,
rustcLinkFlags ? null,
rustcBuildFlags ? null,
mkRustCrate,
rustLib,
lib,
workspaceSrc,
ignoreLockHash,
2024-09-05 08:12:13 +00:00
}: let
2024-09-03 09:08:58 +00:00
nixifiedLockHash = "4598ab22b158163d169b6aea289131643ca58806898bb56966fba495f4660c02";
2024-09-05 08:12:13 +00:00
workspaceSrc =
if args.workspaceSrc == null
then ./.
else args.workspaceSrc;
2024-09-03 09:08:58 +00:00
currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock);
2024-09-05 08:12:13 +00:00
lockHashIgnored =
if ignoreLockHash
then builtins.trace "Ignoring lock hash" ignoreLockHash
else ignoreLockHash;
2024-09-03 09:08:58 +00:00
in
2024-09-05 08:12:13 +00:00
if !lockHashIgnored && (nixifiedLockHash != currentLockHash)
then throw "Cargo.nix ${nixifiedLockHash} is out of sync with Cargo.lock ${currentLockHash}"
else let
inherit (rustLib) fetchCratesIo fetchCrateLocal fetchCrateGit fetchCrateAlternativeRegistry expandFeatures decideProfile genDrvsByProfile;
profilesByName = {
};
rootFeatures' = expandFeatures rootFeatures;
overridableMkRustCrate = f: let
drvs = genDrvsByProfile profilesByName ({
profile,
profileName,
}:
mkRustCrate ({inherit release profile hostPlatformCpu hostPlatformFeatures target profileOpts codegenOpts cargoUnstableFlags rustcLinkFlags rustcBuildFlags;} // (f profileName)));
in
{
compileMode ? null,
profileName ? decideProfile compileMode release,
}: let
drv = drvs.${profileName};
in
if compileMode == null
then drv
else drv.override {inherit compileMode;};
in {
cargo2nixVersion = "0.11.0";
workspace = {
rust-template = rustPackages.unknown.rust-template."0.1.0";
};
"unknown".rust-template."0.1.0" = overridableMkRustCrate (profileName: rec {
name = "rust-template";
version = "0.1.0";
registry = "unknown";
src = fetchCrateLocal workspaceSrc;
});
}