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
Eelco Dolstra
488ff83e6b
Fix completion of --template
2020-06-05 14:09:12 +02:00
Eelco Dolstra
39e84c35d0
Fix log-prefix of nix build -L
...
Alternative fix to #3661 . The cause was that 'name' is a
std::string_view into a temporary which could get overwritten.
2020-06-05 10:45:05 +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
744ce9ce16
Merge branch 'master' of github.com:NixOS/nix into validPathInfo-ca-proper-datatype
2020-06-04 20:46:58 +00:00
John Ericson
574d5460f0
Make sure info.ca tag bit is set in nix add-to-store
2020-06-04 20:33:28 +00:00
Eelco Dolstra
810b2c6a48
nix flake init: Add a '--template' flag
...
The initial contents of the flake is specified by the
'templates.<name>' or 'defaultTemplate' output of another flake. E.g.
outputs = { self }: {
templates = {
nixos-container = {
path = ./nixos-container;
description = "An example of a NixOS container";
};
};
};
allows
$ nix flake init -t templates#nixos-container
Also add a command 'nix flake new', which is identical to 'nix flake
init' except that it initializes a specified directory rather than the
current directory.
2020-06-04 20:22:25 +02:00
Eelco Dolstra
d746ef4a81
Disable eval cache with --impure
...
Fixes
$ nix build nixpkgs#zoom-us
error: Package ‘zoom-us-5.0.399860.0429’ in /nix/store/m79v7h75b69fkk8d2qcwm555l3wq6fmv-source/pkgs/applications/networking/instant-messengers/zoom-us/default.nix:126 has an unfree license (‘unfree’), refusing to evaluate.
$ nix build nixpkgs#zoom-us --impure
error: cached failure of attribute 'legacyPackages.x86_64-linux.zoom-us.drvPath'
2020-06-04 14:53:51 +02: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
Eelco Dolstra
61e3d598b6
Rename 'nix dev-shell' to 'nix develop'
...
Fixes #3648 .
2020-06-04 10:57:40 +02:00
John Ericson
53bc8ff152
No C++ designated initializers yet with Clang 7
2020-06-03 20:45:14 -04:00
Ben Burdette
4335ba999b
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-06-03 17:00:00 -06:00
Eelco Dolstra
c20591ddc3
Merge remote-tracking branch 'origin/master' into flakes
2020-06-03 16:15:22 +02:00
Jonas Chevalier
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
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
Eelco Dolstra
950b46821f
Remove TreeInfo
...
The attributes previously stored in TreeInfo (narHash, revCount,
lastModified) are now stored in Input. This makes it less arbitrary
what attributes are stored where.
As a result, the lock file format has changed. An entry like
"info": {
"lastModified": 1585405475,
"narHash": "sha256-bESW0n4KgPmZ0luxvwJ+UyATrC6iIltVCsGdLiphVeE="
},
"locked": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b88ff468e9850410070d4e0ccd68c7011f15b2be",
"type": "github"
},
is now stored as
"locked": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b88ff468e9850410070d4e0ccd68c7011f15b2be",
"type": "github",
"lastModified": 1585405475,
"narHash": "sha256-bESW0n4KgPmZ0luxvwJ+UyATrC6iIltVCsGdLiphVeE="
},
The 'Input' class is now a dumb set of attributes. All the fetcher
implementations subclass InputScheme, not Input. This simplifies the
API.
Also, fix substitution of flake inputs. This was broken since lazy
flake fetching started using fetchTree internally.
2020-05-30 00:44:11 +02: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
Eelco Dolstra
17ca997fc6
Merge remote-tracking branch 'origin/master' into flakes
2020-05-28 12:55:24 +02:00
Eelco Dolstra
c3eff22f46
Merge branch 'store-visited' of https://github.com/mkenigs/nix into flakes
2020-05-28 12:15:39 +02:00
Eelco Dolstra
6286272371
nixpkgsFlakeRef(): Use locked nixpkgs
2020-05-28 12:13:13 +02: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
Matthew Kenigsberg
8d67794da1
handle circular flake dependencies in list-inputs
2020-05-21 17:06:11 -06:00
Matthew Kenigsberg
c4beded32e
rm includes
2020-05-16 11:19:41 -06:00
Matthew Kenigsberg
ba7d7ed2e3
Create bashInteractive InstallableFlake
2020-05-16 11:03:06 -06:00
Matthew Kenigsberg
0858793604
Call lockFlake once and store in _lockedFlake
2020-05-16 11:03:06 -06:00
Matthew Kenigsberg
04821bc171
use flake's nixpkgs to find bashInteractive
2020-05-16 11:03:06 -06:00
Matthew Kenigsberg
8fbc8540d3
use nixpkgs#bashInteractive for dev-shell
2020-05-16 11:03:06 -06:00
Ben Burdette
92123c6c79
Merge remote-tracking branch 'upstream/master' into errors-phase-2
2020-05-15 07:00:36 -06:00
Eelco Dolstra
5f64655ff4
Move registry-related commands from 'nix flake' to 'nix registry'
...
This makes 'nix flake' less cluttered and more consistent (it's only
subcommands that operator on a flake). Also, the registry is not
inherently flake-related (e.g. fetchTree could also use it to remap
inputs).
2020-05-15 14:38:10 +02:00
Ben Burdette
bfca5fc395
change status messages to info level
2020-05-13 09:52:36 -06:00
Eelco Dolstra
215f09d765
Merge pull request #3587 from NixOS/bash-completion
...
Generic shell completion support for the 'nix' command
2020-05-12 18:26:13 +02:00
Eelco Dolstra
268ecf5b3f
nix: Don't require --experimental-features=nix-command for some subcommands
2020-05-12 15:47:09 +02:00
Eelco Dolstra
b8b2dbf272
Fix InstallableCommand
2020-05-12 11:53:32 +02:00
Ben Burdette
59b1f5c701
Merge branch 'master' into errors-phase-2
2020-05-11 14:35:30 -06:00
Eelco Dolstra
649c2db308
nix flake: Add completion support
2020-05-11 22:10:33 +02:00
Eelco Dolstra
27d34ef770
When completing flakerefs, only return directories
2020-05-11 22:04:13 +02:00
Eelco Dolstra
259ff74bde
Add completion for installables
...
This completes flakerefs using the registry (e.g. 'nix<TAB>' => 'nix
nixpkgs') and flake output attributes by evaluating the flake
(e.g. 'dwarffs#nix<TAB>' => 'dwarffs#nixosModules').
2020-05-11 21:49:02 +02:00
Eelco Dolstra
4c3c638a05
Cleanup
2020-05-11 15:57:45 +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
Matthew Kenigsberg
73ee1afffe
Reorder to build
...
This reverts commit 883948d7a0add742ccae58e9845d769a8064371c.
2020-05-09 14:42:32 -06:00
Matthew Kenigsberg
9f4cfbb2e7
Refactor installables
...
InstallableValue has children InstallableFlake and InstallableAttrPath, but InstallableFlake was overriding toDerivations, and usage was changed so that InstallableFlake didn't need cmd. So these changes were made:
InstallableValue::toDerivations() -> InstalllableAttrPath::toDerivations()
InstallableValue::cmd -> InstallableAttrPath::cmd
InstallableValue uses state instead of cmd
toBuildables() and toDerivations() were made abstract
2020-05-09 14:42:32 -06:00
Matthew Kenigsberg
bf81dd40e9
InstallableExpr unused
2020-05-09 10:16:00 -06:00
Eelco Dolstra
14a3a62bfc
Update src/nix/search.cc
...
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2020-05-07 12:13:16 +02:00
Ben Burdette
e3901638b5
todo removal
2020-05-06 15:01:13 -06:00
Eelco Dolstra
ff394ff206
Remove the nixpkgs.<attr> compatibility hack
...
Since we've changed a lot of things in the 'nix' command (e.g. rename
'nix run') there is not much point in keeping this around.
2020-05-06 17:20:23 +02: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
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
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
6f3244ce45
Merge remote-tracking branch 'origin/master' into flakes
2020-05-05 18:59:33 +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
Eelco Dolstra
941f95284a
Merge remote-tracking branch 'origin/master' into flakes
2020-05-01 11:59:56 +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
Matthew Kenigsberg
5d8504b978
rename nix run to nix shell and nix app to nix run
2020-04-29 15:45:10 -06: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
Eelco Dolstra
9570036146
nix copy: Build derivations
...
Fixes
$ nix copy .#hydraJobs.vendoredCrates --to /tmp/nix
error: path '/nix/store/...' is not valid
2020-04-29 15:51:45 +02:00
Eelco Dolstra
9c4e05766b
nix copy: Move --from / --to check
...
This means you now get an error message *before* stuff gets built:
$ nix copy .#hydraJobs.vendoredCrates
error: you must pass '--from' and/or '--to'
Try 'nix --help' for more information.
2020-04-29 15:50:59 +02:00
Eelco Dolstra
70bcd6a55c
Evaluation cache: Don't barf in read-only mode
...
Fixes
$ nix copy
warning: Git tree '/home/eelco/Dev/nix-flake' is dirty
nix: src/nix/installables.cc:348: std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, nix::FlakeRef, nix::InstallableValue::DerivationInfo> nix::InstallableFlake::toDerivation(): Assertion `state->store->isValidPath(drvPath)' failed.
Aborted (core dumped)
2020-04-29 15:42:53 +02:00
Eelco Dolstra
5ada0831cf
Merge remote-tracking branch 'origin/master' into flakes
2020-04-29 13:32:27 +02:00
Matthew Kenigsberg
6d40fe573c
rename to NIX_GCROOT
2020-04-28 11:18:54 -06:00
Eelco Dolstra
6521c92ce8
Improve path:// handling
...
In particular, doing 'nix build /path/to/dir' now works if
/path/to/dir is not a Git tree (it only has to contain a flake.nix
file).
Also, 'nix flake init' no longer requires a Git tree (but it will do a
'git add flake.nix' if it's a Git tree)
2020-04-27 22:53:11 +02:00
Eelco Dolstra
829dcb35d5
flake-template.nix: Add defaultPackage
2020-04-27 22:52:49 +02: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
Eelco Dolstra
b51dff431c
Improve error message when an argument is not a flake
2020-04-27 18:55:20 +02:00
Eelco Dolstra
b4e23dcd9e
nix search: Search legacyPackages recursively
2020-04-27 16:29:26 +02:00
Eelco Dolstra
0469795978
nix search: Show version
2020-04-24 14:42:17 +02:00
Ben Burdette
e4fb9a3849
remove 'format' from Error constructor calls
2020-04-21 17:07:07 -06:00