Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 runCommand, 3 git, 4 coccinelle, 5 python3, 6}: 7 8/* 9 Can be used as part of an update script to automatically create a patch 10 hardcoding the path of all GSettings schemas in C code. 11 For example: 12 passthru = { 13 hardcodeGsettingsPatch = makeHardcodeGsettingsPatch { 14 inherit src; 15 schemaIdToVariableMapping = { 16 ... 17 }; 18 }; 19 20 updateScript = 21 let 22 updateSource = ...; 23 updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-ews.hardcodeGsettingsPatch" ./hardcode-gsettings.patch; 24 in 25 _experimental-update-script-combinators.sequence [ 26 updateSource 27 updatePatch 28 ]; 29 }; 30 } 31 takes as input a mapping from schema path to variable name. 32 For example `{ "org.gnome.evolution" = "EVOLUTION_SCHEMA_PATH"; }` 33 hardcodes looking for `org.gnome.evolution` into `@EVOLUTION_SCHEMA_PATH@`. 34 All schemas must be listed. 35*/ 36{ 37 src, 38 schemaIdToVariableMapping, 39}: 40 41runCommand 42 "hardcode-gsettings.patch" 43 { 44 inherit src; 45 nativeBuildInputs = [ 46 git 47 coccinelle 48 python3 # For patch script 49 ]; 50 } 51 '' 52 unpackPhase 53 cd "''${sourceRoot:-.}" 54 set -x 55 cp ${builtins.toFile "glib-schema-to-var.json" (builtins.toJSON schemaIdToVariableMapping)} ./glib-schema-to-var.json 56 git init 57 git add -A 58 spatch --sp-file "${./hardcode-gsettings.cocci}" --dir . --in-place 59 git diff > "$out" 60 ''