Commit graph

120 commits

Author SHA1 Message Date
jade 9160d40f80 Address feedback from alois31
- Remove restrict-eval stuff that did nothing
- Remove builders stuff that appears unnecessary:

/* FIXME: The build hook in conjunction with import-from-derivation is
 * causing "unexpected EOF" during eval */
settings.builders.setDefault("");

We removed that line and then observed that it works, so idk:

ifdtest.nix:

let
  ifd = builtins.derivation {
    name = "wat2";
    builder = "/bin/sh";
    args = [ "-c" "echo meow > $out" ];
    system = "aarch64-linux";
  };
in
  builtins.readFile ifd

 » NIX_CONFIG="builders = @/etc/nix/machines" build/src/nix-eval-jobs ifdtest.nix
warning: unknown setting 'trusted-users'
warning: `--gc-roots-dir' not specified
building '/nix/store/xxnd5rb49n3anyla5v71lgdk0wmhmijp-wat2.drv' on 'ssh-ng://root@voracle.jade.fyi'...
copying 0 paths...
building '/nix/store/xxnd5rb49n3anyla5v71lgdk0wmhmijp-wat2.drv'...
copying 1 paths...
copying path '/nix/store/h2yxq9lb7l0nd9plgqrcgf7nvsg67gl7-wat2' from 'ssh-ng://root@voracle.jade.fyi'...

- Changed the impure/flake code to override the pureEval setting, which
  it was definitely *supposed* to be doing in the first place.
2024-11-09 12:46:21 -08:00
Qyriad 43aaa943bf fix build with latest Lix
Lix commit 4dbbd721e[1] changed the way settings are changed, removing
operator= in the process. This commit changes the places where we use
operator= to using either setDefault(), or override(). I *believe* I
have used the correct ones for each changed setting.

Fixes #13.

[1]: 4dbbd721eb9db75d4968a624b8cb9e75e979a144
2024-10-25 14:29:57 -06:00
Pierre Bourdon d9a46559a4
drv: backport CA derivations support changes from hydra-eval-jobs
It is not possible to query output paths for CA derivations since
they're not static / known at eval time. Instead, return JSON nulls for
outputs paths.

This is a partial port of the following Hydra commits:

- 9ba4417940ffdd0fadea43f68c61ef948a4b8d39
- 069b7775c565f5999fe33e8c3f28c7b9306039ca
- fcde5908d8e51f975b883329b34d24a9f30ea4b3

By the following authors:

Co-Authored-By: John Ericson <John.Ericson@Obsidian.Systems>
Co-Authored-By: Théophane Hufschmitt <theophane.hufschmitt@tweag.io>
Co-Authored-By: Alexander Sosedkin <monk@unboiled.info>
Co-Authored-By: Andrea Ciceri <andrea.ciceri@autistici.org>
Co-Authored-By: Charlotte 🦝 Delenk Mlotte@chir.rs>
Co-Authored-By: Sandro Jäckel <sandro.jaeckel@gmail.com>
2024-07-16 09:15:21 +02:00
eldritch horrors f8869bdcca update for lix 2.91-dev
the api of nix::Pid changed, causing a build failure.
2024-06-25 23:57:51 +02:00
jade fd86a1a068 Fix on latest lix
Fixes: lix-project/nix-eval-jobs#9
2024-06-18 23:08:04 -07:00
jade 9c23772cf2 Tidy and make it work on release-2.90 2024-06-18 22:31:42 -07:00
puck 11d467fecd Use our own Thread struct instead of std::thread
We'd highly prefer using std::thread here; but this won't let us configure the stack
size. macOS uses 512KiB size stacks for non-main threads, and musl defaults to 128k.
While Nix configures a 64MiB size for the main thread, this doesn't propagate to the
threads we launch here. It turns out, running the evaluator under an anemic stack of
0.5MiB has it overflow way too quickly. Hence, we have our own custom Thread struct.
2024-06-12 22:39:53 +00:00
jade b67c46d320 lix: deal with util.hh removal 2024-05-29 19:17:54 -07:00
jade 30cf61fd26 fix: don't crash on startup on macOS
This is caused, through several layers of absurdity, by runtime type
information of Nix things being invisible due to -fvisibility=hidden
inside n-e-j.

We don't have any idea why n-e-j has -fvisibility=hidden, since blame
says it's from the initial commit. It is plausible that it was some
ill-advised optimization but it's not sound.

The crash is caused by dynamic_cast<RootArgs *>(MyArgs *) failing, which
is in turn caused by the RTTI being invisible.

See: https://www.qt.io/blog/quality-assurance/one-way-dynamic_cast-across-library-boundaries-can-fail-and-how-to-fix-it
Fixes: lix-project/nix-eval-jobs#2
2024-05-27 18:23:13 -06:00
jade a94f80e512 nixexpr -> lixexpr 2024-05-23 16:23:45 -07:00
Jörg Thalheim 52e96bd421 fix crash in worker when opening the store 2024-05-11 17:41:27 +02:00
eldritch horrors 793841a9b7 fix drv.cc invalid output throw
EvalState::error does not return an exception instance in lix, but an
exception *builder*. throwing this thing will not trigger any catches,
which then causes the worker process to die without reporting an error
to the collector. this confuses the collector and causes *it* to exit,
effectively breaking nix-eval-jobs for anything that has broken attrs.
2024-04-18 18:05:33 +02:00
Linus Heckemann c3d8ca19b3 EvalError needs to reference an eval state now 2024-04-15 19:35:05 +02:00
Linus Heckemann c1ee00bf7c ProcessOptions: remove allowVfork field
This was removed in Lix 1f8b85786eed623319e5c71a5341b15e3006f870
2024-04-15 19:30:56 +02:00
Linus Heckemann 14e4308346 parseCmdline: no allowShebang arg
This arg was only introduced in Nix 2.19 (commit ffd414eb756dcb3c64348551d5dbaf674c0d4900)
2024-04-15 19:30:32 +02:00
Linus Heckemann a2bd945259 hasPrefix -> starts_with
hasPrefix was removed in lix commit 61e21b25576f7f3491f6a837bf59d8b44c6897a0
2024-04-15 19:28:36 +02:00
Linus Heckemann 733f3051b1 Fix include paths for Nix headers
While the previous style seems more sensible to me (the header names
are quite generic), the pkg-config definitions both from upstream Nix
and from Lix specify -I${includedir}/nix in CFLAGS rather than
-I${includedir}. This may be worth changing, but for now I want
nix-eval-jobs to work and this does what I want.
2024-04-15 19:20:21 +02:00
Jörg Thalheim e3d71921c3 buffered-io: also check for interrupts in readline
This allows us to more reliable interrupt nix-eval-jobs
2023-12-17 12:15:15 +00:00
Jörg Thalheim b73f7ceff4 classify SIGSEV/SIGBUS as infinite recursion errors 2023-12-16 11:58:01 +01:00
Jörg Thalheim 093b8ce5cc apply treefmt 2023-12-16 11:44:08 +01:00
Jörg Thalheim 4d97e5a386 improve infinite recursion errors 2023-12-16 10:52:23 +01:00
Jörg Thalheim 83df9d4e24 fix exit status reporting when evaluation fails 2023-12-16 09:48:37 +01:00
Jörg Thalheim 89927c434c make sure we also define HAVE_STRUCT_DIRENT_D_TYPE outside of autotools 2023-12-16 09:24:42 +01:00
Jörg Thalheim 1f4bbded61 optimize imports with "include-what-you-use" 2023-12-16 09:20:53 +01:00
Jörg Thalheim 521380076d release proc.pid properly before calling waitpid() 2023-12-10 20:36:24 +00:00
Jörg Thalheim e1ad62cef1 include orignal json in worker error message 2023-12-10 20:36:24 +00:00
Jörg Thalheim d48cfadb3d fix catching eval errors on macOS 2023-12-10 20:36:24 +00:00
Jörg Thalheim c00fcbba8d drop obsolete compiler warning suppression 2023-12-10 20:36:24 +00:00
Jörg Thalheim b6ec7d2ecf make MyArgs non-copyable
this seems to have weird effects
2023-12-10 20:36:24 +00:00
Jörg Thalheim b24c03e2de simplify collector function
looks like the lambda doesn't buy us anything here.
2023-12-10 20:36:24 +00:00
Jörg Thalheim e7c30b306d don't fail nix-eval-jobs on eval errors
This error handling was copied by accident in 5c764d4a67 (diff-a79ded172fd76747492a417a39848b6c25c14238e65971e6a05fe81706d5048fR622)
2023-12-10 15:57:18 +00:00
Jörg Thalheim 36a5368dfc include missing filesystem header 2023-12-10 14:52:52 +00:00
Jörg Thalheim 3be8c48f54 fix format 2023-12-10 14:52:52 +00:00
Jörg Thalheim a03f039a56 split nix-eval-jobs further into smaller files 2023-12-10 14:52:52 +00:00
Jörg Thalheim 880c66a7d1 move drvs ot its own class 2023-12-10 15:07:38 +01:00
Jörg Thalheim db3099bc8f move argument parsing to new file 2023-12-10 14:22:32 +01:00
Jörg Thalheim 00d3f014e7 print error if worker receives invalid command 2023-12-10 10:25:15 +00:00
Jörg Thalheim 93972c0c18 handle broken evaluation worker pipes on write 2023-12-10 10:25:15 +00:00
Jörg Thalheim 5ad4e7266f handle broken evaluation worker pipes more gracefully
writeLine will throw a SysError exception, which obfuscates out-of-memory events where the eval worker is killed by the OS.
readLine is suffering from the same problem and will be handled in a subsequent commit.
2023-12-10 10:25:15 +00:00
Jörg Thalheim fad244725f print which derivation failed to evaluate 2023-12-10 08:31:27 +00:00
Jörg Thalheim d4eeecf6b2 fix commandline parsing for nix 2.19 2023-12-06 08:30:10 +00:00
Jörg Thalheim c240e61481 fix missing includes for nix 2.19 2023-12-06 08:30:10 +00:00
adisbladis cb9c7cac6b Fix iterating over input derivation outputs 2023-11-03 03:07:37 +00:00
adisbladis dd8affe264 Add missing include for eval-settings.hh 2023-11-03 03:07:37 +00:00
Jörg Thalheim 56f0464288 use platform instead of querySystem()
nix-build uses "system" from the derivation rather than the derivation attributes
2023-10-07 22:52:14 +02:00
Jörg Thalheim 15ec2c4663 print derivation name if system attribute is missing 2023-09-12 07:07:07 +00:00
Andrea Bedini f88571cfc9 Fix formatting 2023-07-14 07:09:40 +00:00
Andrea Bedini 15e5f5f7c8 Add --override-input 2023-07-14 07:09:40 +00:00
Andrea Bedini ab07651f74 Small refactor to avoid optional values 2023-07-14 07:09:40 +00:00
Jörg Thalheim 9e8320dbd6 fix c++20 warnings 2023-06-10 13:52:28 +02:00