From 8cc056c0b08f0e897febcdd61d59f06ccc0dbc58 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 16 Feb 2025 18:13:53 +0100 Subject: [PATCH 1/3] ostree: backport static fix for pkg-config file --- pkgs/by-name/os/ostree/package.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/os/ostree/package.nix b/pkgs/by-name/os/ostree/package.nix index b6d1f6edaa37..f07e757d659d 100644 --- a/pkgs/by-name/os/ostree/package.nix +++ b/pkgs/by-name/os/ostree/package.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchurl +, fetchpatch , pkg-config , gtk-doc , nixosTests @@ -59,6 +60,13 @@ in stdenv.mkDerivation rec { sha256 = "sha256-VOM4fe4f8WAxoGeayitg2pCrf0omwhGCIzPH8jAAq+4="; }; + patches = [ + (fetchpatch { + name = "static-pkg-config.patch"; + url = "https://github.com/ostreedev/ostree/pull/3382.patch"; + hash = "sha256-VCQLq4OqmojtB7WFHNNV82asgXPGq5tKoJun66eUntY="; + }) + ]; nativeBuildInputs = [ autoconf From 6416fc5865df4fc42534c46a8519955f296aa082 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 16 Feb 2025 18:14:29 +0100 Subject: [PATCH 2/3] malcontent: tighten platforms malcontent is tied to polkit, so it'll always only work on a subset of the platforms that polkit does. Being exact about this in the metadata means that we can conditionally enable malcontent in dependent packages based on whether polkit is available. --- pkgs/development/libraries/malcontent/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/malcontent/default.nix b/pkgs/development/libraries/malcontent/default.nix index faa48dda2739..3f5270ce75a4 100644 --- a/pkgs/development/libraries/malcontent/default.nix +++ b/pkgs/development/libraries/malcontent/default.nix @@ -101,6 +101,6 @@ stdenv.mkDerivation rec { homepage = "https://gitlab.freedesktop.org/pwithnall/malcontent"; license = licenses.lgpl21Plus; maintainers = with maintainers; [ jtojnar ]; - platforms = platforms.unix; + inherit (polkit.meta) platforms badPlatforms; }; } From 750c376688ff0060e8c5daf2d577f7c8eeb4c44b Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 16 Feb 2025 18:18:07 +0100 Subject: [PATCH 3/3] flatpak: fix static --- pkgs/by-name/fl/flatpak/package.nix | 150 +++++++++++++++++----------- 1 file changed, 91 insertions(+), 59 deletions(-) diff --git a/pkgs/by-name/fl/flatpak/package.nix b/pkgs/by-name/fl/flatpak/package.nix index 61f16695711d..42620c2c4b7d 100644 --- a/pkgs/by-name/fl/flatpak/package.nix +++ b/pkgs/by-name/fl/flatpak/package.nix @@ -5,6 +5,7 @@ appstream, bison, bubblewrap, + buildPackages, bzip2, coreutils, curl, @@ -13,6 +14,7 @@ docbook-xsl-nons, docbook_xml_dtd_45, fetchurl, + fetchpatch, fuse3, gdk-pixbuf, gettext, @@ -58,11 +60,23 @@ xorg, zstd, withAutoSideloading ? false, + withDconf ? lib.meta.availableOn stdenv.hostPlatform dconf, withDocbookDocs ? true, - withGtkDoc ? withDocbookDocs && stdenv.buildPlatform.canExecute stdenv.hostPlatform, + withGlibNetworking ? lib.meta.availableOn stdenv.hostPlatform glib-networking, + withGtkDoc ? + withDocbookDocs + && stdenv.buildPlatform.canExecute stdenv.hostPlatform + # https://github.com/mesonbuild/meson/pull/14257 + && !stdenv.hostPlatform.isStatic, + withIntrospection ? + lib.meta.availableOn stdenv.hostPlatform gobject-introspection + && stdenv.hostPlatform.emulatorAvailable buildPackages, + withMalcontent ? lib.meta.availableOn stdenv.hostPlatform malcontent, withMan ? withDocbookDocs, + withP11Kit ? lib.meta.availableOn stdenv.hostPlatform p11-kit, + withPolkit ? lib.meta.availableOn stdenv.hostPlatform polkit, withSELinuxModule ? false, - withSystemd ? true, + withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, }: stdenv.mkDerivation (finalAttrs: { @@ -89,43 +103,53 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-ywrFZa3LYhJ8bRHtUO5wRNaoNvppw1Sy9LZAoiv6Syo="; }; - patches = [ - # Hardcode paths used by tests and change test runtime generation to use files from Nix store. - # https://github.com/flatpak/flatpak/issues/1460 - (replaceVars ./fix-test-paths.patch { - inherit - coreutils - gettext - gtk3 - socat - ; - dfu = desktop-file-utils; - hicolorIconTheme = hicolor-icon-theme; - smi = shared-mime-info; - }) + patches = + [ + # Use flatpak from PATH to avoid references to `/nix/store` in `/desktop` files. + # Applications containing `DBusActivatable` entries should be able to find the flatpak binary. + # https://github.com/NixOS/nixpkgs/issues/138956 + ./binary-path.patch - # Hardcode paths used by Flatpak itself. - (replaceVars ./fix-paths.patch { - p11kit = lib.getExe p11-kit; - }) + # Try mounting fonts and icons from NixOS locations if FHS locations don't exist. + # https://github.com/NixOS/nixpkgs/issues/119433 + ./fix-fonts-icons.patch - # Use flatpak from PATH to avoid references to `/nix/store` in `/desktop` files. - # Applications containing `DBusActivatable` entries should be able to find the flatpak binary. - # https://github.com/NixOS/nixpkgs/issues/138956 - ./binary-path.patch + # Nix environment hacks should not leak into the apps. + # https://github.com/NixOS/nixpkgs/issues/53441 + ./unset-env-vars.patch - # Try mounting fonts and icons from NixOS locations if FHS locations don't exist. - # https://github.com/NixOS/nixpkgs/issues/119433 - ./fix-fonts-icons.patch + # The icon validator needs to access the gdk-pixbuf loaders in the Nix store + # and cannot bind FHS paths since those are not available on NixOS. + finalAttrs.passthru.icon-validator-patch - # Nix environment hacks should not leak into the apps. - # https://github.com/NixOS/nixpkgs/issues/53441 - ./unset-env-vars.patch - - # The icon validator needs to access the gdk-pixbuf loaders in the Nix store - # and cannot bind FHS paths since those are not available on NixOS. - finalAttrs.passthru.icon-validator-patch - ]; + (fetchpatch { + name = "static.patch"; + url = "https://github.com/flatpak/flatpak/commit/114c22e814fc28243585915321b8e943471c377f.patch"; + hash = "sha256-3JLzG74myBTssXQau0Ei5rpthy93Va7xb2MHRnJ3kaI="; + }) + ] + ++ lib.optionals finalAttrs.doCheck [ + # Hardcode paths used by tests and change test runtime generation to use files from Nix store. + # https://github.com/flatpak/flatpak/issues/1460 + (replaceVars ./fix-test-paths.patch { + inherit + coreutils + gettext + gtk3 + socat + ; + dfu = desktop-file-utils; + hicolorIconTheme = hicolor-icon-theme; + smi = shared-mime-info; + }) + ] + ++ lib.optionals withP11Kit [ + # Hardcode p11-kit path used by Flatpak itself. + # If disabled, will have to be on PATH. + (replaceVars ./fix-paths.patch { + p11kit = lib.getExe p11-kit; + }) + ]; # Fixup shebangs in some scripts # @@ -146,7 +170,7 @@ stdenv.mkDerivation (finalAttrs: { [ (python3.pythonOnBuildForHost.withPackages (p: [ p.pyparsing ])) bison - gobject-introspection + glib meson ninja pkg-config @@ -155,6 +179,7 @@ stdenv.mkDerivation (finalAttrs: { wrapGAppsNoGuiHook ] ++ lib.optional withGtkDoc gtk-doc + ++ lib.optional withIntrospection gobject-introspection ++ lib.optional withMan libxslt ++ lib.optional withSELinuxModule bzip2 ++ lib.optionals withDocbookDocs [ @@ -163,29 +188,31 @@ stdenv.mkDerivation (finalAttrs: { xmlto ]; - buildInputs = [ - appstream - curl - dconf - fuse3 - gdk-pixbuf - glib-networking - gpgme - gsettings-desktop-schemas - json-glib - libarchive - libcap - librsvg # for flatpak-validate-icon - libseccomp - libxml2 - malcontent - polkit - python3 - wayland - wayland-protocols - xorg.libXau - zstd - ] ++ lib.optional withSystemd systemd; + buildInputs = + [ + appstream + curl + fuse3 + gdk-pixbuf + gpgme + gsettings-desktop-schemas + json-glib + libarchive + libcap + librsvg # for flatpak-validate-icon + libseccomp + libxml2 + python3 + wayland + wayland-protocols + xorg.libXau + zstd + ] + ++ lib.optional withDconf dconf + ++ lib.optional withGlibNetworking glib-networking + ++ lib.optional withMalcontent malcontent + ++ lib.optional withPolkit polkit + ++ lib.optional withSystemd systemd; # Required by flatpak.pc propagatedBuildInputs = [ @@ -197,10 +224,15 @@ stdenv.mkDerivation (finalAttrs: { (lib.mesonBool "auto_sideloading" withAutoSideloading) (lib.mesonBool "installed_tests" finalAttrs.finalPackage.doCheck) (lib.mesonBool "tests" finalAttrs.finalPackage.doCheck) + (lib.mesonEnable "dconf" withDconf) (lib.mesonEnable "docbook_docs" withDocbookDocs) + (lib.mesonEnable "gir" withIntrospection) (lib.mesonEnable "gtkdoc" withGtkDoc) + (lib.mesonEnable "malcontent" withMalcontent) (lib.mesonEnable "man" withMan) (lib.mesonEnable "selinux_module" withSELinuxModule) + (lib.mesonEnable "system_helper" withPolkit) + (lib.mesonEnable "systemd" withSystemd) (lib.mesonOption "dbus_config_dir" (placeholder "out" + "/share/dbus-1/system.d")) (lib.mesonOption "profile_dir" (placeholder "out" + "/etc/profile.d")) (lib.mesonOption "system_bubblewrap" (lib.getExe bubblewrap))