1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 12:10:59 +01:00
Commit graph

8337 commits

Author SHA1 Message Date
Alex Ameen
1a6446b5eb primop: add readFileType, optimize readDir
Allows checking directory entry type of a single file/directory.

This was added to optimize the use of `builtins.readDir` on some
filesystems and operating systems which cannot detect this information
using POSIX's `readdir`.

Previously `builtins.readDir` would eagerly use system calls to lookup
these filetypes using other interfaces; this change makes these
operations lazy in the attribute values for each file with application
of `builtins.readFileType`.

(cherry picked from commit 153ee460c5)
2023-07-31 16:37:44 +02:00
Théophane Hufschmitt
00811f98fb Properly report build errors on chrooted stores
When encountering a build error, Nix moves the output paths out of the
chroot into their final location (for “easier debugging of build
failures”). However this was broken for chroot stores as it was moving
it to the _logical_ location, not the _physical_ one.

Fix it by moving to the physical (_real_) location.

Fix https://github.com/NixOS/nix/issues/8395

(cherry picked from commit d16a1994fb)
2023-05-28 15:11:26 +00:00
Yorick van Pelt
ad96bf9791 Add talkative msg for coro gc debug
(cherry picked from commit 62ddd8633c)
2023-04-07 16:21:30 +00:00
Yorick van Pelt
de7803e15f Always disable GC in a coroutine unless the patch is applied
(cherry picked from commit 58d24a4cb6)
2023-04-07 16:21:30 +00:00
Yorick van Pelt
cc90264a7d DisableGC: replace by CoroutineContext, std::shared_ptr<void>
(cherry picked from commit 00bc34430b)
2023-04-07 16:21:30 +00:00
Yorick van Pelt
325ea715b3 Disable GC inside coroutines on mac OS
(cherry picked from commit 2c53ef1bfe)
2023-04-07 16:21:30 +00:00
Linus Heckemann
e697c74269 LocalDerivationGoal: set NIX_ATTRS_*_FILE correctly for sandboxed builds
(cherry picked from commit af4cbdafe7)
2023-03-16 15:04:52 +00:00
Yorick van Pelt
11522a573d Wait with making /etc unwritable until after build env setup
This fixes /etc/nsswitch.conf

(cherry picked from commit bbba49b3e4)
2023-02-21 19:22:35 +00:00
Eelco Dolstra
1083ecbb2b
Merge pull request #7833 from hercules-ci/backport-7616-to-2.13-maintenance
Backport 7616 to 2.13 maintenance
2023-02-14 16:53:27 +01:00
Yorick van Pelt
bca7075edc Make /etc writability conditional on uid-range feature
(cherry picked from commit 49fd72a903)
2023-02-14 15:50:29 +00:00
Yorick van Pelt
58210e5306 Don't allow writing to /etc
(cherry picked from commit db41f74af3)
2023-02-14 15:50:29 +00:00
Robert Hensing
4ca48e3c7f NarInfoDiskCache: Also test id consistency with updated fields
And clarify test

(cherry picked from commit 19b495a48a)
2023-02-14 14:54:51 +01:00
Robert Hensing
2e31c54ce5 NarInfoDiskCache: Keep BinaryCache.id stable and improve test
Fixes #3898

The entire `BinaryCaches` row used to get replaced after it became
stale according to the `timestamp` column. In a concurrent scenario,
this leads to foreign key conflicts as different instances of the
in-process `state.caches` cache now differ, with the consequence that
the older process still tries to use the `id` number of the old record.

Furthermore, this phenomenon appears to have caused the cache for
actual narinfos to be erased about every week, while the default
ttl for narinfos was supposed to be 30 days.

(cherry picked from commit fb94d5cabd)
2023-02-14 14:54:51 +01:00
Robert Hensing
e404ae5bb6 NarInfoDiskCache: Prepare reproducer for #3898
(cherry picked from commit 2ceece3ef3)
2023-02-14 14:54:51 +01:00
Robert Hensing
80498bd923 NarInfoDiskCacheImpl: Make dbPath a parameter
This allows testing with a clean database.

