Skip to content

Commit

Permalink
fix nix build on osx
Browse files Browse the repository at this point in the history
  • Loading branch information
rupurt committed Aug 23, 2023
1 parent d1b0939 commit c46a51d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,10 @@
];
};
stdenv = pkgs.llvmPackages_15.stdenv;

# Define a helper function to conditionally include the db2-odbc-driver package as not all arch are supported
getDb2OdbcDriver =
if system == "aarch64-linux" || system == "aarch64-darwin" then null else pkgs.db2-odbc-driver {};


in rec {
# packages exported by the flake
packages = {
db2-odbc-driver = getDb2OdbcDriver;
db2-odbc-driver = pkgs.db2-odbc-driver {};
postgres-odbc-driver = pkgs.postgres-odbc-driver {};
};

Expand Down Expand Up @@ -65,15 +59,23 @@
generate-odbcinst-ini = {
type = "app";
program = toString (pkgs.writeScript "generate-odbcinst-ini" ''
DB2_DRIVER_PATH=${packages.db2-odbc-driver}/lib/${if stdenv.isDarwin then "libdb2.dylib" else "libdb2.so"} \
DB2_DRIVER_PATH=${packages.db2-odbc-driver}/lib/${
if stdenv.isDarwin
then "libdb2.dylib"
else "libdb2.so"
} \
POSTGRES_DRIVER_PATH=${packages.postgres-odbc-driver}/lib/psqlodbca.so \
envsubst < ./templates/.odbcinst.ini.template > .odbcinst.ini
'');
};
ls-odbc-driver-paths = {
type = "app";
program = toString (pkgs.writeScript "ls-odbc-driver-paths" ''
echo "db2 ${packages.db2-odbc-driver}/lib/${if stdenv.isDarwin then "libdb2.dylib" else "libdb2.so"}"
echo "db2 ${packages.db2-odbc-driver}/lib/${
if stdenv.isDarwin
then "libdb2.dylib"
else "libdb2.so"
}"
echo "postgres ${packages.postgres-odbc-driver}/lib/psqlodbca.so"
'');
};
Expand Down

0 comments on commit c46a51d

Please sign in to comment.