Commit graph

13771 commits

Author SHA1 Message Date
Valentin Gagarin 2af9fd20c6 clarify definition of "installable"
the term was hard to discover, as its definition and explanation were in
a very long document lacking an overview section.
search did not help because it occurs so often.

- clarify wording in the definition
- add an overview of installable types
- add "installable" to glossary
- link to definition from occurrences of the term
- be more precise about where store derivation outputs are processed
- installable Nix expressions must evaluate to a derivation

Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>
2023-03-05 01:46:17 +01:00
Valentin Gagarin 1e87d5f1ea make descriptions of each installable type an own subsection
this is easier to edit, provides anchors for free, and renders correctly
on the terminal without additional effort.
2023-03-05 01:46:17 +01:00
Eelco Dolstra 0507462c06
Merge pull request #7918 from zimbatm/fix-empty-nix-store-env
treat empty NIX_STORE_DIR env vars as unset
2023-03-03 13:49:56 +01:00
Jonas Chevalier dc8820c71f
fixup: use same style as getEnv 2023-03-03 11:34:36 +01:00
Jonas Chevalier b96d9c1687
fixup: remove warning entirely
fixes 72e1e23051 (r1124211067)
2023-03-03 11:32:06 +01:00
Eelco Dolstra 19c1a4699b
Merge pull request #7946 from cole-h/restore-static-bin-dist
flake: restore binary-dist artifact to Hydra static builds
2023-03-03 10:23:17 +01:00
Eelco Dolstra f0908f592c
Merge pull request #7942 from edolstra/remove-format
Remove FormatOrString and remaining uses of format()
2023-03-03 10:22:11 +01:00
Eelco Dolstra 28c3e4eb1d
Merge pull request #7949 from fricklerhandwerk/pr-tempate
remove stale pull request template
2023-03-03 10:21:43 +01:00
Valentin Gagarin 37c61907d7
Merge pull request #7605 from tweag/comments
add comments
2023-03-03 06:38:29 +01:00
Valentin Gagarin 82b2cbf0f9 remove stale pull request template
the old one seems not to be picked up by GitHub anyway
2023-03-03 05:42:19 +01:00
Théophane Hufschmitt 8730d3002f
Merge pull request #7594 from nrdxp/paths-from-stdin
feat: read installable paths from stdin
2023-03-02 19:56:27 +01:00
Théophane Hufschmitt 1f394d2107
Merge branch 'master' into paths-from-stdin 2023-03-02 19:20:51 +01:00
Cole Helbling a8d0ff1a11 flake: restore binary-dist artifact to Hydra static builds 2023-03-02 10:02:55 -08:00
Eelco Dolstra 3a2b3af824
Merge pull request #7943 from edolstra/fix-make-check
Fix 'make check' inside 'nix develop'
2023-03-02 16:54:37 +01:00
Eelco Dolstra 687d86f8ab
Merge pull request #7940 from tweag/fix-http-errors-encoding
Log the decompressed body in case of http errors
2023-03-02 16:25:09 +01:00
Jonas Chevalier 72e1e23051
Update src/libutil/util.cc
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2023-03-02 16:17:20 +01:00
Eelco Dolstra 9c79ce353d Fix 'make check' inside 'nix develop' 2023-03-02 16:11:49 +01:00
Eelco Dolstra 29abc8e764 Remove FormatOrString and remaining uses of format() 2023-03-02 15:57:54 +01:00
Eelco Dolstra b9370fd7a0
Merge pull request #7941 from edolstra/stdout
Check writes to stdout
2023-03-02 15:57:31 +01:00
Eelco Dolstra b69a73a230 Get rid of some unchecked calls to std::cout 2023-03-02 15:02:24 +01:00
Théophane Hufschmitt 1a825b6919 Log the decompressed body in case of http errors
Don't show the users the raw (possibly compressed) error message as
everyone isn't able to decompress brotli in their brain.
2023-03-02 14:59:15 +01:00
Eelco Dolstra 09f5975c6a Logger::cout: Use fmt()
This ensures that in cout(s), 's' does not get interpreted as a format
string.
2023-03-02 14:52:37 +01:00
Eelco Dolstra 989b823ac5 nix store cat: Use writeFull()
Fixes #7939.
2023-03-02 14:51:14 +01:00
Eelco Dolstra c13cbd20ab Logger::writeToStdout(): Use writeFull()
This ensures that write errors do not get ignored.
2023-03-02 14:46:28 +01:00
Eelco Dolstra 85dbf9de8e
Merge pull request #7919 from NixOS/bump-2.15.0
Bump version
2023-03-02 10:41:36 +01:00
Eelco Dolstra 378508a877 Bump version 2023-03-02 10:01:24 +01:00
Eelco Dolstra 96111ad902
Merge pull request #7901 from hercules-ci/disable-tests
Add ./configure --disable-tests option
2023-03-02 10:00:15 +01:00
Eelco Dolstra 767974f411
Merge pull request #7924 from mkenigs/valid
Always set valid in path-info --json output
2023-03-02 09:58:20 +01:00
Eelco Dolstra edda63a156
Merge pull request #7936 from obsidiansystems/simplify-test
Remove needless `--experimental-feature` in a CA drvs test
2023-03-02 00:38:57 +01:00
John Ericson f9443143ae Remove needless --experimental-feature in a CA drvs test
This is already blanket enabled for these tests
2023-03-01 18:04:28 -05:00
Eelco Dolstra ffadc35df1
Merge pull request #7925 from cole-h/fixup-xdg-nix-env
Check if NIX_LINK_NEW exists instead of checking that NIX_LINK doesn't exist
2023-03-01 23:01:42 +01:00
Félix Baylac Jacqué 25300c0ecd
Treat empty env var paths as unset
We make sure the env var paths are actually set (ie. not "") before
sending them to the canonicalization function. If we forget to do so,
the user will end up facing a puzzled failed assertion internal error.

