diff --git a/flake.lock b/flake.lock index 00f902b..735dfc5 100644 --- a/flake.lock +++ b/flake.lock @@ -20,6 +20,31 @@ "type": "github" } }, + "nix": { + "inputs": { + "flake-compat": [], + "flake-parts": [], + "git-hooks-nix": [], + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-23-11": [], + "nixpkgs-regression": [] + }, + "locked": { + "lastModified": 1736122729, + "narHash": "sha256-X5MiElqJNTXxwyxczOMSl3g5S1avidkH602vCGy3SYU=", + "owner": "NixOS", + "repo": "nix", + "rev": "daab4d18aca63940ebd1e784c298494d0a93ce4a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nix", + "type": "github" + } + }, "nix-github-actions": { "inputs": { "nixpkgs": [ @@ -59,6 +84,7 @@ "root": { "inputs": { "flake-parts": "flake-parts", + "nix": "nix", "nix-github-actions": "nix-github-actions", "nixpkgs": "nixpkgs", "treefmt-nix": "treefmt-nix" diff --git a/flake.nix b/flake.nix index 10dfb06..1b57fcf 100644 --- a/flake.nix +++ b/flake.nix @@ -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; @@ -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 { diff --git a/meson.build b/meson.build index d0748ed..5fc8b50 100644 --- a/meson.build +++ b/meson.build @@ -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) diff --git a/shell.nix b/shell.nix index cfc1822..7cfddc4 100644 --- a/shell.nix +++ b/shell.nix @@ -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}" ''; } diff --git a/src/drv.cc b/src/drv.cc index f572678..d0a2fa7 100644 --- a/src/drv.cc +++ b/src/drv.cc @@ -1,4 +1,3 @@ -#include // IWYU pragma: keep #include #include #include diff --git a/src/meson.build b/src/meson.build index 5fe077c..368e55f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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', + ]) diff --git a/src/nix-eval-jobs.cc b/src/nix-eval-jobs.cc index 13d610c..7efbce3 100644 --- a/src/nix-eval-jobs.cc +++ b/src/nix-eval-jobs.cc @@ -1,4 +1,3 @@ -#include // IWYU pragma: keep // NOLINTBEGIN(modernize-deprecated-headers) // misc-include-cleaner wants these header rather than the C++ versions #include diff --git a/src/worker.cc b/src/worker.cc index 23542c6..4cb9d46 100644 --- a/src/worker.cc +++ b/src/worker.cc @@ -1,5 +1,3 @@ -#include // IWYU pragma: keep - // doesn't exist on macOS // IWYU pragma: no_include