aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix7
-rw-r--r--meson_options.txt1
-rw-r--r--src/jobs.c16
-rw-r--r--src/meson.build2
4 files changed, 20 insertions, 6 deletions
diff --git a/flake.nix b/flake.nix
index 2659b41..af622e6 100644
--- a/flake.nix
+++ b/flake.nix
@@ -67,10 +67,9 @@
highs
];
- postInstall = ''
- wrapProgram $out/bin/evanix \
- --prefix PATH : ${lib.makeBinPath [ pkgs.nix-eval-jobs ]}
- '';
+ mesonFlags = [
+ (lib.mesonOption "NIX_EVAL_JOBS_PATH" (lib.getExe pkgs.nix-eval-jobs))
+ ];
meta = {
homepage = "https://git.sinanmohd.com/evanix";
diff --git a/meson_options.txt b/meson_options.txt
index e8baf64..bd5fb66 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1 +1,2 @@
option('build-python', type: 'boolean', value: 'false')
+option('NIX_EVAL_JOBS_PATH', type: 'string', value: 'nix-eval-jobs')
diff --git a/src/jobs.c b/src/jobs.c
index c65de63..096c97d 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -10,6 +10,15 @@
#include "jobs.h"
#include "util.h"
+#ifndef NIX_EVAL_JOBS_PATH
+#warning "NIX_EVAL_JOBS_PATH not defined, evanix will rely on PATH instead"
+#define NIX_EVAL_JOBS_PATH nix-eval-jobs
+#endif
+
+#define XSTR(x) STR(x)
+#define STR(x) #x
+#pragma message "NIX_EVAL_JOBS_PATH=" XSTR(NIX_EVAL_JOBS_PATH)
+
static void output_free(struct output *output);
static int job_new(struct job **j, char *name, char *drv_path, char *attr,
struct job *parent);
@@ -443,7 +452,9 @@ int jobs_init(FILE **stream, char *expr)
int ret;
argindex = 0;
- args[argindex++] = "nix-eval-jobs";
+
+ args[argindex++] = XSTR(NIX_EVAL_JOBS_PATH);
+
args[argindex++] = "--check-cache-status";
args[argindex++] = "--force-recurse";
if (evanix_opts.isflake)
@@ -452,7 +463,8 @@ int jobs_init(FILE **stream, char *expr)
args[argindex++] = NULL;
/* the package is wrapProgram-ed with nix-eval-jobs */
- ret = vpopen(stream, "nix-eval-jobs", args);
+ ret = vpopen(stream, XSTR(NIX_EVAL_JOBS_PATH), args);
+
return ret;
}
diff --git a/src/meson.build b/src/meson.build
index 5e6e2de..2578b51 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,3 +1,4 @@
+NIX_EVAL_JOBS_PATH = get_option('NIX_EVAL_JOBS_PATH')
e = executable(
'evanix',
[
@@ -14,6 +15,7 @@ e = executable(
include_directories: evanix_inc,
dependencies: [ cjson_dep, highs_dep ],
install: true,
+ c_args: [f'-DNIX_EVAL_JOBS_PATH=@NIX_EVAL_JOBS_PATH@'],
)
test('evanix', e)