diff --git a/nixpkgs/COPYING b/nixpkgs/COPYING new file mode 100644 index 0000000..40eae09 --- /dev/null +++ b/nixpkgs/COPYING @@ -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. diff --git a/nixpkgs/README b/nixpkgs/README new file mode 100644 index 0000000..ff92792 --- /dev/null +++ b/nixpkgs/README @@ -0,0 +1 @@ +Copied from https://github.com/NixOS/nixpkgs/tree/8f55b011e05eee7343860789e904647fb73991aa/pkgs/by-name/ diff --git a/nixpkgs/gn/gnome-shell/fix-paths.patch b/nixpkgs/gn/gnome-shell/fix-paths.patch new file mode 100644 index 0000000..a87f512 --- /dev/null +++ b/nixpkgs/gn/gnome-shell/fix-paths.patch @@ -0,0 +1,58 @@ +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/nixpkgs/gn/gnome-shell/greeter-logo-size.patch b/nixpkgs/gn/gnome-shell/greeter-logo-size.patch new file mode 100644 index 0000000..93965a4 --- /dev/null +++ b/nixpkgs/gn/gnome-shell/greeter-logo-size.patch @@ -0,0 +1,21 @@ +diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js +index 28db1a9de..805b686bf 100644 +--- a/js/gdm/loginDialog.js ++++ b/js/gdm/loginDialog.js +@@ -46,6 +46,7 @@ const _FADE_ANIMATION_TIME = 250; + const _SCROLL_ANIMATION_TIME = 500; + const _TIMED_LOGIN_IDLE_THRESHOLD = 5.0; + const _CONFLICTING_SESSION_DIALOG_TIMEOUT = 60; ++const _LOGO_ICON_HEIGHT = 48; + + export const UserListItem = GObject.registerClass({ + Signals: {'activate': {}}, +@@ -908,7 +909,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); + } diff --git a/nixpkgs/gn/gnome-shell/package.nix b/nixpkgs/gn/gnome-shell/package.nix new file mode 100644 index 0000000..c2f2a1b --- /dev/null +++ b/nixpkgs/gn/gnome-shell/package.nix @@ -0,0 +1,246 @@ +{ + fetchurl, + fetchpatch, + substituteAll, + lib, + stdenv, + meson, + ninja, + pkg-config, + gnome, + json-glib, + gettext, + libsecret, + python3, + polkit, + networkmanager, + gi-docgen, + at-spi2-core, + unzip, + shared-mime-info, + libgweather, + libjxl, + librsvg, + webp-pixbuf-loader, + geoclue2, + perl, + 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, + 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, + libGL, + libXi, + libX11, + libxml2, +}: + +let + pythonEnv = python3.withPackages (ps: with ps; [ pygobject3 ]); +in +stdenv.mkDerivation (finalAttrs: { + pname = "gnome-shell"; + version = "46.4"; + + outputs = [ + "out" + "devdoc" + ]; + + src = fetchurl { + url = "mirror://gnome/sources/gnome-shell/${lib.versions.major finalAttrs.version}/gnome-shell-${finalAttrs.version}.tar.xz"; + hash = "sha256-GIRo/nLpCsSyNOnU0HB9YH/q85oT0lvTqj63XlWj4FI="; + }; + + 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/dcd112d9708954187e7490564c2229d82ba5326f/f/0001-gdm-Work-around-failing-fingerprint-auth.patch"; + hash = "sha256-mgXty5HhiwUO1UV3/eDgWtauQKM0cRFQ0U7uocST25s="; + }) + ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + gettext + gi-docgen + 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 + gjs + mutter + libpulseaudio + evolution-data-server-gtk4 + libical + gtk4 + libadwaita + gdm + geoclue2 + adwaita-icon-theme + gnome-bluetooth + gnome-clocks # schemas needed + at-spi2-core + upower + ibus + gnome-desktop + gnome-settings-daemon + mesa + libGL # for egl, required by mutter-clutter + libXi # required by libmutter + libX11 + libxml2 + + # 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 glib’s 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 + + # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. + moveToOutput "share/doc" "$devdoc" + ''; + + separateDebugInfo = true; + + passthru = { + mozillaPlugin = "/lib/mozilla/plugins"; + updateScript = gnome.updateScript { + packageName = "gnome-shell"; + }; + }; + + meta = with lib; { + description = "Core user interface for the GNOME 3 desktop"; + homepage = "https://gitlab.gnome.org/GNOME/gnome-shell"; + changelog = "https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/${finalAttrs.version}/NEWS?ref_type=tags"; + license = licenses.gpl2Plus; + maintainers = teams.gnome.members; + platforms = platforms.linux; + }; + +}) diff --git a/nixpkgs/gn/gnome-shell/shew-gir-path.patch b/nixpkgs/gn/gnome-shell/shew-gir-path.patch new file mode 100644 index 0000000..6d88872 --- /dev/null +++ b/nixpkgs/gn/gnome-shell/shew-gir-path.patch @@ -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, + ) + diff --git a/nixpkgs/gn/gnome-shell/wrap-services.patch b/nixpkgs/gn/gnome-shell/wrap-services.patch new file mode 100644 index 0000000..eca485c --- /dev/null +++ b/nixpkgs/gn/gnome-shell/wrap-services.patch @@ -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( diff --git a/nixpkgs/mu/mutter/package.nix b/nixpkgs/mu/mutter/package.nix new file mode 100644 index 0000000..720c785 --- /dev/null +++ b/nixpkgs/mu/mutter/package.nix @@ -0,0 +1,215 @@ +{ + fetchurl, + runCommand, + lib, + stdenv, + pkg-config, + gnome, + gettext, + gobject-introspection, + cairo, + colord, + lcms2, + pango, + 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, + libdisplay-info, + gsettings-desktop-schemas, + glib, + atk, + gtk4, + fribidi, + harfbuzz, + gnome-desktop, + pipewire, + libgudev, + libwacom, + libSM, + xwayland, + mesa, + meson, + gnome-settings-daemon, + xorgserver, + python3, + wayland-scanner, + wrapGAppsHook4, + gi-docgen, + sysprof, + libsysprof-capture, + desktop-file-utils, + egl-wayland, + graphene, + wayland, + wayland-protocols, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "mutter"; + version = "46.4"; + + outputs = [ + "out" + "dev" + "man" + "devdoc" + ]; + + src = fetchurl { + url = "mirror://gnome/sources/mutter/${lib.versions.major finalAttrs.version}/mutter-${finalAttrs.version}.tar.xz"; + hash = "sha256-YRvZz5gq21ZZfOKzQiQnL9phm7O7kSpoTXXG8sN1AuQ="; + }; + + 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-mtk + graphene + ]; + + nativeBuildInputs = [ + desktop-file-utils + gettext + libxcvt + mesa # needed for gbm + meson + ninja + xvfb-run + pkg-config + python3 + wayland-scanner + 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 + libdisplay-info + 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-14/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-14"; + + 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"; + }; + }; + + meta = with lib; { + description = "Window manager for GNOME"; + mainProgram = "mutter"; + homepage = "https://gitlab.gnome.org/GNOME/mutter"; + changelog = "https://gitlab.gnome.org/GNOME/mutter/-/blob/${finalAttrs.version}/NEWS?ref_type=tags"; + license = licenses.gpl2Plus; + maintainers = teams.gnome.members; + platforms = platforms.linux; + }; +}) diff --git a/overlay.nix b/overlay.nix index fe2f1e3..692a37d 100644 --- a/overlay.nix +++ b/overlay.nix @@ -11,7 +11,7 @@ let in { - gnome-shell = super.gnome-shell.overrideAttrs (old: rec { + gnome-shell = (super.callPackage ./nixpkgs/gn/gnome-shell/package.nix { }).overrideAttrs (old: rec { version = "46-mobile.1"; src = super.fetchFromGitLab { domain = "gitlab.gnome.org"; @@ -30,7 +30,7 @@ in ''; }); - mutter = super.mutter.overrideAttrs (old: rec { + mutter = (super.callPackage ./nixpkgs/mu/mutter/package.nix { }).overrideAttrs (old: rec { version = "46-mobile.1"; src = super.fetchFromGitLab { domain = "gitlab.gnome.org";