aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd
AgeCommit message (Collapse)Author
2021-09-02Don't use read-only mode for nix build --dry-runGeorges Dubus
In dry run mode, new derivations can't be create, so running the command on anything that has not been evaluated before results in an error message of the form `don't know how to build these paths (may be caused by read-only store access)`. For comparison, the classical `nix-build --dry-run` doesn't use read-only mode. Closes #1795 (cherry picked from commit 54525682df707742e58311c32e9c9cb18de1e31f)
2021-09-02parseInstallables(): Parse store paths as store pathsEelco Dolstra
If the store path contains a flake, this means that a command like "nix path-info /path" will show info about /path, not about the default output of the flake in /path. If you want the latter, you can explicitly ask for it by doing "nix path-info path:/path". Fixes #4568.
2021-08-30Merge pull request #5175 from Pamplemousse/makeEelco Dolstra
Don't overwrite user provided `lib*_LDFLAGS`
2021-08-25Don't overwrite user provided `lib*_LDFLAGS`Pamplemousse
Signed-off-by: Pamplemousse <xav.maso@gmail.com>
2021-08-16Merge pull request #5134 from pszubiak/fix-pkgconfig-install-pathEelco Dolstra
Install pkg-config files in the correct location
2021-08-14fix typo in ca-error messageJörg Thalheim
2021-08-13Install pkg-config files in the correct locationPiotr Szubiakowski
Use `$(libdir)` while installing .pc files looks like a more generic solution. For example, it will work for distributions like RHEL or Fedora where .pc files are installed in `/usr/lib64/pkgconfig`.
2021-07-28Merge pull request #5042 from alyssais/pthreadEelco Dolstra
Enable pthreads for new libraries
2021-07-24Enable pthreads for new librariesAlyssa Ross
Otherwise the lack of pthread causes linking to fail for NetBSD.
2021-07-22buildPaths(): Add an evalStore argumentEelco Dolstra
With this, we don't have to copy the entire .drv closure to the destination store ahead of time (or at all). Instead, buildPaths() reads .drv files from the eval store and copies inputSrcs to the destination store if it needs to build a derivation. Issue #5025.
2021-07-22Use eval-store in more placesEelco Dolstra
In particular, this now works: $ nix path-info --eval-store auto --store https://cache.nixos.org nixpkgs#hello Previously this would fail as it would try to upload the hello .drv to cache.nixos.org. Now the .drv is instantiated in the local store, and then we check for the existence of the outputs in cache.nixos.org.
2021-07-22nix-build: Copy drv closure between eval store and build storeEelco Dolstra
2021-07-22Support --eval-store in nix-instantiate and nix-buildEelco Dolstra
2021-07-22Hacky fast closure copying mechanismEelco Dolstra
2021-07-22Add --eval-store optionEelco Dolstra
2021-07-21Tweak --no/use-registries doc stringsEelco Dolstra
2021-07-16Add use-registries config option (and deprecate --no-registries flag)Alexander Bantyev
Some people want to avoid using registries at all on their system; Instead of having to add --no-registries to every command, this commit allows to set use-registries = false in the config. --no-registries is still allowed everywhere it was allowed previously, but is now deprecated. Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2021-07-08Merge pull request #4969 from serokell/balsoft/fix-nixConfig-flake-registryEelco Dolstra
flake.nixConfig: fix flake-registry config settings
2021-07-05Merge pull request #4980 from Ma27/file-attr-completionEelco Dolstra
libcmd/installables: implement completion for Nix expressions passed via `-f`
2021-07-05completeInstallable: also match for already typed prefixesMaximilian Bosch
2021-07-03libcmd/installables: implement completion for Nix expressions passed via `-f`Maximilian Bosch
2021-07-01Prefer to throw specific errorsPamplemousse
Signed-off-by: Pamplemousse <xav.maso@gmail.com>
2021-07-01fixup! flake.nixConfig: fix flake-registry config settingsAlexander Bantyev
2021-07-01flake.nixConfig: fix flake-registry config settingsAlexander Bantyev
Before this commit, nixConfig.flake-registry didn't have any real effect on the evaluation, since config was applied after inputs were evaluated. Change this behavior: apply the config in the beginning of flake::lockFile.
2021-05-17Split the parsing of an `App` and its resolvingregnat
That way things (like `nix flake check`) can evaluate the `app` outputs without having to build anything
2021-05-17Enfore the use of properly built paths in libcmdregnat
Replace `DerivedPathWithHints` by a new `BuiltPath` type that serves as a proof that the corresponding path has been built.
2021-05-12DerivedPathWithHints -> BuiltPathregnat
Just a renaming for now
2021-04-23Revert "Make `nix shell` fallback to static outputs when needed"regnat
This reverts commit 8d66f5f1107fe87f70ea24ade045720235cc31fa. This fix isn't needed anymore now that the realisations are always properly registered
2021-04-22Merge branch 'master' of github.com:NixOS/nixEelco Dolstra
2021-04-21Get deriver when passing --derivationMatthew Bauer
This makes Nix look up paths derivations when they are passed as a store paths. So: $ nix path-info --derivation /nix/store/0pisd259nldh8yfjvw663mspm60cn5v8-hello-2.10 now gives /nix/store/qp724w90516n4bk5r9gfb37vzmqdh3z7-hello-2.10.drv instead of "". If no deriver is available, Nix now errors instead of silently ignoring that argument.
2021-04-21Make `nix shell` fallback to static outputs when neededregnat
In case of pure input-addressed derivations, the build loop doesn't guaranty that the realisations are stored in the db (if the output paths are already there or can be substituted, the realisations won't be registered). This caused `nix shell` to fail in some cases because it was assuming that the realisations were always existing. A better (but more involved) fix would probably to ensure that we always register the realisations, but in the meantime this patches the surface issue. Fix #4721
2021-04-19libcmd/installables: force re-evaluation of cached failuresMaximilian Bosch
I think that it's not very helpful to get "cached failures" in a wrong `flake.nix`. This can be very confusing when debugging a Nix expression. See for instance NixOS/nixpkgs#118115. In fact, the eval cache allows a forced reevaluation which is used for e.g. `nix eval`. This change makes sure that this is the case for `nix build` as well. So rather than λ ma27 [~/Projects/exp] → ../nix/outputs/out/bin/nix build -L --rebuild --experimental-features 'nix-command flakes' error: cached failure of attribute 'defaultPackage.x86_64-linux' the evaluation of already-evaluated (and failed) attributes looks like this now: λ ma27 [~/Projects/exp] → ../nix/outputs/out/bin/nix build -L --rebuild --experimental-features 'nix-command flakes' error: attribute 'hell' missing at /nix/store/mrnvi9ss8zn5wj6gpn4bcd68vbh42mfh-source/flake.nix:6:35: 5| 6| packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hell; | ^ 7| (use '--show-trace' to show detailed location information)
2021-04-05buildable.{cc,hh} -> derived-path.{cc,hh}John Ericson
2021-04-05Make `DerivedPathWithHints` a newtypeJohn Ericson
This allows us to namespace its constructors under it.
2021-04-05Rename BuildableJohn Ericson
2021-04-05Use `BuildableReq` for `buildPaths` and `ensurePath`John Ericson
This avoids an ambiguity where the `StorePathWithOutputs { drvPath, {} }` could mean "build `brvPath`" or "substitute `drvPath`" depending on context. It also brings the internals closer in line to the new CLI, by generalizing the `Buildable` type is used there and makes that distinction already. In doing so, relegate `StorePathWithOutputs` to being a type just for backwards compatibility (CLI and RPC).
2021-04-05Move `StorePathWithOutputs` into its own header/fileJohn Ericson
In the following commits it will become less prevalent.
2021-04-05Pull out Buildable into its own file/header in libnixstoreJohn Ericson
2021-03-16--override-input: Imply --no-write-lock-fileEelco Dolstra
Fixes #3779.
2021-03-02Make NIX_SHOW_STATS work with new-style commandsregnat
2021-02-19Merge pull request #4541 from obsidiansystems/simpler-store-path-commandEelco Dolstra
Deeper `Command` hierarchy to remove redundancy
2021-02-17Throw an error if --arg / --argstr is used with a flakeEelco Dolstra
Fixes #3949.
2021-02-12Deeper `Command` hierarchy to remove redundancyJohn Ericson
Simply put, we now have `StorePathCommand : public StorePathsCommand` so `StorePathCommand` doesn't reimplement work.
2021-02-06libcmd/markdown: handle allocation errors in lowdown_term_rndrsternenseemann
We upgrade to lowdown 0.8.0 [1] which contains a fix/improvement to a behavior mentioned in this issue thread [2] where a big part of lowdown's API would just call exit(1) on allocation errors since that is a satisfying behavior for the lowdown binary. Now lowdown_term_rndr returns 0 if an allocation error occurred which we check for in libcmd/markdown.cc. Also the extern "C" { } wrapper around lowdown.h has been removed as it is not necessary. [1]: https://github.com/kristapsdz/lowdown/blob/6ca7c855a063d1c77ae0b89405047cc3913a74d8/versions.xml#L987-L1006 [2]: https://github.com/kristapsdz/lowdown/issues/45#issuecomment-756681153
2021-02-04Normalize some error messagesThéophane Hufschmitt
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2021-01-28Add a new Cmd type working on RealisedPathsregnat
Where a `RealisedPath` is a store path with its history, meaning either an opaque path for stuff that has been directly added to the store, or a `Realisation` for stuff that has been built by a derivation This is a low-level refactoring that doesn't bring anything by itself (except a few dozen extra lines of code :/ ), but raising the abstraction level a bit is important on a number of levels: - Commands like `nix build` have to query for the realisations after the build is finished which is fragile (see 27905f12e4a7207450abe37c9ed78e31603b67e1 for example). Having them oprate directly at the realisation level would avoid that - Others like `nix copy` currently operate directly on (built) store paths, but need a bit more information as they will need to register the realisations on the remote side
2021-01-26Move command plugin interface to libnixcmdShea Levy