Skip to content

Commit f0a1ddd

Browse files
author
Alex Kwiatkowski
committed
fix nix build on osx
1 parent d1b0939 commit f0a1ddd

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
outputs = {
1111
flake-utils,
12+
nixpkgs,
1213
odbc-drivers,
1314
...
1415
}: let
@@ -27,17 +28,17 @@
2728
odbc-drivers.overlay
2829
];
2930
};
31+
# pkgs = import nixpkgs {
32+
# inherit system;
33+
# overlays = [
34+
# odbc-drivers.overlay
35+
# ];
36+
# };
3037
stdenv = pkgs.llvmPackages_15.stdenv;
31-
32-
# Define a helper function to conditionally include the db2-odbc-driver package as not all arch are supported
33-
getDb2OdbcDriver =
34-
if system == "aarch64-linux" || system == "aarch64-darwin" then null else pkgs.db2-odbc-driver {};
35-
36-
3738
in rec {
3839
# packages exported by the flake
3940
packages = {
40-
db2-odbc-driver = getDb2OdbcDriver;
41+
db2-odbc-driver = pkgs.db2-odbc-driver {};
4142
postgres-odbc-driver = pkgs.postgres-odbc-driver {};
4243
};
4344

@@ -65,15 +66,23 @@
6566
generate-odbcinst-ini = {
6667
type = "app";
6768
program = toString (pkgs.writeScript "generate-odbcinst-ini" ''
68-
DB2_DRIVER_PATH=${packages.db2-odbc-driver}/lib/${if stdenv.isDarwin then "libdb2.dylib" else "libdb2.so"} \
69+
DB2_DRIVER_PATH=${packages.db2-odbc-driver}/lib/${
70+
if stdenv.isDarwin
71+
then "libdb2.dylib"
72+
else "libdb2.so"
73+
} \
6974
POSTGRES_DRIVER_PATH=${packages.postgres-odbc-driver}/lib/psqlodbca.so \
7075
envsubst < ./templates/.odbcinst.ini.template > .odbcinst.ini
7176
'');
7277
};
7378
ls-odbc-driver-paths = {
7479
type = "app";
7580
program = toString (pkgs.writeScript "ls-odbc-driver-paths" ''
76-
echo "db2 ${packages.db2-odbc-driver}/lib/${if stdenv.isDarwin then "libdb2.dylib" else "libdb2.so"}"
81+
echo "db2 ${packages.db2-odbc-driver}/lib/${
82+
if stdenv.isDarwin
83+
then "libdb2.dylib"
84+
else "libdb2.so"
85+
}"
7786
echo "postgres ${packages.postgres-odbc-driver}/lib/psqlodbca.so"
7887
'');
7988
};

0 commit comments

Comments
 (0)