Commit Graph

106 Commits

Author SHA1 Message Date
Eman Resu
93d9b98b13 fetchgit: partially apply hasInfix 2026-07-20 10:30:10 -04:00
Philip Taron
0c469218f3 build-support: remove assertMsg, throwIf, and throwIfNot usage (#524535) 2026-05-28 18:09:32 +00:00
Hans Joachim Kliemeck
8478c2384b stdenv: Package URL (PURL) metadata fields 2026-05-26 21:47:54 +02:00
Eman Resu
661fe16b08 build-support/fetchgit: remove assertMsg usage 2026-05-26 14:14:41 -04:00
HigherOrderLogic
afa98a746b fetchgit: remove unused argument 2026-02-07 02:53:27 +00:00
Philip Taron
cca4ec8008 fetchgit: take postCheckout to allow gathering revision and commit metadata without leaving .git (#465497) 2025-12-17 19:41:13 +00:00
Yueh-Shun Li
689380e029 fetchurl, fetchgit: use __structuredAttrs = true and pass curlOptsList and sparseCheckout as lists (#464475) 2025-12-11 18:25:29 +00:00
Yueh-Shun Li
4e37d03ba2 fetchgit: reference hash from finalAttrs.hash 2025-12-10 01:07:13 +08:00
Yueh-Shun Li
982cafd8c6 fetchgit: use __structuredAttrs = true 2025-12-09 12:35:42 +08:00
Yueh-Shun Li
fc295b1e28 fetchgit: take postCheckout to allow collecting revision without leaving .git 2025-12-09 12:27:27 +08:00
Yueh-Shun Li
ea1e4d73d8 fetchgit: adjust format for sparseCheckout default
Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
2025-12-08 21:52:45 +08:00
Yueh-Shun Li
5c51547b22 fetchgit: sparseCheckout: reference depending attributes from finalAttrs 2025-12-04 15:28:38 +08:00
Yueh-Shun Li
8c85578602 fetchgit: format expression after eliminating global assertions 2025-12-04 15:26:16 +08:00
Yueh-Shun Li
d1275c4ff1 fetchgit: move sparseCheckout type check down to sparseCheckoutText 2025-12-04 15:25:40 +08:00
Yueh-Shun Li
dd264228ff fetchgit: default sparseCheckout to null and handle the default internally 2025-12-04 15:25:39 +08:00
Yueh-Shun Li
83b42e34ec fetchgit: keep sparseCheckout a list and stringify as sparseCheckoutText 2025-12-04 15:25:39 +08:00
Yueh-Shun Li
ea5b3c6d5d fetchgit: nonConeMode: reference depending attributes from finalAttrs 2025-12-04 15:25:35 +08:00
Yueh-Shun Li
6c5dc5d57f fetchgit: default nonConeMode to null and manage its default internally 2025-12-04 15:22:33 +08:00
Yueh-Shun Li
9fe4e65f3c fetchgit: default argument leaveDotGit to null 2025-11-17 02:09:55 +08:00
Yueh-Shun Li
1d6c7d6650 fetchgit: move assertions down to argument values 2025-11-16 04:04:51 +08:00
Yueh-Shun Li
2946555411 fetchgit: expose getRevWithTag as fetchgit.getRevWithTag 2025-11-03 21:31:04 +08:00
Yueh-Shun Li
21677a6bd8 fetchgit: pass rev as revCustom and make overridable 2025-11-03 21:31:04 +08:00
Yueh-Shun Li
dbf76b7c1b fetchgit: pass tag directly and make overridable 2025-11-03 21:31:04 +08:00
Yueh-Shun Li
076076e946 fetchgit: abstract and simplify revWithTag 2025-11-03 21:31:04 +08:00
Yueh-Shun Li
38f61c3f10 fetchgit: take derivationArgs 2025-11-03 21:31:03 +08:00
Yueh-Shun Li
aeddd850c6 fetchurl, fetchzip, fetchgit: format Nix expression after lib.extendMkDerivation 2025-10-28 06:41:42 +08:00
Yueh-Shun Li
ae5b3bdb05 fetchgit: restructure with lib.extendMkDerivation (not formatted) 2025-10-28 06:38:46 +08:00
Yueh-Shun Li
a7023948c0 fetchgit: take passthru 2025-10-28 01:47:34 +08:00
d068328
e47455f51d Revert "stdenv: pURL implementation (#421125)"
This reverts commit 5427115670, reversing
changes made to 88ee2ac331.
2025-10-18 20:41:01 +00:00
Arian van Putten
5427115670 stdenv: pURL implementation (#421125) 2025-10-17 09:30:32 +00:00
Hans Joachim Kliemeck
028af7c17d stdenv: pURL review suggestions - replace merge 2025-10-14 17:02:51 +00:00
Hans Joachim Kliemeck
bacccc39a9 stdenv: pURL - fix chaining case (github&submodules using fetchgit) 2025-10-14 14:53:13 +00:00
h0nIg
4e2614fc07 stdenv: pURL implementation 2025-10-03 21:19:09 +00:00
Alexander Bantyev
80d9975bd4 config: add a gitConfig/gitConfigFile option
Adds a `gitConfig` option (and `gitConfigFile`), to set a default
`gitConfigFile` argument for `fetchgit`.
2025-09-29 22:34:54 +02:00
Alexander Bantyev
296399ec68 fetchgit: add a gitConfigFile argument
Passing a `gitConfigFile` argument as a string allows setting a custom
git config (as `$GIT_CONFIG_GLOBAL`). The most obvious use is to
override URLs with custom mirrors, but others are possible too.
2025-09-29 22:34:11 +02:00
Philip Taron
754ee2fc40 fetchgit: Add rootDir argument (#427165) 2025-08-10 17:38:43 -07:00
Yuriy Taraday
34612851db fetchgit: Add rootDir argument
With this argument fetchgit will make a subdirectory of the Git
repository a root of the resulting store path. This is helpful for
dealing with monorepos where many projects are in separate directories
and don't need a new source hash every time the monorepo is updated.

Commit hash is removed from the name of the derivation to prevent it
from changing the store path when nothing in the subdirectory changes.
2025-08-08 16:20:05 +02:00
Philip Taron
0ca32f3372 tor: add tor.proxyHook (#426763) 2025-07-25 15:16:39 -07:00
Ryan Hendrickson
a3947d986f tor: add tor.proxyHook
tor.proxyHook is a setup hook intended for use with HTTP-based fetchers,
enabling them to download from .onion addresses using Tor as a proxy.
2025-07-24 13:25:04 -04:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Jan Malakhovski
7c8a4efb68 lib, treewide: introduce repoRevToName, use it in most fetch* functions
This patch adds `lib.repoRevToName` function that generalizes away most of the
code used for derivation name generation by `fetch*` functions (`fetchzip`,
`fetchFromGitHub`, etc, except those which are delayed until latter commits
for mass-rebuild reasons).

It's first argument controls how the resulting name will look (see below).

Since `lib` has no equivalent of Nixpkgs' `config`, this patch adds
`config.fetchedSourceNameDefault` option to Nixpkgs and then re-exposes
`lib.repoRevToName config.fetchedSourceNameDefault` expression as
`pkgs.repoRevToNameMaybe` which is then used in `fetch*` derivations.

The result is that different values of `config.fetchedSourceNameDefault` now
control how the `src` derivations produced by `fetch*` functions are to be
named, e.g.:

- `fetchedSourceNameDefault = "source"` (the default):

  ```
  $ nix-instantiate -A fuse.src
  /nix/store/<hash>-source.drv
  ```

- `fetchedSourceNameDefault = "versioned"`:

  ```
  $ nix-instantiate -A fuse.src
  /nix/store/<hash>-libfuse-2.9.9-source.drv
  ```

- `fetchedSourceNameDefault = "full"`:

  ```
  $ nix-instantiate -A fuse.src
  /nix/store/<hash>-libfuse-2.9.9-github-source.drv
  ```

See the documentation of `config.fetchedSourceNameDefault` for more info.
2025-05-31 10:01:21 +00:00
Tim Black
1247031689 pkgs/build-support/fetchgit: add fetchTags parameter
Added fetchTags feature to fetchgit, explicit and clear support for
fetching all tags after the source tree fetch completes. Doing this at
build-time in the fetcher is required for packages that invoke commands
like 'git describe' which require tags, and since the nix store is
read-only by design, it is not possible to git fetch --tags at
activation- or run-time. This feature may have been possible by
specifying a postFetch option including calling git fetch --tags,
however doing so obfuscates the solution to this very real problem.
Explicit support for fetching tags should be a first class citizen just
like fetching other refs.
2025-05-28 16:47:34 -07:00
Adam Dinwoodie
d95d3724d8 fetchgit: add preFetch hook
This allows running code to change the environment before the
nix-prefetch-git script is run.  In particular, it allows setting things
like NIX_PREFETCH_GIT_CHECKOUT_HOOK, which allows additional code to be
run before deleting the .git directory.

This also means there's potentially value in performing a deep clone
then removing the .git directory, so remove the assertion that prevents
doing so.
2025-05-06 14:14:26 +01:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Alex
1f05c38ab8 fetchgit: now accepts nativeBuildInputs, similar to e.g. fetchzip, fetchpatch 2025-02-25 17:08:26 -08:00
Peder Bergebakken Sundt
1f50def18f fetchgit: passthru tag 2024-12-30 23:08:07 +01:00
Atemu
e9a31f5146 fetchgit{,hub}: assert illegal tag + rev combinations
It's quite a bit more complex due to this but this was asked for during review
2024-12-05 16:29:11 +01:00
Atemu
cb9f9a1e5a fetchgit{,hub}: add tag argument
It's become a common pattern to use `rev = "refs/tags/${version}"` rather than
just `rev = version` to ensure that the tag gets fetched rather than a branch
that has the same name. This has so far been done using boilerplate though, so
let's add a simple abstraction to fetch a tag instead.
2024-11-18 08:20:00 +01:00
Atemu
ee97de3be9 fetchgit: nudge to update the manual when modifying parameters
Many parameters added over the past many years were not documented in the
manual. People likely simple didn't think to do that, so let's nudge them.
2024-11-14 23:50:13 +01:00
nicoo
0518f4d245 fetchgit: factor-out the hash logic to lib.fetchers.withNormalizedHash 2024-09-17 08:31:36 +00:00