diff --git a/pkgs/by-name/ib/ibusMinimal/package.nix b/pkgs/by-name/ib/ibusMinimal/package.nix new file mode 100644 index 000000000000..a828d049c66e --- /dev/null +++ b/pkgs/by-name/ib/ibusMinimal/package.nix @@ -0,0 +1 @@ +{ ibus }: ibus.override { libOnly = true; } diff --git a/pkgs/by-name/sd/sdl3/package.nix b/pkgs/by-name/sd/sdl3/package.nix index 604a9427541a..1519f837e911 100644 --- a/pkgs/by-name/sd/sdl3/package.nix +++ b/pkgs/by-name/sd/sdl3/package.nix @@ -8,7 +8,7 @@ darwinMinVersionHook, dbus, fetchFromGitHub, - ibus, + ibusMinimal, installShellFiles, libGL, libayatana-appindicator, @@ -104,7 +104,11 @@ stdenv.mkDerivation (finalAttrs: { apple-sdk_11 ] ++ lib.optionals ibusSupport [ - ibus + # sdl3 only uses some constants of the ibus headers + # it never actually loads the library + # thus, it also does not have to care about gtk integration, + # so using ibusMinimal avoids an unnecessarily large closure here. + ibusMinimal ] ++ lib.optional waylandSupport zenity; diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix index f951be91af29..6c47a6b6e441 100644 --- a/pkgs/tools/inputmethods/ibus/default.nix +++ b/pkgs/tools/inputmethods/ibus/default.nix @@ -27,8 +27,8 @@ python3, json-glib, libnotify ? null, - enableUI ? true, - withWayland ? true, + enableUI ? !libOnly, + withWayland ? !libOnly, libxkbcommon, wayland, wayland-protocols, @@ -36,6 +36,10 @@ buildPackages, runtimeShell, nixosTests, + versionCheckHook, + nix-update-script, + libX11, + libOnly ? false, }: let @@ -61,14 +65,14 @@ let ''; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "ibus"; version = "1.5.32"; src = fetchFromGitHub { owner = "ibus"; repo = "ibus"; - tag = version; + tag = finalAttrs.version; hash = "sha256-Rp2Aw2C2LXMBp8++pnZtPHiPoFDERpkDsKd0E//twuY="; }; @@ -86,11 +90,14 @@ stdenv.mkDerivation rec { ./build-without-dbus-launch.patch ]; - outputs = [ - "out" - "dev" - "installedTests" - ]; + outputs = + [ + "out" + "dev" + ] + ++ lib.optionals (!libOnly) [ + "installedTests" + ]; postPatch = '' # Maintainer does not want to create separate tarballs for final release candidate and release versions, @@ -107,29 +114,38 @@ stdenv.mkDerivation rec { preAutoreconf = "touch ChangeLog"; - configureFlags = [ - # The `AX_PROG_{CC,CXX}_FOR_BUILD` autoconf macros can pick up unwrapped GCC binaries, - # so we set `{CC,CXX}_FOR_BUILD` to override that behavior. - # https://github.com/NixOS/nixpkgs/issues/21751 - "CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc" - "CXX_FOR_BUILD=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++" - "GLIB_COMPILE_RESOURCES=${lib.getDev buildPackages.glib}/bin/glib-compile-resources" - "PKG_CONFIG_VAPIGEN_VAPIGEN=${lib.getBin buildPackages.vala}/bin/vapigen" - "--disable-memconf" - (lib.enableFeature (dconf != null) "dconf") - (lib.enableFeature (libnotify != null) "libnotify") - (lib.enableFeature withWayland "wayland") - (lib.enableFeature enableUI "ui") - "--disable-gtk2" - "--enable-gtk4" - "--enable-install-tests" - "--with-unicode-emoji-dir=${unicode-emoji}/share/unicode/emoji" - "--with-emoji-annotation-dir=${cldr-annotations}/share/unicode/cldr/common/annotations" - "--with-python=${python3BuildEnv.interpreter}" - "--with-ucd-dir=${unicode-character-database}/share/unicode" - ]; + configureFlags = + [ + # The `AX_PROG_{CC,CXX}_FOR_BUILD` autoconf macros can pick up unwrapped GCC binaries, + # so we set `{CC,CXX}_FOR_BUILD` to override that behavior. + # https://github.com/NixOS/nixpkgs/issues/21751 + "CC_FOR_BUILD=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc" + "CXX_FOR_BUILD=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++" + "GLIB_COMPILE_RESOURCES=${lib.getDev buildPackages.glib}/bin/glib-compile-resources" + "PKG_CONFIG_VAPIGEN_VAPIGEN=${lib.getBin buildPackages.vala}/bin/vapigen" + "--disable-memconf" + "--disable-gtk2" + "--with-python=${python3BuildEnv.interpreter}" + (lib.enableFeature (!libOnly && dconf != null) "dconf") + (lib.enableFeature (!libOnly && libnotify != null) "libnotify") + (lib.enableFeature withWayland "wayland") + (lib.enableFeature enableUI "ui") + (lib.enableFeature (!libOnly) "gtk3") + (lib.enableFeature (!libOnly) "gtk4") + (lib.enableFeature (!libOnly) "xim") + (lib.enableFeature (!libOnly) "appindicator") + (lib.enableFeature (!libOnly) "tests") + (lib.enableFeature (!libOnly) "install-tests") + (lib.enableFeature (!libOnly) "emoji-dict") + (lib.enableFeature (!libOnly) "unicode-dict") + ] + ++ lib.optionals (!libOnly) [ + "--with-unicode-emoji-dir=${unicode-emoji}/share/unicode/emoji" + "--with-emoji-annotation-dir=${cldr-annotations}/share/unicode/cldr/common/annotations" + "--with-ucd-dir=${unicode-character-database}/share/unicode" + ]; - makeFlags = [ + makeFlags = lib.optionals (!libOnly) [ "test_execsdir=${placeholder "installedTests"}/libexec/installed-tests/ibus" "test_sourcesdir=${placeholder "installedTests"}/share/installed-tests/ibus" ]; @@ -146,11 +162,14 @@ stdenv.mkDerivation rec { makeWrapper pkg-config python3BuildEnv - vala - wrapGAppsHook3 dbus-launch + glib # required to satisfy AM_PATH_GLIB_2_0 + vala gobject-introspection ] + ++ lib.optionals (!libOnly) [ + wrapGAppsHook3 + ] ++ lib.optionals withWayland [ wayland-scanner ]; @@ -164,14 +183,17 @@ stdenv.mkDerivation rec { dbus systemd dconf - gdk-pixbuf python3.pkgs.pygobject3 # for pygobject overrides - gtk3 - gtk4 isocodes json-glib - libnotify + libX11 + ] + ++ lib.optionals (!libOnly) [ + gtk3 + gtk4 + gdk-pixbuf libdbusmenu-gtk3 + libnotify vala # for share/vala/Makefile.vapigen (PKG_CONFIG_VAPIGEN_VAPIGEN) ] ++ lib.optionals withWayland [ @@ -181,20 +203,22 @@ stdenv.mkDerivation rec { ]; enableParallelBuilding = true; + strictDeps = true; doCheck = false; # requires X11 daemon - doInstallCheck = true; - installCheckPhase = '' - $out/bin/ibus version - ''; - postInstall = '' + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "version"; + versionCheckProgram = "${placeholder "out"}/bin/ibus"; + + postInstall = lib.optionalString (!libOnly) '' # It has some hardcoded FHS paths and also we do not use it # since we set up the environment in NixOS tests anyway. moveToOutput "bin/ibus-desktop-testing-runner" "$installedTests" ''; - postFixup = '' + postFixup = lib.optionalString (!libOnly) '' # set necessary environment also for tests for f in $installedTests/libexec/installed-tests/ibus/*; do wrapGApp $f @@ -202,16 +226,18 @@ stdenv.mkDerivation rec { ''; passthru = { - tests = { + tests = lib.optionalAttrs (!libOnly) { installed-tests = nixosTests.installed-tests.ibus; }; + updateScript = nix-update-script { }; }; - meta = with lib; { + meta = { + changelog = "https://github.com/ibus/ibus/releases/tag/${finalAttrs.src.tag}"; homepage = "https://github.com/ibus/ibus"; description = "Intelligent Input Bus, input method framework"; - license = licenses.lgpl21Plus; - platforms = platforms.linux; - maintainers = with maintainers; [ ttuegel ]; + license = lib.licenses.lgpl21Plus; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ ttuegel ]; }; -} +})