Skip to content
1 change: 1 addition & 0 deletions pkgs/by-name/ib/ibusMinimal/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ ibus }: ibus.override { libOnly = true; }
54 changes: 43 additions & 11 deletions pkgs/by-name/sd/sdl3/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
darwinMinVersionHook,
dbus,
fetchFromGitHub,
ibus,
ibusMinimal,
installShellFiles,
libGL,
libayatana-appindicator,
Expand All @@ -33,6 +33,11 @@
wayland-scanner,
xorg,
zenity,
# for passthru.tests
SDL_compat,
sdl2-compat,
sdl3-image,
sdl3-ttf,
alsaSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
dbusSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
drmSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
Expand All @@ -45,41 +50,49 @@
config.pulseaudio or stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
libudevSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
sndioSupport ? false,
testSupport ? true,
traySupport ? true,
waylandSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
x11Support ? !stdenv.hostPlatform.isAndroid && !stdenv.hostPlatform.isWindows,
}:

assert lib.assertMsg (
waylandSupport -> openglSupport
) "SDL3 requires OpenGL support to enable Wayland";
assert lib.assertMsg (ibusSupport -> dbusSupport) "SDL3 requires dbus support to enable ibus";

stdenv.mkDerivation (finalAttrs: {
pname = "sdl3";
version = "3.2.14";
version = "3.2.16";

outputs = [
"lib"
"dev"
"out"
"installedTests"
];

src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL";
tag = "release-${finalAttrs.version}";
hash = "sha256-+CcbvF1nxxsVwuO5g50sBVGth0sr5WTFojSfT6B6bok=";
hash = "sha256-xFWE/i4l3sU1KritwbqvN67kJ3/WUfNP3iScMfQUbwA=";
};

postPatch =
# Tests timeout on Darwin
lib.optionalString testSupport ''
# `testtray` loads assets from a relative path, which we are patching to be absolute
lib.optionalString (finalAttrs.finalPackage.doCheck) ''
substituteInPlace test/CMakeLists.txt \
--replace-fail 'set(noninteractive_timeout 10)' 'set(noninteractive_timeout 30)'

substituteInPlace test/testtray.c \
--replace-warn '../test/' '${placeholder "installedTests"}/share/assets/'
''
+ lib.optionalString waylandSupport ''
substituteInPlace src/video/wayland/SDL_waylandmessagebox.c \
--replace-fail '"zenity"' '"${lib.getExe zenity}"'
substituteInPlace src/dialog/unix/SDL_zenitydialog.c \
--replace-fail '"zenity"' '"${lib.getExe zenity}"'
'';

strictDeps = true;
Expand All @@ -99,7 +112,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;

Expand All @@ -108,7 +125,7 @@ stdenv.mkDerivation (finalAttrs: {
libusb1
]
++ lib.optional (
stdenv.hostPlatform.isUnix && !stdenv.hostPlatform.isDarwin
stdenv.hostPlatform.isUnix && !stdenv.hostPlatform.isDarwin && traySupport
) libayatana-appindicator
++ lib.optional alsaSupport alsa-lib
++ lib.optional dbusSupport dbus
Expand Down Expand Up @@ -154,15 +171,17 @@ stdenv.mkDerivation (finalAttrs: {
(lib.cmakeBool "SDL_PIPEWIRE" pipewireSupport)
(lib.cmakeBool "SDL_PULSEAUDIO" pulseaudioSupport)
(lib.cmakeBool "SDL_SNDIO" sndioSupport)
(lib.cmakeBool "SDL_TEST_LIBRARY" testSupport)
(lib.cmakeBool "SDL_TEST_LIBRARY" true)
(lib.cmakeBool "SDL_TRAY_DUMMY" (!traySupport))
(lib.cmakeBool "SDL_WAYLAND" waylandSupport)
(lib.cmakeBool "SDL_WAYLAND_LIBDECOR" libdecorSupport)
(lib.cmakeBool "SDL_X11" x11Support)

(lib.cmakeBool "SDL_TESTS" finalAttrs.finalPackage.doCheck)
(lib.cmakeBool "SDL_TESTS" true)
(lib.cmakeBool "SDL_INSTALL_TESTS" true)
];

doCheck = testSupport && stdenv.buildPlatform.canExecute stdenv.hostPlatform;
doCheck = true;

# See comment below. We actually *do* need these RPATH entries
dontPatchELF = true;
Expand All @@ -175,6 +194,11 @@ stdenv.mkDerivation (finalAttrs: {
) "-rpath ${lib.makeLibraryPath (finalAttrs.dlopenBuildInputs)}";
};

postInstall = ''
moveToOutput "share/installed-tests" "$installedTests"
moveToOutput "libexec/installed-tests" "$installedTests"
'';

passthru = {
# Building this in its own derivation to make sure the rpath hack above propagate to users
debug-text-example = stdenv.mkDerivation (finalAttrs': {
Expand Down Expand Up @@ -204,7 +228,15 @@ stdenv.mkDerivation (finalAttrs: {
});

tests =
{
SDL_compat.tests
// sdl2-compat.tests
// {
inherit
SDL_compat
sdl2-compat
sdl3-image
sdl3-ttf
;
pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; };
inherit (finalAttrs.passthru) debug-text-example;
}
Expand Down
147 changes: 87 additions & 60 deletions pkgs/tools/inputmethods/ibus/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@
python3,
json-glib,
libnotify ? null,
enableUI ? true,
withWayland ? true,
enableUI ? !libOnly,
withWayland ? !libOnly,
libxkbcommon,
wayland,
buildPackages,
runtimeShell,
nixosTests,
versionCheckHook,
nix-update-script,
libX11,
libOnly ? false,
}:

let
Expand All @@ -59,15 +63,15 @@ let
'';
in

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "ibus";
version = "1.5.31";

src = fetchFromGitHub {
owner = "ibus";
repo = "ibus";
rev = version;
sha256 = "sha256-YMCtLIK/9iUdS37Oiow7WMhFFPKhomNXvzWbLzlUkdQ=";
tag = finalAttrs.version;
hash = "sha256-YMCtLIK/9iUdS37Oiow7WMhFFPKhomNXvzWbLzlUkdQ=";
};

patches = [
Expand All @@ -84,11 +88,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,
Expand All @@ -105,29 +112,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"
];
Expand All @@ -136,18 +152,22 @@ stdenv.mkDerivation rec {
pkg-config
];

nativeBuildInputs = [
autoreconfHook
gtk-doc
gettext
makeWrapper
pkg-config
python3BuildEnv
vala
wrapGAppsHook3
dbus-launch
gobject-introspection
];
nativeBuildInputs =
[
autoreconfHook
gtk-doc
gettext
makeWrapper
pkg-config
python3BuildEnv
dbus-launch
glib # required to satisfy AM_PATH_GLIB_2_0
vala
gobject-introspection
]
++ lib.optionals (!libOnly) [
wrapGAppsHook3
];

propagatedBuildInputs = [
glib
Expand All @@ -158,53 +178,60 @@ stdenv.mkDerivation rec {
dbus
systemd
dconf
gdk-pixbuf
python3.pkgs.pygobject3 # for pygobject overrides
gtk3
gtk4
isocodes
json-glib
libnotify
libdbusmenu-gtk3
libX11
vala # for share/vala/Makefile.vapigen (PKG_CONFIG_VAPIGEN_VAPIGEN)
]
++ lib.optionals (!libOnly) [
gtk3
gtk4
gdk-pixbuf
libdbusmenu-gtk3
libnotify
]
++ lib.optionals withWayland [
libxkbcommon
wayland
];

enableParallelBuilding = true;
strictDeps = true;

doCheck = false; # requires X11 daemon

doInstallCheck = true;
installCheckPhase = ''
$out/bin/ibus version
'';
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "version";
versionCheckProgram = "${placeholder "out"}/bin/ibus";

postInstall = ''
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
done
'';

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 ];
};
}
})