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
Daniel Schaefer
3f192ac80c
Add builtins.hashFile
...
For text files it is possible to do it like so:
`builtins.hashString "sha256" (builtins.readFile /tmp/a)`
but that doesn't work for binary files.
With builtins.hashFile any kind of file can be conveniently hashed.
2019-05-03 17:23:36 +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
Nick Van den Broeck
9b3069a88c
Fuzzymatching
...
Fixed issue #61
2019-05-01 12:59:35 +02:00
Nick Van den Broeck
eba85e2367
WIP: still need to adapt flakeref parsing
2019-05-01 12:59:12 +02:00
Eelco Dolstra
4588a6ff3c
Merge remote-tracking branch 'tweag/flakeFlags' into flakes
2019-04-30 12:46:54 +02:00
Nick Van den Broeck
24b35bf9e7
Fixed issue #13
2019-04-30 11:26:45 +02:00
Nick Van den Broeck
35d1c95f7f
Fix flag registry order
2019-04-30 11:04:31 +02:00
Nick Van den Broeck
e9c42c06ef
Fixed lookupFlake bug
2019-04-25 10:50:59 +02:00
Eelco Dolstra
21d5abfc14
Merge remote-tracking branch 'tweag/flake-clone' into flakes
2019-04-24 12:47:35 +02:00
Eelco Dolstra
4fb594a375
Merge remote-tracking branch 'tweag/resolvedFlake' into flakes
2019-04-19 15:56:17 +02:00
Nick Van den Broeck
e51abb6631
Changed some names
2019-04-19 14:23:35 +02:00
Eelco Dolstra
bc259192b4
fetchGit: Return revCount for dirty working trees
2019-04-19 14:15:51 +02:00
Eelco Dolstra
0cbda84f5b
exportGit: Don't clone local repositories
...
This ensures that commands like 'nix flake info /my/nixpkgs' don't
copy a gigabyte of crap to ~/.cache/nix.
Fixes #60 .
2019-04-19 14:10:57 +02:00
Eelco Dolstra
160ce18a0e
Improve missing flake.nix error message
2019-04-19 11:43:56 +02:00
Eelco Dolstra
6960ee929d
Clean up exportGit argument handling
2019-04-19 11:34:23 +02:00
Eelco Dolstra
46cb15df9b
Fix assertion failure in FlakeRef::to_string()
2019-04-19 11:16:14 +02:00
Eelco Dolstra
6e4210d8ce
Fix assertion failure
2019-04-19 10:58:08 +02:00
Eelco Dolstra
160b974fb0
Fix mutability check
2019-04-17 13:54:06 +02:00
Nick Van den Broeck
b42ba08fc8
Add command flake clone
2019-04-17 13:31:09 +02:00
Eelco Dolstra
939bee06cd
Pass a flake to itself as "self"
2019-04-16 16:29:44 +02:00
Eelco Dolstra
3ddb6d1833
Allow refs to start with a digit
...
E.g. we want to accept "19.03" as a ref.
2019-04-16 16:24:51 +02:00
Eelco Dolstra
260527a90c
Use the lock file
2019-04-16 16:18:47 +02:00
Eelco Dolstra
3d0e81051f
Fix lock file generation
...
Before:
"requires": {
"nixpkgs": {
"uri": "nixpkgs"
}
},
After:
"requires": {
"nixpkgs": {
"uri": "github:edolstra/nixpkgs/f10e8a02eb7fa2b4a070f30cf87f4efcc7f3186d"
}
},
2019-04-16 15:43:55 +02:00
Eelco Dolstra
8c4e759efd
updateLockFile(): Make sure Git can see flake.lock
2019-04-16 15:11:17 +02:00
Eelco Dolstra
60834492ae
Update lock files from InstallableFlake::toValue()
...
This ensures that the lock file is updated *before* evaluating it, and
that it gets updated for any nix command, not just 'nix build'.
Also, while computing the lock file, allow arbitrary registry lookups,
not just at top-level.
Also, improve some error messages slightly.
2019-04-16 15:02:02 +02:00
Eelco Dolstra
7b312a8762
Pass stuff by reference
2019-04-16 14:27:54 +02:00
Eelco Dolstra
e1d73edb10
writeLockFile(): Emit empty objects rather than null
2019-04-16 14:23:10 +02:00
Eelco Dolstra
ed9d725392
getFlake(): Use impureIsAllowed
...
This fixes 'nix build nixpkgs:hello' without --impure.
2019-04-16 14:16:20 +02:00
Eelco Dolstra
aecf07b1d6
Remove dead function
2019-04-16 14:08:14 +02:00
Eelco Dolstra
035ac44354
Fix makeFlakeValue()
2019-04-16 13:56:08 +02:00
Eelco Dolstra
3a5493bfe8
Merge remote-tracking branch 'tweag/privateGithub' into flakes
2019-04-16 12:23:56 +02:00
Nick Van den Broeck
7587d62d02
Fixed flake pin issues
2019-04-16 08:38:17 +02:00
Nick Van den Broeck
b3d33b02e3
Added support for private github repositories
2019-04-16 08:14:46 +02:00
Eelco Dolstra
b4e367bf4a
FlakeRef::to_string(): Drop the "flake:" prefix
...
This is unnecessary in most contexts and makes 'nix flake list' output
less readable.
2019-04-15 14:13:10 +02:00
Eelco Dolstra
c179f668e5
Slight cleanup
2019-04-15 14:08:18 +02:00
Eelco Dolstra
f6d684b5e2
getFlakeRegistries(): Return registries regardless of pureEval
...
This makes e.g. 'nix flake list' work.
2019-04-15 13:48:56 +02:00
Eelco Dolstra
84c12dbd7c
Move --impure to MixEvalArgs
2019-04-15 13:45:51 +02:00
Eelco Dolstra
bb6e6923f2
Add environment variable NIX_SHOW_SYMBOLS for dumping the symbol table
2019-04-11 23:04:13 +02:00
Nick Van den Broeck
4ad4e48668
FlakeRegistry = FlakeRef -> FlakeRef
2019-04-11 07:08:04 +02:00
Nick Van den Broeck
c64f98b883
FlakeAlias is implemented
2019-04-09 10:16:02 +02:00
Nick Van den Broeck
f39670c631
Took ref and rev out of FlakeRef
2019-04-09 09:51:42 +02:00
Nick Van den Broeck
3ec0c82fab
Fixed dependency resolution
2019-04-09 09:51:42 +02:00
Nick Van den Broeck
641db127be
FlakeIds are now properly looked up in registries
2019-04-09 09:51:36 +02:00
Nick Van den Broeck
18c019b616
Added nonFlakeRequires and the command nix flake deps
2019-04-09 08:38:09 +02:00
Eelco Dolstra
c996e04aca
Allow relative paths in flakerefs
...
Also allow "." as an installable to refer to the flake in the current
directory. E.g.
$ nix build .
will build 'provides.defaultPackage' in the flake in the current
directory.
2019-04-08 23:52:09 +02:00
Eelco Dolstra
ee1254d4f5
nix: Add --impure as a shorter alias of --no-pure-eval
2019-04-08 23:19:19 +02:00
Eelco Dolstra
6a4c7fb975
Add path flakeref variant
...
Unlike file://<path>, this allows the path to be a dirty Git tree, so
nix build /path/to/flake:attr
is a convenient way to test building a local flake.
2019-04-08 23:09:18 +02:00
Eelco Dolstra
9b7eac332b
Merge remote-tracking branch 'origin/master' into flakes
2019-04-08 14:23:48 +02:00
Eelco Dolstra
154244adc6
nix: New installables syntax
...
The general syntax for an installable is now
<flakeref>:<attrpath>. The attrpath is relative to the flake's
'provides.packages' or 'provides' if the former doesn't yield a
result. E.g.
$ nix build nixpkgs:hello
is equivalent to
$ nix build nixpkgs:packages.hello
Also, '<flakeref>:' can be omitted, in which case it defaults to
'nixpkgs', e.g.
$ nix build hello
2019-04-08 14:21:13 +02:00
Eelco Dolstra
6b0ca8e803
findAlongAttrPath(): Throw AttrPathNotFound
2019-04-08 14:20:58 +02:00
Eelco Dolstra
f32fbf952d
Fix Bison 3.3 warning
2019-03-27 21:09:31 +01:00
Eelco Dolstra
c101b29133
Merge remote-tracking branch 'tweag/flake-registries' into flakes
2019-03-27 14:40:36 +01:00
Eelco Dolstra
f9c7176a87
nix flake add: Handle ~/.config/nix not existing
...
Fixes
$ nix flake add fnord github:edolstra/fnord
error: opening file '/home/eelco/.config/nix/registry.json': No such file or directory
2019-03-26 12:48:57 +01:00
Eelco Dolstra
42be60c6af
Merge remote-tracking branch 'tweag/flake-add' into flakes
2019-03-26 12:35:27 +01:00
Eelco Dolstra
edb3836696
Merge remote-tracking branch 'tweag/auto-update-flake' into flakes
2019-03-26 11:50:22 +01:00
Eelco Dolstra
b5565a7081
Merge remote-tracking branch 'origin/master' into flakes
2019-03-26 11:44:14 +01:00
Jonas Chevalier
514b3c7f83
Add isPath primop
...
this is added for completeness' sake since all the other possible
`builtins.typeOf` results have a corresponding `builtins.is<Type>`
2019-03-24 11:36:49 +01:00
Nick Van den Broeck
a554f523db
Combining registries properly
2019-03-23 13:42:48 +01:00
Nick Van den Broeck
5e4d92d267
Issue #15 is finished
2019-03-22 15:22:18 +01:00
Nick Van den Broeck
e007f367bd
Fixed minor things
2019-03-22 11:21:49 +01:00
Nick Van den Broeck
d4ee8afd59
Implemented --flake flag for nix build
...
Also fixed Eelco's PR comments
2019-03-22 11:16:20 +01:00
Linus Heckemann
2aa89daab3
eval: improve type description for primops and applied primops
...
This can make type errors a little easier to understand.
2019-03-21 15:31:46 +01:00
Eelco Dolstra
1f64f4c7c8
pkg-config files: Use c++17
2019-03-14 14:11:12 +01:00
Eelco Dolstra
ef52ccf035
experimental/optional -> optional
2019-03-14 14:10:52 +01:00
Nick Van den Broeck
6542de98c2
Implemented writeRegistry
2019-03-07 12:00:10 +01:00
Nick Van den Broeck
9ff1a9ea65
Implemented json flag for nix flake info
2019-03-07 11:56:43 +01:00
Nick Van den Broeck
cfb6ab80ce
Implemented "nix flake info"
2019-02-26 13:12:51 +01:00
Eelco Dolstra
d342de02b9
fetchFlake: Use infinite TTL when the revision is specified
2019-02-25 23:23:45 +08:00
Eelco Dolstra
529add316c
downloadCached: Return ETag
...
This allows fetchFlake() to return the Git revision of a GitHub
archive.
2019-02-25 23:20:50 +08:00
Eelco Dolstra
6e9182fbc2
Add basic flake lock file support
2019-02-12 22:43:22 +01:00
Eelco Dolstra
e38ec77de8
Interpret all file:// URIs as Git repositories
2019-02-12 22:06:19 +01:00
Eelco Dolstra
beab05851b
nix: Add --flake flag
...
This allows using an arbitrary "provides" attribute from the specified
flake. For example:
nix build --flake nixpkgs packages.hello
(Maybe provides.packages should be used for consistency...)
2019-02-12 21:55:43 +01:00
Eelco Dolstra
272b58220d
Enforce use of immutable flakes in pure mode
...
... plus a temporary hack to allow impure flakes at top-level for the
default installation source.
2019-02-12 21:07:48 +01:00
Eelco Dolstra
ba05f29838
nix: Enable pure mode by default
...
We want to encourage a brave new world of hermetic evaluation for
source-level reproducibility, so flakes should not poke around in the
filesystem outside of their explicit dependencies.
Note that the default installation source remains impure in that it
can refer to mutable flakes, so "nix build nixpkgs.hello" still works
(and fetches the latest nixpkgs, unless it has been pinned by the
user).
A problem with pure evaluation is that builtins.currentSystem is
unavailable. For the moment, I've hard-coded "x86_64-linux" in the
nixpkgs flake. Eventually, "system" should be a flake function
argument.
2019-02-12 20:35:03 +01:00
Eelco Dolstra
91a6a47b0e
Improve flake references
2019-02-12 18:23:11 +01:00
Eelco Dolstra
0cd7f2cd8d
pkg-config files: Use c++17
2019-02-12 13:44:20 +01:00
Eelco Dolstra
c8a0b9d5cb
experimental/optional -> optional
2019-02-12 13:43:32 +01:00
Eelco Dolstra
52419f8db3
Add flake registry
...
This will eventually be moved to nixos.org.
2019-02-11 13:01:39 +01:00
Eelco Dolstra
dcae46ab14
Add github URIs
...
For example, github:edolstra/dwarffs is more-or-less equivalent to
https://github.com/edolstra/dwarffs.git . It's a much faster way to get
GitHub repositories: it fetches tarballs rather than entire Git
repositories. It also allows fetching specific revisions by hash
without specifying a ref (e.g. a branch name):
github:edolstra/dwarffs/41c0c1bf292ea3ac3858ff393b49ca1123dbd553
2019-02-11 12:05:17 +01:00
Eelco Dolstra
ef4cf4e681
Introduce flake URIs
2019-02-11 12:05:13 +01:00
Eelco Dolstra
7a5cf31060
Initial flake support
2019-02-11 12:00:13 +01:00
Eelco Dolstra
f216c76c56
Bindings::get(): Add convenience method
...
This allows writing attribute lookups as
if (auto name = value.attrs->get(state.sName))
...
2019-02-11 11:55:35 +01:00
Eelco Dolstra
c02da99757
EvalState::allocAttr(): Add convenience method
2019-02-11 11:55:29 +01:00
Eelco Dolstra
aa0e2a2e70
Make constant primops lazy
2019-02-11 11:52:07 +01:00
Shea Levy
b30be6b450
Add builtins.appendContext.
...
A partner of builtins.getContext, useful for the same reasons.
2019-01-31 08:52:23 -05:00
Shea Levy
1d757292d0
Add builtins.getContext.
...
This can be very helpful when debugging, as well as enabling complex
black magic like surgically removing a single dependency from a
string's context.
2019-01-14 11:27:10 -05:00
Shea Levy
087be7281a
Treat plain derivation paths in context as normal paths.
...
Previously, plain derivation paths in the string context (e.g. those
that arose from builtins.storePath on a drv file, not those that arose
from accessing .drvPath of a derivation) were treated somewhat like
derivaiton paths derived from .drvPath, except their dependencies
weren't recursively added to the input set. With this change, such
plain derivation paths are simply treated as paths and added to the
source inputs set accordingly, simplifying context handling code and
removing the inconsistency. If drvPath-like behavior is desired, the
.drv file can be imported and then .drvPath can be accessed.
This is a backwards-incompatibility, but storePath is never used on
drv files within nixpkgs and almost never used elsewhere.
2019-01-13 11:29:55 -05:00