Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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; }
10 changes: 7 additions & 3 deletions pkgs/by-name/sd/sdl2-compat/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
libX11,
libGL,
}:

let
# tray support on sdl3 pulls in gtk3, which is quite an expensive dependency.
# sdl2 does not support the tray, so we can just disable that requirement.
sdl3' = sdl3.override { traySupport = false; };
in
stdenv.mkDerivation (finalAttrs: {
pname = "sdl2-compat";
version = "2.32.56";
Expand All @@ -35,7 +39,7 @@ stdenv.mkDerivation (finalAttrs: {
];

buildInputs = [
sdl3
sdl3'
libX11
];

Expand All @@ -53,7 +57,7 @@ stdenv.mkDerivation (finalAttrs: {

cmakeFlags = [
(lib.cmakeBool "SDL2COMPAT_TESTS" finalAttrs.finalPackage.doCheck)
(lib.cmakeFeature "CMAKE_INSTALL_RPATH" (lib.makeLibraryPath [ sdl3 ]))
(lib.cmakeFeature "CMAKE_INSTALL_RPATH" (lib.makeLibraryPath [ sdl3' ]))
];

# skip timing-based tests as those are flaky
Expand Down
71 changes: 38 additions & 33 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 Down Expand Up @@ -45,41 +45,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.20";
version = "3.2.24";

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

src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL";
tag = "release-${finalAttrs.version}";
hash = "sha256-ESYjTN2prkAeHcTYurZaWeM3RgEKtwCZrt9gSMcOAe0=";
hash = "sha256-LUkj9Rrf+zOW0IdV7aGccb/5bKh3TWf1IGtQkCDHd4k=";
};

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 @@ -92,24 +100,11 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional waylandSupport wayland-scanner;

buildInputs =
finalAttrs.dlopenBuildInputs
++ lib.optionals stdenv.hostPlatform.isDarwin [
# error: 'MTLPixelFormatASTC_4x4_LDR' is unavailable: not available on macOS
(darwinMinVersionHook "11.0")

apple-sdk_11
]
++ lib.optionals ibusSupport [
ibus
]
++ lib.optional waylandSupport zenity;

dlopenBuildInputs =
lib.optionals stdenv.hostPlatform.isLinux [
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 @@ -142,7 +137,20 @@ stdenv.mkDerivation (finalAttrs: {
vulkan-loader
]
++ lib.optional (openglSupport && !stdenv.hostPlatform.isDarwin) libGL
++ lib.optional x11Support xorg.libX11;
++ lib.optional x11Support xorg.libX11
++ lib.optionals stdenv.hostPlatform.isDarwin [
# error: 'MTLPixelFormatASTC_4x4_LDR' is unavailable: not available on macOS
(darwinMinVersionHook "11.0")

apple-sdk_11
]
++ lib.optionals ibusSupport [
# 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
];

cmakeFlags = [
(lib.cmakeBool "SDL_ALSA" alsaSupport)
Expand All @@ -155,26 +163,23 @@ 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)
(lib.cmakeBool "SDL_DEPS_SHARED" false)
];

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

# See comment below. We actually *do* need these RPATH entries
dontPatchELF = true;

env = {
# Many dependencies are not directly linked to, but dlopen()'d at runtime. Adding them to the RPATH
# helps them be found
NIX_LDFLAGS = lib.optionalString (
stdenv.hostPlatform.hasSharedLibraries && stdenv.hostPlatform.extensions.sharedLibrary == ".so"
) "-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
Expand Down
82 changes: 53 additions & 29 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 @@ -87,6 +91,8 @@ stdenv.mkDerivation rec {
outputs = [
"out"
"dev"
]
++ lib.optionals (!libOnly) [
"installedTests"
];

Expand Down Expand Up @@ -114,20 +120,28 @@ stdenv.mkDerivation rec {
"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")
"--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")
"--disable-gtk2"
"--enable-gtk4"
"--enable-install-tests"
(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-python=${python3BuildEnv.interpreter}"
"--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 @@ -143,10 +157,13 @@ stdenv.mkDerivation rec {
makeWrapper
pkg-config
python3BuildEnv
glib # required to satisfy AM_PATH_GLIB_2_0
vala
wrapGAppsHook3
dbus-launch
gobject-introspection
]
++ lib.optionals (!libOnly) [
wrapGAppsHook3
];

propagatedBuildInputs = [
Expand All @@ -157,53 +174,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 ];
};
}
})
Loading