Commit Graph

15439 Commits

Author SHA1 Message Date
John Ericson
a61e42adb5 Move tests to separate directories, and document
Today, with the tests inside a `tests` intermingled with the
corresponding library's source code, we have a few problems:

- We have to be careful that wildcards don't end up with tests being
  built as part of Nix proper, or test headers being installed as part
  of Nix proper.

- Tests in libraries but not executables is not right:

  - It means each executable runs the previous unit tests again, because
    it needs the libraries.

  - It doesn't work right on Windows, which doesn't want you to load a
    DLL just for the side global variable . It could be made to work
    with the dlopen equivalent, but that's gross!

This reorg solves these problems.

There is a remaining problem which is that sibbling headers (like
`hash.hh` the test header vs `hash.hh` the main `libnixutil` header) end
up shadowing each other. This PR doesn't solve that. That is left as
future work for a future PR.

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>

(cherry picked from commit 91b6833686)
2023-12-01 11:37:01 -05:00
Eelco Dolstra
5e265bc140
Merge pull request #9513 from NixOS/2.19-nixpkgs-bumps
[Backport 2.19-maintainence] nixpkgs bumps
2023-12-01 17:10:25 +01:00
Robert Hensing
5656f8c8c7 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/decdf666c833a325cb4417041a90681499e06a41' (2023-11-18)
  → 'github:NixOS/nixpkgs/9ba29e2346bc542e9909d1021e8fd7d4b3f64db0' (2023-11-23)

(cherry picked from commit c5d49ec7ab)
2023-12-01 11:01:20 -05:00
Robert Hensing
f01baf5f06 flake.nix: Update nixpkgs: release-23.05 -> nixos-23.05-small
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/9eb24edd6a0027fed010ccfe300a9734d029983c' (2023-11-01)
  → 'github:NixOS/nixpkgs/decdf666c833a325cb4417041a90681499e06a41' (2023-11-18)

(cherry picked from commit fe4f573d49)
2023-12-01 11:00:01 -05:00
Eelco Dolstra
94a7f91236 Bump version 2023-11-29 17:18:00 +01:00
John Ericson
50f8f1c8bc
Merge pull request #9473 from NixOS/backport-9462-to-2.19-maintenance
[Backport 2.19-maintenance] libexpr: add missing dependency on 'flake/call-flake.nix.gen.hh'
2023-11-27 17:02:47 -05:00
Robert Hensing
28f0322307 libexpr/local.mk: Make eval compile deps regular
Dependency is now entirely through the eval.cc rule.
All gen.hh deps are now there.

(cherry picked from commit 68c48756fe)
2023-11-27 16:26:12 +00:00
Sergei Trofimovich
94b2401138 libexpr: add missing dependency on 'flake/call-flake.nix.gen.hh'
Without the change build for `eval.o` fails occasionally as:

    $ make src/libexpr/eval.o
      GEN    Makefile.config
      GEN    src/libexpr/primops/derivation.nix.gen.hh
      GEN    src/libexpr/fetchurl.nix.gen.hh
      GEN    src/libexpr/parser-tab.cc
      GEN    src/libexpr/lexer-tab.cc
    src/libexpr/lexer.l:314: warning, -s option given but default rule can be matched
      CXX    src/libexpr/eval.o
    src/libexpr/eval.cc:519:18: fatal error: flake/call-flake.nix.gen.hh: No such file or directory
      519 |         #include "flake/call-flake.nix.gen.hh"
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make: *** [mk/patterns.mk:3: src/libexpr/eval.o] Error 1

Noticed in https://github.com/NixOS/nixpkgs/pull/269439

(cherry picked from commit 75134b7513)
2023-11-27 16:26:12 +00:00
Robert Hensing
9a8b6ea118
Merge pull request #9472 from NixOS/backport-9459-to-2.19-maintenance
[Backport 2.19-maintenance] add path based redirects
2023-11-27 15:15:57 +01:00
Valentin Gagarin
6dfb06d4a3 add path based redirects
up to now, those were managed outside of this repo, which as
unsurprisingly a real hassle to deal with if one wanted to prevent URLs
from breaking when moving pages around. this change removes a large part
of the friction involved in moving content in the Nix manual.

possible next steps for further automation:
- check for content that moved and warn if it's not reachable from
  links that were valid prior to a change
- create redirect rules automatically based on this information

(cherry picked from commit 2b7016cc56)
2023-11-27 13:29:03 +00:00
Valentin Gagarin
92f3598a16 add deprecation warnings in documentation
this is hacky, but can serve as a stopgap until we can do it
programmatically.

(cherry picked from commit 7e08bdefcc)
2023-11-27 14:08:16 +01:00
Moritz Angermann
819eda4615 nix flake update add deprecation warnings.
This builds on #8817, to add additional UX help for people with existing
muscle memory (or shell history) with --update-input and tries to gently
guide them towards the newly evolved CLI UI.

Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
(cherry picked from commit af00298587)
2023-11-27 14:07:26 +01:00
Eelco Dolstra
33bacbe220
Merge pull request #9437 from NixOS/backport-9431-to-2.19-maintenance
[Backport 2.19-maintenance] Add missing `-lrapidcheck` fixing build with shared lib
2023-11-22 11:45:57 +01:00
John Ericson
914309c35d Add missing -lrapidcheck fixing build with shared lib
https://github.com/NixOS/nixpkgs/pull/269064 makes rapidcheck be build
as a shared lib, but that broke Nix because the `-lrapidcheck` was
missing. This fixes that (and doesn't break Nix what the library is a
static archive as today).

