On NixOS, I'm using a FHS environment to supply libraries (unixODBC and sqlite-odbc) to libreoffice.

{ pkgs ? import <nixpkgs> {} }:
( pkgs.buildFHSUserEnv {
  name = "odbc-sqlite-libreoffice";
  targetPkgs = pkgs: with pkgs; [libreoffice unixODBC unixODBCDrivers.sqlite];

However, this works in conjunction with the configuration file /etc/odbcinst.ini, which is generated from the environment.unixODBCDrivers option, but I can't figure out how to pass it to the chroot's filesystem.

I tried using the extraBuildCommands option:

extraBuildCommands = "ln -s /host/etc/odbcinst.ini /etc/odbcinst.ini";

but it doesn't seem to be the right way, and it results in an error: ln: failed to create symbolic link '/etc/odbcinst.ini': Permission denied

How would I go about placing the config file? I imagine there should be a way to create an environment based on a particular system configuration/generation.

If there are other ways to configure ODBC and SQLite on NixOS, they are also very welcome.

  • Why do you need to use buildFHSUserEnv? Did installing libreoffice and unixODBC normally and then using the environment.unixODBCDrivers option, not work? – Emmanuel Rosa May 23 at 12:08
  • @EmmanuelRosa No, it doesn't work when they're just installed side by side, nor does it when they're included side by side in an stdenv.mkDerivation environment. I imagine why libreoffice can find the libraries in a buildFHSUserEnv is because it looks for the libraries in a standard, hardcoded, FHS-compliant location. – user142852 May 24 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.