Closed blackliner closed 1 month ago
I think it should be possible to achieve this using the existing nixopts
attribute.
Something along the lines of the following (not tested)
nixpkgs_package(
name = "opencv4",
repositories = NIX_REPOSITORIES,
build_file = "//packages/thirdparty/opencv:BUILD.bazel.tmpl",
nixopts = [ "--arg", "enableGtk2", "false", "--arg", "enableJPEG", "true" ]
)
Doesn't seem to work. Looking at https://ryantm.github.io/nixpkgs/using/overrides/, it mentions .override
that can be used in derivations. Is there a way to use the command line to provide overrides? Or other means with nixpkgs_package
Would https://github.com/NixOS/nix/issues/5766 be the missing part?
Could we write a proxy default.nix
for the time being to set the override? This does NOT do the trick yet :-/
{ pkgs ? import <nixpkgs> {} }:
let
opencv4 = pkgs.opencv4.overrideAttrs (previousAttrs: {
enableEXR = false;
});
in
opencv4
I see, in that case this should be doable using the nix_file_content
attribute to provide a Nix expression, see example in tests.
Something like
nixpkgs_package(
name = "opencv4",
repositories = NIX_REPOSITORIES,
build_file = "//packages/thirdparty/opencv:BUILD.bazel.tmpl",
nix_file_content = "let pkgs = import <nixpkgs> { config = {}; overlays = []; }; in pkgs.opencv.override { enableEXR = false; }",
)
Would https://github.com/NixOS/nix/issues/5766 be the missing part?
That would make it possible to configure the override using nixopts
. But, nix_file_content
should also work.
Thank you, this workaround did it!
Is it possible to use
nixpkgs_package
and change the optional dependencies? See for example: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/opencv/default.nix#L46-L54something like