2 description = "Nix Flake to use LibreOffice Base with an SQLite database";
4 nixpkgs.url = "flake:nixpkgs";
5 git-hooks.url = "github:cachix/git-hooks.nix";
6 git-hooks.inputs.nixpkgs.follows = "nixpkgs";
10 lib = inputs.nixpkgs.lib;
11 forAllSystems = f: lib.genAttrs lib.systems.flakeExposed (system: f rec {
13 pkgs = inputs.nixpkgs.legacyPackages.${system};
17 devShells = forAllSystems ({ pkgs, system, ... }: {
19 let database = "LesQuatreRoux"; in
21 JAVA_HOME = pkgs.libreoffice.unwrapped.jdk;
24 odbcsysini = pkgs.writeTextDir "odbcinst.ini" ''
29 Description = SQLite ODBC Driver
30 Driver = ${pkgs.lib.getLib pkgs.unixODBCDrivers.sqlite}/lib/libsqlite3odbc.so
31 Setup = ${pkgs.lib.getLib pkgs.unixODBCDrivers.sqlite}/lib/libsqlite3odbc.so
40 # Sadly does not work: https://github.com/sqitchers/docker-sqitch/pull/16/.
44 odbcini = pkgs.writeTextDir "odbc.ini" ''
46 Description=${database} database
51 TraceFile=/tmp/${database}.log
52 # DescriptionNote: optional lock timeout in milliseconds; default 100000
56 # ExplanationNote: somehow using ODBCINI= does not work, so keep everything in ODBCSYSINI=
74 (pkgs.writeShellScriptBin "sql" ''
75 exec ${pkgs.hsqldb}/bin/sqltool --inlineRc='url=jdbc:hsqldb:hsql://localhost:9001/LesQuatreRoux' --autoCommit "$@"
79 #bat $ODBCSYSINI/odbcinst.ini
80 #bat $ODBCSYSINI/odbc.ini
81 export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [pkgs.unixODBC]}:$LD_LIBRARY_PATH
84 #odbcinst -q -d -n SQLite3
86 #odbcinst -q -s -n ${database}
88 echo "You may now launch runServer"
89 '' # + checks.${system}.git-hooks-check.shellHook
94 checks = forAllSystems (args: with args; {
95 git-hooks-check = inputs.git-hooks.lib.${system}.run {
98 nixpkgs-fmt.enable = true;
99 #sqlfluff.enable = true;
102 entry = "${pkgs.reuse}/bin/reuse lint";
103 pass_filenames = false;