Merge pull request #67488 from worldofpeace/glib/get-schema-path

glib: add getSchemaPath, makeSchemaPath
This commit is contained in:
worldofpeace 2019-08-27 15:19:11 -04:00 committed by GitHub
commit 6402a044f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 39 additions and 28 deletions

View File

@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
];
postPatch = ''
substituteInPlace deja-dup/nautilus/NautilusExtension.c --subst-var-by DEJA_DUP_GSETTINGS_PATH $out/share/gsettings-schemas/${pname}-${version}/glib-2.0/schemas
substituteInPlace deja-dup/nautilus/NautilusExtension.c --subst-var-by DEJA_DUP_GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"}
'';
nativeBuildInputs = [

View File

@ -23,8 +23,8 @@ stdenv.mkDerivation rec {
];
prePatch = ''
substitute ${./hardcode-gsettings.patch} hardcode-gsettings.patch --subst-var-by ESD_GSETTINGS_PATH $out/share/gsettings-schemas/${pname}-${version}/glib-2.0/schemas \
--subst-var-by GDS_GSETTINGS_PATH "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}/glib-2.0/schemas"
substitute ${./hardcode-gsettings.patch} hardcode-gsettings.patch --subst-var-by ESD_GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"} \
--subst-var-by GDS_GSETTINGS_PATH ${glib.getSchemaPath gsettings-desktop-schemas}
patches="$patches $PWD/hardcode-gsettings.patch"
'';

View File

@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
# Fixup adapted from export-zips.sh in the source.
extensiondir=$out/share/gnome-shell/extensions
schemadir=$out/share/gsettings-schemas/${pname}-${version}/glib-2.0/schemas/
schemadir=${glib.makeSchemaPath "$out" "${pname}-${version}"}
glib-compile-schemas $schemadir

View File

@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
(substituteAll {
src = ./fix-paths.patch;
gapplication = "${glib.bin}/bin/gapplication";
mutter_gsettings_path = "${gnome3.mutter}/share/gsettings-schemas/${gnome3.mutter.name}/glib-2.0/schemas";
mutter_gsettings_path = glib.getSchemaPath gnome3.mutter;
})
];
@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
mesonFlags = [
"-Dgnome_shell_libdir=${gnome3.gnome-shell}/lib"
"-Dgsettings_schemadir=${placeholder "out"}/share/gsettings-schemas/${pname}-${version}/glib-2.0/schemas"
"-Dgsettings_schemadir=${glib.makeSchemaPath (placeholder "out") "${pname}-${version}"}"
"-Dchrome_nmhdir=${placeholder "out"}/etc/opt/chrome/native-messaging-hosts"
"-Dchromium_nmhdir=${placeholder "out"}/etc/chromium/native-messaging-hosts"
"-Dopenssl_path=${openssl}/bin/openssl"

View File

@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
substituteInPlace src/gnome-shell/prefs.js \
--subst-var-by typelibPath "${placeholder "out"}/lib/girepository-1.0"
substituteInPlace src/libgpaste/settings/gpaste-settings.c \
--subst-var-by gschemasCompiled "${placeholder "out"}/share/gsettings-schemas/${pname}-${version}/glib-2.0/schemas"
--subst-var-by gschemasCompiled ${glib.makeSchemaPath (placeholder "out") "${pname}-${version}"}
'';
nativeBuildInputs = [

View File

@ -10,6 +10,7 @@
, desktop-file-utils
, libcanberra
, gtk3
, glib
, libgee
, granite
, libnotify
@ -82,7 +83,7 @@ stdenv.mkDerivation rec {
patchShebangs meson/post_install.py
substituteInPlace filechooser-module/FileChooserDialog.vala \
--subst-var-by ELEMENTARY_FILES_GSETTINGS_PATH $out/share/gsettings-schemas/${pname}-${version}/glib-2.0/schemas
--subst-var-by ELEMENTARY_FILES_GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"}
'';
meta = with stdenv.lib; {

View File

@ -10,6 +10,7 @@
, gtk3
, switchboard
, elementary-settings-daemon
, glib
}:
stdenv.mkDerivation rec {
@ -29,7 +30,7 @@ stdenv.mkDerivation rec {
postPatch = ''
substituteInPlace src/Views/General.vala \
--subst-var-by GSD_GSETTINGS ${elementary-settings-daemon}/share/gsettings-schemas/${elementary-settings-daemon.name}/glib-2.0/schemas
--subst-var-by GSD_GSETTINGS ${glib.getSchemaPath elementary-settings-daemon}
'';
passthru = {
@ -46,6 +47,7 @@ stdenv.mkDerivation rec {
];
buildInputs = [
glib
granite
gtk3
libgee

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, pantheon, meson, ninja, pkgconfig, vala
{ stdenv, fetchFromGitHub, pantheon, meson, ninja, pkgconfig, vala, glib
, libgee, granite, gexiv2, elementary-settings-daemon, gtk3, gnome-desktop
, gala, wingpanel, plank, switchboard, gettext, bamf, fetchpatch }:
@ -29,9 +29,10 @@ stdenv.mkDerivation rec {
buildInputs = [
bamf
gexiv2
gnome-desktop
elementary-settings-daemon
gexiv2
glib
gnome-desktop
granite
gtk3
libgee
@ -51,9 +52,9 @@ stdenv.mkDerivation rec {
postPatch = ''
substituteInPlace src/Views/Appearance.vala \
--subst-var-by GALA_GSETTINGS_PATH ${gala}/share/gsettings-schemas/${gala.name}/glib-2.0/schemas
--subst-var-by GALA_GSETTINGS_PATH ${glib.getSchemaPath gala}
substituteInPlace src/Views/Appearance.vala \
--subst-var-by WINGPANEL_GSETTINGS_PATH ${wingpanel}/share/gsettings-schemas/${wingpanel.name}/glib-2.0/schemas
--subst-var-by WINGPANEL_GSETTINGS_PATH ${glib.getSchemaPath wingpanel}
'';

View File

@ -11,6 +11,7 @@
, elementary-settings-daemon
, granite
, gtk3
, glib
, dbus
, polkit
, switchboard
@ -42,6 +43,7 @@ stdenv.mkDerivation rec {
buildInputs = [
dbus
glib
granite
gtk3
libgee
@ -59,9 +61,9 @@ stdenv.mkDerivation rec {
postPatch = ''
substituteInPlace src/MainView.vala \
--subst-var-by DPMS_HELPER_GSETTINGS_PATH ${elementary-dpms-helper}/share/gsettings-schemas/${elementary-dpms-helper.name}/glib-2.0/schemas
--subst-var-by DPMS_HELPER_GSETTINGS_PATH ${glib.getSchemaPath elementary-dpms-helper}
substituteInPlace src/MainView.vala \
--subst-var-by GSD_GSETTINGS_PATH ${elementary-settings-daemon}/share/gsettings-schemas/${elementary-settings-daemon.name}/glib-2.0/schemas
--subst-var-by GSD_GSETTINGS_PATH ${glib.getSchemaPath elementary-settings-daemon}
'';
PKG_CONFIG_SWITCHBOARD_2_0_PLUGSDIR = "${placeholder ''out''}/lib/switchboard";

View File

@ -9,6 +9,7 @@
, libgee
, granite
, gtk3
, glib
, polkit
, zeitgeist
, switchboard
@ -41,6 +42,7 @@ stdenv.mkDerivation rec {
];
buildInputs = [
glib
granite
gtk3
libgee
@ -60,9 +62,9 @@ stdenv.mkDerivation rec {
patchShebangs meson/post_install.py
substituteInPlace src/Views/LockPanel.vala \
--subst-var-by LIGHTLOCKER_GSETTINGS_PATH ${lightlocker}/share/gsettings-schemas/${lightlocker.name}/glib-2.0/schemas
--subst-var-by LIGHTLOCKER_GSETTINGS_PATH ${glib.getSchemaPath lightlocker}
substituteInPlace src/Views/FirewallPanel.vala \
--subst-var-by SWITCHBOARD_SEC_PRIV_GSETTINGS_PATH $out/share/gsettings-schemas/${pname}-${version}/glib-2.0/schemas
--subst-var-by SWITCHBOARD_SEC_PRIV_GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"}
'';
meta = with stdenv.lib; {

View File

@ -33,16 +33,17 @@ with stdenv.lib;
# TODO: Having https://github.com/NixOS/nixpkgs/issues/54150 would supersede this
runCommand "elementary-gsettings-desktop-schemas" {}
''
mkdir -p $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
cp -rf ${gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
schema_dir=$out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
${concatMapStrings (pkg: "cp -rf ${pkg}/share/gsettings-schemas/*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas\n") gsettingsOverridePackages}
mkdir -p $schema_dir
cp -rf ${glib.getSchemaPath gsettings-desktop-schemas}/*.xml $schema_dir
${concatMapStrings (pkg: "cp -rf ${glib.getSchemaPath pkg}/*.xml $schema_dir\n") gsettingsOverridePackages}
chmod -R a+w $out/share/gsettings-schemas/nixos-gsettings-overrides
cp ${elementary-default-settings}/share/glib-2.0/schemas/20-io.elementary.desktop.gschema.override \
$out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
cp ${elementary-default-settings}/share/glib-2.0/schemas/20-io.elementary.desktop.gschema.override $schema_dir
cat - > $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/nixos-defaults.gschema.override <<- EOF
cat - > $schema_dir/nixos-defaults.gschema.override <<- EOF
[org.gnome.desktop.background]
picture-uri='${nixos-artwork.wallpapers.simple-dark-gray}/share/artwork/gnome/nix-wallpaper-simple-dark-gray.png'
primary-color='#000000'
@ -50,5 +51,5 @@ runCommand "elementary-gsettings-desktop-schemas" {}
${extraGSettingsOverrides}
EOF
${glib.dev}/bin/glib-compile-schemas $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/
${glib.dev}/bin/glib-compile-schemas $schema_dir
''

View File

@ -174,8 +174,10 @@ stdenv.mkDerivation rec {
inherit doCheck;
passthru = {
passthru = rec {
gioModuleDir = "lib/gio/modules";
makeSchemaPath = dir: name: "${dir}/share/gsettings-schemas/${name}/glib-2.0/schemas";
getSchemaPath = pkg: makeSchemaPath pkg pkg.name;
inherit flattenInclude;
updateScript = gnome3.updateScript { packageName = "glib"; };
};

View File

@ -2,7 +2,7 @@
, libnotify, libsecret, polkit, isocodes, modemmanager, libxml2, docbook_xsl, docbook_xml_dtd_43
, mobile-broadband-provider-info, glib-networking, gsettings-desktop-schemas
, libgudev, jansson, wrapGAppsHook, gobject-introspection, python3, gtk3
, libappindicator-gtk3, withGnome ? false, gcr }:
, libappindicator-gtk3, withGnome ? false, gcr, glib }:
let
pname = "network-manager-applet";
@ -40,7 +40,7 @@ in stdenv.mkDerivation rec {
chmod +x meson_post_install.py # patchShebangs requires executable file
patchShebangs meson_post_install.py
substituteInPlace src/wireless-security/eap-method.c --subst-var-by NM_APPLET_GSETTINGS $lib/share/gsettings-schemas/${name}/glib-2.0/schemas
substituteInPlace src/wireless-security/eap-method.c --subst-var-by NM_APPLET_GSETTINGS ${glib.makeSchemaPath "$lib" name}
'';
passthru = {