We issue a non-failing warning as a stop-gap measure. We could want to
revisit this to issue a detailed failing error message in the future.
2023-03-01 20:50:07 +01:00
Théophane Hufschmitt 182129d985
Merge pull request #7932 from obsidiansystems/remove-sameMachine
Remove dead code `RemoteStore::sameMachine`
2023-03-01 20:05:39 +01:00
Valentin Gagarin 651dab55da
Merge pull request #7854 from aameen-tulip/patch-1 2023-03-01 18:24:53 +01:00
John Ericson b7f01a82a9 Remove dead code RemoteStore::sameMachine
It has been dead code since 9747ea84b4.
2023-03-01 11:10:30 -05:00
Valentin Gagarin 306e5c5ce5
Merge pull request #7788 from bobvanderlinden/pr-improve-nix-profile-install-error
Improve error on conflict for nix profile install
2023-03-01 11:48:43 +01:00
Bob van der Linden 12538605fd
nix-profile: add FIXME about using C++20 std::ranges 2023-03-01 07:40:53 +01:00
Cole Helbling 990fbb8fef WIP: pin cachix actions to 2.13.3 to see if CI will pass 2023-02-28 16:19:11 -08:00
Cole Helbling 2b801d6e3c Check if NIX_LINK_NEW exists instead of checking that NIX_LINK doesn't exist
For brand new installations, neither NIX_LINK_NEW
(`$XDG_STATE_HOME/nix/profile` or `~/.local/state/nix/profile`), nor
NIX_LINK (`~/.nix-profile`) will exist.

This restores functionality to nix-env, which is relied upon by GitHub
Actions such as https://github.com/cachix/cachix-action and the Nixpkgs
EditorConfig (and other) CI.
2023-02-28 16:10:42 -08:00
Matthew Kenigsberg f86f2b973f Always set valid in path-info --json output
Currently the valid key is only present when the path is invalid, which
makes checking path validity more complex than it should be. With this
change, the valid key can always be used to check if a path is valid
2023-02-28 16:04:41 -07:00
Valentin Gagarin d5af43cb42
Merge pull request #7600 from obsidiansystems/explicit-drv-ness 2023-02-28 23:48:17 +01:00
John Ericson ea0adfc582 Get rid of .drv special-casing for store path installables
The release notes document the change in behavior, I don't include it
here so there is no risk to it getting out of sync.

