autodep runtime dependencies
Some checks failed
CI / checks (push) Has been cancelled

This commit is contained in:
Robin Appelman 2024-12-14 16:00:51 +01:00
commit d8e263916a
3 changed files with 16 additions and 8 deletions

View file

@ -18,6 +18,7 @@ let
(merged: dep: {
build = merged.build ++ (availableAutoDeps.${dep}.build or [ ]);
native = merged.native ++ (availableAutoDeps.${dep}.native or [ ]);
runtime = merged.runtime ++ (availableAutoDeps.${dep}.runtime or [ ]);
env =
if (hasAttr "env" availableAutoDeps.${dep}) then
pkgs: (merged.env pkgs) // (availableAutoDeps.${dep}.env pkgs)
@ -26,11 +27,13 @@ let
{
build = [ ];
native = [ ];
runtime = [ ];
env = pkgs: { };
}
detectedDeps else {
build = [ ];
native = [ ];
runtime = [ ];
env = pkgs: { };
};
getPkgs = pkgs: deps:
@ -41,6 +44,7 @@ let
autoDeps = pkgs: {
buildInputs = getPkgs pkgs mergedDetectedDeps.build;
nativeBuildInputs = with pkgs; [ pkg-config ] ++ (getPkgs pkgs mergedDetectedDeps.native);
runtimeInputs = getPkgs pkgs mergedDetectedDeps.runtime;
env = mergedDetectedDeps.env pkgs;
};
in

View file

@ -5,11 +5,7 @@
"expat-sys" = { native = [ "cmake" ]; };
"servo-fontconfig-sys" = { build = [ "fontconfig" ]; };
"x11-dl" = { build = [ "xorg.libX11" "xorg.libXcursor" "xorg.libXrandr" "xorg.libXi" ]; };
"glutin_glx_sys" = {
build = [ "libGL" ];
env = pkgs: {
LD_LIBRARY_PATH = with pkgs; "/run/opengl-driver/lib/:${lib.makeLibraryPath ([libGL libGLU])}";
};
};
"glutin_glx_sys" = { runtime = [ "libGL" "libGLU" ]; };
"wayland-egl" = { build = [ "egl-wayland" ]; };
"wayland-sys" = { runtime = [ "wayland" "libxkbcommon" ]; };
}

View file

@ -20,10 +20,13 @@ let
hasDefaultPackage = pathExists (src + /nix/package.nix);
autoDeps = (import ./autodeps { inherit lib src config; });
buildDeps = pkgs: {
buildDeps = pkgs: rec {
buildInputs = (autoDeps pkgs).buildInputs ++ (config.buildInputs pkgs);
nativeBuildInputs = (autoDeps pkgs).nativeBuildInputs ++ (config.nativeBuildInputs pkgs);
env = (autoDeps pkgs).env // (config.buildEnv pkgs);
runtimeInputs = (autoDeps pkgs).runtimeInputs ++ (config.runtimeInputs pkgs);
env = (autoDeps pkgs).env // (config.buildEnv pkgs) // {
LD_LIBRARY_PATH = "/run/opengl-driver/lib/:${lib.makeLibraryPath (runtimeInputs)}";
};
};
in
warnIf (! builtins ? readFileType) "Unsupported Nix version in use."
@ -70,6 +73,11 @@ warnIf (! builtins ? readFileType) "Unsupported Nix version in use."
default = pkgs: { };
description = "build environent variables for the package";
};
runtimeInputs = mkOption {
type = function;
default = pkgs: [ ];
description = "runtime inputs for the package";
};
tools = mkOption {
type = function;
default = pkgs: with pkgs; [ cargo-edit bacon ];