Originally posted by @theCapypara in #749
No, just adding the Cargo.lock is enough for us in that regard. Just tested your PR, builds fine! Thanks!
I just noticed Orca actually vendors MathCAT itself and provides its own Cargo.lock we can use. While I'll use that for Orca, I'll probably still package MathCAT for NixOS as a standalone package, because why not :).
The only other somewhat annoying thing for that is the way that the path to the rules directory is currently somewhat hardcoded and the MathCATRulesDir env variable only being read when a code change is made.
For various reasons we need to provide a custom path to MathCAT.
This requires us to do these patches to make it work:
{
postPatch = ''
substituteInPlace src/main.rs \
--replace-fail 'set_rules_dir(get_rules_dir())' 'set_rules_dir("".to_string())'
substituteInPlace tests/common/mod.rs \
--replace-fail 'set_rules_dir(abs_rules_dir_path())' 'set_rules_dir("".to_string())'
'';
preCheck = ''
export MathCATRulesDir="$src/Rules"
'';
postInstall = ''
install -dm755 "$out/rules"
cp -a ./Rules "$out/rules"
wrapProgram $out/bin/mathcat --set MathCATRulesDir "$out/rules"
'';
}
- The "postPatch" section here replaces
set_rules_dir(get_rules_dir()) with set_rules_dir("".to_string()) (and does the same for the tests)
- In "preCheck" we make sure the tests see the rules
- In "postInstall" we install the rules and make sure the final mathcat binary actually sees them
Ideally for us, the "postPatch" section would not be needed.
Originally posted by @theCapypara in #749
Originally posted by @theCapypara in #749
Originally posted by @theCapypara in #749