fractal-nixified: add a bunch of crateOverrides to get *closer* to a complete build

This commit is contained in:
Colin 2023-09-30 07:07:40 +00:00
parent d26fa5bec1
commit ce9b30767f

View File

@ -10,8 +10,29 @@
# hash = "sha256-z6uURqMG5pT8rXZCv5IzTjXxtt/f4KUeCDSgk90aWdo=";
# };
{ pkgs }:
{ pkgs
, buildPackages
, clang
, dbus-glib
, glib
, gst_all_1
, gtk4
, libadwaita
, libclang
, libshumate
, pipewire
, pkg-config
, rustPlatform
}:
let
gtkDeps = attrs: attrs // {
# see: <https://github.com/nix-community/crate2nix/issues/286>
# gtk -sys packages declare their system dependencies in Cargo.toml like:
# `[package.metadata.system-deps.gstreamer_1_0]`
nativeBuildInputs = [ pkg-config ];
buildInputs = [ dbus-glib gtk4 ];
verbose = true; #< doesn't seem to do anything
};
cargoNix = import ./Cargo.nix {
inherit pkgs;
release = false;
@ -25,6 +46,81 @@ let
hash = "sha256-z6uURqMG5pT8rXZCv5IzTjXxtt/f4KUeCDSgk90aWdo=";
};
};
gdk-pixbuf-sys = gtkDeps;
gdk4-wayland-sys = gtkDeps;
gdk4-x11-sys = gtkDeps;
gio-sys = gtkDeps;
gobject-sys = gtkDeps;
gstreamer-audio-sys = attrs: attrs // {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ gst_all_1.gst-plugins-base ];
};
gstreamer-base-sys = attrs: attrs // {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ gst_all_1.gst-plugins-base ];
};
gstreamer-pbutils-sys = attrs: attrs // {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ gst_all_1.gst-plugins-base ];
};
gstreamer-play-sys = attrs: attrs // {
nativeBuildInputs = [ pkg-config ];
buildInputs = [
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-base
];
};
gstreamer-sys = attrs: attrs // {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ gst_all_1.gst-plugins-base ];
};
gstreamer-video-sys = attrs: attrs // {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ gst_all_1.gst-plugins-base ];
};
gst-plugin-gtk4 = attrs: attrs // {
# [package.metadata.capi.pkg_config]
# requires_private = "gstreamer-1.0, gstreamer-base-1.0, gstreamer-video-1.0, gtk4, gobject-2.0, glib-2.0, gmodule-2.0"
nativeBuildInputs = [ pkg-config ];
buildInputs = [
gst_all_1.gst-plugins-base
gst_all_1.gst-libav
gtk4
glib
];
verbose = true;
CARGO_PKG_REPOSITORY = "nixpkgs";
};
libadwaita-sys = attrs: attrs // {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libadwaita ];
};
libshumate-sys = attrs: attrs // {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libshumate ];
};
libspa-sys = attrs: attrs // {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ pipewire ];
# alternative to this is add `rustPlatform.bindgenHook` to nativeBuildInputs.
# i'm just copying the logic from build-support/rust/hooks/rust-bindgen-hook.sh anyway
preConfigure = (attrs.preConfigure or "") + ''
# export BINDGEN_EXTRA_CLANG_ARGS="$NIX_CFLAGS_COMPILE"
export BINDGEN_EXTRA_CLANG_ARGS="$(< ${clang}/nix-support/cc-cflags) $(< ${clang}/nix-support/libc-cflags) $(< ${clang}/nix-support/libcxx-cxxflags) $NIX_CFLAGS_COMPILE"
'';
LIBCLANG_PATH = "${buildPackages.llvmPackages.libclang.lib}/lib";
};
pipewire-sys = attrs: attrs // {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ pipewire ];
# alternative to this is add `rustPlatform.bindgenHook` to nativeBuildInputs.
# i'm just copying the logic from build-support/rust/hooks/rust-bindgen-hook.sh anyway
preConfigure = (attrs.preConfigure or "") + ''
# export BINDGEN_EXTRA_CLANG_ARGS="$NIX_CFLAGS_COMPILE"
export BINDGEN_EXTRA_CLANG_ARGS="$(< ${clang}/nix-support/cc-cflags) $(< ${clang}/nix-support/libc-cflags) $(< ${clang}/nix-support/libcxx-cxxflags) $NIX_CFLAGS_COMPILE"
'';
LIBCLANG_PATH = "${buildPackages.llvmPackages.libclang.lib}/lib";
};
# js_int = attrs: attrs // {
# features = attrs.features ++ [ "serde" "std" ];
# };