# Packaging ChartDB

**URL:** https://discourse.nixos.org/t/packaging-chartdb/72851
**Category:** Help
**Created:** [December 2, 2025, 7:15pm UTC](https://discourse.nixos.org/t/packaging-chartdb/72851 "2025-12-02T19:15:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Malix](https://discourse.nixos.org/user_avatar/discourse.nixos.org/malix/32/17611_2.png) [@Malix](https://discourse.nixos.org/u/Malix)
#### Post date: [December 2, 2025, 7:15pm UTC](https://discourse.nixos.org/t/packaging-chartdb/72851/1 "2025-12-02T19:15:07Z")

</div>

Hello everyone!

I require help to package ChartDB

> **[ChartDB - Database schema diagrams visualizer](https://chartdb.io/)**
>
> Free and Open-source database diagrams editor, visualize and design your database with a single query. 
> Tool to help you draw your DB relationship diagrams and export DDL scripts.

> **[GitHub - chartdb/chartdb: Database diagrams editor that allows you to...](https://github.com/chartdb/chartdb)**
>
> Database diagrams editor that allows you to visualize and design your DB with a single query.

It is a recent but very popular database diagrams and schema editor TypeScript web application distributed as a [cloud SaaS](https://app.chartdb.io/) and a [docker container image](https://github.com/chartdb/chartdb/pkgs/container/chartdb) (the frontend being displayed in a localhost web browser interface)

It surely might be possible to wrap it in a nixpkgs / nix flake from source without docker, but I have no idea how

* * *

After digging a bit deeper, it seems that it is static (doesn’t require a backend Node.js server) and architectured as a single page application (SPA).  
The Docker container part is just to make Nginx serve static files and injecting environment variables through a script at runtime.

---

<div class="post-metadata">

### Author: ![bme](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@bme](https://discourse.nixos.org/u/bme)
#### Post date: [December 3, 2025, 12:53am UTC](https://discourse.nixos.org/t/packaging-chartdb/72851/2 "2025-12-03T00:53:09Z")

</div>

I’m not saying it’s good, I’m saying I spent about 10m on it. I have no idea if it has other problems, but if you run this, localhost:8080 has stuff on it.

```nix
let
  sources = import ./npins;
  pkgs = import sources.nixpkgs { };
  inherit (pkgs) lib;
  package =
    {
      buildNpmPackage,
      lib,
    }:
    buildNpmPackage rec {
      pname = "chartdb";
      version = lib.removePrefix src.release_prefix src.version;
      src = sources.chartdb;
      npmDepsHash = "sha256-nreu9QeT2lyJNkVomueifviE608YbuwesusdqGhWZqM=";
      installPhase = ''
        runHook preInstall
        mv dist $out
        runHook postInstall
      '';
    };
  chart-db = pkgs.callPackage package { };
  nginxConf = pkgs.writeText "nginx.conf" ''
    daemon off;

    events {
      worker_connections 128;
      ${lib.optionalString pkgs.hostPlatform.isLinux "use epoll;"}
      ${lib.optionalString pkgs.hostPlatform.isDarwin "use kqueue;"}
    }
    http {
      access_log /dev/stdout;
      include ${pkgs.nginx}/conf/mime.types;
      server {
        listen 8080;
        root ${chart-db};
        location / {
          try_files $uri /index.html;
        }
      }
    }
  '';
in
pkgs.writeShellScriptBin "chart-db" ''
  pid=$(mktemp)
  exec ${lib.getExe pkgs.nginx} -c ${nginxConf} -e /dev/stderr -g "pid $pid;"
''

```

EDIT:

```auto
❯ npins show
chartdb: (git release tag)
    repository: https://github.com/chartdb/chartdb.git
    pre_releases: false
    release_prefix: v
    submodules: false
    version: v1.18.1
    revision: 34b1a60737ac7a166f63539cf114b6d634d647b1
    hash: 02jladfmxbqj861km7yf008cxjdwwqmg2hfb59s453rivmlh0f0y
    frozen: false

nixpkgs: (Nix channel)
    name: nixpkgs-unstable
    url: https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre905319.f720de590661/nixexprs.tar.xz
    hash: 07n4hhch0j6n69b0zchdjg0l80z2xrdk7k57ykv90cvhklim5dz1
    frozen: false

```

---

<div class="post-metadata">

### Author: ![Malix](https://discourse.nixos.org/user_avatar/discourse.nixos.org/malix/32/17611_2.png) [@Malix](https://discourse.nixos.org/u/Malix)
#### Post date: [January 1, 2026, 8:30pm UTC](https://discourse.nixos.org/t/packaging-chartdb/72851/3 "2026-01-01T20:30:59Z")

</div>

Done

> <https://github.com/NixOS/nixpkgs/pull/473469>
>
> feat chartdb
> 
> \- https://chartdb.io/
> \- https://github.com/chartdb/chartdb
> 
> 
> …
> 
> \## Things done
> 
> 
> 
> \- Built on platform:
> - \[x\] x86\_64-linux
> - \[\] aarch64-linux
> - \[\] x86\_64-darwin
> - \[\] aarch64-darwin
> \- Tested, as applicable:
> - \[\] \[NixOS tests\] in \[nixos/tests\].
> - \[\] \[Package tests\] at \`passthru.tests\`.
> - \[\] Tests in \[lib/tests\] or \[pkgs/test\] for functions and "core" functionality.
> \- \[\] Ran \`nixpkgs-review\` on this PR. See \[nixpkgs-review usage\].
> \- \[\] Tested basic functionality of all binary files, usually in \`./result/bin/\`.
> \- Nixpkgs Release Notes
> - \[\] Package update: when the change is major or breaking.
> \- NixOS Release Notes
> - \[\] Module addition: when adding a new NixOS module.
> - \[\] Module update: when the change is significant.
> \- \[x\] Fits \[CONTRIBUTING.md\], \[pkgs/README.md\], \[maintainers/README.md\] and other READMEs.
> 
> \[NixOS tests\]: https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests
> \[Package tests\]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests
> \[nixpkgs-review usage\]: https://github.com/Mic92/nixpkgs-review#usage
> 
> \[CONTRIBUTING.md\]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md
> \[lib/tests\]: https://github.com/NixOS/nixpkgs/blob/master/lib/tests
> \[maintainers/README.md\]: https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md
> \[nixos/tests\]: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests
> \[pkgs/README.md\]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
> \[pkgs/test\]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/test
> 
> \---
> 
> Add a :+1: \[reaction\] to \[pull requests you find important\].
> 
> \[reaction\]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
> \[pull requests you find important\]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc

Note that this is only its static file.

A NixOS / Home Manager module would be needed to run it (like Excalidraw)
