Commit graph

13347 commits

Author SHA1 Message Date
John Ericson 19c5394971 Change "while evaluating <fun>" to "while *calling*" in trace
The old way was not correct.

Here is an example:
```
 $ nix-instantiate --eval --expr 'let x = a: throw "asdf"; in x 1' --show-trace
error: asdf

       … while evaluating 'x'

       at «string»:1:9:

            1| let x = a: throw "asdf"; in x 1
             |         ^

       … from call site

       at «string»:1:29:

            1| let x = a: throw "asdf"; in x 1
             |                             ^
```
and yet also:
```
 $ nix-instantiate --eval --expr 'let x = a: throw "asdf"; in x' --show-trace
<LAMBDA>
```

Here is the thing: in both cases we are evaluating `x`!

Nix is a higher-order languages, and functions are a sort of value. When
we write `x = a: ...`, `a: ...` is the expression that `x` is being
defined to be, and that is already a value. Therefore, we should *never*
get an trace that says "while evaluating `x`", because evaluating `a:
...` is *trival* and nothing happens during it!

What is actually happening here is we are applying `x` and evaluating
its *body* with arguments substituted for parameters. I think the
simplest way to say is just "while *calling* `x`", and so that is what I
changed it to.
2022-12-02 09:14:12 -05:00
Eelco Dolstra fa99ef6a87 getMaxCPU(): Lower verbosity level for ignored exceptions
Fixes #7268.
2022-12-02 15:03:40 +01:00
Valentin Gagarin 0ce5742bec
Merge pull request #7381 from aakropotkin/doc-ltoa-conflicts
doc: listToAttrs: document repeated keys
2022-12-02 14:19:34 +01:00
Eelco Dolstra 1e6a5d1ff6 Clean up cgroup handling in getMaxCPU()
Also, don't assume in LocalDerivationGoal that cgroups are mounted on
/sys/fs/cgroup.
2022-12-02 12:59:13 +01:00
Eelco Dolstra 1211e59a03 Move cgroup.{cc,hh} to libutil 2022-12-02 12:38:03 +01:00
Eelco Dolstra ac06c8d248 Revert "docs: drop shell prompt character for consistency"
This reverts commit c068cce107 because
it makes the docs *less* consistent.
2022-12-02 11:56:12 +01:00
Valentin Gagarin ca42068bdc
Merge pull request #7251 from RelationalAI-oss/sp-docs-uninstall-prompt
docs: drop shell prompt character for consistency
2022-12-01 19:24:09 +01:00
Valentin Gagarin 5b95412328 encourage adding 👍 to express interest
decided on the @NixOS/documentation-team, see NixOS/nix.dev#359 for more information
2022-12-01 19:04:04 +01:00
Alex Ameen ef524013aa doc: listToAttrs: add extra whitespace 2022-12-01 10:32:45 -06:00
Eelco Dolstra 7bba4b343b
Merge pull request #7386 from edolstra/fix-json
Really fix 'nix store make-content-addressed --json'
2022-12-01 17:05:18 +01:00
Eelco Dolstra f1e1ba9fe0 Really fix 'nix store make-content-addressed --json'
https://hydra.nixos.org/log/mcgypcf9vj4n8vdmw7lj3l05c899v73w-nix-2.12.0pre20221201_16b03f0-x86_64-unknown-linux-musl.drv
2022-12-01 16:29:09 +01:00
Alex Ameen ec18b7d09b doc: listToAttrs: fix line wrapping 2022-11-30 23:21:09 -06:00
Valentin Gagarin dfa27e6b2f refactor rendering documentation of options
this makes more obvious what the code produces, and the structure of the
output easier to change
2022-12-01 06:08:08 +01:00
Alex Ameen ad46726546 doc: listToAttrs: document repeated keys 2022-11-30 22:53:41 -06:00
Valentin Gagarin 0ea62670ed move documentation on auto-allocate-uids to options docs
this is where it belongs and can be found together with the other
options.
2022-12-01 04:40:02 +01:00
Valentin Gagarin 16b03f03af
Merge pull request #7375 from NixOS/formatting-nitpick
add missing newline, for consistent formatting
2022-12-01 01:58:49 +01:00
Valentin Gagarin 3f881e3378
add missing newline, for consistent formatting 2022-11-30 23:40:53 +01:00
Eelco Dolstra f91dc023f2
Merge pull request #7372 from edolstra/fix-json
nix store make-content-addressed: Fix JSON construction
2022-11-30 14:25:15 +01:00
Eelco Dolstra 0b092bd87f nix store make-content-addressed: Fix JSON construction
Fixes

  error: [json.exception.type_error.301] cannot create object from initializer list

