Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodePackages.mermaid-cli: init 8.4.8 #87766

Open
wants to merge 1 commit into
base: master
from
Open

Conversation

@ysndr
Copy link
Contributor

ysndr commented May 13, 2020

Motivation for this change

I needed mermaid and thought I could also share this.
I am not sure whether the @mermaid-js part is necessary, it does produce some ugly store paths.

Things done
  • Add mermaid to list
  • regenerate node-packges*.nix using the generate.sh script
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@matthew-piziak
Copy link
Contributor

matthew-piziak commented May 13, 2020

Thanks @ysndr! Is there a way I can test this branch as a channel? Or do I have to pull down a local nixpkgs repository to do that?

@ysndr
Copy link
Contributor Author

ysndr commented May 13, 2020

Yes, using the -I nixpkgs=https://github.com/ysndr/nixpkgs/tarball/add/mermaid-cli flag on nix-shell or nix-build

The package name is nodePackages.mermaid I'm on mobile right now so I can not tell exactly, tab completion is your friend though ;)

@matthew-piziak
Copy link
Contributor

matthew-piziak commented May 13, 2020

Huh, I see @mermaid-js/mermaid-cli but that doesn't seem like a valid name.

@ysndr
Copy link
Contributor Author

ysndr commented May 13, 2020

Yes as I said in the description, the path is quite ugly actually, I'll look into it again if there is probably a better way..
Have you tried escaping the special characters?

@matthew-piziak
Copy link
Contributor

matthew-piziak commented May 13, 2020

Yeah, quoting it worked, good idea. I got a weird break:

> puppeteer@2.1.1 install /nix/store/g6s7rfn7nr2wl56x6i21kz0yjz5n4rqv-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer
> node install.js

ERROR: Failed to download Chromium r722234! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ Error: getaddrinfo ENOTFOUND storage.googleapis.com storage.googleapis.com:443
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
  -- ASYNC --
    at BrowserFetcher.<anonymous> (/nix/store/g6s7rfn7nr2wl56x6i21kz0yjz5n4rqv-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer/lib/helper.js:111:15)
    at Object.<anonymous> (/nix/store/g6s7rfn7nr2wl56x6i21kz0yjz5n4rqv-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer/install.js:66:16)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
  errno: 'ENOTFOUND',
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'storage.googleapis.com',
  host: 'storage.googleapis.com',
  port: 443 }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@2.1.1 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the puppeteer@2.1.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /build/.npm/_logs/2020-05-13T21_24_04_713Z-debug.log

builder for '/nix/store/xpy4dxma6qgfxmlajladz5qcl6sc4p34-node__at_mermaid-js_slash_mermaid-cli-8.4.8.drv' failed with exit code 1
cannot build derivation '/nix/store/53n86xg80wv90z0zw03pqangdkw3vgnf-system-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ha8hyqm0qg9ap42layb4in3j6r4rsd3y-nixos-system-mus-20.03.1822.5adf2a6c116.drv': 1 dependencies couldn't be built
error: build of '/nix/store/ha8hyqm0qg9ap42layb4in3j6r4rsd3y-nixos-system-mus-20.03.1822.5adf2a6c116.drv' failed
@ysndr
Copy link
Contributor Author

ysndr commented May 13, 2020

What kind of system are you using? Are you on NixOS or nix on linux?

It's probably related to puppeteer being download during the build phase which is not possible in the sandbox. Maybe this is less strict on MacOS where I used it.

@matthew-piziak
Copy link
Contributor

matthew-piziak commented May 13, 2020

@ysndr Yeah I'm on NixOS, this is weird.

@ysndr
Copy link
Contributor Author

ysndr commented May 13, 2020

Yes, while installing and building the builder does not have access to the internet (and other niceties) to ensure pureness.
I tried overriding supplying chrome using nix now, maybe you can try it again. If it doesn't work I look into it tomorrow.

@matthew-piziak
Copy link
Contributor

matthew-piziak commented May 13, 2020

Progress! Here's what's up now.