> Motivation

>> Plumbing CLI should be simple

Store derivation installations are intended as "plumbing": very simple
utilities for advanced users and scripts, and not what regular users
interact with. (Similarly, regular Git users will use branch and tag
names not explicit hashes for most things.)

The plumbing CLI should prize simplicity over convenience; that is its
raison d'etre. If the user provides a path, we should treat it the same
way not caring what sort of path it is.

>> Scripting

This is especially important for the scripting use-case. when arbitrary
paths are sent to e.g. `nix copy` and the script author wants consistent
behavior regardless of what those store paths are. Otherwise the script
author needs to be careful to filter out `.drv` ones, and then run `nix
copy` again with those paths and `--derivation`. That is not good!

>> Surprisingly low impact

Only two lines in the tests need changing, showing that the impact of
this is pretty light.

Many command, like `nix log` will continue to work with just the
derivation passed as before. This because we used to:

- Special case the drv path and replace it with it's outputs (what this
  gets rid of).

- Turn those output path *back* into the original drv path.

Now we just skip that entire round trip!

> Context

Issue #7261 lays out a broader vision for getting rid of `--derivation`,
and has this as one of its dependencies. But we can do this with or
without that.

`Installable::toDerivations` is changed to handle the case of a
`DerivedPath::Opaque` ending in `.drv`, which is new: it simply doesn't
need to do any extra work in that case. On this basis, commands like
`nix {show-derivation,log} /nix/store/...-foo.drv` still work as before,
as described above.

When testing older daemons, the post-build-hook will be run against the
old CLI, so we need the old version of the post-build-hook to support
that use-case.

Co-authored-by: Travis A. Everett <travis.a.everett@gmail.com>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-02-28 17:07:05 -05:00
Timothy DeHerrera 639659dec2
doc/manual: add release note for --stdin flag 2023-02-28 12:31:05 -07:00
Timothy DeHerrera df643051e2
nix-store: read paths from standard input
Resolves #7437 for new `nix-store` by adding a `--stdin` flag.
2023-02-28 12:29:16 -07:00
Timothy DeHerrera 269caa5317
feat: read installable paths from stdin
Resolves #7437 for new `nix` commands only by adding a `--stdin` flag.

If paths are also passed on the cli they will be combined with the ones
from standard input.
2023-02-28 12:29:15 -07:00
Eelco Dolstra db14e1d4ae
Merge pull request #7920 from cole-h/fix-profile-XDG_STATE_HOME-unbound
nix-profile{,-daemon}.sh.in: Allow XDG_STATE_HOME to be unset
2023-02-28 19:49:04 +01:00
Cole Helbling 24eaa086f0 nix-profile{,-daemon}.sh.in: Allow XDG_STATE_HOME to be unset
One of our CI machines installs Nix via the official script and then
sources the nix-profile.sh script to setup the environment. However, it
doesn't have XDG_STATE_HOME set, which causes sourcing the script to
fail.
2023-02-28 10:10:20 -08:00
Robert Hensing 4489def1b3
Merge pull request #7883 from hercules-ci/json-guidelines
cli-guideline: Add JSON guideline
2023-02-28 17:14:42 +01:00
Robert Hensing d0d0b9a748 doc/cli-guideline: Improve examples
Turns out that the settings themselves have a bad data model anyway, so we cut that. They do still occur in the first example, but not in focus.
2023-02-28 16:35:47 +01:00
Robert Hensing 17f70b10bf doc/cli-guideline: Apply suggestions from code review
Thanks Valentin!
2023-02-28 16:35:42 +01:00