(cherry picked from commit 79f62d2dda)
2023-02-13 12:02:46 +00:00
Robert Hensing
7a67baf951 NarInfoDiskCache: Rename cacheExists -> upToDateCacheExists
This is slightly more accurate considering that an outdated record
may exist in the persistent cache. Possibly-outdated records are
quite relevant as they may be foreign keys to more recent information
that we want to keep, but we will not return them here.

(cherry picked from commit 29f0b196f4)
2023-02-13 12:02:46 +00:00
Robert Hensing
9f788403cf sqlite.cc: Add SQL tracing
Set environment variable NIX_DEBUG_SQLITE_TRACES=1 to log all sql statements.

(cherry picked from commit 8a0ef5d58e)
2023-02-13 12:02:46 +00:00
Robert Hensing
cdad101bc9 Restore some non-rapidcheck tests 2023-01-25 18:11:36 +01:00
Robert Hensing
9566203d0d Partially revert "Test store paths, with property tests"
This reverts the addition of property tests from commit d111d2ed49.
2023-01-25 11:33:29 +01:00
Robert Hensing
65e690a087 Revert "Add rapidcheck dependency for testing"
This reverts commit c92e51ecec.
2023-01-25 11:27:52 +01:00
Robert Hensing
2c552c66af
Merge pull request #7666 from NixOS/backport-7657-to-2.13-maintenance
[Backport 2.13-maintenance] Fix #7655
2023-01-23 16:22:59 +01:00
John Ericson
af27f2fe00 Fix #7655
We had some local variables left over from the older (more
complicated) implementation of this function. They should all be unused,
but one wasn't by mistake.

Delete them all, and replace the one that was still in use as intended.

(cherry picked from commit 0afdf4084c)
2023-01-23 14:43:23 +00:00
John Ericson
d111d2ed49 Test store paths, with property tests
The property test in fact found a bug: we were excluding numbers!

(cherry picked from commit 018e2571aa)
2023-01-23 14:21:44 +00:00
John Ericson
01b30df520 Better-scope Store forward declarations
(cherry picked from commit 685395332d)
2023-01-23 14:21:44 +00:00
John Ericson
c92e51ecec Add rapidcheck dependency for testing
Property tests are great!

Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
(cherry picked from commit 7fe308c2f8)
2023-01-23 14:21:44 +00:00
Eelco Dolstra
be0f37ad7b Add test for OutputsSpec::Names
From @Ericson2314.

(cherry picked from commit 75c89c3e5e)
2023-01-18 16:09:36 +00:00
Eelco Dolstra
9ccde7ec9f OutputSpec: Allow all valid output names
Fixes #7624.

(cherry picked from commit 95cfd50d25)
2023-01-18 16:09:36 +00:00
Eelco Dolstra
fda0d52e3c Restore support for channel: URLs in fetchTarball
Fixes #7625.

(cherry picked from commit 01f268322a)
2023-01-18 13:26:57 +00:00
Robert Hensing
b050a226b2 Revert "Merge pull request #6204 from layus/coerce-string"
This reverts commit a75b7ba30f, reversing
changes made to 9af16c5f74.

(cherry picked from commit 9b33ef3879)
2023-01-18 01:27:12 +00:00
John Ericson
b5e1da41f6 Try again to fix aarch64-linux build failure
f419ab48e6 was on the right track, but
there are a few more missing `raw()` calls to fix.

(cherry picked from commit 3965b0f75f)
2023-01-17 16:29:27 +01:00
Eelco Dolstra
9a32f77a95
Merge pull request #7606 from hercules-ci/recognize-some-flake-attributes
flake check: Recognize well known community attributes
2023-01-17 13:27:30 +01:00
Robert Hensing
4e7592b593 flake check: Recognize well known community attributes
This avoids warning fatigue, making `nix flake check` more effective.
2023-01-16 20:16:45 +01:00
Eelco Dolstra
1df3d62c76
Merge pull request #7585 from NixOS/macos-disconnect
MonitorFdHup: Make it work on macOS again
2023-01-16 13:30:15 +01:00
John Ericson
f419ab48e6 Try to fix build failure
Failure: https://hydra.nixos.org/build/205357257/nixlog/1