(cherry picked from commit 46131567da)
2023-11-22 04:48:14 +00:00
Eelco Dolstra
c27f9777f8 Bump version 2023-11-21 17:30:26 +01:00
Théophane Hufschmitt
455aca36e4
Merge pull request #9426 from NixOS/backport-9425-to-2.19-maintenance
[Backport 2.19-maintenance] Fix "unbound variable" errors in bash
2023-11-21 15:30:20 +01:00
Felix Uhl
e011d94813 Fix "unbound variable" errors in bash
Fixes #9414

(cherry picked from commit 64827360be)
2023-11-21 14:12:50 +00:00
Eelco Dolstra
2a1d549af4
Merge pull request #9409 from NixOS/backport-9408-to-2.19-maintenance
[Backport 2.19-maintenance] Fix bad_format_string error when builder stdout contains %
2023-11-20 17:41:03 +01:00
roblabla
a5c6ba3edc Fix bad_format_string error when builder stdout contains %
(cherry picked from commit e2b6821ca0)
2023-11-20 16:22:58 +00:00
Théophane Hufschmitt
911828a655
Merge pull request #9407 from NixOS/backport-9390-to-2.19-maintenance
[Backport 2.19-maintenance] fetchTree: clarify docs for shallow flag
2023-11-20 15:38:29 +01:00
DavHau
2778b218c3 fetchTree: clarify docs for shallow flag
(cherry picked from commit 796a7eb92d)
2023-11-20 14:16:08 +00:00
Eelco Dolstra
4cc65f3dd5 Bump version 2023-11-20 15:06:04 +01:00
Eelco Dolstra
5b99c823ef Mark official release 2023-11-20 14:09:49 +01:00
Robert Hensing
6832d18ac7
Merge pull request #9399 from edolstra/revert-vlas
Revert use of boost::container::small_vector in the evaluator
2023-11-20 13:37:50 +01:00
Eelco Dolstra
1d6abec993 Revert use of boost::container::small_vector in the evaluator
It caused random crashes (https://hydra.nixos.org/build/241514506,
https://hydra.nixos.org/build/241443330) because the heap allocation
done by small_vector in the not-small case is not scanned for GC
roots.
2023-11-20 12:35:35 +01:00
tomberek
fb68699456
Merge pull request #9370 from hercules-ci/add-value-types
refactor: Add `Value` types, use `std::span` for list iteration
2023-11-20 01:32:32 -05:00
Robert Hensing
4292d99756
Merge pull request #9395 from nbraud/buitlins
builtins.concatMap: Fix typo in error message
2023-11-20 00:25:03 +01:00
nicoo
d5928085d5 builtins.concatMap: Fix typo in error message 2023-11-19 19:57:07 +01:00
John Ericson
c4a74d6dcc
Merge pull request #9382 from tweag/filterSource-link
doc: Add link to filterSource from path
2023-11-19 00:06:18 -05:00
John Ericson
f739fc0729
Merge pull request #9379 from NixOS/shebang-virtual-dtor
Shebang parser: add virtual destructor
2023-11-19 00:05:34 -05:00
Silvan Mosberger
70ddf298e0 doc: Add link to filterSource from path 2023-11-19 04:09:14 +01:00
Robert Hensing
251fb23aea Shebang parser: add virtual destructor
Fixes:

    warning: destructor called on non-final 'nix::ParseUnquoted' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
2023-11-19 01:48:08 +01:00
Robert Hensing
1d86bb4f70
Merge pull request #9373 from obsidiansystems/fix-make-check
Fix `make check`
2023-11-17 19:09:38 +01:00
Robert Hensing
7762335a9c
Merge pull request #9374 from hercules-ci/fix-nogc
Fix buildNoGc
2023-11-17 18:16:11 +01:00
Robert Hensing
4a539ac3ea Fix buildNoGc
Fixes https://hydra.nixos.org/build/241067941/nixlog/1

    src/libexpr/eval.cc:1776:54: error: variable 'boost::container::small_vector<nix::Value*, 4> vArgs' has initializer but incomplete type
2023-11-17 17:38:08 +01:00
John Ericson
293ae59257 Fix make check
After 9c7749e135, `libutil-tests_RUN`
doesn't exist. It needs to become `libutil-tests-exe_RUN`.
2023-11-17 11:26:45 -05:00
Eelco Dolstra
6acc9b11d9
Merge pull request #9372 from edolstra/release-notes
2.19 release notes
2023-11-17 14:52:40 +01:00
Théophane Hufschmitt
b1e7d7cad6
Merge pull request #9280 from R-VdP/rvdp/fix_remote_logging_phase_reporting
Include phase reporting in log file for ssh-ng builds
2023-11-17 14:37:09 +01:00
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