John Ericson
3c78ac348c
Merge remote-tracking branch 'obsidian/no-hash-type-unknown' into validPathInfo-ca-proper-datatype
2020-06-03 04:44:24 +00:00
Carlo Nucera
fd2eb41e64
Move file-hash to content-address
2020-06-02 15:44:58 -04: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
c502119fd3
to-base supports parsing SRI hashes, so make type flag optional
2020-06-02 18:05:26 +00:00
John Ericson
25e61812f3
Apply suggestions from code review
...
Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
2020-06-02 12:47:18 -04: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
John Ericson
1b6461f671
Merge remote-tracking branch 'upstream/master' into validPathInfo-ca-proper-datatype
2020-06-02 14:31:18 +00:00
Ben Burdette
d82d230b40
elide the 'ErrorInfo' in logError and logWarning calls
2020-06-02 08:22:24 -06:00
John Ericson
efcd30da89
WIP
2020-06-02 00:37:43 +00:00
John Ericson
754c910953
WIP more progress
2020-06-01 19:26:40 -04:00
Carlo Nucera
0e9438b6d3
Create new file-hash files
2020-06-01 17:32:40 -04:00
Carlo Nucera
f4b89e11a4
Merge branch 'no-stringly-typed-derivation-output' of github.com:Ericson2314/nix into validPathInfo-ca-proper-datatype
2020-06-01 17:12:50 -04:00
John Ericson
fac0c2d54a
Remove addToStore variant as requested by FIXME
...
The idea is it's always more flexible to consumer a `Source` than a
plain string, and it might even reduce memory consumption.
I also looked at `addToStoreFromDump` with its `// FIXME: remove?`, but
the worked needed for that is far more up for interpretation, so I
punted for now.
2020-05-29 17:02:32 -04:00
Ben Burdette
734283d636
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-05-29 09:51:37 -06: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
0f96f45061
Use FileIngestionMethod
for nix hash
...
There was an enum there that matched in perfectly.
2020-05-27 23:50:11 -04:00
Matthew Bauer
7873fd175d
Don’t use FileIngestionMethod for StorePathsCommand
...
This is a different recursive than used in makeFixedOutputPath.
2020-05-27 13:21:11 -05:00
Carlo Nucera
f3f520c14c
Change syntax for CI
2020-05-26 12:51:28 -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
6d73c10041
Merge remote-tracking branch 'origin/master' into enum-FileIngestionMethod
2020-05-26 11:14:08 -04:00
Ben Burdette
92123c6c79
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-05-15 07:00:36 -06:00
Ben Burdette
bfca5fc395
change status messages to info level
2020-05-13 09:52:36 -06:00
Eelco Dolstra
268ecf5b3f
nix: Don't require --experimental-features=nix-command for some subcommands
2020-05-12 15:47:09 +02:00
Ben Burdette
59b1f5c701
Merge branch 'master' into errors-phase-2
2020-05-11 14:35:30 -06:00
Ben Burdette
e3901638b5
todo removal
2020-05-06 15:01:13 -06:00
Domen Kožar
672985531c
Merge pull request #3570 from Mic92/nix-search
...
nix/search: no error for empty search results if json is enabled
2020-05-06 16:14:58 +02:00
Jörg Thalheim
85c1932c94
nix/search: no error for empty search results if json is enabled
...
- result list will be always empty if --json is passed
- for scripts an empty search result is not really an error,
we rather want to distinguish between evaluation errors and empty results
2020-05-06 14:43:54 +01: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
272c4ba36d
Merge pull request #3557 from Ma27/nix-repl-help
...
Improve help-message for nix-repl
2020-05-06 11:25:47 +02:00
Eelco Dolstra
909b4a8820
nix doctor: Consistency
2020-05-05 15:27:47 +02:00
Eelco Dolstra
f132d82a79
nix --help: Group commands
2020-05-05 15:18:23 +02: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
Maximilian Bosch
2aeb874e83
Improve help-message for nix-repl
...
* Remove obsolete `printHelp` function
* Add an example to demonstrate how to list all available commands
within the REPL
2020-05-01 23:32:01 +02:00
Eelco Dolstra
c089c52d5f
Fix build
2020-05-01 12:42:39 +02:00
Matthew Kenigsberg
d6b4047c2f
rename nix run to nix shell and nix app to nix run
...
(cherry picked from commit 5d8504b978
)
2020-05-01 12:17:36 +02:00
Ben Burdette
f5d3215c87
logError
2020-04-30 16:31:47 -06:00
Ben Burdette
171b4ce85c
typo
2020-04-30 09:57:01 -06:00
Eelco Dolstra
0135fd6ec4
nix dev-shell: Unset shellHook
...
This avoids inheriting the caller's shellHook, which can happen when
running a dev-shell inside a dev-shell.
2020-04-30 14:47:56 +02:00
Eelco Dolstra
efe6c186ea
nix dev-shell: Support structured attrs
...
Tested against https://github.com/NixOS/nixpkgs/pull/72074 .
Fixes #3540 .
2020-04-30 14:47:47 +02:00
Eelco Dolstra
2fcfc6c2c6
nix dev-shell: Refactor script for getting the environment
2020-04-30 13:05:29 +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
Matthew Kenigsberg
6d40fe573c
rename to NIX_GCROOT
2020-04-28 11:18:54 -06:00
Matthew Kenigsberg
9e95b95a5d
comment
2020-04-27 13:18:26 -06:00
Matthew Kenigsberg
a3bc695e7d
Set GCROOT to store path to prevent garbage collection
2020-04-27 11:22:20 -06:00
Ben Burdette
e4fb9a3849
remove 'format' from Error constructor calls
2020-04-21 17:07:07 -06:00
Ben Burdette
15e9564fd1
logEI for tunnelLogger and progressbar
2020-04-19 17:16:51 -06:00
Ben Burdette
3d5b1032a1
logError, logWarning; Logger functions; switch to Verbosity enum
2020-04-17 15:07:44 -06:00
Eelco Dolstra
efaffaa9d1
Use Logger::stdout()
...
(cherry picked from commit 8f41847394
)
2020-04-16 18:14:01 +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
Eelco Dolstra
fcd048a526
Use RootValue
2020-04-16 18:02:59 +02:00
Andreas Rammhold
d2c371927e
SourceExprCommand: allocate the vSourceExpr via uncollectable memory
...
Previously the memory would occasionally be collected during eval since
the GC doesn't consider the member variable as alive / doesn't scan the
region of memory where the pointer lives.
By using the traceable_allocator<T> allocator provided by Boehm GC we
can ensure the memory isn't collected. It should be properly freed when
SourceExprCommand goes out of scope.
2020-04-13 21:23:54 +02:00
Nikola Knezevic
f5095594e7
datatransfer.{cc,hh} -> filetransfer.{cc,hh}
2020-04-08 22:26:57 +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
Nikola Knezevic
cd391206e6
{get,make,new}Downloader -> DataTransfer
2020-04-08 22:26:57 +02:00
Nikola Knezevic
e5cc53beec
DownloadSettings -> DataTransferSettings
2020-04-08 22:26:57 +02:00
Nikola Knezevic
741e9012d3
Rename src/lib/download.* to src/lib/datatransfer.*
2020-04-08 22:26:57 +02:00
Nikola Knezevic
65ef57e0cb
DownloadRequest -> DataTransferRequest
2020-04-08 22:26:57 +02:00
Eelco Dolstra
5449ff7d8a
Merge pull request #3477 from Ninlives/nix-run-using-env
...
`nix run` using $SHELL as default command
2020-04-08 19:35:39 +02:00
mlatus
9d04b5da17
nix run
using $SHELL as default command
2020-04-07 20:29:40 +08: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
Eelco Dolstra
3166b97174
nix shell -> nix dev-shell
2020-03-31 13:45:28 +02:00
John Ericson
c251b011cd
Merge remote-tracking branch 'upstream/master' into enum-FileIngestionMethod
2020-03-30 18:16:44 -04: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
John Ericson
832bd534dc
Store parsed hashes in DerivationOutput
...
It's best to detect invalid data as soon as possible, with data types
that make storing it impossible.
2020-03-30 11:33:35 -04:00
Eelco Dolstra
e322a16523
Remove global -I flags
...
(cherry picked from commit 2c692a3b14
)
2020-03-30 15:30:19 +02:00
John Ericson
225e62a56a
Replace some bool recursive
with a new FileIngestionMethod
enum
2020-03-29 15:16:20 -04: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
Eelco Dolstra
c85097da7c
Fix --refresh with --no-net
...
https://hydra.nixos.org/build/110879699
(cherry picked from commit 5bbe793abf
)
2020-03-24 14:26:23 +01:00
Eelco Dolstra
6b824c78f1
nix: Add --refresh as an alias for --tarball-ttl 0
...
(cherry picked from commit e721f99817
)
2020-03-24 14:26:23 +01:00
Eelco Dolstra
777e21e596
nix path-info --json: Print hash in SRI format
...
(cherry picked from commit 442e665d6d
)
2020-03-24 14:26:23 +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
231a8aa2c2
nix edit: Support non-derivation attributes
...
E.g.
$ nix edit .#nixosConfigurations.bla
now works.
(cherry picked from commit d2032edb2f
)
2020-03-24 14:06:47 +01:00
Eelco Dolstra
c1ca4f0acc
findAlongAttrPath(): Return position
...
(cherry picked from commit 0b013a54dc
)
2020-03-24 14:06:47 +01:00
Eelco Dolstra
ef74fafc03
nix repl: Put EvalState on the heap
...
See 0629601da1
.
2020-03-19 13:52:28 +01:00
Eelco Dolstra
b244e65cdb
nix repl: Scan NixRepl for GC roots
...
Fixes #3175 .
2020-03-19 13:50:01 +01:00
Will Dietz
15edd2349e
local.mk: fix user-env.cc dep on buildenv.nix.gen.hh, resolve occasional build failure
2020-03-12 00:51:56 +01:00
Eelco Dolstra
9950cdec35
Move some corepkgs into the nix binary
2020-03-11 16:57:48 +01:00
Eelco Dolstra
d8fd31f50f
Disable the progress bar if $TERM == dumb or unset
...
Fixes #3363 .
2020-02-18 17:51:18 +01:00
Eelco Dolstra
d8972317fc
Prevent uninitialized StorePath creation
2020-02-13 16:12:16 +01:00
Eelco Dolstra
4511f09b49
nix make-content-addressable: Add --json flag
...
Fixes #3274 .
2019-12-18 17:39:02 +01:00
Eelco Dolstra
ba6d2093c7
Fix progress bar
2019-12-14 23:19:04 +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
Eelco Dolstra
3b9c9d34e5
Shut up clang warning
...
(cherry picked from commit 3392f1b778
)
2019-12-05 20:41:44 +01:00
Eelco Dolstra
80ab95315d
nix doctor: Fix typo
...
(cherry picked from commit 96c6b08ed7
)
2019-12-05 20:40:52 +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
f1b5c76c1a
MultiCommand: Simplify construction
...
(cherry picked from commit 15a16e5c05
)
2019-12-05 20:10:35 +01:00
Eelco Dolstra
313106d549
Fix clang warnings
2019-11-26 21:07:44 +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
0d6774468c
Move editorFor srom libutil to nix
...
libutil should not depend on libexpr.
2019-11-08 15:13:32 +01:00
Eelco Dolstra
d823381c0a
Merge branch 'fix/nix-doctor-output' of https://github.com/bhipple/nix
2019-11-05 16:04:40 +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
f5a46ef0b1
Merge pull request #3202 from kraem/master
...
Update nix eval --help msg to not include deprecated command
2019-11-04 09:34:30 +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
kraem
dcd7a26063
Update nix eval --help msg to not include deprecated command
2019-11-03 18:47:28 +01:00
ng0
b811bd2172
include netinet/in.h in src/nix/main.cc
...
Fixes #3186
2019-11-01 14:09:42 +00:00