Eelco Dolstra
af373c2ece
Add deprecated aliases for renamed commands
2020-12-03 22:45:44 +01:00
regnat
a8a96dbaf8
Add forgotten override
annotation
2020-12-02 14:23:38 +01:00
Eelco Dolstra
1b79b5b983
read(): Use char * instead of unsigned char *
...
This gets rid of some pointless casts.
2020-12-02 14:17:27 +01:00
Eelco Dolstra
faa31f4084
Sink: Use std::string_view
2020-12-02 14:17:27 +01:00
Eelco Dolstra
aa68486112
writeFull/writeFile: Use std::string_view
2020-12-02 14:17:27 +01:00
Eelco Dolstra
88798613ee
replaceStrings(): Use std::string_view
2020-12-01 13:45:43 +01:00
Eelco Dolstra
c0d1354b7d
Macro hygiene
2020-12-01 13:45:06 +01:00
Eelco Dolstra
e224c16d28
Macro hygiene
2020-12-01 13:43:33 +01:00
Dominique Martinet
1fd13d67e8
archive: disable preallocate-contents by default
...
using fallocate() to preallocate files space does more harm than good:
- breaks compression on btrfs
- has been called "not the right thing to do" by xfs developers
(because delayed allocation that most filesystems implement leads to smarter
allocation than what the filesystem needs to do if we upfront fallocate files)
2020-11-26 14:26:57 +01:00
Eelco Dolstra
0287f83057
Ask for confirmation before allowing flake Nix configuration settings
2020-11-26 12:37:23 +01:00
Eelco Dolstra
ef84c780bb
filterANSIEscapes(): Handle UTF-8 characters
2020-11-16 16:41:53 +01:00
Ben Burdette
7d9037035e
usage example location
2020-11-11 09:21:26 -07:00
Ricardo M. Correia
108a2dab7e
Fix stack overflow introduced in #4206
2020-11-10 04:25:24 +01:00
Eelco Dolstra
b87f84cf55
Fix appending to Setting<StringSet>
...
Fixes: warning: unknown setting 'extra-sandbox-paths'
2020-11-09 15:04:34 +01:00
Robert Hensing
c4d903ddb0
Fix memory corruption caused by GC-invisible coroutine stacks
...
Crucially this introduces BoehmGCStackAllocator, but it also
adds a bunch of wiring to avoid making libutil depend on bdw-gc.
Part of the solutions for #4178 , #4200
2020-10-30 21:21:59 +01:00
Eelco Dolstra
dc5696b84f
Fix test
2020-10-30 12:00:53 +01:00
Eelco Dolstra
7f56cf67ba
Fix assertion failure in tab completion for --option
2020-10-29 18:26:35 +01:00
Eelco Dolstra
ff4dea63c9
Generalize extra-* settings
...
This removes the extra-substituters and extra-sandbox-paths settings
and instead makes every array setting extensible by setting
"extra-<name> = <value>" in the configuration file or passing
"--<name> <value>" on the command line.
2020-10-29 18:17:39 +01:00
Eelco Dolstra
662e67f8de
Merge pull request #4198 from mkenigs/capitalize-JSON
...
Capitalize JSON for consistency
2020-10-29 07:34:34 +01:00
Matthew Kenigsberg
6a4bf535d8
Capitalize JSON for consistency
2020-10-28 17:54:28 -05:00
Eelco Dolstra
a5019f0508
Consistency
2020-10-28 20:45:57 +01:00
Eelco Dolstra
14aecbb288
BaseSetting<StringMap>::set(): Don't append to previous value
2020-10-26 20:36:46 +01:00
Eelco Dolstra
9d5e9ef0da
Move Explicit
2020-10-26 17:01:20 +01:00
John Ericson
64be1c15c2
Add missing include for MAX_PATH
...
And remove one that we didn't actually need to add
2020-10-15 19:05:17 +00:00
John Ericson
fccef6a7fa
Merge remote-tracking branch 'upstream/master' into fix-and-ci-static-builds
2020-10-15 18:55:03 +00:00
John Ericson
aef44cbaa9
Split out commonChildInit
2020-10-11 16:38:46 +00:00
Eelco Dolstra
59bd6e87a4
Completions::add(): Guard against newlines
2020-10-09 21:55:59 +02:00
Eelco Dolstra
ea4b2b985f
Merge pull request #4128 from tweag/extended-completions
...
Add a zsh completion script
2020-10-09 21:53:12 +02:00
John Ericson
39de73550d
Merge remote-tracking branch 'upstream/master' into fix-and-ci-static-builds
2020-10-09 18:26:47 +00:00
Eelco Dolstra
e845d19ae3
Remove Lazy
...
This fixes a crash during startup when compiling Nix as a single
compilation unit.
2020-10-09 17:54:59 +02:00
Eelco Dolstra
87157b2bd3
writeFile(): Add error context to writeFull() failure
...
Issue #4092 .
2020-10-09 16:02:53 +02:00
regnat
04e5d0e704
Add a description in the completion outputs
...
Make nix output completions in the form `completion\tdescription`.
This can't be used by bash (afaik), but other shells like zsh or fish
can display it along the completion choices
2020-10-09 09:39:51 +02:00
Eelco Dolstra
be149acfda
Serialize exceptions from the sandbox process to the parent
...
Fixes #4118 .
2020-10-07 16:34:03 +02:00
Eelco Dolstra
27ca87c46a
Formatting
2020-10-07 16:33:19 +02:00
Maximilian Bosch
59f2dd8e8d
libfetchers/github: allow slashes in refs
...
Refs #4061
2020-10-06 20:08:51 +02:00
Eelco Dolstra
85c8be6286
Remove static variable name clashes
...
This was useful for an experiment with building Nix as a single
compilation unit. It's not very useful otherwise but also doesn't
hurt...
2020-10-06 13:49:20 +02:00
Eelco Dolstra
6691256e79
Factor out common showBytes()
2020-10-06 10:40:49 +02:00
Eelco Dolstra
d0bb544128
Add missing #pragma once
2020-10-06 10:40:07 +02:00
Eelco Dolstra
88a667e49e
Fix s3:// store
...
Fixes https://github.com/NixOS/nixos-org-configurations/issues/123 .
2020-10-05 17:53:30 +02:00
Kevin Quick
66c3959e8c
Merge branch 'master' into access-tokens
2020-09-29 08:32:06 -07:00
Gregory Hale
faa5607f54
Merge remote-tracking branch 'origin/master' into github-api-token
2020-09-25 12:10:58 -04:00
John Ericson
cfe791a638
stdout_ -> cout
...
Better to get creative than just sprinkle arbitrary underscores.
2020-09-25 11:30:04 -04:00
Eelco Dolstra
7b2ae472ff
expectArg(): Respect the 'optional' flag
2020-09-25 10:27:40 +02:00
Kevin Quick
a439e9488d
Support StringMap configuration settings.
...
Allows Configuration values that are space-separated key=value pairs.
2020-09-24 22:42:59 -07:00
Eelco Dolstra
8d9402f411
Merge pull request #4054 from edolstra/fix-4021
...
registerOutputs(): Don't call canonicalisePathMetaData() twice
2020-09-23 21:57:53 +02:00
Eelco Dolstra
236d9ee7f7
lstat() cleanup
2020-09-23 19:17:28 +02:00
Dominique Martinet
2548347bba
libutil/archive: add preallocate-contents option
...
Make archive preallocation (fallocate) optional because some filesystems
like btrfs do not behave as expected with fallocate.
See #3550 .
2020-09-23 18:49:11 +02:00
Eelco Dolstra
92ac8df0ec
Merge branch 'add-ca-to-store' of https://github.com/hercules-ci/nix
2020-09-22 11:31:33 +02:00
regnat
c1e79f870c
Silence a compiler warning in serialise.hh
...
Explicitely cast to `uint64_t` in `readNum` to avoid a "comparison
between signed and unsigned" warning
2020-09-22 10:39:29 +02:00
Eelco Dolstra
ecc8672aa0
fmt.hh: Don't include boost/algorithm/string/replace.hpp
...
This cuts compilation time by ~49s.
Issue #4045 .
2020-09-21 19:07:55 +02:00
Eelco Dolstra
557d2427ee
Random header cleanup
2020-09-21 18:59:02 +02:00
Eelco Dolstra
0716adaa8b
abstractsettingtojson.hh -> abstract-setting-to-json.hh
2020-09-21 18:49:43 +02:00
Eelco Dolstra
d51ba43047
Move Callback into its own header
...
This gets rid of the inclusion of <future> in util.hh, cutting
compilation time by ~20s (CPU time).
Issue #4045 .
2020-09-21 18:42:21 +02:00
Eelco Dolstra
e8e1d420f3
Don't include <regex> in header files
...
This reduces compilation time by ~15 seconds (CPU time).
Issue #4045 .
2020-09-21 18:22:45 +02:00
Robert Hensing
8279178b07
Move FramedSink next to FramedSource
2020-09-21 07:55:47 +02:00
Robert Hensing
14b30b3f3d
Move FramedSource and FramedSink, extract withFramedSink
2020-09-17 20:21:04 +02:00
Robert Hensing
29c82ccc77
Add Source.drainInto(Sink)
2020-09-17 20:21:04 +02:00
Robert Hensing
3f93bc0d39
Typo
2020-09-17 20:21:04 +02:00
Greg Hale
a303c0b6dc
Fetch commits from github/gitlab using Auth header
...
`nix flake info` calls the github 'commits' API, which requires
authorization when the repository is private. Currently this request
fails with a 404.
This commit adds an authorization header when calling the 'commits' API.
It also changes the way that the 'tarball' API authenticates, moving the
user's token from a query parameter into the Authorization header.
The query parameter method is recently deprecated and will be disallowed
in November 2020. Using them today triggers a warning email.
2020-09-16 13:46:48 -04:00
regnat
e0817cbcdc
Don't include nlohmann/json.hpp in config.hh
...
Instead make a separate header with the template implementation of
`BaseSetting<T>::toJSONObj` that can be included where needed
2020-09-16 13:53:09 +02:00
regnat
93c0e14a30
Include the full nlohmann/json header in config.hh
...
It is apparently required for using `toJSONObject()`, which we do inside
the header file (because it's in a template).
This was accidentally working when building Nix itself (presumably because
`config.hh` was always included after `nlohman/json.hpp`) but caused a
(pretty dirty) build failure in the perl bindings package.
2020-09-16 13:53:09 +02:00
regnat
a1e82ba450
fixup! Add a default value for the settings
2020-09-16 13:53:09 +02:00
regnat
d65962db4d
Make uri schemes grammar more RFC-compliant
...
Allow `-` and `.` in the RFC schemes as stated by
[RFC3986](https://tools.ietf.org/html/rfc3986#section-3.1 ).
Practically, this is needed so that `ssh-ng` is a valid URI scheme
2020-09-16 13:53:09 +02:00
regnat
35042c9623
Add a default value for the settings
...
The default value is initialized when creating the setting and unchanged
after that
2020-09-16 13:53:08 +02:00
regnat
3c525d1590
Complete the toJSON
instance for Setting<T>
...
Don't let it just contain the value, but also the other fields of the
setting (description, aliases, etc..)
2020-09-16 13:53:08 +02:00
John Ericson
25f7ff16fa
Merge remote-tracking branch 'upstream/master' into fix-and-ci-static-builds
2020-09-04 02:40:36 +00:00
John Ericson
ef278d00f9
Merge remote-tracking branch 'upstream/master' into single-ca-drv-build
2020-09-01 18:01:48 +00:00
Eelco Dolstra
84f5cabbea
Merge remote-tracking branch 'origin/master' into markdown
2020-08-31 14:24:26 +02:00
John Ericson
8017fe7487
Merge remote-tracking branch 'upstream/master' into single-ca-drv-build
2020-08-28 19:59:14 +00:00
Eelco Dolstra
691a1bd717
Merge branch 'minimal-logger' of https://github.com/Ma27/nix
2020-08-28 10:50:52 +02:00
Eelco Dolstra
e915fd6d2a
Typo
2020-08-27 14:51:50 +02:00
Eelco Dolstra
a0f19d9f3a
RemoteStore::addToStore(): Fix race between stderrThread and NAR writer
...
As pointed out by @B4dM4n, the call to to.flush() on stderrThread is
unsafe because the NAR writer thread is also writing to 'to'.
Fixes #3943 .
2020-08-27 14:50:51 +02:00
Eelco Dolstra
24b1c2c66b
Fix tests
2020-08-25 10:51:14 +02:00
Eelco Dolstra
88d5c9ec58
Fix tests
2020-08-24 10:37:10 +02:00
Eelco Dolstra
dc2f278c95
Allow 'nix' subcommands to provide docs in Markdown format
2020-08-20 12:21:46 +02:00
Eelco Dolstra
3c4f8c9175
List deprecated option aliases in the docs
2020-08-20 11:13:17 +02:00
Eelco Dolstra
acb99f03f9
Config: Use nlohmann/json
2020-08-20 11:02:16 +02:00
Eelco Dolstra
c8fa39324a
Generate the nix.conf docs from the source code
...
This means we don't have two (divergent) sets of option descriptions
anymore.
2020-08-19 18:28:04 +02:00
Eelco Dolstra
6f19c776db
Start generation of the nix.1 manpage
2020-08-17 19:33:18 +02:00
Eelco Dolstra
a72a20d68f
Add 'nix dump-args' to dump all commands/flags for manpage generation
2020-08-17 17:44:52 +02:00
John Ericson
3c8b5b6219
Merge remote-tracking branch 'upstream/master' into single-ca-drv-build
2020-08-14 17:00:13 +00:00
Eelco Dolstra
d81f13f7cb
Merge pull request #3899 from obsidiansystems/make-narHash-not-optional
...
Make narHash in ValidPathInfo not optional
2020-08-14 17:00:18 +02:00
John Ericson
85aacbee64
Use TeeSink
and TeeSouce
in a few more places
2020-08-13 14:51:17 +00:00
John Ericson
e913a2989f
Squashed get CA derivations building
2020-08-07 19:51:55 +00:00
John Ericson
39ae9a3d4a
Merge remote-tracking branch 'upstream/master' into fix-and-ci-static-builds
2020-08-07 14:44:47 +00:00
Carlo Nucera
8241e660ba
Remove Hash::operator bool ()
...
Since the hash is not optional anymore
2020-08-05 15:30:38 -04:00
Carlo Nucera
be6e1c6457
Merge branch 'master' of github.com:NixOS/nix into make-narHash-not-optional
2020-08-05 15:14:47 -04:00
Carlo Nucera
1ad6394b33
Add Hash::dummy to signal default value
...
We did this in the same spirit of the dummy value that's present in
libstore/path.hh
2020-08-05 15:11:49 -04:00
John Ericson
839f0fe095
Merge remote-tracking branch 'upstream/master' into misc-ca
2020-08-05 14:40:01 +00:00
John Ericson
03f4fafc27
Merge remote-tracking branch 'upstream/master' into misc-ca
2020-08-05 14:36:25 +00:00
Eelco Dolstra
b91dc7ebad
Merge pull request #3730 from obsidiansystems/better-ca-parse-errors
...
Improve hash parsing and errors
2020-08-05 16:33:07 +02:00
Eelco Dolstra
75f220a595
Merge pull request #3864 from obsidiansystems/more-topo-sort
...
Abstract out topo sorting logic
2020-08-05 16:07:29 +02:00
John Ericson
d3452a5ed6
Merge remote-tracking branch 'upstream/master' into better-ca-parse-errors
2020-08-04 16:13:20 +00:00
Eelco Dolstra
24e07c428f
Delete compressed NARs
...
Fixes #3891 .
2020-08-03 18:34:52 +02:00
John Ericson
bc165e28ae
Embelish documentation of new Hash functions
2020-08-01 15:32:20 +00:00
John Ericson
3cbee1e840
Convert to C-style comments
2020-08-01 15:26:57 +00:00
Carlo Nucera
eee6ef86cd
Merge branch 'master' of github.com:NixOS/nix into better-ca-parse-errors
2020-07-30 18:27:25 -04:00
Matthew Bauer
d7ffe327ae
Merge remote-tracking branch 'origin/master' into fix-and-ci-static-builds
2020-07-30 14:59:57 -05:00
Eelco Dolstra
a785b3eddf
Fix build
2020-07-30 15:27:28 +02:00
Eelco Dolstra
3f6e88a552
unsigned long long -> uint64_t
2020-07-30 13:34:04 +02:00
Eelco Dolstra
ebee2b7852
receiveContents(): unsigned int -> size_t
2020-07-30 13:00:30 +02:00
John Ericson
8065c6d160
Abstract out topo sorting logic
2020-07-27 20:45:34 +00:00
John Ericson
e6115ca004
Merge remote-tracking branch 'upstream/master' into ca-derivation-data-types
2020-07-27 17:41:43 +00:00
John Ericson
1d7d94ceea
Merge branch 'hash-always-has-type' of github.com:obsidiansystems/nix into better-ca-parse-errors
2020-07-27 16:17:50 +00:00
John Ericson
78466bcb2f
Merge branch 'optional-derivation-output-storepath' into ca-derivation-data-types
2020-07-27 14:40:08 +00:00
John Ericson
699fc89b39
Merge remote-tracking branch 'upstream/master' into hash-always-has-type
2020-07-27 14:22:45 +00:00
Maximilian Bosch
6ccfdb79c7
libutil/logging: extend internal-json
logger to make it more machine-readable
...
The new error-format is pretty nice from a UX point-of-view, however
it's fairly hard to parse the output e.g. for editor plugins such as
vim-ale[1] that use `nix-instantiate --parse` to determine syntax errors in
Nix expression files.
This patch extends the `internal-json` logger by adding the fields
`line`, `column` and `file` to easily locate an error in a file and the
field `raw_msg` which contains the error-message itself without
code-lines and additional helpers.
An exemplary output may look like this:
```
[nix-shell]$ ./inst/bin/nix-instantiate ~/test.nix --log-format minimal
{"action":"msg","column":1,"file":"/home/ma27/test.nix","level":0,"line":4,"raw_msg":"syntax error, unexpected IF, expecting $end","msg":"<full error-msg with code-lines etc>"}
```
[1] https://github.com/dense-analysis/ale
2020-07-26 02:29:57 +02:00
Eelco Dolstra
2292814049
createUnixDomainSocket(): Fix off-by-one error in copying the socket path
...
Reported by Kane York.
2020-07-24 11:19:17 +02:00
John Ericson
cdb3f39b64
Merge remote-tracking branch 'upstream/master' into better-ca-parse-errors
2020-07-21 13:43:20 +00:00
John Ericson
5055c595bd
Merge branch 'fix-and-document-addToStoreSlow' of github.com:obsidiansystems/nix into ca-derivation-data-types
2020-07-21 01:20:53 +00:00
Carlo Nucera
362ae93851
Add UnimplementedError to ease grepping for these
2020-07-20 14:13:37 -04:00
John Ericson
c58c6165c5
Remove period at the end of the exception message
2020-07-20 17:43:19 +00:00
John Ericson
bf61871271
parser.hh -> split.hh
2020-07-20 17:42:34 +00:00
John Ericson
eab945f591
Merge remote-tracking branch 'upstream/master' into from-dump-stream
2020-07-20 17:29:23 +00:00
Eelco Dolstra
1c5f8bbfb5
Merge pull request #3822 from obsidiansystems/dump-thrice-fixme
...
Optimize `addToStoreSlow` and remove `TeeParseSink`
2020-07-20 18:55:05 +02:00
Carlo Nucera
745a03cef5
Merge branch 'optional-derivation-output-storepath' of github.com:obsidiansystems/nix into ca-derivation-data-types
2020-07-16 13:36:01 -04:00
John Ericson
cc0d77f8c9
Merge branch 'hash-always-has-type' of github.com:obsidiansystems/nix into better-ca-parse-errors
2020-07-16 17:28:52 +00:00
John Ericson
5ea817dace
Merge remote-tracking branch 'upstream/master' into hash-always-has-type
2020-07-16 14:58:53 +00:00
John Ericson
3dcca18c30
Fix bug in TeeSource
...
We use this to simplify `LocalStore::addToStoreFromDump`.
Also, hope I fixed build error with old clang (used in Darwin CI).
2020-07-16 13:39:27 +00:00
John Ericson
68dfb8c6ae
Optimize addToStoreSlow
and remove TeeParseSink
2020-07-16 05:09:41 +00:00
John Ericson
5602637d9e
Revert "LocalStore::addToStoreFromDump copy in chunks"
...
This reverts commit 592851fb67
. We don't
need this extra feature anymore
2020-07-15 23:37:49 +00:00
John Ericson
bc109648c4
Get rid of LocalStore::addToStoreCommon
...
I got it to just become `LocalStore::addToStoreFromDump`, cleanly taking
a store and then doing nothing too fancy with it.
`LocalStore::addToStore(...Path...)` is now just a simple wrapper with a
bare-bones sinkToSource of the right dump command.
2020-07-15 23:14:30 +00:00
Carlo Nucera
d090562348
Merge branch 'master' of github.com:NixOS/nix into hash-always-has-type
2020-07-15 17:21:01 -04:00
John Ericson
592851fb67
LocalStore::addToStoreFromDump copy in chunks
...
Rather than copying byte-by-byte, we let the coroutine know how much
data we would like it to send back to us.
2020-07-14 13:56:36 +00:00
Eelco Dolstra
832e111494
Merge remote-tracking branch 'origin/master' into flakes
2020-07-14 13:56:18 +02:00
Eelco Dolstra
7c2fef0a81
Make 'nix copy' to s3:// binary caches run in constant memory
2020-07-13 20:07:19 +02:00
Eelco Dolstra
493961b689
Remove istringstream_nocopy
2020-07-13 18:31:19 +02:00
Eelco Dolstra
0a9da00a10
NarAccessor: Run in constant memory
2020-07-13 17:30:42 +02:00
Eelco Dolstra
fc84c358d9
Make 'nix copy' to file:// binary caches run in constant memory
2020-07-13 16:28:45 +02:00
John Ericson
4415765385
Merge remote-tracking branch 'upstream/master' into hash-always-has-type
2020-07-13 03:01:44 +00:00
John Ericson
ffc18583b1
Move C++17 "pattern matching" boilerplat to utils.hh
2020-07-12 22:15:14 +00:00
Maximilian Bosch
64f03635d7
Fix ANSI color constants
...
The `m` acts as termination-symbol when declaring graphics. Because
of this, the `;1m` doesn't have any effect and is directly printed to
the console:
```
$ nix repl
> builtins.fetchGit { /* ... */ }
{ outPath = "/nix/store/s0f0iz4a41cxx2h055lmh6p2d5k5bc6r-source"; rev = "e73e45b723a9a6eecb98bd5f3df395d9ab3633b6"; revCount = ;1m428; shortRev = "e73e45b"; submodules = ;1mfalse; }
```
Introduced by 6403508f5a
.
2020-07-12 16:52:20 +02:00
John Ericson
323d51a7a0
Merge branch 'master' of github.com:NixOS/nix into better-ca-parse-errors
2020-07-09 19:07:06 +00:00
Eelco Dolstra
9223603908
Merge remote-tracking branch 'origin/master' into flakes
2020-07-08 15:55:19 +02:00
Eelco Dolstra
16ec7785ca
Fix 'got unknown message type 1 from Nix daemon'
...
Example:
$ nix-build -E 'with import <nixpkgs> {}; runCommand "foo" { x = runCommand "bar" {} "exit 1"; } "echo foo; exit 1"'
warning: unknown setting 'auto-allocate-uids'
these 2 derivations will be built:
/nix/store/v4fbdbhcdi949929a67g8farwf72zgam-bar.drv
/nix/store/k4fsvrjl7cp2xpz7927iv7g0dqj1zyhs-foo.drv
warning: unknown setting 'auto-allocate-uids'
building '/nix/store/v4fbdbhcdi949929a67g8farwf72zgam-bar.drv'...
error: --- Error ----------------------------------------------------------------------------------------------------------------------------------------------------------------- nix-daemon
builder for '/nix/store/v4fbdbhcdi949929a67g8farwf72zgam-bar.drv' failed with exit code 1
error: --- Error ------------------------------------------------------------------------------------------------------------------------------------------------------------------ nix-build
got unknown message type 1 from Nix daemon
2020-07-08 15:53:14 +02:00
Eelco Dolstra
1ab9da9154
Merge remote-tracking branch 'origin/master' into flakes
2020-07-07 14:38:57 +02:00
Eelco Dolstra
4055cfee36
Fix coverage build
2020-07-07 14:37:47 +02:00
Carlo Nucera
0f05a36e20
Merge branch 'master' of github.com:NixOS/nix into better-ca-parse-errors
2020-07-06 16:57:09 -04:00
Ben Burdette
efd6a8b230
bump
2020-07-06 11:54:53 -06:00
Ben Burdette
75bfcf8d15
revamp trace code and test
2020-07-06 10:51:48 -06:00
Eelco Dolstra
54712aaf8a
Merge remote-tracking branch 'origin/master' into flakes
2020-07-06 16:40:10 +02:00
Ben Burdette
a168224464
spacing
2020-07-04 18:30:49 -06:00
John Ericson
3134db1a83
Merge branch 'hash-always-has-type' of github.com:obsidiansystems/nix into better-ca-parse-errors
2020-07-03 14:12:38 +00:00
John Ericson
dbffd309fe
Merge branch 'master' of github.com:NixOS/nix into hash-always-has-type
2020-07-03 14:11:38 +00:00
Ben Burdette
b29a4ea1dc
Merge branch 'master' into add-trace
2020-07-03 07:57:36 -06:00
John Ericson
13796be78d
Have splitPrefix
and splitPrefixTo
parser helpers
2020-07-02 23:18:22 +00:00
John Ericson
a7cd7425d9
Move getParsedTypeAndSRI
to a more suitable location
...
Also mark it static
2020-07-02 23:10:11 +00:00
Eelco Dolstra
b5e4253697
Fix abort in 'nix develop'
2020-07-02 18:24:11 +02:00
Ben Burdette
5818271c6e
spacing
2020-07-02 09:41:54 -06:00
Carlo Nucera
b6b10b1d4c
Write the implementation for parseNonSRIUnprefixed
2020-07-02 11:34:40 -04:00
Carlo Nucera
ea48e3a5b5
Abstract common parsing functionality
2020-07-02 11:29:33 -04:00
Carlo Nucera
36cbc74689
Inline and simplify in parseAnyPrefixed
2020-07-02 11:21:00 -04:00
Carlo Nucera
9462d8a50b
Rename fromSRI to parseSRI for constistency
2020-07-02 11:11:18 -04:00
Carlo Nucera
f61bc45d19
Get rid of the std::pair
2020-07-02 11:09:04 -04:00
Ben Burdette
bf2788e4c1
move showTrace to new loggerSettings
2020-07-02 09:04:31 -06:00
Carlo Nucera
27c8029573
Inline newFunction
2020-07-02 11:01:10 -04:00
Carlo Nucera
343d1569b1
Fix test suite
2020-07-02 10:48:47 -04:00
Carlo Nucera
263ccdd489
Rename two hash constructors to proper functions
2020-07-01 18:34:18 -04:00
Carlo Nucera
c8c4bcf90e
Inline Hash::init()
2020-07-01 18:03:35 -04:00
Carlo Nucera
d63a5ded76
Remove unused import
2020-07-01 17:53:24 -04:00
Carlo Nucera
6faeec3b2a
Keep the previous name, for diffing
2020-07-01 17:50:34 -04:00
Carlo Nucera
274a8136fb
Correct FIXMEs in libfetchers
2020-07-01 17:47:15 -04:00
Carlo Nucera
c2e7f7a712
Fixed build, we still have test errors
2020-07-01 17:32:06 -04:00
Ben Burdette
8497891b99
spacing
2020-07-01 13:50:18 -06:00
Eelco Dolstra
6ff9aa8df7
Don't process an option if any of its arguments need completion
2020-07-01 20:31:39 +02:00
Ben Burdette
a295b2ea96
if no errLoc, no Loc.
2020-07-01 12:02:02 -06:00
Ben Burdette
3629b0585a
don't include errpos for addErrorContext
2020-07-01 11:49:01 -06:00
Ben Burdette
2a39c083dc
non-pos trace test
2020-07-01 10:37:31 -06:00
Ben Burdette
a7d5d26443
fix tests with the 'from string' change
2020-06-30 22:05:21 -06:00
Ben Burdette
9159dfe3d8
comments and cleanup
2020-06-30 16:31:55 -06:00
Ben Burdette
70bcb39d3f
double addtrace for 'called from'
2020-06-30 15:44:19 -06:00
Ben Burdette
ddb81ca126
Merge branch 'master' into add-trace
2020-06-30 12:21:45 -06:00
Carlo Nucera
b798efb829
WIP initial design
2020-06-30 14:10:30 -04:00
Ben Burdette
a0705e0dd1
invalid pos check
2020-06-30 11:01:46 -06:00
Ben Burdette
e72a16a339
check for a null symbol
2020-06-30 11:00:51 -06:00
Carlo Nucera
a1f66d1d9e
Factor the prefix splitting in hash
2020-06-30 12:49:00 -04:00
Carlo Nucera
7ba0fae0dd
Create the spitPrefix function in parser.hh
2020-06-30 11:57:09 -04:00
Ben Burdette
c484a67914
trace formatting
2020-06-29 15:46:21 -06:00
John Ericson
24da034bc3
Add possibly missing <string>
include
2020-06-29 21:22:00 +00:00
Eelco Dolstra
2b834d48aa
NAR parser: Fix missing name field check
...
Discovered by @Kloenk.
2020-06-29 22:45:41 +02:00
Matthew Bauer
da77331cb7
Remove lazy lookup in getHome
...
this seems to break in Musl/Static with:
terminate called after throwing an instance of 'std::bad_function_call'
what(): bad_function_call
2020-06-29 20:34:26 +00:00
Matthew Bauer
88cf6ffce3
Rename logging->stdout to logging->stdout_
...
musl doesn't like this identifier
2020-06-29 20:34:26 +00:00
John Ericson
987a4a0be9
Merge remote-tracking branch 'upstream/master' into hash-always-has-type
2020-06-29 18:03:21 +00:00
Ben Burdette
8f81fae116
showTrace flag in loggers
2020-06-29 10:20:51 -06:00
Ben Burdette
ef24a0835d
showtrace as function arg
2020-06-27 12:19:31 -06:00
Eelco Dolstra
adf2fbbdc2
Merge remote-tracking branch 'origin/master' into flakes
2020-06-26 08:46:46 +02:00
Ben Burdette
bc9e87412c
'string' makes more sense in nix repl
2020-06-25 09:56:32 -06:00
Ben Burdette
9ab808c926
showTrace flag for ErrorInfo; showTrace test.
2020-06-25 09:23:12 -06:00
Eelco Dolstra
de2641ae99
Fix empty std::optional dereference in writeDerivation()
...
https://hydra.nixos.org/build/123017579
2020-06-25 15:50:30 +02:00
Ben Burdette
9c0e1fd4f1
add trace test; error formatting refinements
2020-06-24 18:31:28 -06:00
Ben Burdette
023912def3
convenience form of addTrace
2020-06-24 13:46:25 -06:00
Ben Burdette
b18ed02b76
repl indenting
2020-06-24 13:10:41 -06:00
Ben Burdette
00fe653ea5
nixCode -> LinesOfCode
2020-06-24 08:33:53 -06:00
Ben Burdette
1d43a6e123
use plain errPos instead of nixCode; fix tests
2020-06-23 15:30:13 -06:00
John Ericson
ec3a857307
Fix and clean up hash parser
2020-06-23 18:19:40 +00:00
John Ericson
98e5d1af03
Merge remote-tracking branch 'upstream/master' into hash-always-has-type
2020-06-23 17:03:37 +00:00
Ben Burdette
d0e78fbb03
re-add Pos origin in tests
2020-06-23 10:51:58 -06:00
Ben Burdette
abe0552504
Merge remote-tracking branch 'upstream/master' into add-trace
2020-06-23 09:40:28 -06:00
Ben Burdette
13e87535ff
traces to bottom
2020-06-23 09:36:58 -06:00
Eelco Dolstra
015e1c2131
Merge pull request #3724 from bburdette/hintfmt-percent
...
Hintfmt percent test, and fix
2020-06-23 12:26:00 +02:00
Ben Burdette
9d1cb0c5e6
with normaltxt, elide yellow color code instead of canceling it; use normaltxt on plain_string hintfmt
2020-06-22 11:32:20 -06:00
Ben Burdette
28b079067f
Update src/libutil/fmt.hh
...
Co-authored-by: John Ericson <git@JohnEricson.me>
2020-06-22 10:00:37 -06:00
Ben Burdette
be4f444175
tidying up
2020-06-19 16:58:12 -06:00
Ben Burdette
0309488a66
fmt -> hintfmt test
2020-06-19 16:46:49 -06:00
Ben Burdette
397dbe114e
remove formathelper
2020-06-19 15:57:19 -06:00
John Ericson
507aa48739
WIP: Make Hash always store a valid hash type
2020-06-19 21:48:57 +00:00
Ben Burdette
b193aca4ae
escape percents
2020-06-19 15:29:19 -06:00
Ben Burdette
db475f9e7e
too few, too many args
2020-06-19 15:28:13 -06:00
Ben Burdette
cdddf24f25
add hintfmt test
2020-06-19 14:54:41 -06:00
Ben Burdette
54e8f550c9
addErrorTrace
2020-06-19 13:44:08 -06:00
John Ericson
e288c0987a
Merge remote-tracking branch 'upstream/master' into validPathInfo-ca-proper-datatype
2020-06-19 18:44:24 +00:00
John Ericson
c98081d270
Merge remote-tracking branch 'upstream/master' into no-hash-type-unknown
2020-06-19 17:50:05 +00:00
John Ericson
c1892a5316
tabs -> spaces
2020-06-19 17:49:57 +00:00
John Ericson
2f0e395c99
Merge remote-tracking branch 'me/no-stringly-typed-derivation-output' into validPathInfo-ca-proper-datatype
2020-06-19 15:26:59 +00:00
John Ericson
b90cac3bad
Remove uneeded = default
for Hash
2020-06-19 15:00:38 +00:00
John Ericson
01dc8b0bab
Merge remote-tracking branch 'upstream/master' into no-stringly-typed-derivation-output
2020-06-19 14:59:05 +00:00
Eelco Dolstra
2886c92aef
Merge pull request #3669 from gilligan/add-compression-tests
...
Add compression unit tests
2020-06-19 13:59:04 +02:00
John Ericson
3fc58a9638
Remove some Base::
that crept in
2020-06-19 00:24:47 +00:00
John Ericson
669c3992e8
Merge branch 'no-hash-type-unknown' into validPathInfo-temp
2020-06-18 22:33:07 +00:00
John Ericson
15abb2aa2b
Revert the enum struct
change
...
Not a regular git revert as there have been many merges and things.
2020-06-18 22:11:26 +00:00
John Ericson
bbbf3602a3
Merge branch 'enum-class' into no-hash-type-unknown
2020-06-18 22:11:19 +00:00
John Ericson
40526fbea5
Merge remote-tracking branch 'upstream/master' into enum-class
2020-06-18 21:38:15 +00:00
Ben Burdette
4d1a4f0217
addTrace
2020-06-18 15:25:26 -06:00
Ben Burdette
e6f93b94fc
Merge branch 'master' into caveman-LOCs
2020-06-18 13:07:53 -06:00
Eelco Dolstra
4d5169bdd5
Merge pull request #3707 from p01arst0rm/outdated-function-fix
...
replaced uncaught_exception with uncaught_exceptions
2020-06-17 18:26:01 +02:00
John Ericson
6403508f5a
Use ansicolor.hh
in nix repl
rather than duplicates
2020-06-17 15:13:00 +00:00
Eelco Dolstra
1524752c17
Merge remote-tracking branch 'origin/master' into flakes
2020-06-17 10:26:52 +02:00
John Ericson
517f5980e2
Merge remote-tracking branch 'upstream/master' into no-stringly-typed-derivation-output
2020-06-17 04:58:43 +00:00
p01arst0rm
e9970a34e8
appended ' __attribute__((weak)); ' to 'extern char * * environ '
2020-06-17 03:25:34 +01:00
p01arst0rm
c9d06558b6
replaced uncaught_exception with uncaught_exceptions
2020-06-17 03:15:47 +01:00
Eelco Dolstra
df4da4f5da
Merge pull request #3702 from NixOS/store-path-cxx
...
Rewrite StorePath class in C++
2020-06-16 21:37:26 +02:00
John Ericson
fbf90bd693
Add another missing #include
2020-06-16 14:19:49 +00:00
Eelco Dolstra
759947bf72
StorePath: Rewrite in C++
...
On nix-env -qa -f '<nixpkgs>', this reduces maximum RSS by 20970 KiB
and runtime by 0.8%. This is mostly because we're not parsing the hash
part as a hash anymore (just validating that it consists of base-32
characters).
Also, replace storePathToHash() by StorePath::hashPart().
2020-06-16 14:28:41 +02:00
Tobias Pflug
cd8214c398
Fix logging unit tests
2020-06-16 10:23:15 +02:00
John Ericson
7e7e3b71f3
Add mising #include for strerror
2020-06-15 23:35:07 +00:00
Eelco Dolstra
8b099812ea
Respect terminal width printing error messages
2020-06-15 19:35:31 +02:00
Eelco Dolstra
f20bb983ca
Cleanup
2020-06-15 18:16:03 +02:00
Eelco Dolstra
5ed5d7acbd
Improve "waiting for locks" messages
...
These are now shown in the progress bar.
Closes #3577 .
2020-06-15 16:03:29 +02:00
Eelco Dolstra
e14e62fddd
Remove trailing whitespace
2020-06-15 14:12:39 +02:00
Eelco Dolstra
1fb762d11f
Get rid of explicit ErrorInfo constructors
2020-06-15 14:06:58 +02:00
Eelco Dolstra
fd64e4fb96
Disambiguate BaseError(Args) constructor
...
This means that 'throw Error({ ... ErrorInfo ... })' now works.
2020-06-15 13:50:33 +02:00
Eelco Dolstra
7a77762961
Merge branch 'errors-phase-2' of https://github.com/bburdette/nix
2020-06-15 11:46:31 +02:00
John Ericson
f6f01416b7
Use std::string_view
in a few more places
2020-06-12 21:32:30 +00:00
Eelco Dolstra
2853ba4ab2
Fix build
2020-06-12 19:00:48 +02:00
Eelco Dolstra
00fa7e2205
Merge pull request #3674 from matthewbauer/allow-empty-hash2
...
Allow empty hash in derivations
2020-06-12 18:18:12 +02:00
Matthew Bauer
ea0d29d99a
Provide base argument to to_string
2020-06-12 10:18:27 -05:00
Matthew Bauer
b260c9ee03
Add newHashAllowEmpty helper function
...
This replaces the copy&paste with a helper function in hash.hh.
2020-06-12 10:11:16 -05:00
Eelco Dolstra
4a4c063222
Merge pull request #3670 from gilligan/add-pool-tests
...
Add tests for pool.hh
2020-06-12 11:19:05 +02:00
Ben Burdette
ef1b3f21b6
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-06-11 14:06:35 -06:00
Eelco Dolstra
ac4d43a31b
Merge pull request #3073 from tweag/machine-logs
...
Add an option to print the logs in a machine-readable format
2020-06-11 15:45:18 +02:00
Eelco Dolstra
dd9bb11d0d
Move names.{cc,hh} to libstore
2020-06-11 15:42:18 +02:00
Tobias Pflug
4750d98bbd
Add tests for pool.hh
2020-06-10 22:29:50 +02:00
Eelco Dolstra
b9ae1bdd7a
Merge pull request #3655 from zimbatm/hash-encoding-prepare
...
libutils/hash: remove default encoding
2020-06-10 11:48:38 +02:00
Ben Burdette
2f19650768
add file origin to Pos in stests
2020-06-08 11:21:17 -06:00
Ben Burdette
b1c53b034c
Merge branch 'errors-phase-2' into caveman-LOCs
2020-06-08 11:10:13 -06:00
regnat
801112de1a
Move progress-bar.cc to libmain
...
Needed so that we can include it as a logger in loggers.cc without
adding a dependency on nix
This also requires moving names.hh to libutil to prevent a circular
dependency between libmain and libexpr
2020-06-08 17:16:52 +02:00
Eelco Dolstra
6470450ab4
Add completion for --update-input
2020-06-08 16:20:00 +02:00
Tobias Pflug
cd6dbf951a
Add compression unit tests
2020-06-08 11:34:37 +02:00
regnat
4983401440
Unify the printing of the logs between bar-with-logs and raw
...
Make the printing of the build logs systematically go through the
logger, and replicate the behavior of `no-build-output` by having two
different loggers (one that prints the build logs and one that doesn't)
2020-06-08 09:31:15 +02:00
regnat
170e86dff5
Make the logger customisable
...
Add a new `--log-format` cli argument to change the format of the logs.
The possible values are
- raw (the default one for old-style commands)
- bar (the default one for new-style commands)
- bar-with-logs (equivalent to `--print-build-logs`)
- internal-json (the internal machine-readable json format)
2020-06-08 09:31:15 +02:00
Ben Burdette
94c347577e
set verbosity levels
2020-06-07 07:24:49 -06:00
Tobias Pflug
952e72c804
Add tests for logging.hh
2020-06-06 10:22:32 +02:00
John Ericson
e5cc1ebc5d
Merge remote-tracking branch 'upstream/master' into no-stringly-typed-derivation-output
2020-06-04 21:04:35 +00:00
John Ericson
a7b82fd006
Remove file which shouldn't be committed
2020-06-04 21:04:20 +00:00
Ben Burdette
94427ffee3
add some comments
2020-06-04 11:53:19 -06:00
Eelco Dolstra
f85606c431
Merge remote-tracking branch 'origin/master' into flakes
2020-06-04 13:16:28 +02:00
Eelco Dolstra
0f44b60e6d
Make 'nix dev-shell' a deprecated alias for 'nix develop'
2020-06-04 11:14:19 +02:00
Ben Burdette
4335ba999b
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-06-03 17:00:00 -06:00
Ben Burdette
f97576c5d9
newline-as-prefix; no final newline in output.
2020-06-03 14:47:00 -06:00
Eelco Dolstra
c20591ddc3
Merge remote-tracking branch 'origin/master' into flakes
2020-06-03 16:15:22 +02:00
zimbatm
6ee03b8444
libutils/hash: remove default encoding
...
This will make it easier to reason about the hash encoding and switch to
SRI everywhere where possible.
2020-06-03 13:49:51 +02:00
John Ericson
01572c2198
Missing #include <cassert>
in lru-cache.hh
( #3654 )
...
This was a latent bug that just appeared because of the tests that were
added. Remember to wait for CI! :)
2020-06-03 10:15:22 +00:00
John Ericson
1fcd3afc38
Fix hashes
2020-06-02 20:35:17 +00:00
John Ericson
c664e68b87
Fix to-base --type handler to correctly set std::optional flag
...
Now that we have a separate flag function, also describe why it is
optional.
2020-06-02 18:25:32 +00:00
John Ericson
d73dbc8e4c
Remove hashingWithUnknownAlgoExits
...
A valid hash type must be provided now. The hash itself can still be
invalid, but that doesn't cause an `abort()`.
2020-06-02 16:28:54 +00:00
John Ericson
64cffb804a
Merge remote-tracking branch 'upstream/master' into no-hash-type-unknown
2020-06-02 16:07:25 +00:00
John Ericson
450dcf2c1b
Remove HashType::Unknown
...
Instead, `Hash` uses `std::optional<HashType>`. In the future, we may
also make `Hash` itself require a known hash type, encoraging people to
use `std::optional<Hash>` instead.
2020-06-02 15:52:13 +00:00
Ben Burdette
156d4f8bc8
remove extra space in SysErrors
2020-06-02 08:45:37 -06:00
Ben Burdette
d82d230b40
elide the 'ErrorInfo' in logError and logWarning calls
2020-06-02 08:22:24 -06:00
Eelco Dolstra
c16fdda3a6
Merge branch 'lru-tests' of https://github.com/gilligan/nix
2020-06-02 12:07:48 +02:00
Eelco Dolstra
e9fee8e6a7
src/libutil/tests/lru-cache.cc: Check erase()
...
Co-authored-by: James Lee <jbit@jbit.net>
2020-06-02 12:06:59 +02:00
Tobias Pflug
eca1ff7a9f
Add tests for lru-cache.hh
2020-05-31 01:05:05 +02:00
Nikola Knezevic
77007d4eab
Improve ref validity checking in fetchGit
...
The previous regex was too strict and did not match what git was allowing. It
could lead to `fetchGit` not accepting valid branch names, even though they
exist in a repository (for example, branch names containing `/`, which are
pretty standard, like `release/1.0` branches).
The new regex defines what a branch name should **NOT** contain. It takes the
definitions from `refs.c` in https://github.com/git/git and `git help
check-ref-format` pages.
This change also introduces a test for ref name validity checking, which
compares the result from Nix with the result of `git check-ref-format --branch`.
2020-05-30 12:29:35 +02:00
Ben Burdette
734283d636
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-05-29 09:51:37 -06:00
Carlo Nucera
6dd471ebf6
Fixing the result of merge
2020-05-28 12:14:36 -04:00
Carlo Nucera
4f597fb901
Merge branch 'master' of github.com:NixOS/nix into enum-class
2020-05-28 10:58:22 -04:00
John Ericson
5b4cd84bc2
Merge remote-tracking branch 'me/more-rust-ffi' into no-stringly-typed-derivation-output
2020-05-28 10:35:53 -04:00
John Ericson
ef71caba29
Merge remote-tracking branch 'upstream/master' into more-rust-ffi
2020-05-28 10:31:46 -04:00
Eelco Dolstra
17ca997fc6
Merge remote-tracking branch 'origin/master' into flakes
2020-05-28 12:55:24 +02:00
Andreas Rammhold
fc137d2f00
config.hh: Add documentation
...
Provides some general overview on the mechanics of Config/Setting and
comments for the public methods of Config.
2020-05-27 17:47:18 +02:00
Andreas Rammhold
9df3d8ccd7
tests/config.cc: add tests for Config::applyConfig
2020-05-27 17:47:18 +02:00
Andreas Rammhold
e1b8c64c04
config.cc: extract parts of applyConfigFile into applyConfig
...
This moves the actual parsing of configuration contents into applyConfig
which applyConfigFile is then going to call. By changing this we can now
test the configuration file parsing without actually create a file on
disk.
2020-05-27 17:47:18 +02:00
Andreas Rammhold
93129cf1dd
Add unit tests for config.cc
2020-05-27 17:47:17 +02:00
Eelco Dolstra
66d3ac94c9
Merge pull request #3621 from gilligan/add-json-tests
...
Add unit tests for "json.hh"
2020-05-27 11:08:12 +02:00
Eelco Dolstra
dae6a267a8
Merge pull request #3625 from gilligan/xml-writer-tests
...
Add unit tests for xml-writer
2020-05-27 11:07:53 +02:00
Carlo Nucera
89a5ac9d3b
Merge remote-tracking branch 'john-ericson/more-rust-ffi' into no-stringly-typed-derivation-output
2020-05-26 12:31:26 -04:00
Carlo Nucera
d49e65ba9d
Merge remote-tracking branch 'john-ericson/enum-FileIngestionMethod' into no-stringly-typed-derivation-output
2020-05-26 12:30:48 -04:00
Carlo Nucera
0f3f901071
Merge remote-tracking branch 'origin/master' into more-rust-ffi
2020-05-26 11:46:42 -04:00
Carlo Nucera
c2f33edd1f
Update src/libutil/rust-ffi.hh
...
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2020-05-26 11:43:18 -04:00
Tobias Pflug
4b388e8431
Add unit tests for xml-writer
2020-05-25 18:34:55 +02:00
Tobias Pflug
c284700867
Add unit tests for "json.hh"
2020-05-25 11:57:45 +02:00
Tobias Pflug
ecc5c90dfc
Add unit tests for hashing functions
2020-05-25 11:50:41 +02:00
Ben Burdette
0e49de6a2b
position for stdin, string; (string) for trace; fix tests
2020-05-21 14:28:45 -06:00
Ben Burdette
6a420d672c
print LOC for stdin, string args
2020-05-20 22:18:26 -06:00
Ben Burdette
85ce455b85
get code lines from the nix file
2020-05-20 17:25:02 -06:00
Tobias Pflug
a73a820a5d
Add unit testes for url.cc
...
This adds tests for
- parseURL
- percentDecode
- decodeQuery
2020-05-20 16:37:35 +02:00
Ben Burdette
19694aa213
fix compile errors
2020-05-14 12:28:18 -06:00
Ben Burdette
ef9dd9f9bc
formatting and a few minor changes
2020-05-13 15:56:39 -06:00
Ben Burdette
bfca5fc395
change status messages to info level
2020-05-13 09:52:36 -06:00
Ben Burdette
ecbb8e9c0a
no blank line if no LOC
2020-05-12 14:41:30 -06:00
Ben Burdette
19cffc29c9
remove unused extra json fields
2020-05-12 12:09:12 -06:00
Eelco Dolstra
437614b479
Fix macOS build
...
macOS doesn't have GLOB_ONLYDIR.
2020-05-12 11:09:09 +02:00
Ben Burdette
b93c1bf3d6
fixes to merged code
2020-05-11 15:52:15 -06:00
Ben Burdette
59b1f5c701
Merge branch 'master' into errors-phase-2
2020-05-11 14:35:30 -06:00
Eelco Dolstra
27d34ef770
When completing flakerefs, only return directories
2020-05-11 22:04:13 +02:00
Eelco Dolstra
e917332d63
Shut up warnings while running completers
2020-05-11 21:38:17 +02:00
Ben Burdette
958e81987b
switch from printError warnings to logWarnings
2020-05-11 13:02:16 -06:00
Eelco Dolstra
4c3c638a05
Cleanup
2020-05-11 15:57:45 +02:00
Eelco Dolstra
0884f180f5
Simplify
2020-05-10 21:50:32 +02:00
Eelco Dolstra
e0c19ee620
Add completion for paths
2020-05-10 21:35:07 +02:00
Eelco Dolstra
91ddee6bf0
nix: Implement basic bash completion
2020-05-10 20:32:21 +02:00
Ben Burdette
55eb717148
add pos to errorinfo, remove from hints
2020-05-08 18:18:28 -06:00
Tobias Pflug
181a47d884
Enable toLower umlauts test
...
Update comment and enable the test
2020-05-08 15:13:55 +02:00
Tobias Pflug
2191141274
Enable baseNameOf
test
...
Add note about removal of trailing slashes in the doc comment of
baseNameOf and enabled the test.
2020-05-08 15:07:40 +02:00
Tobias Pflug
e3df9c2a6e
Enable dirOf
test
...
Adjusted the doc comment for `dirOf` to reflect the implementation
behavior.
2020-05-08 15:03:44 +02:00
Eelco Dolstra
5b8883faac
configure: Look for gtest
2020-05-08 12:09:37 +02:00
Eelco Dolstra
ca657525b8
Don't install unit tests
2020-05-08 12:03:27 +02:00
Eelco Dolstra
7898cdb75a
make check: Run unit tests
2020-05-08 11:49:40 +02:00
Eelco Dolstra
72b9d971bc
Fix warning
2020-05-08 11:35:57 +02:00
Eelco Dolstra
7cc7cef950
Move unit tests to sr/libutil/tests, use mk make rules
2020-05-08 11:34:09 +02:00
Ben Burdette
1b801cec40
pretending to be const
2020-05-07 16:43:36 -06:00
Tobias Pflug
1f3602a2c9
Remove replaceInSet
...
The function isn't being used anywhere so it seems safe to remove
2020-05-07 18:15:13 +02:00
Ben Burdette
e76ad2e48a
implement SysError errno handling
2020-05-06 14:07:20 -06:00
Eelco Dolstra
2f8ee4578f
Merge remote-tracking branch 'origin/master' into flakes
2020-05-06 12:01:40 +02:00
Eelco Dolstra
74a1bfdcab
Merge pull request #3546 from guibou/nix_readfile_on_0_sized_files
...
builtins.readFile: do not truncate content
2020-05-06 11:33:55 +02:00
Eelco Dolstra
fd4911269f
Revert "Merge pull request #3558 from LnL7/ssh-ng-stderr"
...
This reverts commit 3ebfbecdd1
, reversing
changes made to c089c52d5f
.
https://github.com/NixOS/nix/pull/3558
2020-05-06 10:54:18 +02:00
Eelco Dolstra
6f3244ce45
Merge remote-tracking branch 'origin/master' into flakes
2020-05-05 18:59:33 +02:00
Eelco Dolstra
f132d82a79
nix --help: Group commands
2020-05-05 15:18:23 +02:00
Ben Burdette
7ffb5efdbc
appending to hints; remove _printError
2020-05-04 16:19:57 -06:00
Ben Burdette
f30de61578
add normaltxt, yellowify->yellowtxt
2020-05-04 16:19:20 -06:00
Ben Burdette
afaa541013
affinity operator<<
2020-05-04 14:44:00 -06:00
Eelco Dolstra
a721a0b114
Flag: Use designated initializers
2020-05-04 22:40:19 +02:00
Ben Burdette
ab6f0b9641
convert some printError calls to logError
2020-05-03 08:01:25 -06:00
Daiderd Jordan
4769eea5e2
logging: handle build log lines in simple logger
...
The raw stderr output isn't logged anymore so the build logs need to be
printed by the default logger in order for the old commands like
nix-build to still show build output.
2020-05-02 23:40:53 +02:00
Ben Burdette
39ff80d031
errorinfo constructor test
2020-04-29 18:57:05 -06:00
Guillaume Bouchard
2e5be2a749
StringSink pre allocate
...
When used with `readFile`, we have a pretty good heuristic of the file
size, so `reserve` this in the `string`. This will save some allocation
/ copy when the string is growing.
2020-04-29 18:44:01 +02:00
Guillaume Bouchard
7afcb5af98
Remove the drain
argument from readFile
...
Now it is always `drain` (see previous commit).
2020-04-29 18:43:45 +02:00
Ben Burdette
e2f61263eb
uncrustify formatting
2020-04-29 10:14:32 -06:00
Guillaume Bouchard
5a34a473dd
builtins.readFile: do not truncate content
...
This closes #3026 by allowing `builtins.readFile` to read a file with a
wrongly reported file size, for example, files in `/proc` may report a
file size of 0. Reading file in `/proc` is not a good enough motivation,
however I do think it just makes nix more robust by allowing more file
to be read. Especially, I do considerer the previous behavior to be
dangerous because nix was previously reading truncated files. Examples
of file system which incorrectly report file size may be network file
system or dynamic file system (for performance reason, a dynamic file
system such as FUSE may generate the content of the file on demand).
```
nix-repl> builtins.readFile "/proc/version"
""
```
With this commit:
```
nix-repl> builtins.readFile "/proc/version"
"Linux version 5.6.7 (nixbld@localhost) (gcc version 9.3.0 (GCC)) #1-NixOS SMP Thu Apr 23 08:38:27 UTC 2020\n"
```
Here is a summary of the behavior changes:
- If the reported size is smaller, previous implementation
was silently returning a truncated file content. The new implementation
is returning the correct file content.
- If a file had a bigger reported file size, previous implementation was
failing with an exception, but the new implementation is returning the
correct file content. This change of behavior is coherent with this pull
request.
Open questions
- The behavior is unchanged for correctly reported file size, however
performances may vary because it uses the more complex sink interface.
Considering that sink is used a lot, I don't think this impacts the
performance a lot.
- `builtins.readFile` on an infinite file, such as `/dev/random` may
fill the memory.
- it does not support adding file to store, such as `${/proc/version}`.
2020-04-29 14:50:52 +02:00
Eelco Dolstra
5ada0831cf
Merge remote-tracking branch 'origin/master' into flakes
2020-04-29 13:32:27 +02:00
Ben Burdette
22e6490311
Error classname as name
2020-04-28 21:06:08 -06:00
Ben Burdette
e51a757720
astyle format
2020-04-27 15:15:08 -06:00
Alyssa Ross
c05e20daa1
Fix long paths permanently breaking GC
...
Suppose I have a path /nix/store/[hash]-[name]/a/a/a/a/a/[...]/a,
long enough that everything after "/nix/store/" is longer than 4096
(MAX_PATH) bytes.
Nix will happily allow such a path to be inserted into the store,
because it doesn't look at all the nested structure. It just cares
about the /nix/store/[hash]-[name] part. But, when the path is deleted,
we encounter a problem. Nix will move the path to /nix/store/trash, but
then when it's trying to recursively delete the trash directory, it will
at some point try to unlink
/nix/store/trash/[hash]-[name]/a/a/a/a/a/[...]/a. This will fail,
because the path is too long. After this has failed, any store deletion
operation will never work again, because Nix needs to delete the trash
directory before recreating it to move new things to it. (I assume this
is because otherwise a path being deleted could already exist in the
trash, and then moving it would fail.)
This means that if I can trick somebody into just fetching a tarball
containing a path of the right length, they won't be able to delete
store paths or garbage collect ever again, until the offending path is
manually removed from /nix/store/trash. (And even fixing this manually
is quite difficult if you don't understand the issue, because the
absolute path that Nix says it failed to remove is also too long for
rm(1).)
This patch fixes the issue by making Nix's recursive delete operation
use unlinkat(2). This function takes a relative path and a directory
file descriptor. We ensure that the relative path is always just the
name of the directory entry, and therefore its length will never exceed
255 bytes. This means that it will never even come close to AX_PATH,
and Nix will therefore be able to handle removing arbitrarily deep
directory hierachies.
Since the directory file descriptor is used for recursion after being
used in readDirectory, I made a variant of readDirectory that takes an
already open directory stream, to avoid the directory being opened
multiple times. As we have seen from this issue, the less we have to
interact with paths, the better, and so it's good to reuse file
descriptors where possible.
I left _deletePath as succeeding even if the parent directory doesn't
exist, even though that feels wrong to me, because without that early
return, the linux-sandbox test failed.
Reported-by: Alyssa Ross <hi@alyssa.is>
Thanks-to: Puck Meerburg <puck@puckipedia.com>
Tested-by: Puck Meerburg <puck@puckipedia.com>
Reviewed-by: Puck Meerburg <puck@puckipedia.com>
2020-04-27 20:50:17 +00:00
Ben Burdette
1ff42722ce
error.hh
2020-04-26 14:47:41 -06:00
Ben Burdette
d4fd7b543e
print dashes instead of empty name string
2020-04-25 12:05:26 -06:00
Ben Burdette
cdac083dc5
don't print blank lines for blank description
2020-04-24 21:40:13 -06:00
Ben Burdette
d8d4844b88
all things error to error.hh
2020-04-24 14:57:51 -06:00
Ben Burdette
d9632765a8
add has_value check; remove obslete friend class
2020-04-24 12:44:23 -06:00
Ben Burdette
833501f6f1
'what' string
2020-04-23 15:55:34 -06:00
Eelco Dolstra
ef4d3fc111
Merge remote-tracking branch 'origin/master' into flakes
2020-04-23 15:16:18 +02:00
Eelco Dolstra
c9d0cf7e02
Don't include error.hh in util.hh to prevent header bloat
2020-04-22 15:29:27 +02:00
Eelco Dolstra
16e3bf4537
Merge branch 'error-format' of https://github.com/bburdette/nix
2020-04-22 15:29:10 +02:00
Ben Burdette
e4fb9a3849
remove 'format' from Error constructor calls
2020-04-21 17:07:07 -06:00
Ben Burdette
d3052197fe
add ErrorInfo to BaseError
2020-04-21 13:25:41 -06:00
Ben Burdette
4697552948
demoing other error levels than warn/error; rename line and file fields in errPos
2020-04-17 15:50:46 -06:00
Ben Burdette
3d5b1032a1
logError, logWarning; Logger functions; switch to Verbosity enum
2020-04-17 15:07:44 -06:00
Ben Burdette
12814806ef
iomanip no longer needed
2020-04-16 10:48:15 -06:00
Eelco Dolstra
0858738355
Merge remote-tracking branch 'origin/master' into flakes
2020-04-16 18:27:37 +02:00
Eelco Dolstra
67a5941472
Logger: Add method for writing to stdout
...
Usually this just writes to stdout, but for ProgressBar, we need to
clear the current line, write the line to stdout, and then redraw the
progress bar.
(cherry picked from commit 696c026006
)
2020-04-16 18:03:38 +02:00
Ben Burdette
96262e744e
switch to structs, which don't need public:
2020-04-16 09:55:38 -06:00
Eelco Dolstra
696c026006
Logger: Add method for writing to stdout
...
Usually this just writes to stdout, but for ProgressBar, we need to
clear the current line, write the line to stdout, and then redraw the
progress bar.
2020-04-16 13:47:59 +02:00
Ben Burdette
057e5b6b2e
move implementation to cc
2020-04-15 10:09:43 -06:00
Ben Burdette
adf03b0b8e
Merge branch 'initializer-style' into error-format
2020-04-15 10:06:20 -06:00
zimbatm
895516cadf
add NIX_USER_CONF_FILES
...
Motivation: maintain project-level configuration files.
Document the whole situation a bit better so that it corresponds to the
implementation, and add NIX_USER_CONF_FILES that allows overriding
which user files Nix will load during startup.
2020-04-14 18:45:06 +02:00
Eelco Dolstra
d103c79144
Merge remote-tracking branch 'origin/master' into flakes
2020-04-09 15:54:21 +02:00
Nikola Knezevic
c330109bfa
DataTransfer -> FileTransfer
2020-04-08 22:26:57 +02:00
Nikola Knezevic
a0c5931208
actDownload -> actDataTransfer
2020-04-08 22:26:57 +02:00
Ben Burdette
805ffe1bc9
indention
2020-04-08 11:33:46 -06:00
Ben Burdette
8c2bf15c4f
format -> fmt
2020-04-08 11:17:02 -06:00
Ben Burdette
555baa8fb0
comments
2020-04-08 09:56:10 -06:00
Ben Burdette
54f91923c8
return of NixCode
2020-04-08 09:48:21 -06:00
Ben Burdette
47ed067d45
initializer style
2020-04-08 09:07:58 -06:00
Ben Burdette
00c507cc52
columnRange -> column
2020-04-07 14:36:32 -06:00
Ben Burdette
20c0984a46
remove columnrange; switch to fmt in error.cc
2020-04-07 10:14:15 -06:00
Eelco Dolstra
462421d345
Backport libfetchers from the flakes branch
...
This provides a pluggable mechanism for defining new fetchers. It adds
a builtin function 'fetchTree' that generalizes existing fetchers like
'fetchGit', 'fetchMercurial' and 'fetchTarball'. 'fetchTree' takes a
set of attributes, e.g.
fetchTree {
type = "git";
url = "https://example.org/repo.git ";
ref = "some-branch";
rev = "abcdef...";
}
The existing fetchers are just wrappers around this. Note that the
input attributes to fetchTree are the same as flake input
specifications and flake lock file entries.
All fetchers share a common cache stored in
~/.cache/nix/fetcher-cache-v1.sqlite. This replaces the ad hoc caching
mechanisms in fetchGit and download.cc (e.g. ~/.cache/nix/{tarballs,git-revs*}).
This also adds support for Git worktrees (c169ea5904
).
2020-04-07 09:03:14 +02:00
Ben Burdette
55c96b64e4
comment cleanup
2020-04-06 20:14:48 -06:00
Ben Burdette
ec449c8450
constructor style basically working
2020-04-06 19:43:22 -06:00
Ben Burdette
216263c36f
Merge branch 'master' into error-format
2020-04-06 10:00:00 -06:00
Ben Burdette
9bb528d392
handle Pos instead of individual file/line/columnrange args
2020-04-03 13:15:59 -06:00
Ben Burdette
7b7801d3f0
variadic args for hint format
2020-04-03 08:48:20 -06:00
Ben Burdette
c6b3fcddb0
formatted with astyle
2020-04-02 16:02:40 -06:00
Ben Burdette
1c329ca433
indenting
2020-04-02 14:25:43 -06:00
Ben Burdette
e697884f65
using std:: everywhere; fix a formatting error; add exception flags
2020-04-01 21:30:19 -06:00
Ben Burdette
dd7b8183a5
indenting
2020-04-01 16:20:20 -06:00
Ben Burdette
8713aeac5e
remove using std::*, switch to include guard
2020-04-01 15:51:14 -06:00
Ben Burdette
5b3aefff85
add some explanatory comments
2020-03-31 12:42:41 -06:00
Ben Burdette
9e7b89bf10
rename errors/warnings
2020-03-31 11:56:37 -06:00
Ben Burdette
09652f597c
enum style
2020-03-31 09:36:20 -06:00
Eelco Dolstra
e1a94ad852
Backport 'nix dev-shell' from the flakes branch
...
This also adds a '--profile' option to 'nix build' (replacing 'nix-env
--set').
2020-03-30 19:16:45 +02:00
Ben Burdette
35c7bab09a
build with make
2020-03-30 09:14:29 -06:00
Eelco Dolstra
e0a0ae0467
Move fetchers from libstore to libfetchers
2020-03-30 14:04:53 +02:00
John Ericson
87b32bab05
Use enum struct
and drop prefixes
...
This does a few enums; the rest will be gotten in subsequent commits.
2020-03-29 11:23:15 -04:00
Ben Burdette
759f39800b
remove util.hh from deps
2020-03-27 10:55:09 -06:00
Ben Burdette
00eb3fcb7a
more cleanup
2020-03-27 10:13:46 -06:00
Ben Burdette
a3ef00be6c
camelcase; optional hint
2020-03-27 10:03:02 -06:00
John Ericson
e433d4af4c
Extend Rust FFI
...
Do idiomatic C++ copy and move constructors for a few things, so
wrapping structs' defaults can work.
2020-03-25 16:12:14 -04:00
Ben Burdette
d44c9c5581
some colors
2020-03-25 11:20:44 -06:00
Ben Burdette
3582dc3c88
programName as static member var
2020-03-25 10:52:03 -06:00
Ben Burdette
fc310eda3a
switch to one level of builder function, not subobject functions
2020-03-24 14:24:57 -06:00
Ben Burdette
0166e7ab6d
MkNixCode, MkErrLine approach
2020-03-24 11:21:35 -06:00
Ben Burdette
4171ab4bbd
renaming
2020-03-24 09:18:23 -06:00
Eelco Dolstra
0a10854f85
Misc changes from the flakes branch
2020-03-24 14:34:47 +01:00
Eelco Dolstra
7a8de57d3e
Pretty-print 'nix why-depends' / 'nix-store -q --tree' output
...
Extracted from 678301072f
.
2020-03-24 14:26:23 +01:00
Eelco Dolstra
4260a22a55
absPath(): Use std::optional
...
(cherry picked from commit 1bf9eb21b7
)
2020-03-24 14:25:28 +01:00
Eelco Dolstra
edc34cc1a2
Add function for quoting strings
...
(cherry picked from commit 7dcf5b011a
)
2020-03-24 13:44:04 +01:00
Ben Burdette
aadd59d005
error test
2020-03-23 15:29:49 -06:00
Ben Burdette
f694f43d7d
straightforward port of rust mockup code
2020-03-22 12:25:47 -06:00
Eelco Dolstra
6208d24c38
Merge remote-tracking branch 'origin/master' into flakes
2020-02-14 22:42:35 +01:00
Eelco Dolstra
d8972317fc
Prevent uninitialized StorePath creation
2020-02-13 16:12:16 +01:00
Eelco Dolstra
8451298b35
Factor out TreeInfo
2020-02-01 22:06:55 +01:00
Eelco Dolstra
c5319e5d0b
Show "warning:" in yellow instead of red
2020-02-01 12:37:22 +01:00
Eelco Dolstra
8414685c0f
Change lock file format to use an attribute representation of flake refs rather than URLs
2020-01-31 19:16:40 +01:00
Eelco Dolstra
e91f32f2b5
Use light box drawing symbols
2020-01-31 14:09:27 +01:00
Eelco Dolstra
678301072f
nix flake list-inputs: Pretty-print the tree
2020-01-31 14:09:27 +01:00
Eelco Dolstra
9f4d8c6170
Pluggable fetchers
...
Flakes are now fetched using an extensible mechanism. Also lots of
other flake cleanups.
2020-01-21 22:56:04 +01:00
Eelco Dolstra
1bf9eb21b7
absPath(): Use std::optional
2020-01-21 22:39:43 +01:00
Eelco Dolstra
c7866733d7
Merge remote-tracking branch 'origin/master' into flakes
2019-12-20 12:45:58 +01:00
Eelco Dolstra
c84c843e33
tarfile.cc: Restore timestamps
...
This is needed to get the lastModified attribute of GitHub flakes.
2019-12-19 15:09:54 +01:00
Eelco Dolstra
2550c11373
tarfile.cc: Don't change the cwd
...
Nix is multithreaded so it's not safe to change the cwd.
2019-12-19 15:08:16 +01:00
Eelco Dolstra
be32da0ed0
tarfile.cc: Style fixes
2019-12-19 15:01:58 +01:00
Eelco Dolstra
ee235e764c
Merge branch 'libarchive' of https://github.com/yorickvP/nix
2019-12-19 14:47:18 +01:00
Eelco Dolstra
87873d0d65
Merge remote-tracking branch 'origin/master' into flakes
2019-12-18 14:25:25 +01:00
Eelco Dolstra
f8abbdd456
Add priority setting to stores
...
This allows overriding the priority of substituters, e.g.
$ nix-store --store ~/my-nix/ -r /nix/store/df3m4da96d84ljzxx4mygfshm1p0r2n3-geeqie-1.4 \
--substituters 'http://cache.nixos.org?priority=100 daemon?priority=10'
Fixes #3264 .
2019-12-17 17:17:53 +01:00
Eelco Dolstra
ad6b738ed8
Merge remote-tracking branch 'origin/master' into flakes
2019-12-16 20:17:21 +01:00
Eelco Dolstra
54bf5ba422
nix-store -r: Handle symlinks to store paths
...
Fixes #3270 .
2019-12-16 19:11:47 +01:00
Eelco Dolstra
ac9cc2ec08
Move some code
2019-12-13 19:10:39 +01:00
Eelco Dolstra
b4edc3ca61
Don't leak exceptions
2019-12-13 19:05:26 +01:00
Eelco Dolstra
e6bd88878e
Improve gzip error message
2019-12-13 19:05:26 +01:00
Eelco Dolstra
ca87707c90
Get rid of CBox
2019-12-13 19:05:26 +01:00
Eelco Dolstra
3e787423c2
Remove FIXME
2019-12-13 12:55:52 +01:00
Tom Bereknyei
c6295a3afd
Initial gzip support
...
Closes #3256
2019-12-13 03:34:15 -05:00
Eelco Dolstra
ecb3a1afa2
Merge remote-tracking branch 'origin/master' into flakes
2019-12-11 14:53:30 +01:00
Eelco Dolstra
bbe97dff8b
Make the Store API more type-safe
...
Most functions now take a StorePath argument rather than a Path (which
is just an alias for std::string). The StorePath constructor ensures
that the path is syntactically correct (i.e. it looks like
<store-dir>/<base32-hash>-<name>). Similarly, functions like
buildPaths() now take a StorePathWithOutputs, rather than abusing Path
by adding a '!<outputs>' suffix.
Note that the StorePath type is implemented in Rust. This involves
some hackery to allow Rust values to be used directly in C++, via a
helper type whose destructor calls the Rust type's drop()
function. The main issue is the dynamic nature of C++ move semantics:
after we have moved a Rust value, we should not call the drop function
on the original value. So when we move a value, we set the original
value to bitwise zero, and the destructor only calls drop() if the
value is not bitwise zero. This should be sufficient for most types.
Also lots of minor cleanups to the C++ API to make it more modern
(e.g. using std::optional and std::string_view in some places).
2019-12-10 22:06:05 +01:00
Yorick van Pelt
eba82b7c88
further clean up libarchive code
2019-12-09 17:21:46 +07:00
Puck Meerburg
28ee687adf
Clean up libarchive support
2019-12-07 18:12:21 +00:00
Yorick van Pelt
fe7ec70e6b
remove rust unpack_tarfile ffi
2019-12-07 23:28:31 +07:00
Yorick van Pelt
1355554d12
code 'cleanup'
2019-12-07 23:23:11 +07:00
Yorick van Pelt
f54c168031
add wrapper function around libarchive to c++ errors
2019-12-07 23:10:27 +07:00
Yorick van Pelt
232b390766
fixup! libarchive proof of concept
2019-12-07 23:00:37 +07:00
Yorick van Pelt
9ff5f6492f
libarchive proof of concept
2019-12-07 22:35:14 +07:00
Eelco Dolstra
ab88f4bbd4
Merge remote-tracking branch 'origin/master' into flakes
2019-12-05 20:53:32 +01:00
Eelco Dolstra
5e449b43ed
Initialize Command::_name
...
(cherry picked from commit d0a769cb06
)
2019-12-05 20:21:22 +01:00
Eelco Dolstra
ac67685606
Make subcommand construction in MultiCommand lazy
...
(cherry picked from commit a0de58f471
)
2019-12-05 20:19:26 +01:00
Eelco Dolstra
f964f428fe
Move Command and MultiCommand to libutil
...
(cherry picked from commit f70434b1fb
)
2019-12-05 20:13:47 +01:00
Eelco Dolstra
092af3c826
Eliminate more pass-by-value in variadic calls
2019-12-05 19:58:52 +01:00
Eelco Dolstra
603b2f583c
Revert "Make fmt() non-recursive"
...
This reverts commit 2b761d5f50
.
Also *really* make fmt() take arguments by reference.
2019-12-05 19:58:49 +01:00
Eelco Dolstra
334b8f8af1
fmt(): Pass arguments by reference rather than by value
2019-12-05 17:40:46 +01:00
Eelco Dolstra
c3c23a52ee
Merge remote-tracking branch 'origin/master' into flakes
2019-12-04 00:31:09 +01:00
Eelco Dolstra
949dc84894
Fix segfault on i686-linux
...
https://hydra.nixos.org/build/107467517
Seems that on i686-linux, gcc and rustc disagree on how to return
1-word structs: gcc has the caller pass a pointer to the result, while
rustc has the callee return the result in a register. Work around this
by using a bare pointer.
2019-11-27 14:17:15 +01:00
Eelco Dolstra
8918bae098
Drop remaining uses of external "tar"
...
Also, fetchGit now runs in O(1) memory since we pipe the output of
'git archive' directly into unpackTarball() (rather than first reading
it all into memory).
2019-11-26 22:07:28 +01:00
Eelco Dolstra
d33dd6e6c0
Move code around
2019-11-26 22:07:28 +01:00
Eelco Dolstra
b7fba16613
Move code around
2019-11-26 22:07:28 +01:00
Eelco Dolstra
ba87b08f85
getEnv(): Return std::optional
...
This allows distinguishing between an empty value and no value.
2019-11-22 16:18:13 +01:00
Eelco Dolstra
5ee23c35b9
Merge pull request #3219 from Ericson2314/semicolons
...
Fix extra semicolons warnings
2019-11-11 12:13:51 +01:00
John Ericson
4c34054673
Remove unneeded semicolons
2019-11-10 11:24:47 -05:00
John Ericson
96e6e680c1
Fix extra ; warnings involving MakeError
2019-11-10 11:24:47 -05:00
Eelco Dolstra
2c1e05ae93
Merge remote-tracking branch 'origin/master' into flakes
2019-11-08 15:22:54 +01:00
Eelco Dolstra
0d6774468c
Move editorFor srom libutil to nix
...
libutil should not depend on libexpr.
2019-11-08 15:13:32 +01:00
Eelco Dolstra
f730841db4
Merge remote-tracking branch 'origin/master' into flakes
2019-11-07 11:44:02 +01:00
Eelco Dolstra
39a2e166dd
Cleanup
2019-11-06 16:53:02 +01:00
Eelco Dolstra
88c452d160
Merge remote-tracking branch 'origin/master' into flakes
2019-11-06 10:56:33 +01:00
Eelco Dolstra
852554bb16
Merge branch 'nix-repl-e' of https://github.com/zimbatm/nix
2019-11-05 11:20:53 +01:00
Eelco Dolstra
1b600ecd14
Don't use SOCK_CLOEXEC on macOS
...
https://hydra.nixos.org/build/105428308
2019-11-05 10:25:09 +01:00
Eelco Dolstra
b81d9d26f5
Merge remote-tracking branch 'origin/master' into flakes
2019-11-04 22:29:31 +01:00
Harald van Dijk
c935ad3f02
Fix progress bar when nix-prefetch-url is piped.
...
The intent of the code was that if the window size cannot be determined,
it would be treated as having the maximum possible size. Because of a
missing assignment, it was actually treated as having a width of 0.
The reason the width could not be determined was because it was obtained
from stdout, not stderr, even though the printing was done to stderr.
This commit addresses both issues.
2019-11-03 21:46:59 +00:00
Eelco Dolstra
63b99af85a
Move Unix domain socket creation to libutil
...
Also drop multithread-unfriendly hacks like doing a temporary
chmod/umask.
2019-10-29 13:30:51 +01:00
zimbatm
3774fe55fd
editorFor: take a pos object instead
2019-10-28 21:36:34 +01:00
Eelco Dolstra
f1c0b2c0e1
Add O(1)-memory copyPath() function
2019-10-27 18:18:58 +01:00
zimbatm
207a537343
libutil: add editorFor heuristic
2019-10-23 16:48:28 +02:00
Eelco Dolstra
9a18f544ac
Merge remote-tracking branch 'origin/master' into flakes
2019-10-21 18:48:21 +02:00
Eelco Dolstra
0abb3ad537
Allow content-addressable paths to have references
...
This adds a command 'nix make-content-addressable' that rewrites the
specified store paths into content-addressable paths. The advantage of
such paths is that 1) they can be imported without signatures; 2) they
can enable deduplication in cases where derivation changes do not
cause output changes (apart from store path hashes).
For example,
$ nix make-content-addressable -r nixpkgs.cowsay
rewrote '/nix/store/g1g31ah55xdia1jdqabv1imf6mcw0nb1-glibc-2.25-49' to '/nix/store/48jfj7bg78a8n4f2nhg269rgw1936vj4-glibc-2.25-49'
...
rewrote '/nix/store/qbi6rzpk0bxjw8lw6azn2mc7ynnn455q-cowsay-3.03+dfsg1-16' to '/nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16'
We can then copy the resulting closure to another store without
signatures:
$ nix copy --trusted-public-keys '' ---to ~/my-nix /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16
In order to support self-references in content-addressable paths,
these paths are hashed "modulo" self-references, meaning that
self-references are zeroed out during hashing. Somewhat annoyingly,
this means that the NAR hash stored in the Nix database is no longer
necessarily equal to the output of "nix hash-path"; for
content-addressable paths, you need to pass the --modulo flag:
$ nix path-info --json /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16 | jq -r .[].narHash
sha256:0ri611gdilz2c9rsibqhsipbfs9vwcqvs811a52i2bnkhv7w9mgw
$ nix hash-path --type sha256 --base32 /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16
1ggznh07khq0hz6id09pqws3a8q9pn03ya3c03nwck1kwq8rclzs
$ nix hash-path --type sha256 --base32 /nix/store/iq6g2x4q62xp7y7493bibx0qn5w7xz67-cowsay-3.03+dfsg1-16 --modulo iq6g2x4q62xp7y7493bibx0qn5w7xz67
0ri611gdilz2c9rsibqhsipbfs9vwcqvs811a52i2bnkhv7w9mgw
2019-10-21 17:47:24 +02:00
Eelco Dolstra
90df25ef7e
Fix build
2019-10-10 15:07:50 +02:00
Eelco Dolstra
e99bb91217
Merge remote-tracking branch 'origin/master' into flakes
2019-10-10 12:54:37 +02:00
Eelco Dolstra
9348f9291e
nix-env: Create ~/.nix-profile automatically
2019-10-09 23:35:01 +02:00
Eelco Dolstra
55bba8e4f5
Make std::uncaught_exception warning less noisy
2019-10-09 23:04:11 +02:00
Eelco Dolstra
a323b7826c
Merge remote-tracking branch 'origin/master' into flakes
2019-10-04 17:26:32 +02:00
Eelco Dolstra
93b1ce1ac5
Revert "std::uncaught_exception() -> std::uncaught_exceptions()"
...
This reverts commit 6b83174fff
because
it doesn't work on macOS yet.
https://hydra.nixos.org/build/102617587
2019-10-04 16:34:59 +02:00
Eelco Dolstra
092ee24627
Merge remote-tracking branch 'origin/master' into flakes
2019-09-18 12:02:50 +02:00
Eelco Dolstra
6b83174fff
std::uncaught_exception() -> std::uncaught_exceptions()
...
The former is deprecated in C++17. Fixes a clang warning.
2019-09-13 20:05:44 +02:00
Eelco Dolstra
4caeefaf00
Revert "Remove obsolete OpenSSL locking code"
...
This reverts commit aeb695c007
.
2019-09-04 14:06:52 +02:00
Eelco Dolstra
e302ba0e65
Merge remote-tracking branch 'origin/master' into flakes
2019-09-04 13:30:11 +02:00
Eelco Dolstra
f186000367
Add some noexcepts
...
This is to assert that callback functions should never throw (since
the context in which they're called may not be able to handle the
exception).
2019-09-03 13:45:35 +02:00
Eelco Dolstra
7348653ff4
Ensure that Callback is called only once
...
Also, make Callback movable but uncopyable.
2019-09-03 13:45:35 +02:00
Eelco Dolstra
aeb695c007
Remove obsolete OpenSSL locking code
...
OpenSSL 1.1.1 no longer needs this (2e52e7df51
).
This shuts up a clang warning about opensslLockCallback being unused.
2019-09-02 17:50:44 +02:00
Eelco Dolstra
c693f80b81
Shut up some clang warnings
2019-09-02 17:43:27 +02:00
Eelco Dolstra
ebc4dae517
Merge remote-tracking branch 'origin/master' into flakes
2019-08-29 16:11:38 +02:00
Eelco Dolstra
a2c4fcd5e9
Don't rely on st_blocks
...
It doesn't seem very reliable on ZFS.
2019-08-29 14:49:58 +02:00
zimbatm
91b00b145f
libutil: add SizedSource
...
Introduce the SizeSource which allows to bound how much data is being
read from a source. It also contains a drainAll() function to discard
the rest of the source, useful to keep the nix protocol in sync.
2019-08-16 15:05:40 +02:00
Eelco Dolstra
1d750e0587
Merge remote-tracking branch 'origin/master' into flakes
2019-08-08 15:49:13 +02:00
regnat
7c5596734f
Add a post-build-hook
...
Passing `--post-build-hook /foo/bar` to a nix-* command will cause
`/foo/bar` to be executed after each build with the following
environment variables set:
DRV_PATH=/nix/store/drv-that-has-been-built.drv
OUT_PATHS=/nix/store/...build /nix/store/...build-bin /nix/store/...build-dev
This can be useful in particular to upload all the builded artifacts to
the cache (including the ones that don't appear in the runtime closure
of the final derivation or are built because of IFD).
This new feature prints the stderr/stdout output to the `nix-build`
and `nix build` client, and the output is printed in a Nix 2
compatible format:
[nix]$ ./inst/bin/nix-build ./test.nix
these derivations will be built:
/nix/store/ishzj9ni17xq4hgrjvlyjkfvm00b0ch9-my-example-derivation.drv
building '/nix/store/ishzj9ni17xq4hgrjvlyjkfvm00b0ch9-my-example-derivation.drv'...
hello!
bye!
running post-build-hook '/home/grahamc/projects/github.com/NixOS/nix/post-hook.sh'...
post-build-hook: + sleep 1
post-build-hook: + echo 'Signing paths' /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation
post-build-hook: Signing paths /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation
post-build-hook: + sleep 1
post-build-hook: + echo 'Uploading paths' /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation
post-build-hook: Uploading paths /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation
post-build-hook: + sleep 1
post-build-hook: + printf 'very important stuff'
/nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation
[nix-shell:~/projects/github.com/NixOS/nix]$ ./inst/bin/nix build -L -f ./test.nix
my-example-derivation> hello!
my-example-derivation> bye!
my-example-derivation (post)> + sleep 1
my-example-derivation (post)> + echo 'Signing paths' /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation
my-example-derivation (post)> Signing paths /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation
my-example-derivation (post)> + sleep 1
my-example-derivation (post)> + echo 'Uploading paths' /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation
my-example-derivation (post)> Uploading paths /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation
my-example-derivation (post)> + sleep 1
my-example-derivation (post)> + printf 'very important stuff'
[1 built, 0.0 MiB DL]
Co-authored-by: Graham Christensen <graham@grahamc.com>
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2019-08-02 10:48:15 -04:00