aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd
AgeCommit message (Collapse)Author
2022-05-04Get rid of most `.at` calls (#6393)Alain Zscheile
Use one of `get` or `getOr` instead which will either return a null-pointer (with a nicer error message) or a default value when the key is missing.
2022-05-03Allow selecting derivation outputs using 'installable!outputs'Eelco Dolstra
E.g. 'nixpkgs#glibc^dev,static' or 'nixpkgs#glibc^*'.
2022-04-29remove 'libnix'Ben Burdette
2022-04-29line endingsBen Burdette
2022-04-29incorporate PosIdx changes, symbol changes.Ben Burdette
2022-04-28Merge branch 'master' into debug-merge-masterBen Burdette
2022-04-26nix: Respect meta.outputsToInstall, and use all outputs by defaultEelco Dolstra
'nix profile install' will now install all outputs listed in the package's meta.outputsToInstall attribute, or all outputs if that attribute doesn't exist. This makes it behave consistently with nix-env. Fixes #6385. Furthermore, for consistency, all other 'nix' commands do this as well. E.g. 'nix build' will build and symlink the outputs in meta.outputsToInstall, defaulting to all outputs. Previously, it only built/symlinked the first output. Note that this means that selecting a specific output using attrpath selection (e.g. 'nix build nixpkgs#libxml2.dev') no longer works. A subsequent PR will add a way to specify the desired outputs explicitly.
2022-04-26EvalCache: Revert to using symbols in getAttr()Eelco Dolstra
2022-04-25rename SymbolIdx -> Symbol, Symbol -> SymbolStrpennae
after #6218 `Symbol` no longer confers a uniqueness invariant on the string it wraps, it is now possible to create multiple symbols that compare equal but whose string contents have different addresses. this guarantee is now only provided by `SymbolIdx`, leaving `Symbol` only as a string wrapper that knows about the intricacies of how symbols need to be formatted for output. this change renames `SymbolIdx` to `Symbol` to restore the previous semantics of `Symbol` to that name. we also keep the wrapper type and rename it to `SymbolStr` instead of returning plain strings from lookups into the symbol table because symbols are formatted for output in many places. theoretically we do not need `SymbolStr`, only a function that formats a string for output as a symbol, but having to wrap every symbol that appears in a message into eg `formatSymbol()` is error-prone and inconvient.
2022-04-21store Symbols in a table as well, like positionspennae
this slightly increases the amount of memory used for any given symbol, but this increase is more than made up for if the symbol is referenced more than once in the EvalState that holds it. on average every symbol should be referenced at least twice (once to introduce a binding, once to use it), so we expect no increase in memory on average. symbol tables are limited to 2³² entries like position tables, and similar arguments apply to why overflow is not likely: 2³² symbols would require as many string instances (at 24 bytes each) and map entries (at 24 bytes or more each, assuming that the map holds on average at most one item per bucket as the docs say). a full symbol table would require at least 192GB of memory just for symbols, which is well out of reach. (an ofborg eval of nixpks today creates less than a million symbols!)
2022-04-21replace most Pos objects/ptrs with indexes into a position tablepennae
Pos objects are somewhat wasteful as they duplicate the origin file name and input type for each object. on files that produce more than one Pos when parsed this a sizeable waste of memory (one pointer per Pos). the same goes for ptr<Pos> on 64 bit machines: parsing enough source to require 8 bytes to locate a position would need at least 8GB of input and 64GB of expression memory. it's not likely that we'll hit that any time soon, so we can use a uint32_t index to locate positions instead.
2022-04-21don't use full Pos for findPackageFilename/editorForpennae
only file and line of the returned position were ever used, it wasn't actually used a position. as such we may as well use a path+int pair for only those two values and remove a use of Pos that would not work well with a position table.
2022-04-21Fix the error message in case of a missing realisationThéophane Hufschmitt
Don’t say that the derivation is CA as it might happen on a non-ca derivation too. Technically we could always recover _something_ for a purely input-addressed derivation (like we already do when the `ca-derivations` xp feature isn’t enabled), but it seems better to consistently fail − the end-result wouldn’t really make sense anyways in most cases.
2022-04-19Merge remote-tracking branch 'upstream/master' into indexed-store-path-outputsJohn Ericson
2022-04-19Merge pull request #6128 from ncfavier/fix-completionEelco Dolstra
Shell completion improvements
2022-04-19Merge pull request #6404 from edolstra/unify-flake-attr-evalEelco Dolstra
Make InstallableFlake::toValue() and toDerivation() behave consistently
2022-04-15Merge branch 'master' into debug-exploratory-PRBen Burdette
2022-04-15Merge pull request #6323 from erikarvstedt/eval-read-onlyEelco Dolstra
`nix eval`: Add option `--read-only`
2022-04-14Make InstallableFlake::toValue() and toDerivation() behave consistentlyEelco Dolstra
In particular, this means that 'nix eval` (which uses toValue()) no longer auto-calls functions or functors (because AttrCursor::findAlongAttrPath() doesn't). Fixes #6152. Also use ref<> in a few places, and don't return attrpaths from getCursor() because cursors already have a getAttrPath() method.
2022-04-08revise command helpBen Burdette
2022-04-08trace stack, not call stackBen Burdette
2022-04-08clean up makefilesBen Burdette
2022-04-08minor cleanupBen Burdette
2022-04-08remove 'debugError', dead codeBen Burdette
2022-04-08move throw to preverve Error type; turn off debugger for tryEvalBen Burdette
2022-04-07Merge remote-tracking branch 'upstream/master' into upstream-mergeBen Burdette
2022-04-07in debugger mode, print the current error when another repl returns.Ben Burdette
2022-04-07newline before envBen Burdette
2022-04-07free valmap on exitBen Burdette
2022-04-06show expr pos if DebugTrace one is noPosBen Burdette
2022-04-01Require (new) computed-derivations experimental feature for ! installableJohn Ericson
2022-04-01Merge remote-tracking branch 'upstream/master' into indexed-store-path-outputsJohn Ericson
2022-03-31show 'with' bindings as well as staticBen Burdette
2022-03-28load debug trace staticenv on 'show'Ben Burdette
2022-03-28debugTraceIndexBen Burdette
2022-03-28nix profile install: Don't use queryDerivationOutputMap()Eelco Dolstra
Instead get the outputs from Installable::build(). This will also allow 'nix profile install' to support impure derivations. Fixes #6286.
2022-03-26nix eval: Add option `read-only`Erik Arvstedt
2022-03-26Minor comment fixErik Arvstedt
2022-03-25add DebugTrace for errorBen Burdette
2022-03-25Merge remote-tracking branch 'upstream' into indexed-store-path-outputsJohn Ericson
Co-Authored-By: Tom Bereknyei <tomberek@gmail.com>
2022-03-22nix edit: support kakouneHideaki Kawai
2022-03-16nix: allow using --file - to read from stdinArtturin
2022-03-16formattingBen Burdette
2022-03-14have only one debuggerHook declarationBen Burdette
2022-03-10Merge remote-tracking branch 'upstream/master' into indexed-store-path-outputsJohn Ericson
2022-03-09BuildResult: Use DerivedPathEelco Dolstra
2022-03-08Add Store::buildPathsWithResults()Eelco Dolstra
This function is like buildPaths(), except that it returns a vector of BuildResults containing the exact statuses and output paths of each derivation / substitution. This is convenient for functions like Installable::build(), because they then don't need to do another series of calls to get the outputs of CA derivations. It's also a precondition to impure derivations, where we *can't* query the output of those derivations since they're not stored in the Nix database. Note that PathSubstitutionGoal can now also return a BuildStatus.
2022-03-07Add shell completion for --override-flakeNaïm Favier
Requires moving the MixEvalArgs class from libexpr to libcmd because that's where completeFlakeRef is.
2022-03-07Perform tilde expansion when completing flake fragmentsNaïm Favier
Allows completing `nix build ~/flake#<Tab>`. We can implement expansion for `~user` later if needed. Not using wordexp(3) since that expands way too much.
2022-03-07Fix completion of nested attributes in completeInstallableNaïm Favier
Without this, completing `nix eval -f file.nix foo.<Tab>` suggests `bar` instead of `foo.bar`, which messes up the command