Commit Graph

17 Commits

Author SHA1 Message Date
Ivan Petkov
95b42093e5
downloadCargoPackageFromGit: take hash instead of sha256 (#691) 2024-08-29 15:47:52 -07:00
Ivan Petkov
5d6c16530f
downloadCargoPackageFromGit: set fetchLFS when an output hash is defined (#690) 2024-08-29 15:35:39 -07:00
Simon Žlender
aa5dcd0518
Splice overrideToolchain (#652)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2024-06-29 11:29:52 -07:00
Ivan Petkov
9787dc25b2
lib: use makeScopeWithSplicing' instead of makeScope (#634) 2024-06-03 02:48:19 +00:00
Ivan Petkov
b7a1655564
Fix crate vendoring to not run the default fixup phase (#619) 2024-05-19 21:59:49 +00:00
Ivan Petkov
54fe6fed44
vendorCargoDeps: allow arbitrary overrides when vendoring sources (#615) 2024-05-18 23:39:46 +00:00
Ivan Petkov
c5a3c5dac3
crane-utils: bump dependencies (#508) 2024-01-28 19:22:09 +00:00
Ivan Petkov
960d350770
vendorCargoDeps: manually splice packages to avoid cross build issues (#507)
* Source vendoring is passed as a standalone attribute to
  `mkCargoDerivation`, meaning it does not automagically get spliced
  with the correct local/cross system inputs (i.e. what would happen if
  it was a `depsBuildBuild` entry)
* To fix this we need to make sure that `vendorCargoDeps` and all of its
  transitive dependencies always use `runCommand` (and friends) from
  their `pkgsBuildBuild` equivalent. This should always be safe to do
  (even for cross-builds) since this amounts to building up a bunch of
  sources which will be read by the build system
* Unfortunately I had to manually specify `pkgsBuildBuild.whatever` in
  multiple places as I could not get things to work by messing with the
  `callPackage` definition. Perhaps we should be using
  `makeScopeWithSplicing'` instead of `makeScope` when constructing the
  library, but I couldn't get it working (and I couldn't find any decent
  docs on how to use it online) so this will make do for the time being.
2024-01-28 19:08:44 +00:00
Jörg Thalheim
16f5732c14
allow to pass outputHashes to crane (#266)
This makes it possible to evaluate crane in a nixos test without network
as well as allow to backup all fetched input derivations properly in a
binary cache, whereas fetchGit will fallback to downloading from a
repository, which also requires a `git` binary to be present.

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-09-22 04:08:53 +00:00
Ivan Petkov
8b4f7a4dab
various: switch to using runCommand to improve caching (#384)
For example, commands which extract a tarball should be cached (i.e
should use `runCommand` not `runCommandLocal`) because it allows builds
to download the unpacked result instead of having to write both to the
store
2023-09-04 00:33:25 +00:00
Ivan Petkov
7809d36971
downloadCargoPackageFromGit: resolve symlinks in crate directory (#367) 2023-08-12 01:26:37 +00:00
Ivan Petkov
00564437f3
Properly handle workspace inheritance in git dependencies (#224)
Crates from git repos are vendored in a flattened directory where each crate shows up at the root of the vendor directory. Since the vendoring step effectively breaks workspace structures, any crates which use workspace inheritance (e.g. package.version.workspace = true will fail to resolve.

To work around this we inspect the crate's workspace manifest (if it exists) and attempt to manually merge the values while copying the contents to the vendor directory.
2023-01-21 16:46:32 -08:00
Zhaofeng Li
2e24bc6591
downloadCargoPackageFromGit: Ignore crates with duplicate package IDs (#158)
For example, the Cargo git repo contains multiple "case" Cargo.toml
files in the testsuite. Let's ignore them like what Cargo does [1].

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2022-11-09 18:12:34 -08:00
Ivan Petkov
2ce1a3313e
Eliminate dead code (#148) 2022-10-23 23:20:22 +00:00
Ivan Petkov
f8d1e70dfc
Fix handling of git repos whose rev is not on the main branch
* When Nix fetches a git repo it will only look for the specified
  revision only starting from the main branch (apparently fetching
  arbitrary revisions from a repository has some security implications)
* If a ref (i.e. branch or tag) is not specified, Nix will only fetch
  the repo's main branch
* To remedy this we will supply Nix with the branch or tag (if specified
  in the Cargo.lock) to help it find the specified revision
* If cargo does not specify a branch or tag for us, we'll set `allRefs =
  true` so that Nix can try fetching all possible branches and tags
  before trying to check out the locked revision
2022-02-18 18:10:53 -08:00
Ivan Petkov
472d7ffc99
Handle case where a git repo contains multiple crates 2022-02-10 20:32:31 -08:00
Ivan Petkov
ca73fc5305
Add support for git dependencies 2022-02-07 20:03:12 -08:00