Eelco Dolstra
087530dec4
Add comments
2019-06-04 21:07:55 +02:00
Eelco Dolstra
1e53a07712
Make non-flake inputs lazy
...
Also add a proper test for non-flake inputs.
2019-06-04 20:56:42 +02:00
Eelco Dolstra
1c5067b9a7
Check hash
2019-06-04 20:35:35 +02:00
Eelco Dolstra
45b5c606ac
Don't register invalid paths as GC roots
...
Unfortunately this doesn't work. Maybe we should keep separate roots
for each path.
2019-06-04 20:34:08 +02:00
Eelco Dolstra
5fe7be2409
Rename dep -> input
...
Also use nlohmann::json range-based for.
2019-06-04 20:08:13 +02:00
Eelco Dolstra
9e99b5205c
Move LockFile and related types to a separate file
2019-06-04 20:01:21 +02:00
Eelco Dolstra
278114d559
Fix GC closure generation
2019-06-04 19:45:16 +02:00
Eelco Dolstra
6dbd5c26e6
Make flake input fetching lazy
...
As long as the flake input is locked, it is now only fetched when it
is evaluated (e.g. "nixpkgs" is fetched when
"inputs.nixpkgs.<something>" is evaluated).
This required adding an "id" attribute to the members of "inputs" in
lockfiles, e.g.
"inputs": {
"nixpkgs/release-19.03": {
"id": "nixpkgs",
"inputs": {},
"narHash": "sha256-eYtxncIMFVmOHaHBtTdPGcs/AnJqKqA6tHCm0UmPYQU=",
"nonFlakeInputs": {},
"uri": "github:edolstra/nixpkgs/e9d5882bb861dc48f8d46960e7c820efdbe8f9c1"
}
}
because the flake ID needs to be known beforehand to construct the
"inputs" attrset.
Fixes #2913 .
2019-06-04 19:17:03 +02:00
Eelco Dolstra
653c4e439b
Fix clang compilation error
...
https://hydra.nixos.org/build/94332344
https://stackoverflow.com/questions/46114214/lambda-implicit-capture-fails-with-variable-declared-from-structured-binding
2019-06-03 21:51:06 +02:00
Nick Van den Broeck
d9a6a75ed2
Made epochs more fine-grained
...
Fixes #2894
2019-06-03 14:47:47 +02:00
Eelco Dolstra
5fbd9fee0b
Add 'nix app' command
...
This is like 'nix run', except that the command to execute is defined
in a flake output, e.g.
defaultApp = {
type = "app";
program = "${packages.blender_2_80}/bin/blender";
};
Thus you can do
$ nix app blender-bin
to start Blender from the 'blender-bin' flake.
In the future, we can extend this with sandboxing. (For example we
would want to be able to specify that Blender should not have network
access by default and should only have access to certain paths in the
user's home directory.)
2019-06-03 09:27:03 +02:00
Eelco Dolstra
fb692e5f7b
Bindings: Add convenience method for requiring an attribute
2019-06-03 09:27:03 +02:00
Eelco Dolstra
a2f86ac647
Merge remote-tracking branch 'origin/master' into flakes
2019-06-03 09:22:19 +02:00
Eelco Dolstra
aec545c20b
Fix segfault in builtin fetchurl with hashed mirrors + SRI hashes
2019-06-01 15:27:43 +02:00
Eelco Dolstra
15f241775a
Doh
2019-05-31 23:21:53 +02:00
Eelco Dolstra
8cb3bbd504
Fix handling of bare flakerefs containing a colon
2019-05-31 22:17:39 +02:00
Eelco Dolstra
8abb8647a3
Automatically determine subdir for path flakes
...
This means that in a flake in a subdirectory of a Git repo, you can
now do
$ nix build
rather than the inconvenient
$ nix build ../..?dir=foo/bar
2019-05-31 21:52:02 +02:00
Eelco Dolstra
ccb1bad612
Allow bare flakerefs as installables
...
So now
$ nix build blender-bin
works and builds the default package from that flake. You don't need
to add a colon at the end anymore.
2019-05-31 21:42:23 +02:00
Eelco Dolstra
7adb10d29b
Fix reading the lockfile of a flake in a subdirectory
2019-05-31 20:12:59 +02:00
Eelco Dolstra
9169046e64
Add operator << for LockFile
...
Useful for debugging.
2019-05-31 20:10:56 +02:00
Eelco Dolstra
b971e406de
Support 'dir' and other parameters in path flakerefs
2019-05-31 19:01:11 +02:00
Eelco Dolstra
63c5c91cc0
Show hash mismatch warnings in SRI format
2019-05-31 18:48:28 +02:00
Eelco Dolstra
094539ef4a
Rename requires -> inputs, provides -> outputs
...
Issue #2828 .
2019-05-31 09:59:48 +02:00
Eelco Dolstra
49436bdbb7
nix flake info --json: List the "provides"
...
It also lists the contents of "checks" and "packages".
For example:
$ nix flake info --json | jq
{
"branch": "HEAD",
"description": "The purely functional package manager",
"epoch": 2019,
"id": "nix",
"lastModified": 1559161142,
"path": "/nix/store/2w2qla8735dbxah8gai8r1nsbf5x4f5d-source",
"provides": {
"checks": {
"binaryTarball": {},
"nix-copy-closure": {},
"perlBindings": {},
"remoteBuilds": {},
"setuid": {}
},
"defaultPackage": {},
"devShell": {},
"hydraJobs": {},
"packages": {
"nix": {},
"nix-perl-bindings": {}
}
},
"revCount": 6955,
"revision": "8cb24e04e8b6cc60e2504733afe78e0eadafcd98",
"uri": "/home/eelco/Dev/nix"
}
Fixes #2820 .
2019-05-29 22:22:28 +02:00
Eelco Dolstra
3488fa7c6c
Hack: Use legacyPackages from Nixpkgs
...
Nixpkgs doesn't provide a clean "packages" set yet, so until that's
the case, look for packages in "legacyPackages" as well.
2019-05-29 22:22:28 +02:00
Eelco Dolstra
a9d3524e1f
nix flake check: Use read-only mode if we're not building
2019-05-29 21:00:44 +02:00
Eelco Dolstra
0e32b32fa3
nix flake check: Check defaultPackage, devShell and packages
2019-05-29 20:57:08 +02:00
Eelco Dolstra
e0aaf05f4f
Add 'nix flake check' command
...
This evaluates all the 'provides' of a flake and builds the 'check'
attributes.
2019-05-29 17:25:41 +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
6636808e90
Merge remote-tracking branch 'origin/master' into flakes
2019-05-29 12:36:44 +02:00
Ding Xiang Fei
abdedcdb38
bump cpptoml to v0.1.1
2019-05-29 17:01:39 +08: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
22f2744afd
Iterate over references
2019-05-28 23:05:08 +02:00
Eelco Dolstra
9eaebbf575
Merge branch 'attrPaths' of https://github.com/NinjaTrappeur/nix
2019-05-28 22:59:05 +02:00
Eelco Dolstra
444786e6d3
nix flake info: Add missing newline
2019-05-28 14:11:19 +02:00
Eelco Dolstra
46294d60cd
printFlakeInfo: Separate JSON output
2019-05-28 14:01:57 +02:00
Eelco Dolstra
ecee759b80
callFlake(): Emit source info attributes for non-flake dependencies
2019-05-28 14:01:08 +02:00
Eelco Dolstra
e7e7a03baf
nix flake deps: Remove --json flag for now
...
It doesn't produce valid JSON at the moment (but a concatenation of
JSON objects). Anyway we probably should merge this command info 'nix
flake info'.
2019-05-28 13:22:11 +02:00
Eelco Dolstra
fdf06ce72f
printFlakeInfo/printNonFlakeInfo: Factor out commonality
2019-05-28 13:21:06 +02:00
Eelco Dolstra
25e497bf9c
nix flake info/deps: Stop progress bar before printing output
2019-05-28 13:14:27 +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
3e8ef9eb22
nix flake deps: Print flake dependencies
2019-05-22 14:04:18 +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
Eelco Dolstra
4d829916e7
Merge pull request #2800 from flokli/progress-bar-hide-unknown-expected
...
progress-bar: hide expected if expected is 0 (unknown)
2019-05-21 13:29:28 +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
b531695331
Merge pull request #96 from tweag/support-chroot-store
...
Make flakes work with 'nix build --store ...'
2019-05-16 10:51:40 +02:00
Eelco Dolstra
0f5032c5a4
Merge remote-tracking branch 'origin/master' into flakes
2019-05-15 20:51:29 +02:00
Eelco Dolstra
8f6c72faee
Merge pull request #2810 from NixOS/print-build-logs
...
nix: Add --print-build-logs flag
2019-05-15 20:38:38 +02:00
Eelco Dolstra
66b8a62101
nix: Add --print-build-logs flag
...
This causes 'nix' to print build log output to stderr rather than
showing the last log line in the progress bar. Log lines are prefixed
by the name of the derivation (minus the version string), e.g.
binutils> make[1]: Leaving directory '/build/binutils-2.31.1'
binutils-wrapper> unpacking sources
binutils-wrapper> patching sources
...
binutils-wrapper> Using dynamic linker: '/nix/store/kr51dlsj9v5cr4n8700jliyz8v5b2q7q-bootstrap-stage0-glibc/lib/ld-linux-x86-64.so.2'
bootstrap-stage2-gcc-wrapper> unpacking sources
...
linux-headers> unpacking sources
linux-headers> unpacking source archive /nix/store/8javli69jhj3bkql2c35gsj5vl91p382-linux-4.19.16.tar.xz
2019-05-15 17:33:56 +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
Eelco Dolstra
5f6840fbb4
Merge pull request #2802 from LnL7/fix-needs-hashrewrite
...
build: move needsHashRewrite initialization to startBuilder
2019-05-13 08:53:48 +02:00
Graham Christensen
f1b8e9efe7
runProgram: Uncomment chdir support
2019-05-12 17:03:01 -04:00
Daiderd Jordan
ce02fc74b2
build: make needsHashRewrite a method
2019-05-12 22:56:27 +02:00
Graham Christensen
73b797c207
handleDiffHook: stop passing allowVfork
2019-05-12 13:44:22 -04:00
Graham Christensen
b4a05edbfe
runProgram: support gid, uid, chdir
2019-05-12 13:17:27 -04:00
Graham Christensen
dde8eeb39a
chdir, setgroups
2019-05-12 13:17:26 -04:00
Graham Christensen
6df61db060
diff hook: execute as the build user, and pass the temp dir
2019-05-12 13:17:26 -04:00
Graham Christensen
c78686e411
build: run diff-hook under --check and document diff-hook
2019-05-12 13:17:24 -04:00
Daiderd Jordan
ff6867ab94
build: move needsHashRewrite initialization to startBuilder
...
The value of useChroot is not set yet in the constructor, resulting in
hash rewriting being enabled in certain cases where it should not be.
Fixes #2801
2019-05-12 15:53:40 +02:00
Florian Klink
6ade7ec022
progress-bar: hide expected if expected is 0 (unknown)
...
Sometimes, "expected" can be "0", but in fact means "unknown".
This is for example the case when downloading a file while the http
server doesn't send the `Content-Length` header, like when running `nix
build` pointing to a nixpkgs checkout streamed from GitHub:
⇒ nix build -f https://github.com/NixOS/nixpkgs/archive/master.tar.gz hello
[1.8/0.0 MiB DL] downloading 'https://github.com/NixOS/nixpkgs/archive/master.tar.gz '
In that case, don't show that weird progress bar, but only the (slowly
increasing) downloaded size ("done").
⇒ nix build -f https://github.com/NixOS/nixpkgs/archive/master.tar.gz hello
[1.8 MiB DL] downloading 'https://github.com/NixOS/nixpkgs/archive/master.tar.gz '
This commit also updates fmt calls with three numbers (when something is
currently 'running' too) - I'm not sure if this can be provoked, but
showing "0" as expected doesn't make any sense, as we're obviously doing
more than nothing.
2019-05-11 12:34:39 +02:00
Eelco Dolstra
156e3a9daa
nix dev-shell: Ignore SSL_CERT_FILE
2019-05-11 01:50:28 +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
cb5ebc5c11
nix dev-shell: Keep $TERM
2019-05-08 17:07:35 +02:00
Eelco Dolstra
2bc55aba1e
Merge remote-tracking branch 'origin/master' into flakes
2019-05-08 14:30:27 +02:00
Eelco Dolstra
7c6391ddc7
nix-shell: Don't absolutize '-p' expressions
...
This prevents spurious syscalls like
25011 lstat("/home/eelco/with import <nixpkgs> { }; (pkgs.runCommandCC or pkgs.runCommand) \"shell\" { buildInputs = [ (hello) ]; } \"\"", 0x7ffe9c67f580) = -1 ENOENT (No such file or directory)
2019-05-08 14:29:36 +02:00
Eelco Dolstra
a887892eb6
nix-shell: Don't fail if run from a path containing the string "nix-shell"
2019-05-08 14:17:32 +02:00
Eelco Dolstra
54e54db2e2
Merge remote-tracking branch 'tweag/flake-test' into flakes
2019-05-08 13:55:55 +02:00
Eelco Dolstra
2fc8a29a9c
Merge remote-tracking branch 'tweag/nix-shell' into flakes
2019-05-08 13:46:44 +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
92caa60c49
Merge branch 'repl/ctrlc' of https://github.com/xbreak/nix
2019-05-08 10:18:45 +02:00
Eelco Dolstra
3e940bbf2d
Merge pull request #2790 from samueldr/fix/minor-comment-NIX_ROOT_FINDER
...
findRootsNoTemp: fixes comment about findRuntimeRoots
2019-05-08 10:13:09 +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
Eelco Dolstra
f9a2ea4486
Fix "Bad system call" running i686-linux binaries on x86_64-linux
...
To determine which seccomp filters to install, we were incorrectly
using settings.thisSystem, which doesn't denote the actual system when
--system is used.
Fixes #2791 .
2019-05-03 10:48:33 +02:00
Eelco Dolstra
7ba0f98e64
nix dev-shell: Less purity
2019-05-02 21:28:52 +02:00
Eelco Dolstra
8ec77614f6
Move createTempFile to libutil
2019-05-02 21:28:41 +02:00
Eelco Dolstra
dea18ff999
nix dev-shell: Execute shellHook
2019-05-02 21:13:19 +02:00
Eelco Dolstra
2919c496ea
nix dev-shell: Use 'provides.devShell' by default
...
Thus
$ nix dev-shell
will now build the 'provides.devShell' attribute from the flake in the
current directory. If it doesn't exist, it falls back to
'provides.defaultPackage'.
2019-05-02 21:10:13 +02:00
Eelco Dolstra
7dcf5b011a
Add function for quoting strings
2019-05-02 21:09:52 +02:00
Eelco Dolstra
2b8c63f303
Add 'nix dev-shell' and 'nix print-dev-env' command
...
'nix dev-shell' is intended to replace nix-shell. It supports flakes,
e.g.
$ nix dev-shell nixpkgs:hello
starts a bash shell providing an environment for building 'hello'.
Like Lorri (and unlike nix-shell), it computes the build environment
by building a modified top-level derivation that writes the
environment after running $stdenv/setup to $out and exits. This
provides some caching, so it's faster than nix-shell in some cases
(especially for packages with lots of dependencies, where the setup
script takes a long time).
There also is a command 'nix print-dev-env' that prints out shell code
for setting up the build environment in an existing shell, e.g.
$ . <(nix print-dev-env nixpkgs:hello)
https://github.com/tweag/nix/issues/21
2019-05-02 20:22:14 +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
Samuel Dionne-Riel
cbc7d9a412
findRootsNoTemp: fixes comment about findRuntimeRoots
...
The NIX_ROOT_FINDER environment variable was removed in
3c46fe62b8
when porting from perl to C.
2019-04-30 22:43:24 -04: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
Eelco Dolstra
e6109ec765
Merge remote-tracking branch 'tweag/fixFlakeList' into flakes
2019-04-25 14:05:40 +02:00
Nick Van den Broeck
d867e1804a
Fix printing FlakeList
2019-04-25 11:43:16 +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
cc51e37ad0
Use "." as the default installable
...
This makes e.g. "nix build" do something more or less reasonable
(namely, build the default package of the flake in the current
directory).
2019-04-19 16:16:04 +02:00
Eelco Dolstra
4fb594a375
Merge remote-tracking branch 'tweag/resolvedFlake' into flakes
2019-04-19 15:56:17 +02:00
Eelco Dolstra
f8a52cc598
nlohmann-json: 3.5.0 -> 3.6.1
...
https://github.com/nlohmann/json/releases/tag/v3.6.1
This fixes some clang warnings.
2019-04-19 14:53:58 +02:00
Eelco Dolstra
3392f1b778
Shut up clang warning
2019-04-19 14:41:06 +02:00
Nick Van den Broeck
e51abb6631
Changed some names
2019-04-19 14:23:35 +02:00
Eelco Dolstra
50ec2bed9e
nix flake info: Show revcount
2019-04-19 14:19:46 +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
Daiderd Jordan
b614e0e53d
build: only skip hash rewriting for sandboxing on linux
...
The sandbox on darwin, and possibly other future platforms, doesn't have
enough isolation to redirect outputs without hash rewriting.
2019-04-17 23:41:23 +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
3c28cb1b8f
Improve 'nix flake info' a bit
...
Example:
$ nix flake info dwarffs
ID: dwarffs
URI: github:edolstra/dwarffs/a83d182fe3fe528ed6366a5cec3458bcb1a5f6e1
Description: A filesystem that fetches DWARF debug info from the Internet on demand
Revision: a83d182fe3fe528ed6366a5cec3458bcb1a5f6e1
Path: /nix/store/grgd14kxxk8q4n503j87mpz48gcqpqw7-source
2019-04-16 16:18:19 +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
cfca793a20
Remove unneeded pureEval flags
2019-04-16 15:06:40 +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
ba66455636
Improve incremental build
2019-04-16 14:10:05 +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
d8fa2fc429
Add FIXME for pureEval
2019-04-16 12:26:17 +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
a12cd53567
Merge remote-tracking branch 'tweag/automatedUpdate' into flakes
2019-04-15 12:11:16 +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
4bf3a8226b
Automated lockfile updating with nix build
2019-04-11 14:34:04 +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
87033f2c4e
Whitespace
2019-04-08 23:58:33 +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
507da65900
Move flake template into a separate file
2019-04-08 23:39:38 +02:00
Eelco Dolstra
47727252ff
Add "nix flake init" command for creating a flake
2019-04-08 23:36:12 +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
4023ae4cdf
nix: Support nixpkgs.<attrpath> for compatibility
2019-04-08 16:22:04 +02:00
Eelco Dolstra
101d964a59
nix: Make -f work for compatibility
2019-04-08 16:11:17 +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
41ba5135e0
primeCache(): Barf if builds are needed but not allowed
...
Fixes #2753 .
2019-04-01 21:09:49 +02:00
Eelco Dolstra
2bc6304793
getMachines(): Cache result
2019-04-01 21:09:35 +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
be7fd63595
Remove debug line
2019-03-26 14:25:43 +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
Eelco Dolstra
5c05c238e6
Merge pull request #1828 from zimbatm/isPath
...
Add isPath primop
2019-03-25 19:58:11 +01:00
Will Dietz
42e2d5e7b7
store-api.hh: add missing include for unordered_map
2019-03-25 09:18:30 +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
xbreak
fcd7660976
repl: Restore CTRL-C behaviour
...
Install signal handler during `readline` to handle SIGINT to abort
partially typed expressions.
2019-03-24 09:39:48 +00: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
Chaker Benhamed
81a23fa7e2
Add a 5 seconds of timeouts to connect to S3.
...
The default is 1000ms, but we can hit it a lot of we don't have direct
link to AWS (e.g. using VPN).
2019-03-15 13:23:58 +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
Eelco Dolstra
86f3b94c8c
nix-store --gc --print-roots: Sort output
2019-03-14 13:59:10 +01:00
Eelco Dolstra
578ed7a259
findRoots(): Don't censor for trusted users
...
They're pretty much root anyway.
2019-03-14 13:53:34 +01:00
Eelco Dolstra
53522cb6ac
findRoots(): Add 'censor' parameter
...
This is less brittle than filtering paths after the fact in
nix-daemon.
2019-03-14 13:53:34 +01:00
Eelco Dolstra
a3f37d87ea
findRuntimeRoots: Simplify/fix handling of /proc files
...
Scanning of /proc/<pid>/{exe,cwd} was broken because '{memory:' was
prepended twice. Also, get rid of the whole '{memory:...}' thing
because it's unnecessary, we can just list the file in /proc directly.
2019-03-14 13:30:25 +01:00
Guillaume Maudoux
4f4391193c
Fix warning about unused variable
2019-03-10 00:56:09 +01:00
Guillaume Maudoux
38ee16ae9c
Unify internal findRootsXxx() api
2019-03-10 00:56:09 +01:00
Guillaume Maudoux
9d7221183a
unify naming of roots as links & targets
2019-03-10 00:56:09 +01:00
Guillaume Maudoux
5c56570726
Also obfuscate the number of memory roots
2019-03-10 00:56:09 +01:00
Guillaume Maudoux
fc02b1b3ee
Also print rooted path in nix-store -q --roots
2019-03-10 00:56:09 +01:00
Guillaume Maudoux
8574b70342
fixup! Make roots a map of store paths to pinning links
2019-03-10 00:56:09 +01:00
Guillaume Maudoux
ebc86550f9
Make roots a map of store paths to pinning links
...
This new structure makes more sense as there may be many sources rooting
the same store path. Many profiles can reference the same path but this
is even more true with /proc/<pid>/maps where distinct pids can and
often do map the same store path.
This implementation is also more efficient as the `Roots` map contains
only one entry per rooted store path.
2019-03-10 00:56:09 +01:00
Guillaume Maudoux
a17f86ce3a
Obfuscate memory roots for non-root users
2019-03-10 00:56:09 +01:00
Guillaume Maudoux
43331d6344
detail memory roots
2019-03-10 00:56:09 +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
volth
fff8db205c
canBuildLocally: check for features
...
It could happen that the local builder match the system but lacks some features.
Now it results a failure.
The fix gracefully excludes the local builder from the set of available builders for derivation which requires the feature, so the derivation is built on remote builders only (as though it has incompatible system, like ```aarch64-linux``` when local is x86)
2019-03-06 05:03:25 +00:00
Will Dietz
0963479741
archive.cc: ignore more posix_fallocate "not supported" error codes
...
Fixes w/musl.
2019-03-01 10:31:17 +08:00
Nick Van den Broeck
cfb6ab80ce
Implemented "nix flake info"
2019-02-26 13:12:51 +01:00
Dzmitry Zaitsau
06d6335987
fix indentation
2019-02-26 11:07:37 +01:00
Dzmitry Zaitsau
ac200c3678
Apply param values on S3Helper initialization
2019-02-25 18:06:19 +01:00
Dzmitry Zaitsau
56c18c67d9
Extend S3 URL parsing with parameters extraction
2019-02-25 18:00:55 +01:00
Dzmitry Zaitsau
07f992a74b
Extract and expose splitUriAndParams function
...
which splits a URL into localtor and parameter parts
2019-02-25 17:59:26 +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
d8fe447139
Merge pull request #2579 from catern/dumpdb
...
nix-store: make --dump-db take a list of paths to dump
2019-02-14 13:08:02 +01: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
7a7ec22298
Merge pull request #2628 from shlevy/context-introspection
...
Context introspection
2019-02-12 17:57:35 +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
f70434b1fb
Move Command and MultiCommand to libutil
2019-02-11 11:55:25 +01:00
Eelco Dolstra
15a16e5c05
MultiCommand: Simplify construction
2019-02-11 11:55:22 +01:00
Eelco Dolstra
aa0e2a2e70
Make constant primops lazy
2019-02-11 11:52:07 +01:00
Eelco Dolstra
01d07b1e92
Revert "Restore parent mount namespace before executing a child process"
...
This reverts commit a0ef21262f
. This
doesn't work in 'nix run' and nix-shell because setns() fails in
multithreaded programs, and Boehm GC mark threads are uncancellable.
Fixes #2646 .
2019-02-05 10:49:19 +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