Skip to content

Commit

Permalink
fix build against nix-meson
Browse files Browse the repository at this point in the history
fix weird crash
  • Loading branch information
Mic92 committed Jan 6, 2025
1 parent cbae915 commit 55935b6
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 13 deletions.
26 changes: 26 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 16 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@
inputs.nix-github-actions.url = "github:nix-community/nix-github-actions";
inputs.nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";

inputs.nix.url = "github:NixOS/nix";
inputs.nix.inputs.nixpkgs.follows = "nixpkgs";
inputs.nix.inputs.flake-parts.follows = "";
inputs.nix.inputs.flake-compat.follows = "";
inputs.nix.inputs.git-hooks-nix.follows = "";
inputs.nix.inputs.nixpkgs-23-11.follows = "";
inputs.nix.inputs.nixpkgs-regression.follows = "";

outputs =
inputs@{ flake-parts, ... }:
let
inherit (inputs.nixpkgs) lib;
inherit (inputs) self;
nixVersion = lib.fileContents ./.nix-version;
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = inputs.nixpkgs.lib.systems.flakeExposed;
Expand Down Expand Up @@ -43,12 +50,17 @@
};

perSystem =
{ pkgs, self', ... }:
{
inputs',
pkgs,
self',
...
}:
let
drvArgs = {
srcDir = self;
nix =
if nixVersion == "latest" then pkgs.nixVersions.latest else pkgs.nixVersions."nix_${nixVersion}";
nix = inputs'.nix.packages.nix;
#if nixVersion == "latest" then pkgs.nixVersions.latest else pkgs.nixVersions."nix_${nixVersion}";
};
in
{
Expand Down
7 changes: 4 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ project('nix-eval-jobs', 'cpp',
)

libcurl_dep = dependency('libcurl', required: true)
nix_main_dep = dependency('nix-main', required: true)
nix_store_dep = dependency('nix-store', required: true)
nix_expr_dep = dependency('nix-expr', required: true)
nix_cmd_dep = dependency('nix-cmd', required: true)
nix_expr_dep = dependency('nix-expr', required: true)
nix_fetchers_dep = dependency('nix-fetchers', required: true)
nix_flake_dep = dependency('nix-flake', required: true)
nix_main_dep = dependency('nix-main', required: true)
nix_store_dep = dependency('nix-store', required: true)
threads_dep = dependency('threads', required: true)
nlohmann_json_dep = dependency('nlohmann_json', required: true)
boost_dep = dependency('boost', required: true)
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ in
(lib.hiPrio pkgs.llvmPackages_latest.clang-tools)
];

shellHook = lib.optionalString stdenv.isLinux ''
shellHook = lib.optionalString (stdenv.isLinux && nix ? debug) ''
export NIX_DEBUG_INFO_DIRS="${pkgs.curl.debug}/lib/debug:${nix.debug}/lib/debug''${NIX_DEBUG_INFO_DIRS:+:$NIX_DEBUG_INFO_DIRS}"
'';
}
1 change: 0 additions & 1 deletion src/drv.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <nix/config.h> // IWYU pragma: keep
#include <nix/path-with-outputs.hh>
#include <nix/store-api.hh>
#include <nix/local-fs-store.hh>
Expand Down
11 changes: 10 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@ executable('nix-eval-jobs', src,
nix_expr_dep,
nix_cmd_dep,
nix_flake_dep,
nix_fetchers_dep,
boost_dep,
nlohmann_json_dep,
threads_dep
],
install: true,
cpp_args: ['-std=c++2a', '--include', 'autotools-config.h'])
cpp_args: [
'-std=c++2a',
'--include', 'autotools-config.h',
'--include', 'nix/config-cmd.hh',
'--include', 'nix/config-expr.hh',
'--include', 'nix/config-main.hh',
'--include', 'nix/config-store.hh',
'--include', 'nix/config-util.hh',
])
1 change: 0 additions & 1 deletion src/nix-eval-jobs.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <nix/config.h> // IWYU pragma: keep
// NOLINTBEGIN(modernize-deprecated-headers)
// misc-include-cleaner wants these header rather than the C++ versions
#include <signal.h>
Expand Down
2 changes: 0 additions & 2 deletions src/worker.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <nix/config.h> // IWYU pragma: keep

// doesn't exist on macOS
// IWYU pragma: no_include <bits/types/struct_rusage.h>

Expand Down

0 comments on commit 55935b6

Please sign in to comment.