This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.
Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
Methodology:
- `sed` to find and replace in pkgs/*
- exclude pkgs/top-level
- nixpkgs-review on x86_64-linux and aarch64-linux
- revert everything that doesn't build
- revert everything that doesn't launch [x86_64-linux]
- check upstream source whether the change makes sense [free software only]
Before:
$ ./result/bin/ApacheDirectoryStudio
SWT WebKitGDBus: error creating DBus server Error binding to address (GUnixSocketAddress): No such file or directory
SWT WebKit: error initializing DBus server, dBusServer == 0
(Apache Directory Studio:1218305): GLib-GIO-CRITICAL **: 15:17:33.727: g_dbus_server_get_client_address: assertion 'G_IS_DBUS_SERVER (server)' failed
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fe033c36f48, pid=1218305, tid=1218306
#
# JRE version: OpenJDK Runtime Environment (21.0.5+1) (build 21.0.5+1-nixos)
# Java VM: OpenJDK 64-Bit Server VM (21.0.5+1-nixos, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C [libswt-gtk-4940r23.so+0x36f48] Java_org_eclipse_swt_internal_C_strlen+0xf
#
# Core dump will be written. Default location: Core dumps may be processed with "/nix/store/jz45idky1nhvf3c9gz20ds2py19kdvgf-systemd/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/bf/nixpkgs/core.1218305)
#
# An error report file with more information is saved as:
# /home/bf/nixpkgs/hs_err_pid1218305.log
[2.073s][warning][os] Loading hsdis library failed
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
After:
$ ./result/bin/ApacheDirectoryStudio
** (WebKitWebProcess:1221467): ERROR **: 15:18:35.064: Failed to create server: Error binding to address (GUnixSocketAddress): No such file or directory
...but the GUI opens and the application seems fine.
Tested on NixOS with GNOME (Wayland).
Fixes https://github.com/nixos/nixpkgs/issues/333377.
Fix loading the SWT library by adding glib to the runtime library
search path.
Before:
$ ./result/bin/ApacheDirectoryStudio
ApacheDirectoryStudio:
An error has occurred. See the log file
/home/bf/.eclipse/1900982865_linux_gtk_x86_64/configuration/1740319909191.log.
where the log file contains
!SESSION 2025-02-23 15:11:49.037 -----------------------------------------------
eclipse.buildId=unknown
java.version=21.0.5
java.vendor=N/A
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: /studio-rcp/resources/icons/linux/studio.xpm
Command-line arguments: -os linux -ws gtk -arch x86_64 /studio-rcp/resources/icons/linux/studio.xpm
!ENTRY org.eclipse.osgi 4 0 2025-02-23 15:11:49.771
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-pi4-gtk-4940r23 in java.library.path: /nix/store/l1rnlmalihpfg7aj9lxh4mv5ffnqx6qi-webkitgtk-2.46.6+abi=4.0/lib:/etc/sane-libs:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
no swt-pi4-gtk in java.library.path: /nix/store/l1rnlmalihpfg7aj9lxh4mv5ffnqx6qi-webkitgtk-2.46.6+abi=4.0/lib:/etc/sane-libs:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
Can't load library: /home/bf/.swt/lib/linux/x86_64/libswt-pi4-gtk-4940r23.so
Can't load library: /home/bf/.swt/lib/linux/x86_64/libswt-pi4-gtk.so
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:338)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:257)
at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:96)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:209)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:155)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:163)
at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:726)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:168)
at org.apache.directory.studio.Application.start(Application.java:47)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
at org.eclipse.equinox.launcher.Main.main(Main.java:1434)
It's worth noting, that when the program fails to load
libswt-pi4-gtk-*.so, it has libswt-pi3-gtk-*.so available (it is put
there by the application):
$ tree ~/.swt
/home/bf/.swt
└── lib
└── linux
└── x86_64
└── libswt-pi3-gtk-4940r23.so
After:
(a different runtime error, possibly only seen on some DEs -- will be
fixed in next commit)
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19.tar.gz \
--argstr baseRev b32a094368
result/bin/apply-formatting $NIXPKGS_PATH
We are migrating packages that meet below requirements:
1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration
The tool is here: https://github.com/Aleksanaa/by-name-migrate.