Commit Graph

15483 Commits

Author SHA1 Message Date
Théophane Hufschmitt
90f9a350fb Add release notes 2024-03-01 09:43:42 +01:00
Théophane Hufschmitt
e744fe293b Fix a typo in a test comment
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2024-03-01 09:43:42 +01:00
Théophane Hufschmitt
68b6f897e4 Copy the output of fixed-output derivations before registering them
It is possible to exfiltrate a file descriptor out of the build sandbox
of FODs, and use it to modify the store path after it has been
registered.
To avoid that issue, don't register the output of the build, but a copy
of it (that will be free of any leaked file descriptor).
2024-03-01 09:43:42 +01:00
Théophane Hufschmitt
ca05f6d203 Add a NixOS test for the sandbox escape
Test that we can't leverage abstract unix domain sockets to leak file
descriptors out of the sandbox and modify the path after it has been
registered.
2024-03-01 09:43:42 +01:00
github-actions[bot]
d829c21ef3
fix location of _redirects file (#9957) 2024-02-07 11:43:55 +01:00
John Ericson
2c4bb93ba5
Merge pull request #9851 from NixOS/backport-9848-to-2.19-maintenance
[Backport 2.19-maintenance] Make `StoreConfig::getDefaultSystemFeatures` a static method
2024-01-25 13:45:40 -05:00
John Ericson
5c1fa89f78 Make StoreConfig::getDefaultSystemFeatures a static method
This makes something in Hydra bit simpler. If someday the default
depends on the other config options, we can always change it back.

(cherry picked from commit a9e10a1dbd)
2024-01-25 16:58:00 +00:00
Eelco Dolstra
03e96b9dc0 Bump version 2024-01-19 13:07:31 +01:00
Eelco Dolstra
91e60868bd Use BackedStringView
(cherry picked from commit 1fe8f54bd3)
2024-01-19 10:14:17 +01:00
Eelco Dolstra
8bb4cb0565 Print a more helpful message if the daemon crashes
Instead of

   error: unexpected end-of-file

you now get

   error: Nix daemon disconnected unexpectedly (maybe it crashed?)

(cherry picked from commit a3cf27ca47)
2024-01-19 10:14:12 +01:00
Eelco Dolstra
f1788c425b
Merge pull request #9810 from NixOS/backport-9804-to-2.19-maintenance
[Backport 2.19-maintenance] Fix crash when NAR is missing from binary cache
2024-01-19 09:40:07 +01:00
Eelco Dolstra
fdf5313e7e copyStorePath(): Bail out early if the store path already exists
In rare cases (e.g. when using allowSubstitutes = false), it's
possible that we simultaneously have a DerivationGoal *and* a
SubstitutionGoal building the same path. So if a DerivationGoal
already built the path while the SubstitutionGoal was waiting for a
download slot, it saves us a superfluous download to exit early.

(cherry picked from commit dca0a80240)
2024-01-19 08:39:09 +00:00
Eelco Dolstra
cc94ea5a17 LocalStore::addToStore(): Ignore exceptions from parseDump()
In the "discard" case (i.e. when the store path already exists
locally), when we call parseDump() from a Finally and it throws an
exception (e.g. if the download of the NAR fails), Nix crashes:

   terminate called after throwing an instance of 'nix::SubstituteGone'
     what():  error: file 'nar/06br3254rx4gz4cvjzxlv028jrx80zg5i4jr62vjmn416dqihgr7.nar.xz' does not exist in binary cache 'http://localhost'
   Aborted (core dumped)

(cherry picked from commit a18d8d688a)
2024-01-19 08:39:09 +00:00
Eelco Dolstra
3cb2740721 Show what goal is waiting for a build slot
(cherry picked from commit ab786e22f1)
2024-01-19 08:39:09 +00:00
John Ericson
dc09e6193b
Merge pull request #9739 from shlevy/ifd-buildStore-2.19
(Backport #9661) Build IFD in the build store when using eval-store.
2024-01-11 10:06:09 -05:00
Shea Levy
2e4239f9e3
Merge branch '2.19-maintenance' into ifd-buildStore-2.19 2024-01-11 07:21:51 -05:00
Shea Levy
e7c2b35827
Build IFD in the build store when using eval-store.
Previously, IFDs would be built within the eval store, even though one
is typically using `--eval-store` precisely to *avoid* local builds.

Because the resulting Nix expression must be copied back to the eval
store in order to be imported, this requires the eval store to trust
the build store's signatures.

(cherry picked from commit c3942ef85f)
2024-01-11 06:34:27 -05:00
Shea Levy
be208d8e78
remote-store test: Break out IFD expression into a separate file
(cherry picked from commit 9cb287657b)
2024-01-11 06:30:02 -05:00
github-actions[bot]
958ecd81a8
fix an old lost direct (#9718)
this part must have been moved quite a while ago, but apparently so far
no one noticed

(cherry picked from commit 6db805b3d1)

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2024-01-08 20:57:50 +01:00
Eelco Dolstra
8ef5c1cc06
Merge pull request #9691 from NixOS/backport-9687-to-2.19-maintenance
[Backport 2.19-maintenance] withFramedSink(): Receive interrupts on the stderr thread
2024-01-08 13:27:42 +01:00
Eelco Dolstra
6af94c431b Make some more threads receive interrupts
Shouldn't hurt to do this. In particular, this should speed up
shutting down the PathSubstitutionGoal thread if it's copying from a
remote store.

(cherry picked from commit 295a2ff8bd)
2024-01-04 16:06:41 +00:00
Eelco Dolstra
4b38ebb009 withFramedSink(): Receive interrupts on the stderr thread
Otherwise Nix deadlocks when Ctrl-C is received in withFramedSink():
the parent thread will wait forever for the stderr thread to shut
down.

Fixes the hang reported in https://github.com/NixOS/nix/issues/7245#issuecomment-1770560923.

(cherry picked from commit 24e70489e5)
2024-01-04 16:06:41 +00:00
Robert Hensing
b38e5a665e
Merge pull request #9609 from NixOS/backport-9547-to-2.19-maintenance
[Backport 2.19-maintenance] `allowed-uris`: match whole schemes without slashes #9547
2023-12-14 00:38:30 +01:00
Robert Hensing
01cf57703a Revert "Add nix::isASCII*, locale-independent"
This reverts commit 79eb2920bb.

Not used at this time.

(cherry picked from commit 0b87ba50c0)
2023-12-13 21:09:33 +01:00
Robert Hensing
ebdb6926fd isValidSchemeName: Use regex
As requested by Eelco Dolstra. I think it used to be simpler.

(cherry picked from commit 4eaeda6604)
2023-12-13 21:09:31 +01:00
Robert Hensing
598b0e2317 schemeRegex -> schemeNameRegex
Scheme could be understood to include the typical `:` separator.

(cherry picked from commit 2e451a663e)
2023-12-13 21:09:22 +01:00
Robert Hensing
ffb6246650 allowed-uris: Match whole schemes also when scheme is not followed by slashes
(cherry picked from commit a05bc9eb92)
2023-12-13 21:09:20 +01:00
Robert Hensing
2116ee2454 isValidSchemeName: Add function
(cherry picked from commit d3a85b6834)
2023-12-13 21:08:13 +01:00
Robert Hensing
772a8efff4 Add nix::isASCII*, locale-independent
(cherry picked from commit 79eb2920bb)
2023-12-13 21:07:54 +01:00
Robert Hensing
4795569bf7 isAllowedURI: Format
(cherry picked from commit 1fa958dda1)
2023-12-13 21:07:54 +01:00
Robert Hensing
ec5e4041ba isAllowedURI: Remove incorrect note
(cherry picked from commit 6cbba914a7)
2023-12-13 21:07:54 +01:00
Robert Hensing
90c7904abf isAllowedURI: Extract function and test
(cherry picked from commit 91ba7b2307)
2023-12-13 21:07:50 +01:00
John Ericson
2b0ce229aa
Merge pull request #9599 from NixOS/backport-9593-to-2.19-maintenance
[Backport 2.19-maintenance] Fix query parsing for path-like flakes
2023-12-12 15:00:53 -05:00
Fabian Möller
1e92097ce3 Add test cases for flake urls with fragments
(cherry picked from commit 994f1b5c0d)
2023-12-12 18:08:08 +00:00
Fabian Möller
f72b0b5b00 Fix query parsing for path-like flakes
(cherry picked from commit f45d2ee2b7)
2023-12-12 18:08:08 +00:00
Robert Hensing
ae451e2247
Merge pull request #9595 from NixOS/backport-9588-to-2.19-maintenance
[Backport 2.19-maintenance] Give `Store::queryDerivationOutputMap` and `evalStore` argument
2023-12-11 18:13:58 +01:00
Robert Hensing
0fad9ad5b7
Merge pull request #9594 from obsidiansystems/backport-9563-to-2.19-maintenance
[Backport 2.19-maintenance] [PARTIAL] Give `Derivation::tryResolve` an `evalStore` argument
2023-12-11 17:30:53 +01:00
John Ericson
5fc116a620 Give Store::queryDerivationOutputMap and evalStore argument
Picking up where https://github.com/NixOS/nix/pull/9563 left off.

(cherry picked from commit 5f30c8acc7)
2023-12-11 16:16:40 +00:00
John Ericson
e6a03920ad Give Derivation::tryResolve an evalStore argument
*N.B. Backport is modified not to change any call sites / behavior.*

This is needed for building CA deriations with a src store / dest store
split. In particular it is needed for Hydra.

https://github.com/NixOS/hydra/issues/838 currently puts realizations,
and thus build outputs, in the local store, but it should not.

(cherry picked with modifications from commit 96dd757b0c)
2023-12-11 10:42:06 -05:00
John Ericson
43d55dd15f
Merge pull request #9544 from NixOS/backport-9542-to-2.19-maintenance
[Backport 2.19-maintenance] Add missing `-pthread` for test support libraries
2023-12-05 19:26:08 -05:00
John Ericson
45cde5a343 Add missing -pthread for test support libraries
This is good in general (see how the other libraries also have long had
it, since 49fe9592a4) but in particular
needed to fix the NetBSD build.

(cherry picked from commit b23273f6a2)
2023-12-05 23:44:44 +00:00
Valentin Gagarin
aaeab00401 fix up release note
(cherry picked from commit 2ece9d5b92)
2023-12-04 16:56:46 +01:00
Valentin Gagarin
9c42b2c954 reword description for the fetch-tree experimental feature
without knowing a lot of context, it's not clear who "we" are in that
text. I'm also strongly opposed to adding procedural notes into
a reference manual; it just won't age well.

this change leaves a factual description of the experimental feature and
its purpose.

(cherry picked from commit 3c6244b55e)
2023-12-04 16:56:46 +01:00
Robert Hensing
175d598674
Merge pull request #9516 from NixOS/2.19-flatten-tests
[Backport 2.19-maintanence] Move tests to separate directories, and document
2023-12-01 19:31:45 +01:00
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