fix build on the latest nixos-unstable

This commit is contained in:
Chuang Zhu 2024-05-06 10:37:19 +08:00
parent fce9ad2667
commit e018d836f3
11 changed files with 651 additions and 3 deletions

20
gnome-shell/COPYING Normal file
View file

@ -0,0 +1,20 @@
Copyright (c) 2003-2024 Eelco Dolstra and the Nixpkgs/NixOS contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1
gnome-shell/README Normal file
View file

@ -0,0 +1 @@
Copied from Nixpkgs @ 63c3a29ca82437c87573e4c6919b09a24ea61b0f

236
gnome-shell/default.nix Normal file
View file

@ -0,0 +1,236 @@
{ fetchurl
, fetchpatch
, substituteAll
, lib, stdenv
, meson
, ninja
, pkg-config
, gnome
, json-glib
, gettext
, libsecret
, python3
, polkit
, networkmanager
, gtk-doc
, docbook-xsl-nons
, at-spi2-core
, libstartup_notification
, unzip
, shared-mime-info
, libgweather
, libjxl
, librsvg
, webp-pixbuf-loader
, geoclue2
, perl
, docbook_xml_dtd_45
, desktop-file-utils
, libpulseaudio
, libical
, gobject-introspection
, wrapGAppsHook4
, libxslt
, gcr_4
, accountsservice
, gdk-pixbuf
, gdm
, upower
, ibus
, libnma-gtk4
, gnome-desktop
, gsettings-desktop-schemas
, gnome-keyring
, glib
, gjs
, mutter
, evolution-data-server-gtk4
, gtk3
, gtk4
, libadwaita
, sassc
, systemd
, pipewire
, gst_all_1
, adwaita-icon-theme
, gnome-bluetooth
, gnome-clocks
, gnome-settings-daemon
, gnome-autoar
, gnome-tecla
, asciidoc
, bash-completion
, mesa
}:
let
pythonEnv = python3.withPackages (ps: with ps; [ pygobject3 ]);
in
stdenv.mkDerivation (finalAttrs: {
pname = "gnome-shell";
version = "45.5";
outputs = [ "out" "devdoc" ];
src = fetchurl {
url = "mirror://gnome/sources/gnome-shell/${lib.versions.major finalAttrs.version}/gnome-shell-${finalAttrs.version}.tar.xz";
sha256 = "sha256-vVw9PQKNRyM+QgUiPwrAKsmpc7aZvCd0OQlNQaeNarA=";
};
patches = [
# Hardcode paths to various dependencies so that they can be found at runtime.
(substituteAll {
src = ./fix-paths.patch;
glib_compile_schemas = "${glib.dev}/bin/glib-compile-schemas";
gsettings = "${glib.bin}/bin/gsettings";
tecla = "${lib.getBin gnome-tecla}/bin/tecla";
unzip = "${lib.getBin unzip}/bin/unzip";
})
# Use absolute path for libshew installation to make our patched gobject-introspection
# aware of the location to hardcode in the generated GIR file.
./shew-gir-path.patch
# Make D-Bus services wrappable.
./wrap-services.patch
# Fix greeter logo being too big.
# https://gitlab.gnome.org/GNOME/gnome-shell/issues/2591
# Reverts https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1101
./greeter-logo-size.patch
# Work around failing fingerprint auth
(fetchpatch {
url = "https://src.fedoraproject.org/rpms/gnome-shell/raw/9a647c460b651aaec0b8a21f046cc289c1999416/f/0001-gdm-Work-around-failing-fingerprint-auth.patch";
sha256 = "pFvZli3TilUt6YwdZztpB8Xq7O60XfuWUuPMMVSpqLw=";
})
];
nativeBuildInputs = [
meson
ninja
pkg-config
gettext
docbook-xsl-nons
docbook_xml_dtd_45
gtk-doc
perl
wrapGAppsHook4
sassc
desktop-file-utils
libxslt.bin
asciidoc
gobject-introspection
];
buildInputs = [
systemd
gsettings-desktop-schemas
gnome-keyring
glib
gcr_4
accountsservice
libsecret
polkit
gdk-pixbuf
librsvg
networkmanager
libstartup_notification
gjs
mutter
libpulseaudio
evolution-data-server-gtk4
libical
gtk3
gtk4
libadwaita
gdm
geoclue2
adwaita-icon-theme
gnome-bluetooth
gnome-clocks # schemas needed
at-spi2-core
upower
ibus
gnome-desktop
gnome-settings-daemon
mesa
# recording
pipewire
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
# not declared at build time, but typelib is needed at runtime
libgweather
libnma-gtk4
# for gnome-extension tool
bash-completion
gnome-autoar
json-glib
# for tools
pythonEnv
];
mesonFlags = [
"-Dgtk_doc=true"
"-Dtests=false"
];
postPatch = ''
patchShebangs src/data-to-c.pl
# We can generate it ourselves.
rm -f man/gnome-shell.1
rm data/theme/gnome-shell-{light,dark}.css
'';
postInstall = ''
# Pull in WebP and JXL support for gnome-backgrounds.
# In postInstall to run before gappsWrapperArgsHook.
export GDK_PIXBUF_MODULE_FILE="${gnome._gdkPixbufCacheBuilder_DO_NOT_USE {
extraLoaders = [
libjxl
librsvg
webp-pixbuf-loader
];
}}"
'';
preFixup = ''
gappsWrapperArgs+=(
# Until glibs xdgmime is patched
# Fixes “Failed to load resource:///org/gnome/shell/theme/noise-texture.png: Unrecognized image file format”
--prefix XDG_DATA_DIRS : "${shared-mime-info}/share"
)
'';
postFixup = ''
# The services need typelibs.
for svc in org.gnome.ScreenSaver org.gnome.Shell.Extensions org.gnome.Shell.Notifications org.gnome.Shell.Screencast; do
wrapGApp $out/share/gnome-shell/$svc
done
'';
separateDebugInfo = true;
passthru = {
mozillaPlugin = "/lib/mozilla/plugins";
updateScript = gnome.updateScript {
packageName = "gnome-shell";
attrPath = "gnome.gnome-shell";
};
};
meta = with lib; {
description = "Core user interface for the GNOME 3 desktop";
homepage = "https://gitlab.gnome.org/GNOME/gnome-shell";
license = licenses.gpl2Plus;
maintainers = teams.gnome.members;
platforms = platforms.linux;
};
})

