1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00
Commit graph

15631 commits

Author SHA1 Message Date
Eelco Dolstra f7d59d0dda Release notes 2023-11-17 14:21:17 +01:00
Eelco Dolstra 3a7f024a9c
Merge pull request #9363 from edolstra/symlink-regression
Fix symlink handling
2023-11-17 14:11:50 +01:00
Robert Hensing d4370d8850
Merge pull request #9368 from frogamic/let-inherit
doc: Add example of inherit in a let expression
2023-11-17 11:22:27 +01:00
Robert Hensing 7b0e8c5c2c
Apply suggestions from code review
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-11-17 10:56:23 +01:00
Robert Hensing 121665f377 nix-env: Use state.mkList, required for correct stats 2023-11-17 10:23:32 +01:00
Robert Hensing 260c614762 Value: use std::span, change use of const
**`Value` and `const`**

These two deserve some explanation. We'll get to lists later.

Values can normally be thought of as immutable, except they are
are also the vehicle for call by need, which must be implemented
using mutation.

This circumstance makes a `const Value` a rather useless thing:

 - If it's a thunk, you can't evaluate it, except by copying, but
   that would not be call by need.

 - If it's not a thunk, you know the type, so the method that
   acquired it for you should have returned something more specific,
   such as a `const Bindings &` (which actually does make sense
   because that's an immutable span of pointers to mutable `Value`s.

 - If you don't care about the type yet, you might establish the
   convention that `const Value` means `deepSeq`-ed data, but
   this is hardly useful and not actually as safe as you would
   supposedly want to trust it to be - just convention.

**Lists**

`std::span` is a tuple of pointer and size - just what we need.

We don't return them as `const Value`, because considering the
first bullet point we discussed before, we'd have to force all
the list values, which isn't what we want.

So what we end up with is a nice representation of a list in
weak head normal form: the spine is immutable, but the
items may need some evaluation later.
2023-11-17 10:19:03 +01:00
Robert Hensing 7055c65285 Value: extract Value::Lambda 2023-11-17 10:19:03 +01:00
Robert Hensing 6af1d9f7b9 Value: extract Value::FunctionApplicationThunk 2023-11-17 10:19:03 +01:00
Robert Hensing b55203e874 Value: extract Value::ClosureThunk 2023-11-17 10:19:03 +01:00
Robert Hensing d8ff5cfe8e Value: extract Value::Path 2023-11-17 10:19:03 +01:00
Robert Hensing 2eb59c34b5 Value: extract Value::StringWithContext 2023-11-17 10:19:03 +01:00
Dominic Shelton c819375769
doc: Add example of inherit in a let expression 2023-11-17 17:50:17 +11:00
Théophane Hufschmitt 7ba4e073e8
Merge pull request #6469 from gbpdt/fix/skipped_build_locking
Unlock output paths when a derivation is already built
2023-11-16 21:59:25 +01:00
Théophane Hufschmitt fabae98ab4
Merge pull request #9360 from obsidiansystems/install-unit-tests
Allow installing unit tests
2023-11-16 21:25:21 +01:00
Théophane Hufschmitt ac4431e9d0
Merge pull request #7348 from thufschmitt/dont-use-vlas
Remove the usage of VLAs in the code
2023-11-16 19:05:37 +01:00
Eelco Dolstra 57de482e00
Merge pull request #9364 from edolstra/fix-coverage
Fix a broken generated header file dependency
2023-11-16 17:37:05 +01:00
Eelco Dolstra 96d67620d5 Fix a broken generated header file dependency
https://hydra.nixos.org/build/240882042
2023-11-16 17:12:06 +01:00
Eelco Dolstra 31ebc6028b Fix symlink handling
This restores the symlink handling behaviour prior to
94812cca98.

Fixes #9298.
2023-11-16 16:45:14 +01:00
John Ericson 6c8f4ef350 Allow installing unit tests
Closes #9343

See that issue for motivation.

Installing these is disabled by default, but we enable it (and the
additional output we want isntall these too so as not to clutter the
existing ones) to use in cross builds and dev shells.
2023-11-16 09:55:42 -05:00
Robert Hensing 4e27f1947a libexpr: Reduce nonRecursiveStackReservation
128 is still beyond the point where the allocation overhead is
insignificant, but we don't anticipate to overflow for these
use cases, so it's fine.
2023-11-16 15:38:21 +01:00
Robert Hensing a96be29db5 removeAttrs: increase stack reservation to 64 2023-11-16 15:38:21 +01:00
Robert Hensing 1b9813e4e6 primops: Name stack reservation limits 2023-11-16 15:38:21 +01:00
Robert Hensing 898c47384f primops: Err on the side of less stack usage
Try to stay away from stack overflows.

These small vectors use stack space. Most instances will not need
to allocate because in general most things are small, and large
things are worth heap allocating.

16 * 3 * word = 384 bytes is still quite a bit, but these functions
tend not to be part of deep recursions.
2023-11-16 15:38:21 +01:00
Robert Hensing 91114a6fa4 ExprCall::eval: Heap allocate at arity 5+ 2023-11-16 15:38:21 +01:00
Robert Hensing 206ece0f41 builtins.{any,all}: Use constant errorCtx
Clang warned that the expanded code used to have a buffer overflow.
Very strange, but also very avoidable.
2023-11-16 15:38:21 +01:00
Robert Hensing 9fa133dde5 readProcLink: Replace unnecessary value judgement by actual info 2023-11-16 15:38:21 +01:00
Robert Hensing 12c91a823e maxPrimOpArity: 64 -> 8
This makes stack usage significantly more compact, allowing larger
amounts of data to be processed on the same stack.

PrimOp functions with more than 8 positional (curried) arguments
should use an attrset instead.
2023-11-16 15:38:21 +01:00
Eelco Dolstra 2bd2702127
Merge pull request #9354 from vicky1999/fix/8875
Renamed nix nar dump-path to nix nar pack
2023-11-16 15:06:33 +01:00
Eelco Dolstra 16c052e4e7
Merge pull request #9307 from flox/tomberek.nix_key_newline
nix key: no need for progressBar
2023-11-16 15:05:34 +01:00
Eelco Dolstra c47f769391
Merge pull request #9350 from NixOS/dependabot/github_actions/zeebe-io/backport-action-2.1.1
build(deps): bump zeebe-io/backport-action from 2.1.0 to 2.1.1
2023-11-16 15:01:49 +01:00
Robert Hensing 0daccb1121 libexpr: Check primop arity earlier 2023-11-16 12:28:32 +01:00
Théophane Hufschmitt ba3cb4a049 Remove all the occurences of VLAs
There's generally no strict reason for using them, and they are somewhat
fishy, so let's avoid them.
2023-11-16 12:27:30 +01:00
Théophane Hufschmitt 5196613e82 Use boost small vectors instead of VLAs in the primops
VLAs are a dangerous feature, and their usage triggers an undefined
behavior since theire size can be zero in some cases.
So replace them with `boost::small_vector`s which fit the same goal but
are safer.

It's also incidentally consistently 1% faster on the benchmarks.
2023-11-16 12:27:30 +01:00
John Ericson e34c424279
Merge pull request #9357 from NixOS/nix-store-add
Add a new `nix store add` command
2023-11-15 13:49:44 -05:00
Théophane Hufschmitt 84128461b6 Add a new nix store add command
Deprecate `nix store add-file` and `nix store add-path`, and replace
them with a single `nix store add` command.
2023-11-15 19:21:17 +01:00
Eelco Dolstra 7ab91e7238 Implement shallow fetching 2023-11-15 15:00:17 +01:00
Eelco Dolstra 5dd4ae8687 Remove unused cacheType field 2023-11-15 14:08:34 +01:00
Eelco Dolstra 2890999911 Show Git fetch progress 2023-11-15 13:57:20 +01:00
Silvan Mosberger 70b396649c doc: logical implication is right-associative
nix-repl> bools = [ false true ]

    nix-repl> combinations = builtins.concatMap (a: builtins.concatMap (b: map (c: { inherit a b c; }) bools) bools) bools

    nix-repl> builtins.all ({ a, b, c }: (a -> b -> c) == (a -> (b -> c))) combinations
    true

    nix-repl> builtins.all ({ a, b, c }: (a -> b -> c) == ((a -> b) -> c)) combinations
    false
2023-11-15 07:04:09 +01:00
John Ericson d23d0a074d
Merge pull request #9355 from obsidiansystems/fix-tiny-libutil-unit-test-make-bug
Fix makefile bug confusing `libnixutil-test` exe vs lib
2023-11-14 12:13:41 -05:00
John Ericson 9c7749e135 Fix makefile bug confusing libnixutil-test exe vs lib
The `-exe` variant is the program, the unsuffixed variant is the
library.

The corrected usage matches `libnixstore-test`.
2023-11-14 11:45:52 -05:00
Eelco Dolstra 2964a9f562 Fix relative submodule handling
Tested on

  nix flake prefetch 'git+https://github.com/blender/blender.git?rev=4ed8a360e956daf2591add4d3c9ec0719e2628fe&submodules=1'
2023-11-14 16:00:21 +01:00
Eelco Dolstra 6ec6b8aa36 Improve git submodule error reporting 2023-11-14 15:52:18 +01:00
vicky1999 e07e3c106a code cleanup 2023-11-14 20:02:33 +05:30
vicky1999 4944cdb94d nar dump-path command renamed to nar pack 2023-11-14 19:59:48 +05:30
Eelco Dolstra c257c82447 Cleanup 2023-11-14 14:47:17 +01:00
Eelco Dolstra 7f576f5dfe Rename UnionInputAccessor to MountedInputAccessor 2023-11-14 14:02:57 +01:00
Eelco Dolstra 21140c987b Fix doxygen comments 2023-11-14 14:02:57 +01:00
Eelco Dolstra 4329bdf6a3 Move comment 2023-11-14 14:02:57 +01:00
Eelco Dolstra 25cf8f1071
src/libfetchers/union-input-accessor.cc: Apply suggestion
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-11-14 13:57:24 +01:00