The problem seems to be trying to `std::visit` a derived class of
`std::variant`. Per
https://stackoverflow.com/questions/63616709/incomplete-type-stdvariant-used-in-nested-name-specifier
certain C++ standard library implementations allow this, but others do
not.

The solution is simply to call the `raw` method, which upcasts the
reference back to the `std::variant`.
2023-01-15 15:16:14 -05:00
John Ericson
a416476217 Move ValidPathInfo defintions to path-info.cc
Originally there was no `path-info.*`, then there was `path-info.hh`,
then there was `path-info.cc`, but only for new things. Moving this
stuff over makes everything consistent.
2023-01-13 15:39:19 -05:00
Robert Hensing
fec527bba1
Merge pull request #7597 from tweag/move-implem-bit-to-implem-file
Move the `getBuildLog` implementation to its own implementation file
2023-01-13 20:16:33 +01:00
Robert Hensing
d21f54958e
Merge pull request #6815 from obsidiansystems/better-wanted-outputs
`OutputSpec` for `DerivationGoal` and `DerivedPath`, today's `OutputSpec` -> `ExtendedOutputSpec`
2023-01-13 16:03:12 +01:00
Théophane Hufschmitt
b8a0e9a9b8 Move the getBuildLog implementation to its own implementation file
Keep the header minimal and clean
2023-01-13 11:05:44 +01:00
Théophane Hufschmitt
bdeb6de889
Merge pull request #7430 from tweag/ca/fix-nix-log
Ca/fix nix log
2023-01-13 11:00:56 +01:00
John Ericson
d8512653d4 Write more (extended) output spec tests 2023-01-12 22:05:55 -05:00
John Ericson
d29eb08563 Assert on construction that OutputsSpec::Names is non-empty 2023-01-12 20:52:29 -05:00
John Ericson
e947aa5401 Unit test OuputsSpec::{union_, isSubsetOf} 2023-01-12 20:33:50 -05:00
John Ericson
31875bcfb7 Split OutputsSpec::merge into OuputsSpec::{union_, isSubsetOf}
Additionally get rid of the evil time we made an empty
`OutputSpec::Names()`.
2023-01-12 20:20:27 -05:00
Théophane Hufschmitt
eaa20f2574
Merge pull request #7590 from fricklerhandwerk/remove-unnecessary-cast
remove unncessary cast
2023-01-12 14:00:43 +01:00
Valentin Gagarin
48b2a3a0d0 remove unncessary cast 2023-01-12 13:23:32 +01:00
John Ericson
0faf5326bd Improve tests for OutputsSpec 2023-01-11 19:09:21 -05:00
John Ericson
5ba6e5d0d9 Remove default constructor from OutputsSpec
This forces us to be explicit.

It also requires to rework how `from_json` works. A `JSON_IMPL` is added
to assist with this.
2023-01-11 19:08:19 -05:00
John Ericson
114a6e2b09 Make it hard to construct an empty OutputsSpec::Names
This should be a non-empty set, and so we don't want people doing this
by accident. We remove the zero-0 constructor with a little inheritance
trickery.
2023-01-11 19:08:19 -05:00
John Ericson
8a3b1b7ced Simplify and document store path installable parsing 2023-01-11 19:08:19 -05:00
John Ericson
ce2f91d356 Split OutputsSpec and ExtendedOutputsSpec, use the former more
`DerivedPath::Built` and `DerivationGoal` were previously using a
regular set with the convention that the empty set means all outputs.
But it is easy to forget about this rule when processing those sets.
Using `OutputSpec` forces us to get it right.
2023-01-11 18:57:18 -05:00