diff --git a/Cargo.nix b/Cargo.nix index 9d66681..b600c1c 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -1,7 +1,6 @@ # This file was @generated by cargo2nix 0.11.0. # It is not intended to be manually edited. - -args@{ +args @ { release ? true, rootFeatures ? [ "rust-template/default" @@ -22,37 +21,50 @@ args@{ lib, workspaceSrc, ignoreLockHash, -}: -let +}: let nixifiedLockHash = "4598ab22b158163d169b6aea289131643ca58806898bb56966fba495f4660c02"; - workspaceSrc = if args.workspaceSrc == null then ./. else args.workspaceSrc; + workspaceSrc = + if args.workspaceSrc == null + then ./. + else args.workspaceSrc; currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock); - lockHashIgnored = if ignoreLockHash - then builtins.trace "Ignoring lock hash" ignoreLockHash - else ignoreLockHash; -in 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; }; + lockHashIgnored = + if ignoreLockHash + then builtins.trace "Ignoring lock hash" ignoreLockHash + else ignoreLockHash; 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; - }); - -} + 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; + }); + } diff --git a/renovate.json b/renovate.json index b54dda1..748669a 100644 --- a/renovate.json +++ b/renovate.json @@ -1,5 +1,15 @@ { "extends": [ "config:best-practices" - ] + ], + "postUpgradeTasks": { + "commands": [ + "cargo2nix -o", + "alejandra ." + ], + "fileFilters": [ + "Cargo.toml", + "Cargo.lock" + ] + } } \ No newline at end of file