IntersectMBO / IntersectMBO/cardano-db-sync
[Bug] NixOS module missing dependencies
- Dominant language
- Haskell
- Stars
- 318
- Forks
- 168
- PR merge metrics
- No merged PRs in 30d
Description
**OS**
NixOS
**Versions**
The `db-sync` version (eg `cardano-db-sync --version`): 13.2.0.1
PostgreSQL version: 15
**Build/Install Method**
NixOS module
**Run method**
The method you used to run `cardano-db-sync` (eg Nix/Docker/systemd/none): NixOS module
**Additional context**
Add any other context about the problem here.
**Problem Report**
The getconf bin in postgresql.sh setup script used [here](https://github.com/IntersectMBO/cardano-db-sync/blob/77cd7949603007cd48b66ba1ea7763392dc76286/scripts/postgresql-setup.sh#L28) isn't in coreutils pkg of nixos, but this script does get used by the dbsync systemd service:
```
/nix/store/8srs5rqymbnsm8gg515qxxbnl3k4jjyl-postgresql-setup.sh: line 28: getconf: command not found
/nix/store/8srs5rqymbnsm8gg515qxxbnl3k4jjyl-postgresql-setup.sh: line 29: test: : integer expression expected
During a takeSnapshot operation, the error is fatal and a snapshot won't be taken:
Mar 06 19:18:06 misc1-snapshots-eu-central-1a-1 systemd[1]: Stopping cardano-db-sync.service...
Mar 06 19:18:07 misc1-snapshots-eu-central-1a-1 cardano-db-sync-post-stop[131443]: yes: standard output: Broken pipe
Mar 06 19:18:07 misc1-snapshots-eu-central-1a-1 cardano-db-sync-post-stop[131456]: /nix/store/1bys3yjgm97yxy91sfy8f5law41fyif9-postgresql-setup.sh: line 28: getconf: command not found
Mar 06 19:18:07 misc1-snapshots-eu-central-1a-1 cardano-db-sync-post-stop[131454]: /nix/store/1bys3yjgm97yxy91sfy8f5law41fyif9-postgresql-setup.sh: line 29: test: : integer expression expected
Mar 06 19:18:07 misc1-snapshots-eu-central-1a-1 cardano-db-sync-post-stop[131454]: Working directory: /tmp/db-sync-snapshot-JPdTxx0lUE
Mar 06 19:18:07 misc1-snapshots-eu-central-1a-1 cardano-db-sync-post-stop[131472]: pg_dump: error: -j/--jobs must be in range 1..2147483647
Mar 06 19:18:07 misc1-snapshots-eu-central-1a-1 systemd[1]: cardano-db-sync.service: Control process exited, code=exited, status=1/FAILURE
I've added pkgs.getconf to the systemd.services.cardano-db-sync.path and that fixes the takeSnapshot failure (probably will also fix the non-fatal error for restore snapshot, but haven't tested that). Probably that getconf package should get added to the nixos cardano-db-sync service path by default. (edited)
```
Contributor guide
Assessment
This issue has not been assessed yet.