Add a nix-prefetch-fossil script that follows the same pattern as the
existing nix-prefetch-git, nix-prefetch-hg, etc. scripts. This allows
users to easily fetch Fossil repositories and calculate their hashes
for use with fetchfossil in Nix expressions.
The script supports:
- Fetching from Fossil repository URLs
- Specifying revisions (defaults to "trunk")
- Checking expected hashes
- JSON output compatible with other nix-prefetch scripts
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.
Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
If we're running it from a build (fetchgit, fetchCargoVendor, etc),
none of the code paths that actually call Nix are hit.
If we're _not_ running it from a build, the user can reasonably be expected
to have a Nix present ambiently.
This avoids pulling Nix into the build closure of fetchCargoVendor,
and thus causing infrecs when Nix depends on Rust things.
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.
Overlays for CppNix nightly, Lix, or Tvix want to change the default Nix
implementation in Nixpkgs by overriding `pkgs.nix`. However, some
packages link against the internal/unstable CppNix APIs directly, and
these packages will break if built with different versions or
implementations of Nix.
If you want to swap out the Nix implementation in your package set, you
don't want these packages to break. Therefore, some packages will refer
to `nixForLinking` explicitly, at least until these dependencies can be
sorted out.
The addition of an explicit `nixForLinking` attribute decoupled from
`nix`, which is just "a Nix implementation", will help Nix
implementation maintainers test Nix implementations in Nixpkgs with
minimal hassle.
Or else using `nix-prefetch-git --fetch-lfs` results in failure, unless
the user manually extends $PATH before calling nix-prefetch-git (which
is bad UX).
This script is not needed anymore since "nix-prefetch-url --unpack
<url>" and "nix-prefetch-url -A foo.src" (where "foo.src" is a
fetchzip / fetchFromGitHub call) work fine.
Otherwise, a call to, for example, nix-prefetch-git, in a nix-shell --pure or
nix-build phase would result in an error such as:
Switched to a new branch 'fetchgit'
removing `.git'...
/nix/store/7qvjji7kbd033nsyxlpiiiam61a44yz9-nix-prefetch-git/bin/.nix-prefetch-git-wrapped: line 374: nix-hash: command not found