From ce9b30767fade2f81950cd6e99e102165b6b06bb Mon Sep 17 00:00:00 2001 From: Colin Date: Sat, 30 Sep 2023 07:07:40 +0000 Subject: [PATCH] fractal-nixified: add a bunch of crateOverrides to get *closer* to a complete build --- pkgs/additional/fractal-nixified/default.nix | 98 +++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/pkgs/additional/fractal-nixified/default.nix b/pkgs/additional/fractal-nixified/default.nix index 4090bbd7..8961038e 100644 --- a/pkgs/additional/fractal-nixified/default.nix +++ b/pkgs/additional/fractal-nixified/default.nix @@ -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: + # 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" ]; # };