Describe the bug
Using sqlite as backend yields the following error
Sep 07 19:05:22 fr-desktop codimd[6179]: Error: Please install sqlite3 package manually
Sep 07 19:05:22 fr-desktop codimd[6179]: at ConnectionManager._loadDialectModule (/nix/store/vxidbmisivc15x6ac431sm6ch0cm626k-codimd/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:81:15)
Sep 07 19:05:22 fr-desktop codimd[6179]: at new ConnectionManager (/nix/store/vxidbmisivc15x6ac431sm6ch0cm626k-codimd/node_modules/sequelize/lib/dialects/sqlite/connection-manager.js:22:21)
Sep 07 19:05:22 fr-desktop codimd[6179]: at new SqliteDialect (/nix/store/vxidbmisivc15x6ac431sm6ch0cm626k-codimd/node_modules/sequelize/lib/dialects/sqlite/index.js:14:30)
Sep 07 19:05:22 fr-desktop codimd[6179]: at new Sequelize (/nix/store/vxidbmisivc15x6ac431sm6ch0cm626k-codimd/node_modules/sequelize/lib/sequelize.js:324:20)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Object.<anonymous> (/nix/store/vxidbmisivc15x6ac431sm6ch0cm626k-codimd/lib/models/index.js:23:15)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Module._compile (internal/modules/cjs/loader.js:778:30)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Module.load (internal/modules/cjs/loader.js:653:32)
Sep 07 19:05:22 fr-desktop codimd[6179]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Module.require (internal/modules/cjs/loader.js:692:17)
Sep 07 19:05:22 fr-desktop codimd[6179]: at require (internal/modules/cjs/helpers.js:25:18)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Object.<anonymous> (/nix/store/vxidbmisivc15x6ac431sm6ch0cm626k-codimd/app.js:26:14)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Module._compile (internal/modules/cjs/loader.js:778:30)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Module.load (internal/modules/cjs/loader.js:653:32)
Sep 07 19:05:22 fr-desktop codimd[6179]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
Sep 07 19:05:22 fr-desktop codimd[6179]: at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
Sep 07 19:05:22 fr-desktop codimd[6179]: at startup (internal/bootstrap/node.js:283:19)
Sep 07 19:05:22 fr-desktop codimd[6179]: at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
How should sqlite be added? Should yarn be ran again?
To Reproduce
services.codimd = {
enable = true;
configuration.db = {
dialect = "sqlite";
storage = "/var/lib/codimd/db.codimd.sqlite";
};
};
Notify maintainers
@WilliButz
Metadata
# nixos-version
20.09.20200820.c59ea8b (Nightingale)
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module: `services.codimd`
I did some digging into why this does not work anymore and it seems that this probably did not work for a long time without anyone noticing (including me), even though this should have been caught by the test.
The node module sqlite3 is built with node-pre-gyp using node_napi_label = v72, but on startup I could see that node looks for the sqlite3 module with v64. Also according to npm-sqlite3 upstream node version 10 does not seem to be officially supported by sqlite3.
Adding..
pushd lib/binding
ln -vs node* node-v64-linux-x64
popd
..directly after calling npm install for sqlite3 does work, but I am pretty sure that this hack could have weird consequences during runtime :)
Building codimd with node version 12, which is officially supported by sqlite3, is probably our best option here and I just successfully ran the test with it. I'll open a PR with the update later this evening.
/cc @Ma27
Working well now, thanks!
Most helpful comment
I did some digging into why this does not work anymore and it seems that this probably did not work for a long time without anyone noticing (including me), even though this should have been caught by the test.
The node module
sqlite3is built withnode-pre-gypusingnode_napi_label = v72, but on startup I could see that node looks for thesqlite3module withv64. Also according to npm-sqlite3 upstream node version 10 does not seem to be officially supported bysqlite3.Adding..
..directly after calling
npm installforsqlite3does work, but I am pretty sure that this hack could have weird consequences during runtime :)Building codimd with node version 12, which is officially supported by sqlite3, is probably our best option here and I just successfully ran the test with it. I'll open a PR with the update later this evening.
/cc @Ma27