View file

@ -0,0 +1,71 @@
diff --git a/data/org.gnome.Shell-disable-extensions.service b/data/org.gnome.Shell-disable-extensions.service
index de91167c5..1c9965678 100644
--- a/data/org.gnome.Shell-disable-extensions.service
+++ b/data/org.gnome.Shell-disable-extensions.service
@@ -11,5 +11,5 @@ ConditionPathExists=%t/gnome-shell-disable-extensions
[Service]
Type=simple
# Disable extensions
-ExecStart=gsettings set org.gnome.shell disable-user-extensions true
+ExecStart=@gsettings@ set org.gnome.shell disable-user-extensions true
Restart=no
diff --git a/js/ui/extensionDownloader.js b/js/ui/extensionDownloader.js
index 197cc1c1c..dd74aa167 100644
--- a/js/ui/extensionDownloader.js
+++ b/js/ui/extensionDownloader.js
@@ -110,7 +110,7 @@ async function extractExtensionArchive(bytes, dir) {
stream.close_async(GLib.PRIORITY_DEFAULT, null);
const unzip = Gio.Subprocess.new(
- ['unzip', '-uod', dir.get_path(), '--', file.get_path()],
+ ['@unzip@', '-uod', dir.get_path(), '--', file.get_path()],
Gio.SubprocessFlags.NONE);
await unzip.wait_check_async(null);
@@ -132,7 +132,7 @@ async function extractExtensionArchive(bytes, dir) {
}
const compileSchema = Gio.Subprocess.new(
- ['glib-compile-schemas', '--strict', schemasPath.get_path()],
+ ['@glib_compile_schemas@', '--strict', schemasPath.get_path()],
Gio.SubprocessFlags.NONE);
try {
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index fff4e73c2..92859b099 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -1092,6 +1092,6 @@ class InputSourceIndicator extends PanelMenu.Button {
if (xkbVariant.length > 0)
description = `${description}\t${xkbVariant}`;
- Util.spawn(['tecla', description]);
+ Util.spawn(['@tecla@', description]);
}
});
diff --git a/subprojects/extensions-tool/src/command-install.c b/subprojects/extensions-tool/src/command-install.c
index 11fb4b6b7..e00e4807b 100644
--- a/subprojects/extensions-tool/src/command-install.c
+++ b/subprojects/extensions-tool/src/command-install.c
@@ -158,7 +158,7 @@ install_extension (const char *bundle,
schemapath = g_file_get_path (schemadir);
proc = g_subprocess_new (G_SUBPROCESS_FLAGS_STDERR_SILENCE, &error,
- "glib-compile-schemas", "--strict", schemapath,
+ "@glib_compile_schemas@", "--strict", schemapath,
NULL);
if (!g_subprocess_wait_check (proc, NULL, &error))
diff --git a/subprojects/extensions-tool/src/command-pack.c b/subprojects/extensions-tool/src/command-pack.c
index f2cfcd51a..2a9a7efdf 100644
--- a/subprojects/extensions-tool/src/command-pack.c
+++ b/subprojects/extensions-tool/src/command-pack.c
@@ -168,7 +168,7 @@ extension_pack_add_schemas (ExtensionPack *pack,
#else
dstpath = g_file_get_path (dstdir);
proc = g_subprocess_new (G_SUBPROCESS_FLAGS_STDERR_SILENCE, error,
- "glib-compile-schemas", "--strict", dstpath, NULL);
+ "@glib_compile_schemas@", "--strict", dstpath, NULL);
if (!g_subprocess_wait_check (proc, NULL, error))
return FALSE;

View file

@ -0,0 +1,21 @@
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index a3e4372b4..36f6c1f47 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -43,6 +43,7 @@ import * as UserWidget from '../ui/userWidget.js';
const _FADE_ANIMATION_TIME = 250;
const _SCROLL_ANIMATION_TIME = 500;
const _TIMED_LOGIN_IDLE_THRESHOLD = 5.0;
+const _LOGO_ICON_HEIGHT = 48;
export const UserListItem = GObject.registerClass({
Signals: {'activate': {}},
@@ -839,7 +840,7 @@ export const LoginDialog = GObject.registerClass({
const scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
const texture = this._textureCache.load_file_async(
this._logoFile,
- -1, -1,
+ -1, _LOGO_ICON_HEIGHT,
scaleFactor, resourceScale);
this._logoBin.add_child(texture);
}

View file

@ -0,0 +1,11 @@
--- a/subprojects/shew/src/meson.build
+++ b/subprojects/shew/src/meson.build
@@ -13,7 +13,7 @@ shew_sources = [
libshew = library(full_name,
sources: shew_sources,
dependencies: [gtk_dep, x11_dep],
- install_dir: pkglibdir,
+ install_dir: get_option('prefix') / pkglibdir,
install: true,
)

View file

@ -0,0 +1,57 @@
diff --git a/js/dbusServices/dbus-service.in b/js/dbusServices/dbus-service.in
old mode 100644
new mode 100755
index 5c698f58a..1ed61a7e3
--- a/js/dbusServices/dbus-service.in
+++ b/js/dbusServices/dbus-service.in
@@ -1,3 +1,9 @@
+#!@gjs@ -m
+
+// gjs determines the package name from argv[0], which is .*-wrapped
+// so we need to override it to the original one.
+imports.package._findEffectiveEntryPointName = () => '@service@'
+
import {programInvocationName, programArgs} from 'system';
imports.package.init({
diff --git a/js/dbusServices/dbus-service.service.in b/js/dbusServices/dbus-service.service.in
index 3b0d09abe..4fd4bb66d 100644
--- a/js/dbusServices/dbus-service.service.in
+++ b/js/dbusServices/dbus-service.service.in
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=@service@
-Exec=@gjs@ -m @pkgdatadir@/@service@
+Exec=@pkgdatadir@/@service@
diff --git a/js/dbusServices/meson.build b/js/dbusServices/meson.build
index eb941ed90..552051e5a 100644
--- a/js/dbusServices/meson.build
+++ b/js/dbusServices/meson.build
@@ -2,6 +2,7 @@ launcherconf = configuration_data()
launcherconf.set('PACKAGE_NAME', meson.project_name())
launcherconf.set('prefix', prefix)
launcherconf.set('libdir', libdir)
+launcherconf.set('gjs', gjs.full_path())
dbus_services = {
'org.gnome.Shell.Extensions': 'extensions',
@@ -18,16 +19,17 @@ endif
config_dir = '@0@/..'.format(meson.current_build_dir())
foreach service, dir : dbus_services
+ svc_launcherconf = launcherconf
+ svc_launcherconf.set('service', service)
configure_file(
input: 'dbus-service.in',
output: service,
- configuration: launcherconf,
+ configuration: svc_launcherconf,
install_dir: pkgdatadir,
)
serviceconf = configuration_data()
serviceconf.set('service', service)
- serviceconf.set('gjs', gjs.full_path())
serviceconf.set('pkgdatadir', pkgdatadir)
configure_file(

20
mutter/COPYING Normal file
View file

@ -0,0 +1,20 @@
Copyright (c) 2003-2024 Eelco Dolstra and the Nixpkgs/NixOS contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1
mutter/README Normal file
View file

@ -0,0 +1 @@
Copied from Nixpkgs @ 63c3a29ca82437c87573e4c6919b09a24ea61b0f

210
mutter/default.nix Normal file
View file

@ -0,0 +1,210 @@
{ fetchurl
, runCommand
, lib
, stdenv
, pkg-config
, gnome
, gettext
, gobject-introspection
, cairo
, colord
, lcms2
, pango
, json-glib
, libstartup_notification
, libcanberra
, ninja
, xvfb-run
, libxcvt
, libICE
, libX11
, libXcomposite
, libXcursor
, libXdamage
, libXext
, libXfixes
, libXi
, libXtst
, libxkbfile
, xkeyboard_config
, libxkbcommon
, libXrender
, libxcb
, libXrandr
, libXinerama
, libXau
, libinput
, libdrm
, libei
, gsettings-desktop-schemas
, glib
, atk
, gtk4
, fribidi
, harfbuzz
, gnome-desktop
, pipewire
, libgudev
, libwacom
, libSM
, xwayland
, mesa
, meson
, gnome-settings-daemon
, xorgserver
, python3
, wrapGAppsHook4
, gi-docgen
, sysprof
, libsysprof-capture
, desktop-file-utils
, libcap_ng
, egl-wayland
, graphene
, wayland
, wayland-protocols
}:
stdenv.mkDerivation (finalAttrs: {
pname = "mutter";
version = "45.5";
outputs = [ "out" "dev" "man" "devdoc" ];
src = fetchurl {
url = "mirror://gnome/sources/mutter/${lib.versions.major finalAttrs.version}/mutter-${finalAttrs.version}.tar.xz";
sha256 = "sha256-UcMyS4qXX5luWsaTqzhWPElubxQubNM1e0lQ0lAzSHQ=";
};
mesonFlags = [
"-Degl_device=true"
"-Dinstalled_tests=false" # TODO: enable these
"-Dtests=false"
"-Dwayland_eglstream=true"
"-Dprofiler=true"
"-Dxwayland_path=${lib.getExe xwayland}"
# This should be auto detected, but it looks like it manages a false
# positive.
"-Dxwayland_initfd=disabled"
"-Ddocs=true"
];
propagatedBuildInputs = [
# required for pkg-config to detect mutter-clutter
json-glib
libcap_ng
graphene
];
nativeBuildInputs = [
desktop-file-utils
gettext
libxcvt
mesa # needed for gbm
meson
ninja
xvfb-run
pkg-config
python3
wrapGAppsHook4
gi-docgen
xorgserver
gobject-introspection
];
buildInputs = [
cairo
egl-wayland
glib
gnome-desktop
gnome-settings-daemon
gsettings-desktop-schemas
atk
fribidi
harfbuzz
libcanberra
libdrm
libei
libgudev
libinput
libstartup_notification
libwacom
libSM
colord
lcms2
pango
pipewire
sysprof # for D-Bus interfaces
libsysprof-capture
xwayland
wayland
wayland-protocols
] ++ [
# X11 client
gtk4
libICE
libX11
libXcomposite
libXcursor
libXdamage
libXext
libXfixes
libXi
libXtst
libxkbfile
xkeyboard_config
libxkbcommon
libXrender
libxcb
libXrandr
libXinerama
libXau
];
postPatch = ''
patchShebangs src/backends/native/gen-default-modes.py
'';
postInstall = ''
${glib.dev}/bin/glib-compile-schemas "$out/share/glib-2.0/schemas"
'';
postFixup = ''
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
# TODO: Move this into a directory devhelp can find.
moveToOutput "share/mutter-13/doc" "$devdoc"
'';
# Install udev files into our own tree.
PKG_CONFIG_UDEV_UDEVDIR = "${placeholder "out"}/lib/udev";
separateDebugInfo = true;
passthru = {
libdir = "${finalAttrs.finalPackage}/lib/mutter-13";
tests = {
libdirExists = runCommand "mutter-libdir-exists" {} ''
if [[ ! -d ${finalAttrs.finalPackage.libdir} ]]; then
echo "passthru.libdir should contain a directory, ${finalAttrs.finalPackage.libdir} is not one."
exit 1
fi
touch $out
'';
};
updateScript = gnome.updateScript {
packageName = "mutter";
attrPath = "gnome.mutter";
};
};
meta = with lib; {
description = "A window manager for GNOME";
mainProgram = "mutter";
homepage = "https://gitlab.gnome.org/GNOME/mutter";
license = licenses.gpl2Plus;
maintainers = teams.gnome.members;
platforms = platforms.linux;
};
})

View file

@ -1,6 +1,6 @@
self: super: {
gnome = super.gnome.overrideScope' (gself: gsuper: {
gnome-shell = gsuper.gnome-shell.overrideAttrs (old: {
gnome = super.gnome.overrideScope (gself: gsuper: {
gnome-shell = (gself.callPackage ./gnome-shell { }).overrideAttrs (old: {
version = "unstable-2023-09-08";
src = super.fetchFromGitLab {
domain = "gitlab.gnome.org";
@ -28,7 +28,7 @@ self: super: {
'';
});
mutter = gsuper.mutter.overrideAttrs (old: {
mutter = (gself.callPackage ./mutter { }).overrideAttrs (old: {
version = "unstable-2023-09-08";
src = super.fetchFromGitLab {
domain = "gitlab.gnome.org";