diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2023-11-13 02:13:02 +0100 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2023-11-21 08:42:47 +0100 |
commit | 6f695f3d92be6b9994d69f3de2eaffb9d6b94f92 (patch) | |
tree | d18951c7bd9b4d81c07d31f05ad78466e93f2b83 /pkgs/build-support/make-hardcode-gsettings-patch/default.nix | |
parent | 81283429b7a1aa3f5ed96700ac4401509aa3df31 (diff) |
makeHardcodeGsettingsPatch: Improve docs
- Describe arguments and usage in more detail. - Use finalAttrs in example. - Use schema id, not path. - Schema id is not what is replaced.
Diffstat (limited to 'pkgs/build-support/make-hardcode-gsettings-patch/default.nix')
-rw-r--r-- | pkgs/build-support/make-hardcode-gsettings-patch/default.nix | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/pkgs/build-support/make-hardcode-gsettings-patch/default.nix b/pkgs/build-support/make-hardcode-gsettings-patch/default.nix index a1d2de21c4cb3..a4a2dc36df053 100644 --- a/pkgs/build-support/make-hardcode-gsettings-patch/default.nix +++ b/pkgs/build-support/make-hardcode-gsettings-patch/default.nix @@ -6,15 +6,35 @@ }: /* - Can be used as part of an update script to automatically create a patch - hardcoding the path of all GSettings schemas in C code. - For example: - passthru = { - hardcodeGsettingsPatch = makeHardcodeGsettingsPatch { - inherit src; - schemaIdToVariableMapping = { - ... - }; + Creates a patch that replaces every instantiation of GSettings in a C project + with a code that loads a GSettings schema from a hardcoded path. + + This is useful so that libraries can find schemas even though Nix lacks + a standard location like /usr/share, where GSettings system could look for schemas. + The derivation is is somewhat dependency-heavy so it is best used as part of an update script. + + For each schema id referenced in the source code (e.g. org.gnome.evolution), + a variable name such as `EVOLUTION` must be provided. + It will end up in the generated patch as `@EVOLUTION@` placeholder, which should be replaced at build time + with a path to the directory containing a `gschemas.compiled` file that includes the schema. + + + Arguments: + - `src`: source to generate the patch for. + + - `schemaIdToVariableMapping`: attrset assigning schema ids to variable names. + All used schemas must be listed. + + For example, `{ "org.gnome.evolution" = "EVOLUTION_SCHEMA_PATH"; }` + hardcodes looking for `org.gnome.evolution` into `@EVOLUTION_SCHEMA_PATH@`. + + Example: + passthru = { + hardcodeGsettingsPatch = makeHardcodeGsettingsPatch { + inherit (finalAttrs) src; + schemaIdToVariableMapping = { + ... + }; }; updateScript = @@ -26,12 +46,8 @@ updateSource updatePatch ]; - }; - } - takes as input a mapping from schema path to variable name. - For example `{ "org.gnome.evolution" = "EVOLUTION_SCHEMA_PATH"; }` - hardcodes looking for `org.gnome.evolution` into `@EVOLUTION_SCHEMA_PATH@`. - All schemas must be listed. + }; + } */ { src, |