nix-eval-jobs/src/eval-args.hh
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

39 lines
1.1 KiB
C++

#pragma once
#include <lix/libexpr/flake/flake.hh>
#include <lix/libutil/args/root.hh>
#include <lix/libcmd/common-eval-args.hh>
#include <stddef.h>
#include <lix/libmain/common-args.hh>
#include <lix/libexpr/flake/flakeref.hh>
#include <lix/libutil/types.hh>
#include <string>
#include <optional>
class MyArgs : virtual public nix::MixEvalArgs,
virtual public nix::MixCommonArgs,
virtual public nix::RootArgs {
public:
std::string releaseExpr;
nix::Path gcRootsDir;
bool flake = false;
bool fromArgs = false;
bool meta = false;
bool showTrace = false;
bool impure = false;
bool forceRecurse = false;
bool checkCacheStatus = false;
size_t nrWorkers = 1;
size_t maxMemorySize = 4096;
// usually in MixFlakeOptions
nix::flake::LockFlags lockFlags = {.updateLockFile = false,
.writeLockFile = false,
.useRegistries = false,
.allowUnlocked = false};
MyArgs();
MyArgs(const MyArgs&) = delete;
void parseArgs(char** argv, int argc);
};