**INFO** Skipping Chromium download. "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" environment variable was found.
chalk@3.0.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/chalk
ansi-styles@4.2.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/ansi-styles
@types/color-name@1.1.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/@types/color-name
color-convert@2.0.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/color-convert
color-name@1.1.4 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/color-name
supports-color@7.1.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/supports-color
has-flag@4.0.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/has-flag
commander@4.1.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/commander
puppeteer@2.1.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer
@types/mime-types@2.1.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/@types/mime-types
debug@4.1.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/debug
ms@2.1.2 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/ms
extract-zip@1.7.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/extract-zip
concat-stream@1.6.2 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/concat-stream
buffer-from@1.1.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/buffer-from
inherits@2.0.4 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/inherits
readable-stream@2.3.7 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/readable-stream
core-util-is@1.0.2 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/core-util-is
isarray@1.0.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/isarray
process-nextick-args@2.0.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/process-nextick-args
safe-buffer@5.1.2 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/safe-buffer
string_decoder@1.1.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/string_decoder
util-deprecate@1.0.2 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/util-deprecate
typedarray@0.0.6 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/typedarray
debug@2.6.9 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/extract-zip/node_modules/debug
ms@2.0.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/extract-zip/node_modules/ms
mkdirp@0.5.5 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/mkdirp
minimist@1.2.5 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/minimist
yauzl@2.10.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/yauzl
fd-slicer@1.1.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/fd-slicer
pend@1.2.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/pend
buffer-crc32@0.2.13 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/buffer-crc32
https-proxy-agent@4.0.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/https-proxy-agent
agent-base@5.1.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/agent-base
mime@2.4.5 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/mime
mime-types@2.1.27 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/mime-types
mime-db@1.44.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/mime-db
progress@2.0.3 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/progress
proxy-from-env@1.1.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/proxy-from-env
rimraf@2.7.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/rimraf
glob@7.1.6 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/glob
fs.realpath@1.0.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/fs.realpath
inflight@1.0.6 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/inflight
once@1.4.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/once
wrappy@1.0.2 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/wrappy
minimatch@3.0.4 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/minimatch
brace-expansion@1.1.11 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/brace-expansion
balanced-match@1.0.0 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/balanced-match
concat-map@0.0.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/concat-map
path-is-absolute@1.0.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/path-is-absolute
ws@6.2.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/ws
async-limiter@1.0.1 /nix/store/s6pn2q7qhndsr0bbcf861a4d03h9slyd-node__at_mermaid-js_slash_mermaid-cli-8.4.8/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/async-limiter
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @fortawesome/fontawesome-free-webfonts@^1.0.9 (node_modules/@fortawesome/fontawesome-free-webfonts):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/@fortawesome%2ffontawesome-free-webfonts failed: cache mode is 'only-if-cached' but no cached response available.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: babel-cli@^6.26.0 (node_modules/babel-cli):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/babel-cli failed: cache mode is 'only-if-cached' but no cached response available.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: babel-preset-env@^1.7.0 (node_modules/babel-preset-env):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/babel-preset-env failed: cache mode is 'only-if-cached' but no cached response available.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: mermaid@^8.4.8 (node_modules/mermaid):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/mermaid failed: cache mode is 'only-if-cached' but no cached response available.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: standard@^11.0.1 (node_modules/standard):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/standard failed: cache mode is 'only-if-cached' but no cached response available.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: yarn-upgrade-all@^0.3.0 (node_modules/yarn-upgrade-all):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/yarn-upgrade-all failed: cache mode is 'only-if-cached' but no cached response available.

up to date in 0.318s

2 packages are looking for funding
  run `npm fund` for details

/nix/store/ba8fhbmvfyh439606lni91y420yflmlc-stdenv-linux/setup: line 81: wrapProgram: command not found
builder for '/nix/store/qmip4m6yrxz55spml78dh00f7h2827kc-node__at_mermaid-js_slash_mermaid-cli-8.4.8.drv' failed with exit code 127
cannot build derivation '/nix/store/1pvaxrw1i6105d7szid5rs0qxzkswdg9-system-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/0v9h3k9j4v8d1fi83sgm9p0g50kq3xlx-nixos-system-mus-20.03.1822.5adf2a6c116.drv': 1 dependencies couldn't be built
error: build of '/nix/store/0v9h3k9j4v8d1fi83sgm9p0g50kq3xlx-nixos-system-mus-20.03.1822.5adf2a6c116.drv' failed
@ysndr
Copy link
Contributor Author

