Will Dietz
44de71a396
progress-bar: re-draw last update if nothing new for 1sec.
...
Slightly nicer behavior when updates are somewhat far apart
(during a long linking step, perhaps) ensuring things
don't appear unresponsive.
If we wait the maximum amount for the update,
don't bother waiting another 50ms (for rate-limiting purposes)
and just check if we should quit.
This also ensures we'll notice the request to quit within 1s
if quit is signalled but there is not an udpate.
(I'm not sure if this happens or not)
2018-06-18 17:54:09 -05:00
Eelco Dolstra
85530bcc0b
nix: Remove special handling of .drv files
...
This makes 'nix copy' and 'nix path-info' work on .drv store
paths. Removing special treatment of .drv files seems the most
future-proof approach given the possible removal of .drv files in the
future.
Note that 'nix build' will still build (rather than substitute) .drv
paths due to the unfortunate overloading in Store::buildPaths().
2018-06-13 18:04:22 +02:00
Eelco Dolstra
0629601da1
Move EvalState from the stack to the heap
...
EvalState contains a few counters (e.g. nrValues) that increase
quickly enough that they end up being interpreted as pointers by the
garbage collector. Moving it to the heap makes them invisible to the
garbage collector.
This reduces the max RSS doing 100 evaluations of
nixos.tests.firefox.x86_64-linux.drvPath from 455 MiB to 292 MiB.
Note: ideally, allocations would be much further up in the 64-bit
address space to reduce the odds of an integer being misinterpreted as
a pointer. Maybe we can use some linker magic to move the .bss segment
to a higher address.
2018-06-12 17:49:55 +02:00
Eelco Dolstra
1672bcd230
Move evaluator-specific settings out of libstore
2018-05-30 13:29:50 +02:00
Eelco Dolstra
737ed88f35
Modularize config settings
...
Allow global config settings to be defined in multiple Config
classes. For example, this means that libutil can have settings and
evaluator settings can be moved out of libstore. The Config classes
are registered in a new GlobalConfig class to which config files
etc. are applied.
Relevant to https://github.com/NixOS/nix/issues/2009 in that it
removes the need for ad hoc handling of useCaseHack, which was the
underlying cause of that issue.
2018-05-30 13:28:01 +02:00
Daniel Poelzleithner
b712d4674b
Allow multiple search experssions in nix search
...
The common use case is to search for packages containing multiple words
like a "git" "frontend". Having only one expressions makes this simple regular
use case very complicated. Instead, search accepts multiple regular epressions
which all need to match.
nix search git 'gui|frontend'
returns a list of all git uis for example
2018-04-18 21:08:35 +02:00
Eelco Dolstra
a4aac7f88c
Handle arguments in $EDITOR
...
Fixes #2079 .
2018-04-17 12:16:04 +02:00
Félix Baylac-Jacqué
a91fb422fe
nix repl: Fix multiline SIGINT handling.
...
Fixes #2076
2018-04-16 16:09:30 +02:00
Eelco Dolstra
1839a5542a
Fix #2057
2018-04-11 11:42:17 +02:00
Jonas Chevalier
865ca2402f
nix copy: add an example with S3
...
I couldn't find a good example how to use it with non-us-east-1 buckets.
2018-03-30 02:31:14 +01:00
Eelco Dolstra
446bb88f13
Remove reference to non-existent manpages
2018-03-29 12:29:10 +02:00
Eelco Dolstra
4868721506
Filter ANSI colors when not writing to a terminal
...
Fixes https://github.com/NixOS/nixpkgs/issues/37114 .
2018-03-15 16:08:07 +01:00
Shea Levy
56f2ed0081
Merge pull request #1906 from dtzWill/fix/nix-search
...
nix search: tests and fix #1893 and part of #1892
2018-03-13 18:43:47 -06:00
Shea Levy
3748a0ca1e
Merge branch 'improve-search-algorithm' of git://github.com/Ma27/nix
2018-03-02 11:41:08 -05:00
Shea Levy
aa8bbbf69d
Merge branch 'write-failure-fixes' of git://github.com/lheckemann/nix
2018-03-02 10:59:59 -05:00
Eelco Dolstra
24ec750003
nix run: Fix segfault on macOS
...
Note that clearenv() is not available on macOS.
Fixes #1907 .
2018-02-26 18:29:40 +01:00
Will Dietz
009cf9cd23
nix search: explicitly handle empty search string, fixes #1893
...
This is important since this is given as an example.
Other patterns containing "empty search string" will still
be handled differently on different platforms ("asdf|")
but that's less of an issue.
2018-02-25 16:40:56 -06:00
Will Dietz
3cac8734ac
nix search: fix bug where we wrote to cache when shouldn't, breaking
...
This is exposed by the tests added previously,
and resolves the error reported in #1892 :
"expected JSON value".
2018-02-25 16:40:05 -06:00
Eelco Dolstra
de4c03d201
Merge branch 'fix/dry-run-partially' of https://github.com/dtzWill/nix
2018-02-22 12:18:20 +01:00
Eelco Dolstra
0d54671b7b
Manual: Update chapter on remote builds
...
Alos add a command "nix ping-store" to make it easier to see if Nix
can connect to a remote builder (e.g. 'nix ping-store --store
ssh://mac').
2018-02-21 16:24:26 +01:00
Jörg Thalheim
fa7fd76c5e
nix-copy: fix examples
...
maybe a left-over from nix-store -r ?
2018-02-21 01:13:46 +00:00
Eelco Dolstra
70eb64147e
Update release notes
...
Also add some examples to nix --help.
2018-02-19 20:38:53 +01:00
Linus Heckemann
78ac3eb4eb
Fix #1762
...
nix-store --export, nix-store --dump, and nix dump-path would previously
fail silently if writing the data out failed, because
a) FdSink::write ignored exceptions, and
b) the commands relied on FdSink's destructor, which ignores
exceptions, to flush the data out.
This could cause rather opaque issues with installing nixos, because
nix-store --export would happily proceed even if it couldn't write its
data out (e.g. if nix-store --import on the other side of the pipe
failed).
This commit adds tests that expose these issues in the nix-store
commands, and fixes them for all three.
2018-02-13 14:26:19 +00:00
Eelco Dolstra
1c10a74c73
Merge branch 'plugins' of https://github.com/shlevy/nix
2018-02-13 12:15:27 +01:00
Eelco Dolstra
35fd31770c
toBuildables -> build
2018-02-12 17:06:06 +01:00
Shea Levy
88cd2d41ac
Add plugins to make Nix more extensible.
...
All plugins in plugin-files will be dlopened, allowing them to
statically construct instances of the various Register* types Nix
supports.
2018-02-08 12:44:37 -05:00
Will Dietz
98031b6050
nix build: Don't create output links with --dry-run.
...
Fixes #1849 .
2018-02-07 15:20:54 -06:00
Eelco Dolstra
84989d3af2
Improve filtering of ANSI escape sequences in build logs
...
All ANSI sequences except color setting are now filtered out. In
particular, terminal resets (such as from NixOS VM tests) are filtered
out.
Also, fix the completely broken tab character handling.
2018-02-07 15:23:57 +01:00
Eelco Dolstra
6f6bfc8205
Update the progress bar at most 20 times per second
...
Fixes #1834 .
2018-02-06 20:51:37 +01:00
Eelco Dolstra
55012ec0b9
Tweak progress bar message
...
Say "copying" instead of "fetching" when copying from another local
store. Nice for nixos-install.
2018-02-05 18:32:23 +01:00
Eelco Dolstra
6fa690291a
Add 'nix upgrade-nix' command
...
This command upgrades Nix to the latest stable version by installing a
store path obtained from
https://github.com/NixOS/nixpkgs/raw/master/nixos/modules/installer/tools/nix-fallback-paths.nix
which is the same store path that the installer at
https://nixos.org/nix/install.sh uses.
The upgrade fails if Nix is not installed in a profile (e.g. on NixOS,
or when installed outside of the Nix store).
2018-01-31 16:24:43 +01:00
Eelco Dolstra
27b510af5c
nix eval: Stop progress bar before printing the result
2018-01-17 12:04:44 +01:00
Eelco Dolstra
16e0287556
nix eval: Take only one argument
...
Thus --json no longer produces a list.
2018-01-17 12:03:06 +01:00
Eelco Dolstra
23fa7e3606
parseExprFromFile -> evalFile
...
parseExprFromFile() should be avoided since it doesn't cache anything.
2018-01-16 17:11:58 +01:00
Will Dietz
6454ca393a
nix log: use pager
2018-01-12 15:05:26 -06:00
Will Dietz
bd17ccf1d8
nix repl: use linenoiseKeyType to differentiate ^C and ^D
...
Fixes #1757 .
2017-12-26 19:25:50 -06:00
Ben Gamari
626a94d70e
edit: Catch stoi exceptions from line number parsing
2017-12-14 19:11:56 -05:00
Maximilian Bosch
0413aeb35d
search.cc: sort attribute names with std::map
2017-12-12 15:13:36 +01:00
Will Dietz
c800f47395
Fix forward-decl of Bindings as "class", match definition.
...
(appease clang -Wmismatched-tags warning)
2017-12-11 11:51:55 -06:00
Shea Levy
5ba5ca7888
Merge branch 'feature/linenoise-ng' of git://github.com/dtzWill/nix
2017-12-11 07:52:20 -05:00
Eelco Dolstra
f1efb97075
Fix #1635 .
2017-12-04 13:19:16 +01:00
Will Dietz
964349e44d
no "linenoiseFree" in linenoise-ng
2017-11-27 18:30:05 -06:00
Will Dietz
21f515724c
replace vendored linenoise with linenoise-ng
2017-11-27 18:27:28 -06:00
Eelco Dolstra
f5f29dc2b7
nix eval --raw: Use coerceToString()
...
Thus,
$ nix eval --raw '("foo")'
foo
$ nix eval --raw nixpkgs.hello
/nix/store/1y6ckg6khrdsvll54s5spcmf3w6ka9k4-hello-2.10
$ nix eval --raw '(/etc/resolv.conf)'
/nix/store/vml92ama92i8mz013nny461mlvg8mvap-resolv.conf
2017-11-20 18:27:29 +01:00
Eelco Dolstra
1ff01187e2
nix run: Fix "flag '--command' requires 2 argument(s)"
2017-11-20 18:07:58 +01:00
Eelco Dolstra
4eb9e20028
nix run: Fix accidental removal of /nix/store existence check
...
Parenthetical to #1686 , we don't need to create a new root if we can
just bind-mount on top of the existing /nix/store.
2017-11-20 17:59:32 +01:00
Eelco Dolstra
a3aa850f0f
nix run: Ignore non-directories while setting up the chroot
...
Fixes #1686 .
2017-11-20 17:58:47 +01:00
Eelco Dolstra
4db0a9555e
nix ls-{nar,store} --json: Respect -R
2017-11-14 14:31:38 +01:00
Eelco Dolstra
c8155e9f5f
Don't indent JSON output
2017-11-14 14:28:03 +01:00
Eelco Dolstra
bac8055652
nix ls-{store,nar}: Add --json flag
2017-11-14 14:23:53 +01:00
Eelco Dolstra
5ef5d70b5e
Make config options available to legacy commands
2017-11-14 14:04:09 +01:00
Eelco Dolstra
3460e4cf00
More progress indicator improvements
...
In particular, don't show superfluous "fetching path" and "building
path(s)" messages, and show the current round (with --repeat).
2017-10-24 15:32:38 +02:00
Eelco Dolstra
be220702a7
Progress indicator: Show on what machine we're building
...
E.g.
$ nix build nixpkgs.hello --builders 'root@wendy'
[1/0/1 built] building hello-2.10 on ssh://root@wendy: checking for minix/config.h... no
2017-10-24 14:24:57 +02:00
Eelco Dolstra
0d59f1ca49
nix: Respect -I, --arg, --argstr
...
Also, random cleanup to argument handling.
2017-10-24 12:58:34 +02:00
Eelco Dolstra
f32cdc4fab
Turn $NIX_REMOTE into a configuration option
2017-10-23 20:50:28 +02:00
Eelco Dolstra
f3e0d46821
nix run: Restore signals
...
Otherwise Ctrl-C doesn't work.
2017-09-28 17:58:59 +02:00
Eelco Dolstra
5421ad243e
nix copy: make recursive by default
2017-09-27 18:28:54 +02:00
Eelco Dolstra
b8875213dc
Tweak message
2017-09-27 13:21:25 +02:00
Eelco Dolstra
bfef3ec855
nix build: Fix realising a store path
2017-09-27 13:14:45 +02:00
Eelco Dolstra
d1c6e0fe8c
nix why-depends: Write to stdout
2017-09-25 16:59:16 +02:00
Eelco Dolstra
e8d6ee7c1b
Add "nix show-derivation"
...
This debug command prints a store derivation in JSON format. For
example:
$ nix show-derivation nixpkgs.hello
{
"/nix/store/ayjwpwwiyy04nh9z71rsdgd3q7bra7ch-hello-2.10.drv": {
"outputs": {
"out": {
"path": "/nix/store/w5w4v29ql0qwqhczkdxs94ix2lh7ibgs-hello-2.10"
}
},
"inputSrcs": [
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
"inputDrvs": {
"/nix/store/13839aqdf6x4k3b785rw5f2l7857l6y3-bash-4.4-p12.drv": [
"out"
],
"/nix/store/vgdx7fdc7d4iirmnwj2py1nrvr5qwzj7-hello-2.10.tar.gz.drv": [
"out"
],
"/nix/store/x3kkd0vsqfflbvwf1055l9mr39bg0ms0-stdenv.drv": [
"out"
]
},
"platform": "x86_64-linux",
"builder": "/nix/store/qp5fw57d38bd1n07ss4zxh88zg67c3vg-bash-4.4-p12/bin/bash",
"args": [
"-e",
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
"env": {
"buildInputs": "",
"builder": "/nix/store/qp5fw57d38bd1n07ss4zxh88zg67c3vg-bash-4.4-p12/bin/bash",
"configureFlags": "",
"doCheck": "1",
"name": "hello-2.10",
"nativeBuildInputs": "",
"out": "/nix/store/w5w4v29ql0qwqhczkdxs94ix2lh7ibgs-hello-2.10",
"propagatedBuildInputs": "",
"propagatedNativeBuildInputs": "",
"src": "/nix/store/3x7dwzq014bblazs7kq20p9hyzz0qh8g-hello-2.10.tar.gz",
"stdenv": "/nix/store/6zngq1rdh0ans9qyckqimqibgnlvlfrm-stdenv",
"system": "x86_64-linux"
}
}
}
This removes the need for pp-aterm.
2017-09-25 13:43:35 +02:00
Eelco Dolstra
970366266b
Add "nix add-to-store" command
2017-09-14 13:29:33 +02:00
Eelco Dolstra
1c58ad2ffa
nix why-depends: Fix showing self-references
2017-09-14 11:17:32 +02:00
Eelco Dolstra
fc0ded3408
nix why-depends: Add option to show all edges causing a dependency
...
For example, without --all:
$ nix why-depends nixpkgs.nixUnstable nixpkgs.libssh2
/nix/store/s9n5gvj2l49b4n19nz6xl832654nf7n7-nix-1.12pre5511_c94f3d55
└───lib/libnixstore.so: …/lib:/nix/store/w9ykqpl5v0r3vfwsgn408jqhs72cx96x-curl-7.55.0/lib…
=> /nix/store/w9ykqpl5v0r3vfwsgn408jqhs72cx96x-curl-7.55.0
└───lib/libcurl.la: …ib -L/nix/store/4mbayl1y5hpjbjzkx8ndyhkv98kqw1wi-libssh2-1.8.0/l…
=> /nix/store/4mbayl1y5hpjbjzkx8ndyhkv98kqw1wi-libssh2-1.8.0
but with --all:
$ nix why-depends -a nixpkgs.nixUnstable nixpkgs.libssh2
/nix/store/s9n5gvj2l49b4n19nz6xl832654nf7n7-nix-1.12pre5511_c94f3d55
├───lib/libnixstore.so: …/lib:/nix/store/w9ykqpl5v0r3vfwsgn408jqhs72cx96x-curl-7.55.0/lib…
│ => /nix/store/w9ykqpl5v0r3vfwsgn408jqhs72cx96x-curl-7.55.0
│ └───lib/libcurl.la: …ib -L/nix/store/4mbayl1y5hpjbjzkx8ndyhkv98kqw1wi-libssh2-1.8.0/l…
│ lib/libcurl.so.4.4.0: …/lib:/nix/store/4mbayl1y5hpjbjzkx8ndyhkv98kqw1wi-libssh2-1.8.0/l…
│ => /nix/store/4mbayl1y5hpjbjzkx8ndyhkv98kqw1wi-libssh2-1.8.0
└───lib/libnixstore.so: …/lib:/nix/store/bx2i9vi76lps6w9rr73fxf6my31s4dg5-aws-sdk-cpp-1.0…
=> /nix/store/bx2i9vi76lps6w9rr73fxf6my31s4dg5-aws-sdk-cpp-1.0.153
└───lib/libaws-cpp-sdk-core.so: …e.so./nix/store/w9ykqpl5v0r3vfwsgn408jqhs72cx96x-curl-7.55.0/lib…
lib/libaws-cpp-sdk-s3.so: …/lib:/nix/store/w9ykqpl5v0r3vfwsgn408jqhs72cx96x-curl-7.55.0/lib…
=> /nix/store/w9ykqpl5v0r3vfwsgn408jqhs72cx96x-curl-7.55.0
2017-09-11 16:21:27 +02:00
Eelco Dolstra
d41c5eb13f
Add command "nix why-depends"
...
This command shows why a package has another package in its runtime
closure. For example, to see why VLC has libdrm.dev in its closure:
$ nix why-depends nixpkgs.vlc nixpkgs.libdrm.dev
/nix/store/g901z9pcj0n5yy5n6ykxk3qm4ina1d6z-vlc-2.2.5.1:
lib/libvlccore.so.8.0.0: …nfig:/nix/store/405lmx6jl8lp0ad1vrr6j498chrqhz8g-libdrm-2.4.75-d…
/nix/store/s3nm7kd8hlcg0facn2q1ff2n7wrwdi2l-mesa-noglu-17.0.7-dev:
nix-support/propagated-native-build-inputs: …-dev /nix/store/405lmx6jl8lp0ad1vrr6j498chrqhz8g-libdrm-2.4.75-d…
Thus, VLC's lib/libvlccore.so.8.0.0 as well as mesa-noglu's
nix-support/propagated-native-build-inputs cause the dependency.
2017-09-10 22:40:33 +02:00
Eelco Dolstra
8af704eef1
Typo
2017-09-10 22:40:33 +02:00
Eelco Dolstra
ad228d84e5
nix build: Only download the requested derivation outputs
...
Also some refactoring.
2017-09-10 22:40:33 +02:00
Eelco Dolstra
e02edb1483
nix copy: Add --substitute flag
2017-09-08 15:32:07 +02:00
Eelco Dolstra
3cf1705583
nix copy: Don't open the --from store twice
2017-09-08 14:46:55 +02:00
Eelco Dolstra
a2740c9ca2
nix copy: Add examples
2017-09-08 11:33:46 +02:00
Eelco Dolstra
24e23a1a73
nix search: Add examples
2017-09-07 20:42:11 +02:00
Eelco Dolstra
4967f0509a
nix eval: Add examples
2017-09-07 20:37:46 +02:00
Eelco Dolstra
2ebeffcfd4
nix log: Add examples
2017-09-07 20:18:29 +02:00
Eelco Dolstra
17afc42895
nix build: Add examples
2017-09-07 20:14:04 +02:00
Eelco Dolstra
2e9b7c4cb2
nix run: Add some examples
2017-09-07 20:09:04 +02:00
Eelco Dolstra
dff440aab3
nix build: Add --out-link and --no-link options
2017-09-06 16:20:34 +02:00
Eelco Dolstra
df4342bc17
nix build: Create result symlinks
2017-09-06 16:03:22 +02:00
Eelco Dolstra
7a108d904e
Fix verbosity level for nix build --dry-run
2017-09-01 12:37:09 +02:00
Eelco Dolstra
fd73c1e20a
Add an activity for binary cache queries
2017-08-31 15:25:58 +02:00
Eelco Dolstra
7d4a7136db
More macOS build fixes
2017-08-31 12:52:07 +02:00
Eelco Dolstra
fabde432dc
Fix build failure on non-Linux
...
https://hydra.nixos.org/build/59649086
2017-08-31 11:05:18 +02:00
Eelco Dolstra
e9c07a3b26
nix edit / log: Operate on a single Installable
2017-08-29 16:18:00 +02:00
Eelco Dolstra
9b82ecbae0
nix search: Warn about cached results
2017-08-29 15:22:05 +02:00
Eelco Dolstra
c8235c5313
nix run: Flush the progress bar before starting the command
2017-08-29 15:13:30 +02:00
Eelco Dolstra
05d68a6e23
nix run: Add some flags for clearing/keeping the environment
...
This is useful for testing commands in isolation.
For example,
$ nix run nixpkgs.geeqie -i -k DISPLAY -k XAUTHORITY -c geeqie
runs geeqie in an empty environment, except for $DISPLAY and
$XAUTHORITY.
2017-08-29 15:00:08 +02:00
Eelco Dolstra
5cc8609e30
nix run: Allow passing a command to execute
...
E.g.
nix run nixpkgs.hello -c hello --greeting Hallo
Note that unlike "nix-shell --command", no quoting of arguments is
necessary.
"-c" (short for "--command") cannot be combined with "--" because they
both consume all remaining arguments. But since installables shouldn't
start with a dash, this is unlikely to cause problems.
2017-08-29 14:42:48 +02:00
Eelco Dolstra
93a5ef0516
nix run: Fix chroot execution
...
Running "nix run" with a diverted store, e.g.
$ nix run --store local?root=/tmp/nix nixpkgs.hello
stopped working when Nix became multithreaded, because
unshare(CLONE_NEWUSER) doesn't work in multithreaded processes. The
obvious solution is to terminate all other threads first, but 1) there
is no way to terminate Boehm GC marker threads; and 2) it appears that
the kernel has a race where unshare(CLONE_NEWUSER) will still fail for
some indeterminate amount of time after joining other threads.
So instead, "nix run" will now exec() a single-threaded helper ("nix
__run_in_chroot") that performs the actual unshare()/chroot()/exec().
2017-08-29 13:21:07 +02:00
Eelco Dolstra
1c58e13bee
Hide commands that don't have a description
...
These are assumed to be internal.
2017-08-29 11:52:55 +02:00
Eelco Dolstra
2cc345b95f
Give activities a verbosity level again
...
And print them (separately from the progress bar) given sufficient -v
flags.
2017-08-28 19:13:24 +02:00
Eelco Dolstra
e681b1f064
Simplify
2017-08-28 14:30:35 +02:00
Eelco Dolstra
94a0548dc4
Simplify
2017-08-25 21:26:37 +02:00
Eelco Dolstra
9b845e6936
Doh
2017-08-25 20:52:34 +02:00
Eelco Dolstra
0ac35b67b8
Allow derivations to update the build phase
...
So the progress bar can show
[1/0/1 built, 0.0 MiB DL] building hello-2.10 (configuring): checking whether pread is declared without a macro... yes
2017-08-25 18:04:05 +02:00
Eelco Dolstra
c137c0a5eb
Allow activities to be nested
...
In particular, this allows more relevant activities ("substituting X")
to supersede inferior ones ("downloading X").
2017-08-25 17:49:40 +02:00
Eelco Dolstra
f194629f96
Fix Debian build
...
https://hydra.nixos.org/build/59390148
2017-08-25 16:11:18 +02:00
Eelco Dolstra
db1d45037c
Handle SIGWINCH
2017-08-25 15:59:03 +02:00
Eelco Dolstra
ec9e0c03c3
When truncating the progress bar, take ANSI escape sequences into account
2017-08-25 15:59:03 +02:00
Eelco Dolstra
0e9ddcc306
Restore activity metadata
...
This allows the progress bar to display "building perl-5.22.3" instead
of "building /nix/store/<hash>-perl-5.22.3.drv".
2017-08-25 15:58:35 +02:00
Eelco Dolstra
4c6a26539c
Remove debug line
2017-08-21 12:18:46 +02:00
Eelco Dolstra
c2cab20732
nix verify: Restore the progress indicator
2017-08-16 20:56:03 +02:00