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