| Age | Commit message (Collapse) | Author |
|
Funny bug - we were running a .override on fetchzip on every single call
to fetchFromGitHub.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reduce future test rebuilds when making githubBase overridable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This reverts commit 54271156702fc3a3f5d156df567a2a4a274bac6b, reversing
changes made to 88ee2ac331edc3ce9f9df92aaf824592473ed868.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This argument was added to fetchgit in #427165,
and it's not supported by fetchzip.
Co-authored-by: Philip Taron <philip.taron@gmail.com>
|
|
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.
|
|
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](https://github.com/NixOS/nixpkgs/tree/8616af08d915377bd930395f3b700a0e93d08728/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.
|
|
https://github.com/NixOS/nixpkgs/pull/321484 introduced a bug when when
`forceFetchGit=true`.
This PR revert the change only for this case.
The previous PR made work cases like:
```bash
nix-build -E 'let pkgs = import ./nixpkgs {}; in pkgs.fetchFromGitHub {
owner = "<username>"; repo = "<repo>"; rev = "HEAD"; hash = "";
private=true; forceFetchGit=false; }'
```
You should see the download working and nix complaining about hash
mismatch.
Now if you take the case where `forceFetchGit=true`, this is a different
story:
```
nix-build -E 'let pkgs = import ./nixpkgs {}; in pkgs.fetchFromGitHub {
owner = "<username>"; repo = "<repo>"; rev = "HEAD"; hash = "";
private=true; forceFetchGit=true; }'
```
Logs look like:
```
Initialized empty Git repository in /nix/store/<hash>-source/.git/
fatal: could not read Username for 'https://github.com': No such device or address
fatal: could not read Username for 'https://github.com': No such device or address
fatal: could not read Username for 'https://github.com': No such device or address
fatal: could not read Username for 'https://github.com': No such device or address
Unable to checkout HEAD from https://github.com/<username>/<repo>.git.
```
I was using `forceFetchGit` for the exact reason the previous PR was
made, I will move to `forceFetchGit=false` now.
Still the previous PR was a broke usage of `fetchFromGitHub` force private repository when `forceFetchGit` is used.
|
|
Co-authored-by: Philip Taron <philip.taron@gmail.com>
|
|
GitHub currently has two kinds of personal access token: "classic" and
"fine-grained". Fine-grained personal access tokens, as the name
suggests, allow much more control over what the token can and cannot do,
and in particular allow users to specify which repositories the token
should provide access to.
Unfortunately, fine-grained tokens don't allow access to repository
archive tarballs for private repositories at (say)
https://github.com/me-and/private-demo/archive/HEAD.tar.gz.
Fortunately, the GitHub API endpoint does provide this access, and also
works with classic tokens and -- for public repositories -- no token at
all.
To allow folk to use fine-grained access tokens, use the GitHub API for
accessing private repos. Keep using the existing interface for
non-private repos, as we can only assume an authenticated user for
private repos, and unauthenticated users have restrictive rate limits on
the API interface.
Fixes #321481
|
|
|
|
|
|
It's quite a bit more complex due to this but this was asked for during review
|
|
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.
|
|
|
|
|
|
|
|
|
|
Without the change metadata evaluation fails on package like
`zammad.src` where no fields are defined in `.nix `files:
src = fetchFromGitHub (lib.importJSON ./source.json);
There evaluation fails as:
$ nix-instantiate --strict --eval --expr 'with import ./. {}; zammad.src.meta'
error:
23| # to indicate where derivation originates, similar to make-derivation.nix's mkDerivation
24| position = "${position.file}:${toString position.line}";
| ^
25| };
error: value is null while a set was expected
After the change evaluation succeeds as:
$ nix-instantiate --strict --eval --expr 'with import ./. {}; zammad.src.meta'
{ homepage = "https://github.com/zammad/zammad"; }
|
|
|
|
Passing a (multi-line) string was deprecated in #200082 in favour of
list of strings, but still supported (with warning). Now, enforce use of
list of strings.
|
|
|
|
|
|
|
|
a67950f20b97a293b2fefeecc349c6b785321e4b added `url` attribute
from `fetchurl` and therefore also from `fetchzip`.
We previously relied on `url` from fetchgit-based fetchers
to find the repo URL but now it will just return tarballs
in the case of `fetchFrom{GitHub,GitLab}`.
Let’s add an attribute to `fetch{git,FromGitHub,FromGitLab}`
to expose a repo URL consistently.
|
|
|
|
|
|
|
|
|
|
|