ysndr commented May 14, 2020

@matthew-piziak can you try it now? I missed including makeWrapper as dependency.
Also, on MacOS I cannot wrap chromium, sowee have to rely on puppeteer downloading chromium.

@ysndr
Copy link
Contributor Author

ysndr commented May 14, 2020

Notice: I added it as nodePackages.mermaid-cli

@matthew-piziak
Copy link
Contributor

matthew-piziak commented May 15, 2020

It works! Thank you!

I don't suppose you can tell me how to add custom configuration files to the derivation options?

Here's what I have:

# Diagrams as code.

{ pkgs, ... }:
let
  mermaid-cli = pkgs.writeScriptBin "mmdc" ''
    #!${pkgs.mpr.stdenv.shell}
    exec ${pkgs.mpr.nodePackages.mermaid-cli}/bin/mmdc \
    --set PUPPETEER_EXECUTABLE_PATH ${pkgs.mpr.chromium.outPath}/bin/chromium \
    "$@" \
    --cssFile $/out/mermaid.css \
    --configFile $/out/mermaid.json
  '';
in { environment.systemPackages = [ mermaid-cli ]; }

In case you're curious, here's my intention. It's to support generation of nice high-res PNGs on the command line without a browser: mermaidjs/mermaid.cli#3 (comment)

@matthew-piziak
Copy link
Contributor

matthew-piziak commented May 15, 2020

With some help from IRC I have this:

# Diagrams as code.

{ pkgs, ... }:
let
  mermaid-cli = pkgs.writeScriptBin "mmdc" ''
    #!${pkgs.mpr.stdenv.shell}
    exec ${pkgs.mpr.nodePackages.mermaid-cli}/bin/mmdc \
    --set PUPPETEER_EXECUTABLE_PATH ${pkgs.mpr.chromium.outPath}/bin/chromium \
    "$@" \
    --cssFile ${./mermaid.css} \
    --configFile ${./mermaid.json}
  '';
in { environment.systemPackages = [ mermaid-cli ]; }

This setup works great! Thank you. :)

@ysndr
Copy link
Contributor Author

ysndr commented May 15, 2020

It works! Thank you!

Glad to hear that!

# Diagrams as code.

{ pkgs, ... }:
let
  mermaid-cli = pkgs.writeScriptBin "mmdc" ''
    #!${pkgs.mpr.stdenv.shell}
    exec ${pkgs.mpr.nodePackages.mermaid-cli}/bin/mmdc \
    --set PUPPETEER_EXECUTABLE_PATH ${pkgs.mpr.chromium.outPath}/bin/chromium \
    "$@" \
    --cssFile ${./mermaid.css} \
    --configFile ${./mermaid.json}
  '';
in { environment.systemPackages = [ mermaid-cli ]; }

You should not need #!${pkgs.mpr.stdenv.shell} as this is added if you used writeShellScriptBin. Other than that this should work definitely fine.

@svanderburg are we good to merge this?

@ysndr ysndr requested review from svanderburg and rycee May 15, 2020
@prusnak
Copy link
Member

prusnak commented May 30, 2020

Please rework your PR. It now has a merge conflict after PR #89184 has been merged

@ysndr
Copy link
Contributor Author

ysndr commented May 31, 2020

Did the rework. It still works for me on MacOS at least.

Copy link
Member

prusnak left a comment

Please change commit message to: nodePackages.mermaid-cli: init 8.4.8

@ysndr ysndr force-pushed the ysndr:add/mermaid-cli branch from dd4ddae to e4ec1bf May 31, 2020
@ysndr ysndr changed the title (mermaid-cli): init 8.4.8 nodePackages.mermaid-cli: init 8.4.8 May 31, 2020
@ysndr
Copy link
Contributor Author

ysndr commented May 31, 2020

Please change commit message to: nodePackages.mermaid-cli: init 8.4.8

done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.