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

Merged
merged 2 commits into from Oct 3, 2020
Merged

Conversation

@ysndr
Copy link
Contributor

@ysndr 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 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 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 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 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 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 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 matthew-piziak commented May 13, 2020

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

@ysndr
Copy link
Contributor Author

@ysndr 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 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 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 ysndr commented May 14, 2020

Notice: I added it as nodePackages.mermaid-cli

@matthew-piziak
Copy link
Contributor

@matthew-piziak 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 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 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 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 ysndr commented May 31, 2020

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

Copy link
Member

@prusnak prusnak left a comment

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

blitz
blitz approved these changes Jul 28, 2020
@yurrriq
Copy link
Member

@yurrriq yurrriq commented Sep 29, 2020

Looks like there are merge conflicts again.. any chance at a rebase and merge?

@ysndr
Copy link
Contributor Author

@ysndr ysndr commented Sep 29, 2020

Sure, all good things are three.

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Sep 29, 2020

Since May I've been building directly from the pull request with fetchWithConfig "https://github.com/NixOS/nixpkgs/archive/pull/87766/head.tar.gz";. It takes some luck to get fast merges in nixpkgs, and with node-packages.{json, nix} being changed with every node package, new merge conflicts pop up quickly.

@ysndr ysndr force-pushed the add/mermaid-cli branch from 0f00d8b to c1834f4 Sep 30, 2020
@ysndr
Copy link
Contributor Author

@ysndr ysndr commented Sep 30, 2020

Let's try again then.

@ofborg ofborg bot requested a review from midchildan Sep 30, 2020
@ysndr
Copy link
Contributor Author

@ysndr ysndr commented Sep 30, 2020

@matthew-piziak you want to try if everything works with it?

@yurrriq
Copy link
Member

@yurrriq yurrriq commented Sep 30, 2020

fwiw nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/tarball/pull/87766/head -p nodePackages.mermaid-cli works well for me, both yesterday and today 😃

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Sep 30, 2020

Thank you once again @ysndr. Looks good to me!

merge

graph TD
    A[Mermaid PR] --> B{{Merge Conflict?}};
    B -->|Yes| C[Resolve];
    C --> B;
    B --> |No| E{{Wait for Merge}};
    E --> |Merged| S[Success!]:::success;
    classDef success fill:#3e3;
    E --> |Too Slow| B;

@ysndr
Copy link
Contributor Author

@ysndr ysndr commented Oct 3, 2020

Who is responsible for merging this though? I have no rights here :D

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Oct 3, 2020

@ysndr That's the million-dollar question. I've pinged it on #nixos about four times now. The contributing guidelines are silent on the topic of actually getting PRs merged.

@7c6f434c
Copy link
Member

@7c6f434c 7c6f434c commented Oct 3, 2020

Well, it's pretty natural people are feeling unsure about something that, in addition to stated goal, also updates a ton of nodePackages… But maybe npm cannot be made worse…

@7c6f434c 7c6f434c merged commit 2621037 into NixOS:master Oct 3, 2020
17 checks passed
@lheckemann
Copy link
Member

@lheckemann lheckemann commented Oct 3, 2020

Sorry about the poor contribution experience! We have a discourse thread where PRs in dire need of committer attention can be mentioned: https://discourse.nixos.org/t/prs-in-distress/3604

@ysndr
Copy link
Contributor Author

@ysndr ysndr commented Oct 3, 2020

@7c6f434c is it even possible to add an npm package without changing (updating) a ton of other libraries at the same time?

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Oct 3, 2020

Thank you @7c6f434c @lheckemann!! It's wonderful to have this hit master.

@7c6f434c
Copy link
Member

@7c6f434c 7c6f434c commented Oct 4, 2020

@ysndr I guess updating could be avoided with heroic effort, but you did nothing wrong — you just got caught in a particularly annoying process gotcha.

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Oct 9, 2020

Weird, I can't access node-packages.mermaid-cli on unstable-small yet, but I can still build it from this PR.

@lheckemann
Copy link
Member

@lheckemann lheckemann commented Oct 9, 2020

https://status.nixos.org/ it only updated 36 minutes ago after having build problems for a while, did you try less than 36 minutes ago?

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Oct 9, 2020

@lheckemann Tried it again just now. I still get attribute 'mermaid-cli' missing.

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Oct 9, 2020

I also made sure to set tarball-ttl to 1.

@lheckemann
Copy link
Member

@lheckemann lheckemann commented Oct 10, 2020

nix build -f channel:nixos-unstable nodePackages.mermaid-cli works for me. node-packages doesn't exist though.

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Oct 10, 2020

Weird. If I wget https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable-small.tar.gz, I can't grep any references to mermaid-cli.

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Oct 10, 2020

Same for https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz. And yet nix build -f channel:nixos-unstable nodePackages.mermaid-cli terminates with no errors.

@matthew-piziak
Copy link
Contributor

@matthew-piziak matthew-piziak commented Oct 10, 2020

Ah, it's because nixos-channels has been deprecated. Using https://github.com/NixOS/nixpkgs/archive/nixos-unstable-small.tar.gz fixed it. Thanks!

Infinisil
Copy link
Member

Infinisil commented on c1834f4 Oct 20, 2020

Unfortunately this broke vega-lite, introduced in #97908. Fails with:

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'vega'
Require stack:
- /nix/store/pg3cvj41h61h84cm46a8g090w88aj22z-node_vega-lite-4.16.8/lib/node_modules/vega-lite/bin/render.js
- /nix/store/pg3cvj41h61h84cm46a8g090w88aj22z-node_vega-lite-4.16.8/lib/node_modules/vega-lite/bin/vl2svg
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/nix/store/pg3cvj41h61h84cm46a8g090w88aj22z-node_vega-lite-4.16.8/lib/node_modules/vega-lite/bin/render.js:3:14)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/nix/store/pg3cvj41h61h84cm46a8g090w88aj22z-node_vega-lite-4.16.8/lib/node_modules/vega-lite/bin/render.js',
    '/nix/store/pg3cvj41h61h84cm46a8g090w88aj22z-node_vega-lite-4.16.8/lib/node_modules/vega-lite/bin/vl2svg'
  ]
}

Looks like bin/vg2svg and co. aren't a bash script anymore, but a node one instead. I'm not sure how this needs to be fixed yet, maybe with some NODE_PATH stuff

Ping @MMesch

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

9 participants