Eelco Dolstra
b971e406de
Support 'dir' and other parameters in path flakerefs
2019-05-31 19:01:11 +02:00
Eelco Dolstra
094539ef4a
Rename requires -> inputs, provides -> outputs
...
Issue #2828 .
2019-05-31 09:59:48 +02:00
Eelco Dolstra
6ae4437acb
Remove makeFlakeValue()
2019-05-29 15:44:48 +02:00
Eelco Dolstra
6e4a8c47f4
Put flake-related stuff in its own namespace
2019-05-29 15:31:07 +02:00
Eelco Dolstra
c356d034f3
Make unsupported flake attributes a fatal error
2019-05-29 15:12:22 +02:00
Eelco Dolstra
ae7b56cd9a
Get last commit time of github flakes
2019-05-29 10:10:40 +02:00
Eelco Dolstra
0f840483c7
Add date of last commit to SourceInfo
...
This is primarily useful for version string generation, where we need
a monotonically increasing number. The revcount is the preferred thing
to use, but isn't available for GitHub flakes (since it requires
fetching the entire history). The last commit timestamp OTOH can be
extracted from GitHub tarballs.
2019-05-29 10:10:36 +02:00
Eelco Dolstra
ecee759b80
callFlake(): Emit source info attributes for non-flake dependencies
2019-05-28 14:01:08 +02:00
Eelco Dolstra
dda4f7167b
Remove redundant resolvedRef fields since they're already in SourceInfo
2019-05-28 13:12:43 +02:00
Eelco Dolstra
4846304541
Rename contentHash -> narHash for consistency
2019-05-28 13:08:40 +02:00
Eelco Dolstra
894e007445
Move hash into SourceInfo and rename to narHash to avoid ambiguity
2019-05-28 13:07:15 +02:00
Eelco Dolstra
6d7efcfaeb
Store SourceInfo in Flake and NonFlake
...
This deduplicates some shared fields. Factoring out the commonality is
useful in places like makeFlakeValue().
2019-05-28 13:06:43 +02:00
Eelco Dolstra
de36cf3db9
Merge branch 'nonFlakeRequiresTest' of https://github.com/CSVdB/nix into flakes
2019-05-28 12:05:11 +02:00
Nick Van den Broeck
4d030a8d96
Added nonFlakeRequires test
...
Fixes #2888
2019-05-28 10:51:45 +02:00
Nick Van den Broeck
6fb7545fa1
Fixed relative path parsing
...
Fixed #2821
2019-05-28 10:17:28 +02:00
Eelco Dolstra
90fe1dfd2f
Register flake source trees as GC roots
...
This ensures that flakes don't get garbage-collected, which is
important to get nix-channel-like behaviour.
For example, running
$ nix build hydra:
will create a GC root
~/.cache/nix/flake-closures/hydra -> /nix/store/xarfiqcwa4w8r4qpz1a769xxs8c3phgn-flake-closure
where the contents/references of the linked file in the store are the
flake source trees used by the 'hydra' flake:
/nix/store/n6d5f5lkpfjbmkyby0nlg8y1wbkmbc7i-source
/nix/store/vbkg4zy1qd29fnhflsv9k2j9jnbqd5m2-source
/nix/store/z46xni7d47s5wk694359mq9ay353ar94-source
Note that this in itself is not enough to allow offline use; the
fetcher for the flakeref (e.g. fetchGit or downloadCached) must not
fail if it cannot fetch the latest version of the file, so long as it
knows a cached version.
Issue #2868 .
2019-05-23 23:53:25 +02:00
Eelco Dolstra
6b77bfc28d
FlakeRef::to_string(): Check round trip
2019-05-23 23:39:58 +02:00
Eelco Dolstra
6e984431dd
fetchGit: Don't barf if we can't update our Git clone
...
Instead print a warning that we're continuing with the most recently
fetched version.
2019-05-23 23:38:40 +02:00
Eelco Dolstra
f0d6d67af9
Prevent the global registry from being GC'ed
...
Issue #2868 .
2019-05-22 23:43:58 +02:00
Eelco Dolstra
df3f5a78d5
Refactor downloadCached() interface
2019-05-22 23:36:29 +02:00
Eelco Dolstra
66f1d7ee95
Fetch the flake registry from the NixOS/flake-registry repo
2019-05-22 22:56:46 +02:00
Eelco Dolstra
e414bde6f9
Check the flake epoch
...
Closes #2883 .
2019-05-22 14:31:40 +02:00
Eelco Dolstra
70136a9bf4
Move flake-related flags into a separate class
...
Also, rename --dont-save-lock-file to --no-save-lock-file and change
noRegistries to useRegistries.
2019-05-22 14:04:18 +02:00
Eelco Dolstra
2468672e30
Improve FlakeCommand
...
It now handles commonality like calling getFlake() and resolving
relative local flake refs.
Fixes #2822 .
2019-05-22 14:03:28 +02:00
Eelco Dolstra
5990b86391
Use warn(), tweak messages
2019-05-21 15:03:54 +02:00
Eelco Dolstra
20a1a65d37
Only rewrite the lockfile if it changed
...
This removes spurious warnings about failure to write the lockfile.
2019-05-21 14:55:43 +02:00
Nick Van den Broeck
ef6ae61503
Lockfile handling in resolveFlake
is fixed
2019-05-17 14:50:10 +02:00
Nick Van den Broeck
98f20dee41
Give errors in resolveFlake
...
If DontUpdate but the lockfile isn't correct
2019-05-16 15:02:25 +02:00
Nick Van den Broeck
d9ad3723d5
Fixed issue 65
...
lockfile updating
2019-05-16 15:02:05 +02:00
Eelco Dolstra
5c34d66538
Make flakes work with 'nix build --store ...'
...
It was getting confused between logical and real store paths.
Also, make fetchGit and fetchMercurial update allowedPaths properly.
(Maybe the evaluator, rather than the caller of the evaluator, should
apply toRealPath(), but that's a bigger change.)
2019-05-15 15:38:24 +02:00
Nick Van den Broeck
4c9ebd20d7
One FIXME was already fixed
2019-05-15 08:10:46 +02:00
Nick Van den Broeck
d209bdcd08
Fixed issue #47
...
Content hashes
2019-05-09 14:27:55 +02:00
Eelco Dolstra
8fc1c3f413
Fix assertion failure in FlakeRef::to_string()
...
Fixes
$ nix build
nix: src/libexpr/primops/flakeref.cc:169: std::__cxx11::string nix::FlakeRef::to_string() const: Assertion `!rev' failed.
Aborted
e.g. when flake.nix doesn't exist.
Also use gitRev().
2019-05-08 22:09:18 +02:00
Eelco Dolstra
455aa8d9ea
Add newline at end of lockfile
...
Suggested by @grahamc.
2019-05-08 18:28:01 +02:00
Eelco Dolstra
54e54db2e2
Merge remote-tracking branch 'tweag/flake-test' into flakes
2019-05-08 13:55:55 +02:00
Eelco Dolstra
77e1f9010c
Export missing rev/shortRev attributes
2019-05-08 13:38:32 +02:00
Eelco Dolstra
9d07c3717b
updateLockFile: Do "git add" in a slightly nicer way
...
"--intent-to-add" ensures the change shows up in "git diff".
2019-05-08 13:26:20 +02:00
Eelco Dolstra
ddd42b7e94
Fix immutable flakeref construction
...
We were appending ref/revs incorrectly for the IsGit case (by
appending /<ref>/<rev> rather than ?ref=<ref>&rev=<rev).
2019-05-07 23:32:09 +02:00
Eelco Dolstra
2a41a567e2
Improve FlakeRef::to_string()
...
We were incorrectly using path syntax (i.e. /<ref>/<rev>) for Git
repositories. This is only valid for GitHub flakerefs.
2019-05-07 23:32:09 +02:00
Eelco Dolstra
3c171851a8
Make the URL/path of the global flake registry configurable
2019-05-07 22:49:13 +02:00
Nick Van den Broeck
201f92e02c
Fixed Flake data type and flake fetching
2019-05-07 05:57:08 +02:00
Eelco Dolstra
f8c4742c2f
Fix 'git add' when subdir is empty
2019-05-03 13:15:13 +02:00
Eelco Dolstra
2aafa6901e
Merge remote-tracking branch 'tweag/subdir' into flakes
2019-05-03 12:54:59 +02:00
Nick Van den Broeck
e0d4aa75fc
Fixed compile errors
2019-05-02 08:40:00 +02:00
Eelco Dolstra
5d6e8c008b
Allow 'dir' parameter in github: URIs
...
E.g. 'github:edolstra/dwarffs/flake?dir=foo/bar'.
2019-05-01 20:44:30 +02:00
Eelco Dolstra
a37436d792
Accept empty directories
2019-05-01 20:44:30 +02:00
Eelco Dolstra
fa88f71520
Validate 'dir=' parameters
...
We reject any path element starting with a '.' (mostly to reject '.'
and '..').
2019-05-01 20:44:30 +02:00
Eelco Dolstra
ab9e47284a
Improve error message
2019-05-01 20:44:30 +02:00
Nick Van den Broeck
43408d3cd6
flake.lock now uses flakeRef.subdir
2019-05-01 16:24:33 +02:00
Eelco Dolstra
00db8d4549
Support 'dir' parameters in https and ssh flake URIs
2019-05-01 14:24:22 +02:00