···66}:
7788/*
99- Can be used as part of an update script to automatically create a patch
1010- hardcoding the path of all GSettings schemas in C code.
1111- For example:
1212- passthru = {
1313- hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
1414- inherit src;
1515- schemaIdToVariableMapping = {
1616- ...
1717- };
99+ Creates a patch that replaces every instantiation of GSettings in a C project
1010+ with a code that loads a GSettings schema from a hardcoded path.
1111+1212+ This is useful so that libraries can find schemas even though Nix lacks
1313+ a standard location like /usr/share, where GSettings system could look for schemas.
1414+ The derivation is is somewhat dependency-heavy so it is best used as part of an update script.
1515+1616+ For each schema id referenced in the source code (e.g. org.gnome.evolution),
1717+ a variable name such as `EVOLUTION` must be provided.
1818+ It will end up in the generated patch as `@EVOLUTION@` placeholder, which should be replaced at build time
1919+ with a path to the directory containing a `gschemas.compiled` file that includes the schema.
2020+2121+2222+ Arguments:
2323+ - `src`: source to generate the patch for.
2424+2525+ - `schemaIdToVariableMapping`: attrset assigning schema ids to variable names.
2626+ All used schemas must be listed.
2727+2828+ For example, `{ "org.gnome.evolution" = "EVOLUTION_SCHEMA_PATH"; }`
2929+ hardcodes looking for `org.gnome.evolution` into `@EVOLUTION_SCHEMA_PATH@`.
3030+3131+ Example:
3232+ passthru = {
3333+ hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
3434+ inherit (finalAttrs) src;
3535+ schemaIdToVariableMapping = {
3636+ ...
3737+ };
1838 };
19392040 updateScript =
···2646 updateSource
2747 updatePatch
2848 ];
2929- };
3030- }
3131- takes as input a mapping from schema path to variable name.
3232- For example `{ "org.gnome.evolution" = "EVOLUTION_SCHEMA_PATH"; }`
3333- hardcodes looking for `org.gnome.evolution` into `@EVOLUTION_SCHEMA_PATH@`.
3434- All schemas must be listed.
4949+ };
5050+ }
3551*/
3652{
3753 src,
···11/**
22- * Since Nix does not have a standard location like /usr/share,
33- * where GSettings system could look for schemas, we need to point the software to a correct location somehow.
22+ * Since Nix does not have a standard location like /usr/share where GSettings system
33+ * could look for schemas, we need to point the software to a correct location somehow.
44 * For executables, we handle this using wrappers but this is not an option for libraries like e-d-s.
55- * Instead, we hardcode the schema path when creating the settings.
66- * A schema path (ie org.gnome.evolution) can be replaced by @EVOLUTION_SCHEMA_ID@
77- * which is then replaced at build time by substituteAll.
88- * The mapping is provided in a json file ./glib-schema-to-var.json
55+ * Instead, we patch the source code to look for the schema in a schema source
66+ * through a hardcoded path to the schema.
77+ *
88+ * For each schema id referenced in the source code (e.g. org.gnome.evolution),
99+ * a variable name such as `EVOLUTION` must be provided in the ./glib-schema-to-var.json JSON file.
1010+ * It will end up in the resulting patch as `@EVOLUTION@` placeholder, which should be replaced at build time
1111+ * with a path to the directory containing a `gschemas.compiled` file that includes the schema.
912 */
10131114@initialize:python@