in tests/fetchClosure.sh.
2022-11-30 13:46:33 +01:00
Eelco Dolstra e4a2a08b04 Merge remote-tracking branch 'origin/master' into nixpkgs-22.11 2022-11-30 13:09:45 +01:00
Théophane Hufschmitt 0596bdf3a9
Merge pull request #7342 from fricklerhandwerk/refactor-generate-builtins
refactor rendering documentation of builtins
2022-11-29 15:55:43 +01:00
Eelco Dolstra fbc53e97ed
Merge pull request #3600 from NixOS/auto-uid-allocation
Automatic UID allocation
2022-11-29 14:01:42 +01:00
Eelco Dolstra 4f762e2b02 Restore ownership of / for non-uid-range builds 2022-11-29 13:10:53 +01:00
Linus Heckemann 9c90452f9d bump nixpkgs to 22.11 beta 2022-11-29 12:06:57 +01:00
Eelco Dolstra f904f6a66f
Merge pull request #7365 from NixOS/fix-6979-nobody-user-in-docker
Add nobody user/group to Nix docker image
2022-11-29 11:43:31 +01:00
Eelco Dolstra af8a32143b
Merge pull request #7358 from ncfavier/repl-exit-newline
repl: print a newline on ctrl-D
2022-11-29 11:31:43 +01:00
Eelco Dolstra 4dda67260a
Merge pull request #7363 from NixOS/dependabot/github_actions/zeebe-io/backport-action-0.0.9
Bump zeebe-io/backport-action from 0.0.8 to 0.0.9
2022-11-29 11:30:17 +01:00
Rok Garbas 46a6be28be Add nobody user/group to Nix docker image 2022-11-29 10:01:46 +00:00
dependabot[bot] dc61e1028d
Bump zeebe-io/backport-action from 0.0.8 to 0.0.9
Bumps [zeebe-io/backport-action](https://github.com/zeebe-io/backport-action) from 0.0.8 to 0.0.9.
- [Release notes](https://github.com/zeebe-io/backport-action/releases)
- [Commits](https://github.com/zeebe-io/backport-action/compare/v0.0.8...v0.0.9)

---
updated-dependencies:
- dependency-name: zeebe-io/backport-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-28 22:00:44 +00:00
Eelco Dolstra 7dd3e1fec4 Add example 2022-11-28 22:04:51 +01:00
Eelco Dolstra 67bcb99700 Add a setting for enabling cgroups 2022-11-28 21:54:02 +01:00
Eelco Dolstra ff12d1c1a1 Check that auto-allocated UIDs don't clash with existing accounts 2022-11-28 20:49:17 +01:00
Eelco Dolstra dbf78a7ada
Merge pull request #7313 from yorickvP/nlohmann-everywhere
Replace src/libutil/json.cc with nlohmann
2022-11-28 15:03:48 +01:00
Naïm Favier 9b35cc716b
use logger->cout
in order to avoid potential problems with the progress bar

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2022-11-28 14:59:06 +01:00
Naïm Favier 04ec157517
repl: print a newline on ctrl-D 2022-11-28 10:38:23 +01:00
Eelco Dolstra fc14585610 Fix evaluation 2022-11-27 18:58:21 +01:00
Eelco Dolstra f1b5c6876b Add tests for auto-uid-allocation, uid-range and cgroups 2022-11-27 16:38:34 +01:00
Eelco Dolstra cc308ee93d
Merge pull request #7353 from edolstra/gc-shutdown
Fix random client failures during GC server shutdown
2022-11-27 13:30:26 +01:00
Eelco Dolstra 5b798f6cae Fix random client failures during GC server shutdown
We need to close the GC server socket before shutting down the active
GC client connections, otherwise a client may (re)connect and get
ECONNRESET. But also handle ECONNRESET for resilience.

Fixes random failures like

  GC socket disconnected
  connecting to '/tmp/nix-shell.y07M0H/nix-test/default/var/nix/gc-socket/socket'
  sending GC root '/tmp/nix-shell.y07M0H/nix-test/default/store/kb5yzija0f1x5xkqkgclrdzldxj6nnc6-non-blocking'
  reading GC root from client: error: unexpected EOF reading a line
  1 store paths deleted, 0.00 MiB freed
  error: reading from file: Connection reset by peer

in gc-non-blocking.sh.
2022-11-27 12:57:18 +01:00
Liu Xiaoyi c4ce89f772
Clarify uninstallation steps on Linux
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2022-11-26 22:01:51 +08:00
Eelco Dolstra 534332c8a0
Merge pull request #7350 from edolstra/remove-strndup
Don't use GC_STRNDUP
2022-11-26 08:50:54 +01:00
Eelco Dolstra 0b4c4d7434 Don't use GC_STRNDUP
It calls strlen() on the input (rather than simply copying at most
`size` bytes), which can fail if the input is not zero-terminated and
is inefficient in any case.

Fixes #7347.
2022-11-25 22:30:56 +01:00
John Ericson 26534f141c
Merge branch 'master' into indexed-store-path-outputs 2022-11-25 08:14:32 -05:00
Valentin Gagarin d6318e1638 refactor rendering documentation of builtins
as in [1], make the document structure visible, like in a template

[1]: 4655563470
2022-11-24 14:15:43 +01:00
Valentin Gagarin 341a807444
the point is setting a default reviewer, not notifications 2022-11-24 11:33:59 +01:00
Théophane Hufschmitt bc9692a6b7
Merge pull request #7337 from Radvendii/why-depends-ca
Fix why-depends for CA derivations
2022-11-23 20:16:14 +01:00
Taeer Bar-Yam bd8571a5c3 add explanation and test 2022-11-23 12:06:47 -05:00
Taeer Bar-Yam b13fd4c58e Fix why-depends for CA derivations
why-depends assumed that we knew the output path of the second argument.
For CA derivations, we might not know until it's built. One way to solve
this would be to build the second installable to get the output path.

In this case we don't need to, though. If the first installable (A)
depends on the second (B), then getting the store path of A will
necessitate having the store path B. The contrapositive is, if the store
path of B is not known (i.e. it's a CA derivation which hasn't been
built), then A does not depend on B.
2022-11-23 11:39:50 -05:00
Eelco Dolstra 2aa3f2e810 Include UID in hex 2022-11-23 17:07:59 +01:00
Eelco Dolstra 989fc8a8b9 Add release notes 2022-11-23 15:24:50 +01:00