]> Git — Sourcephile - tmp/julm/libreoffice-base-sqlite.git/commitdiff
fix odbc.ini by putting it inside ODBCSYSINI main
authorJulien Moutinho <julm+les4roux@sourcephile.fr>
Sun, 20 Apr 2025 19:15:40 +0000 (21:15 +0200)
committerJulien Moutinho <julm+les4roux@sourcephile.fr>
Sun, 20 Apr 2025 19:31:42 +0000 (21:31 +0200)
flake.nix

index 83dca4191e8b67d478e49b24c17c11a0c410e5b7..a9abce60c89835c2867aa888650d6e77028826a0 100644 (file)
--- a/flake.nix
+++ b/flake.nix
     {
       devShells = forAllSystems ({ pkgs, system, ... }: {
         default =
-          let driverSqlite = "${pkgs.lib.getLib pkgs.unixODBCDrivers.sqlite}/lib/libsqlite3odbc.so"; in
+          let sqliteDB = "les4roux"; in
+          let sqliteDriverPath = "${pkgs.lib.getLib pkgs.unixODBCDrivers.sqlite}/lib/libsqlite3odbc.so"; in
           pkgs.mkShell {
             JAVA_HOME = pkgs.libreoffice.unwrapped.jdk;
-            ODBCSYSINI = pkgs.writeTextDir "odbcinst.ini" ''
-              [ODBC Drivers]
-              SQLite3Driver=Installed
+            ODBCSYSINI =
+              let
+                odbcsysini = pkgs.writeTextDir "odbcinst.ini" ''
+                  [ODBC Drivers]
+                  SQLite3=Installed
 
-              [SQLite3Driver]
-              Description = SQLite ODBC Driver
-              Driver      = ${driverSqlite}
-              Setup       = ${driverSqlite}
-              Threading   = 2
-              UsageCount=1
-              FileUsage= 1
-              CPTimeout=
-              CPReuse=
-              FKSupport=Yes
-              SyncPragma=
+                  [SQLite3]
+                  Description = SQLite ODBC Driver
+                  Driver      = ${sqliteDriverPath}
+                  Setup       = ${sqliteDriverPath}
+                  Threading   = 2
+                  UsageCount=1
+                  FileUsage= 1
+                  CPTimeout=
+                  CPReuse=
+                  FKSupport=Yes
+                  SyncPragma=
 
-              # Sadly does not work: https://github.com/sqitchers/docker-sqitch/pull/16/.
-              [Default]
-              Driver=SQLite3Driver
-            '';
-            ODBCINI = pkgs.writeText "odbc.ini" ''
-              [testDSN]
-              Description=Test DB
-              Driver=SQLite3Driver
-              Database=/home/julm/work/julminfo/sibert/test.sqlite
-              TraceFile=/home/julm/work/julminfo/sibert/test.log
-              NoCreat=No
-              LongNames=Yes
-              # DescriptionNote: optional lock timeout in milliseconds; default 100000
-              #Timeout=2000
-            '';
+                  # Sadly does not work: https://github.com/sqitchers/docker-sqitch/pull/16/.
+                  [Default]
+                  Driver=SQLite3
+                '';
+                odbcini = pkgs.writeTextDir "odbc.ini" ''
+                  [${sqliteDB}]
+                  Description=${sqliteDB} database
+                  Driver=SQLite3
+                  NoCreat=No
+                  LongNames=Yes
+                  Database=${sqliteDB}.sqlite
+                  TraceFile=/tmp/${sqliteDB}.log
+                  # DescriptionNote: optional lock timeout in milliseconds; default 100000
+                  #Timeout=2000
+                '';
+              in pkgs.symlinkJoin {
+                name = "ODBCSYSINI";
+                paths = [
+                  odbcsysini
+                  odbcini
+                ];
+              };
             buildInputs = [
+              pkgs.bat
+              pkgs.libreoffice
               pkgs.sqlite
               pkgs.sqlitebrowser
-              pkgs.libreoffice
-              pkgs.bat
               pkgs.unixODBC
             ];
             shellHook = ''
               bat $ODBCSYSINI/odbcinst.ini
-              bat $ODBCINI
+              bat $ODBCSYSINI/odbc.ini
               export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [pkgs.unixODBC]}:$LD_LIBRARY_PATH
               set -x
               odbcinst -j
-              odbcinst -q -d -n SQLite3Driver
+              odbcinst -q -d -n SQLite3
               odbcinst -q -s -h
-              odbcinst -q -s -n testDSN
+              odbcinst -q -s -n ${sqliteDB}
               set +x
             '' # + checks.${system}.git-hooks-check.shellHook
             ;