I’m trying to create a derivation for Oracle database 23c. The package provided by Oracle is an RPM file, can be freely downloaded from Oracle without registration.
I don’t have much time to try, but first, I’m surprised, don’t you need autoPatchelfHook to patch the link to the loaders? (autoPatchelfHook might only patch stuff in the bin folder, so you might need to copy the binaries in $out/bin and libraries in $out/lib) Otherwise, I would use strace ./yourprogram to debug this, looking for the list of path it tries to open. It might try to dlopen a library that is not present…
You should try the latest version of the repo, I just succeeded to run sqplus using buildFHSEnv. Apparently, @K900 told me on Matrix that patching the ELF file might not be a good idea, since he believes that Oracle has integrity checks (looks like he was right, once again!).
Now, what’s left to do in here, is to be able to run binaries transparently within a simple derivation.
Yeah, I usually try to avoid buildFHSEnv when possible, but in case of integrity checks it is hard to avoid.
That’s a good question… I’m not sure if there is a direct way to specify multiple runScript in a buildFHSEnv (maybe create an issue for that?). One solution might be to create a first derivation with buildFHSEnv that does not sets runScript (this way it is just bash), and then create another derivation that wraps it by calling the appropriate binary, like ${yourFHS}/bin/foo -c "myprogram" will call bash -c "myprogram", so you might be able to write something like:
let myDerivation = buildFHSEnv {name = "foo"; …}; in
runCommand "myProgram" {} ''
mkdir -p $out/bin
cd ${myDerivation}/opt/oracle/product/23c/dbhomeFree/bin
for $file in $(ls) do
# Goal: since by default runScript is bash, we try to run bash
makeWrapper $out/bin/$file ${myDerivation}/bin/foo --add-flags "-c" --add-flags '"$file"'
done
'';
but this certainly need some more work as I can’t test it right now. Also, this will not propagate the arguments correctly as they need to be inside the argument to -c and not sure how to do that with makeWrapper directly…
Yep, I’m totally blocked right now, I can’t link the binaries provided by Oracle through the FHSEnv.
I simply cannot find a way to build a derivation where each executable in $out/bin is a script that sets up an FHS env and execs the analogous original binary from the Oracle release.
Today, I was looking for a solution to have an Oracle database running and made a NixOS module using Podman and the official Oracle container to run it.