Age | Commit message (Collapse) | Author |
|
Future editions of flakes or the Nix language can be supported by
renaming flake.nix (e.g. flake-v2.nix). This avoids a bootstrap
problem where we don't know which grammar to use to parse
flake*.nix. It also allows a project to support multiple flake
editions, in theory.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Make function arguments retain position info
|
|
|
|
|
|
|
|
This provides a pluggable mechanism for defining new fetchers. It adds
a builtin function 'fetchTree' that generalizes existing fetchers like
'fetchGit', 'fetchMercurial' and 'fetchTarball'. 'fetchTree' takes a
set of attributes, e.g.
fetchTree {
type = "git";
url = "https://example.org/repo.git";
ref = "some-branch";
rev = "abcdef...";
}
The existing fetchers are just wrappers around this. Note that the
input attributes to fetchTree are the same as flake input
specifications and flake lock file entries.
All fetchers share a common cache stored in
~/.cache/nix/fetcher-cache-v1.sqlite. This replaces the ad hoc caching
mechanisms in fetchGit and download.cc (e.g. ~/.cache/nix/{tarballs,git-revs*}).
This also adds support for Git worktrees (c169ea59049f861aaba429f48b828d0820b74d1d).
|
|
This is useful for finding out what a registry lookup resolves to, e.g
$ nix flake info patchelf
Resolved URL: github:NixOS/patchelf
Locked URL: github:NixOS/patchelf/cd7955af31698c571c30b7a0f78e59fd624d0229
|
|
When we do something like 'nix flake update --override-input nixpkgs
...', the override is now kept on subsequent calls. (If you don't want
this behaviour, you can use --no-write-lock-file.)
|
|
|
|
call-flake.nix now passes node.info.narHash to fetchTree. This ensures
that dirty Git trees work even in pure mode.
|
|
|
|
'lastModifiedDate' is now a string representing the equivalent
date/time.
|
|
|
|
The attrError variable is no longer used but still allocated on every
call to the findAlongAttrPath function.
|
|
|
|
|
|
This allows querying the location of function arguments. E.g.
builtins.unsafeGetAttrPos "x" (builtins.functionArgs ({ x }: null))
=> { column = 57; file = "/home/infinisil/src/nix/inst/test.nix"; line = 1; }
|
|
(cherry picked from commit 2c692a3b144523bca68dd6de618124ba6c9bb332)
|
|
|
|
|
|
Using std::filesystem means also having to link with -lstdc++fs on
some platforms and it's hard to discover for what platforms this is
needed. As all the functionality is already implemented as utilities,
use those instead.
|
|
Due to fetchGit not checking if rev is an ancestor of ref (there is even
a FIXME comment about it in the code), the cache repo might not have the
ref even though it has the rev. This doesn't matter when submodule =
false, but the submodule = true code blows up because it tries to fetch
the (missing) ref from the cache repo.
Fix this in the simplest way possible: fetch all refs from the local
cache repo when submodules = true.
TODO: Add tests.
|
|
|
|
Major bugfix for the submodules = true code path.
TODO: Add tests.
|
|
The .link file is used as a lock, so I think we should put the
"submodule" attribute in there since turning on submodules creates a new
.link file path.
|
|
Before this change it would be false for all evaluations but the first.
Now it follows the input argument (as it should).
|
|
submodules
|
|
Some platforms seem to still require linking with stdc++fs to enable
STL std::filesystem support.
|
|
|
|
This fixes fetching repositories with no submodules and also cleans up
.git files in checkouts.
|
|
There are some downsides to this features:
- Submodules are not cached (unlike the root repo),
- Full checkouts are created in a temporary directory.
|
|
|
|
|
|
This is now done in a single pass. Also fixes some issues when
updating flakes with circular dependencies. Finally, when using
'--recreate-lock-file --commit-lock-file', the commit message now
correctly shows the differences.
|
|
|
|
|
|
https://hydra.nixos.org/build/110757285
(cherry picked from commit b430a81a1fbf6c792ba49e3aefe46256263430e5)
|
|
E.g.
$ nix edit .#nixosConfigurations.bla
now works.
(cherry picked from commit d2032edb2f86e955a8a7724a27c0c3225f386500)
|
|
(cherry picked from commit 0b013a54dc570395bed887369f8dd622b8ce337b)
|
|
(cherry picked from commit 6b0ca8e803710342af70e257935724c5ad84ca04)
|
|
(cherry picked from commit c02da997570ac0d9b595d787bea8cb5a4e3cc1f5)
|
|
|
|
Everything uses the generic caching system now.
|
|
If you do a fetchTree on a Git repository, whether the result contains
a revCount attribute should not depend on whether that repository
happens to be a shallow clone or not. That would complicate caching a
lot and would be semantically messy. So applying fetchTree/fetchGit to
a shallow repository is now an error unless you pass the attribute
'shallow = true'. If 'shallow = true', we don't return revCount, even
if the repository is not actually shallow.
Note that Nix itself is not doing shallow clones at the moment. But it
could do so as an optimisation if the user specifies 'shallow = true'.
Issue #2988.
|