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

patchwork: init at 3.8.0 (WIP) #31052

Closed
wants to merge 4 commits into from

Conversation

matthiasbeyer
Copy link
Contributor

@matthiasbeyer matthiasbeyer commented Oct 31, 2017

Motivation for this change

Closes #24784

Because nobody did yet, I'm trying to get this going. Does not work, though, as npm2nix is broken and I do not know how to fix.

Of course this is WIP and not working yet.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@matthiasbeyer
Copy link
Contributor Author

matthiasbeyer commented Oct 31, 2017

disasm on IRC told me that I need to add the patchwork repository to the node package json file (also the v4 one?) and regenerate the files...

but after that:

nix-build -A nodePackages.ssb-patchwork-undefined

fails with

[...]
  CXX(target) Release/obj.target/spellchecker/src/transcoder_posix.o
  SOLINK_MODULE(target) Release/obj.target/spellchecker.node
  COPY Release/spellchecker.node
make: Leaving directory '/nix/store/fc87idw98yh5whv09jhawv1s53md0wzy-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/node_modules/@paulcbetts/spellchecker/build'

> keyboard-layout@2.0.13 install /nix/store/fc87idw98yh5whv09jhawv1s53md0wzy-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/node_modules/keyboard-layout
> node-gyp rebuild

make: Entering directory '/nix/store/fc87idw98yh5whv09jhawv1s53md0wzy-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/node_modules/keyboard-layout/build'
  CXX(target) Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o
In file included from ../src/keyboard-layout-manager-linux.cc:1:0:
../src/keyboard-layout-manager.h:7:22: fatal error: X11/Xlib.h: No such file or directory
 #include <X11/Xlib.h>
                      ^
compilation terminated.
make: *** [keyboard-layout-manager.target.mk:96: Release/obj.target/keyboard-layout-manager/src/keyboard-layout-manager-linux.o] Error 1
make: Leaving directory '/nix/store/fc87idw98yh5whv09jhawv1s53md0wzy-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/node_modules/keyboard-layout/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/nix/store/xlinq4y3whqzhyhr13wh4hsjk1svlp71-nodejs-6.11.5/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
gyp ERR! System Linux 4.13.7
gyp ERR! command "/nix/store/xlinq4y3whqzhyhr13wh4hsjk1svlp71-nodejs-6.11.5/bin/node" "/nix/store/xlinq4y3whqzhyhr13wh4hsjk1svlp71-nodejs-6.11.5/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /nix/store/fc87idw98yh5whv09jhawv1s53md0wzy-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/node_modules/keyboard-layout
gyp ERR! node -v v6.11.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 

npm ERR! Linux 4.13.7
npm ERR! argv "/nix/store/xlinq4y3whqzhyhr13wh4hsjk1svlp71-nodejs-6.11.5/bin/node" "/nix/store/xlinq4y3whqzhyhr13wh4hsjk1svlp71-nodejs-6.11.5/bin/npm" "--registry" "http://www.example.com" "--nodedir=/nix/store/0q0jap5qcmls50grf0pkgfbiph6yj86s-node-sources" "--production" "rebuild"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! keyboard-layout@2.0.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the keyboard-layout@2.0.13 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the keyboard-layout package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs keyboard-layout
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls keyboard-layout
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /nix/store/fc87idw98yh5whv09jhawv1s53md0wzy-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/npm-debug.log
builder for ‘/nix/store/l3sx8gm5ab9162d29jdjpvsgx7abz4kf-node-ssb-patchwork-3.8.0.drv’ failed with exit code 1
error: build of ‘/nix/store/l3sx8gm5ab9162d29jdjpvsgx7abz4kf-node-ssb-patchwork-3.8.0.drv’ failed

And I don't know how to fix this. It looks like dependencies are not met... so how to import them?

@matthiasbeyer
Copy link
Contributor Author

Okay, I feel we're getting closer:

  CXX(target) Release/obj.target/leveldown/src/database_async.o
  CXX(target) Release/obj.target/leveldown/src/iterator.o
  CXX(target) Release/obj.target/leveldown/src/iterator_async.o
  CXX(target) Release/obj.target/leveldown/src/leveldown.o
  CXX(target) Release/obj.target/leveldown/src/leveldown_async.o
  SOLINK_MODULE(target) Release/obj.target/leveldown.node
  COPY Release/leveldown.node
make: Leaving directory '/nix/store/njhza98w027m0ir6jgpxxmi4fk8xsxgs-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/node_modules/level/node_modules/leveldown/build'

> typechecker@2.0.8 preinstall /nix/store/njhza98w027m0ir6jgpxxmi4fk8xsxgs-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/node_modules/i18n/node_modules/messageformat/node_modules/watchr/node_modules/extendr/node_modules/typechecker
> node ./cyclic.js


> typechecker@2.0.8 preinstall /nix/store/njhza98w027m0ir6jgpxxmi4fk8xsxgs-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/node_modules/i18n/node_modules/messageformat/node_modules/watchr/node_modules/extract-opts/node_modules/typechecker
> node ./cyclic.js


> sodium-native@1.10.3 install /nix/store/njhza98w027m0ir6jgpxxmi4fk8xsxgs-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/node_modules/patchcore/node_modules/ssb-client/node_modules/multiserver/node_modules/secret-handshake/node_modules/chloride/node_modules/sodium-native
> node-gyp-build "node preinstall.js" "node postinstall.js"

sh: node-gyp-build: command not found

npm ERR! Linux 4.13.7
npm ERR! argv "/nix/store/xlinq4y3whqzhyhr13wh4hsjk1svlp71-nodejs-6.11.5/bin/node" "/nix/store/xlinq4y3whqzhyhr13wh4hsjk1svlp71-nodejs-6.11.5/bin/npm" "--registry" "http://www.example.com" "--nodedir=/nix/store/0q0jap5qcmls50grf0pkgfbiph6yj86s-node-sources" "--production" "rebuild"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! sodium-native@1.10.3 install: `node-gyp-build "node preinstall.js" "node postinstall.js"`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the sodium-native@1.10.3 install script 'node-gyp-build "node preinstall.js" "node postinstall.js"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sodium-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp-build "node preinstall.js" "node postinstall.js"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sodium-native
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sodium-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /nix/store/njhza98w027m0ir6jgpxxmi4fk8xsxgs-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/npm-debug.log
builder for ‘/nix/store/z16x4mzldvx5mmcnqcc2y2qx461a5z74-node-ssb-patchwork-3.8.0.drv’ failed with exit code 1
error: build of ‘/nix/store/z16x4mzldvx5mmcnqcc2y2qx461a5z74-node-ssb-patchwork-3.8.0.drv’ failed

Error on 8a755f7

I don't know what node-gyp-build is...

@matthiasbeyer
Copy link
Contributor Author

Bringing libsodium.dev into scope does not help.


xorg = pkgs.xorg;
in
nodePackages.package.override (oldAttrs: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessary to place all of this into its own file, for overriding purposes https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/node-packages/default-v6.nix can be used.
After that it should be enough to add an alias to all-packages.nix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love to get it to build first, then we can discuss where it should be placed. 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mic92 Mic92 changed the title patchwork: init at 3.8.0 patchwork: init at 3.8.0 (WIP) Nov 2, 2017
@matthiasbeyer
Copy link
Contributor Author

So... node-gyp-build is not in scope but it is clearly in the node-packages.nix ... so I don't understand what's not working here...

@matthiasbeyer
Copy link
Contributor Author

@yegortimoshenko How to? I have no experience with this electron monster thing, let alone with the nixpkgs infrastructure around it...

@matthiasbeyer
Copy link
Contributor Author

@Mic92 and @Ma27 ... I'm still interested in this, though don't know how to proceed. Can you please investigate and help me?

@baldo
Copy link
Contributor

baldo commented Dec 6, 2017

Hey, not sure if this helps, but I think it might be worth sharing. I got patchwork compiling and running via the following shell.nix (it's rough, but it works):

with import <nixpkgs> {};
with pkgs;

let pwEnv = buildEnv {
  name = "pwenv";
  paths = [
    alsaLib
    atk
    binutils
    bzip2
    cairo
    cups
    dbus.lib
    expat
    fontconfig
    freetype
    fuse
    gcc
    gdk_pixbuf
    glib
    glibc
    gnome2.gtk
    gnome3.gconf
    gnumake
    libcap
    libgpgerror
    libnotify
    libsodium
    nspr
    nss
    pango
    readline
    systemd
    udev
    udev
    xorg.kbproto
    xorg.libX11
    xorg.libXScrnSaver
    xorg.libXcomposite
    xorg.libXcursor
    xorg.libXdamage
    xorg.libXext
    xorg.libXfixes
    xorg.libXi
    xorg.libXrandr
    xorg.libXrender
    xorg.libXtst
    xorg.libxcb
    xorg.libxkbfile
    xorg.xproto
    zlib
  ];
  extraOutputsToInstall = [ "lib" "dev" "out" ];
}; in

(pkgs.buildFHSUserEnv {
  name = "patchwork";

  targetPkgs = pkgs: (with pkgs; [
    nodejs-8_x
    git
    python
    pwEnv
  ]);

  extraOutputsToInstall = [ "lib" "dev" "out" ];

  extraBuildCommands = ''
    (cd usr/lib64 && ln -sv libbz2.so.1.0.* libbz2.so.1.0)
  '';

  profile = ''
    export npm_config_cache="/tmp/pw-npm-cache/"
    export npm_config_devdir="/tmp/pw-gyp/"
    export ELECTRON_CACHE="/tmp/pw-electron-cache/"

    export CFLAGS="$NIX_CFLAGS_COMPILE"
    export CXXFLAGS="$NIX_CFLAGS_COMPILE"
    export LDFLAGS="$NIX_LDFLAGS_BEFORE"
  '';
}).env

@matthiasbeyer
Copy link
Contributor Author

@baldo wow, sounds great. I will definitively use this!

@matthiasbeyer
Copy link
Contributor Author

Ummm... what?


make: Entering directory '/nix/store/c7j3pvmxxjsxg5948lkbh2073k57mm6y-node-ssb-patchwork-3.8.0/lib/node_modules/ssb-patchwork/node_modules/electron-spellchecker/node_modules/@paulcbetts/cld/build'
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/cldutil.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/cldutil_shared.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/compact_lang_det.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/compact_lang_det_hint_code.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/compact_lang_det_impl.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/debug.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/fixunicodevalue.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/generated_entities.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/generated_language.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/generated_ulscript.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/getonescriptspan.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/lang_script.o
  CXX(target) Release/obj.target/cld-c/deps/cld/internal/offsetmap.o
In file included from /nix/store/rww78vdn2rkayrnqsjl8ib5iq2vfm3sw-gcc-6.4.0/include/c++/6.4.0/bits/stl_algo.h:59:0,
                 from /nix/store/rww78vdn2rkayrnqsjl8ib5iq2vfm3sw-gcc-6.4.0/include/c++/6.4.0/algorithm:62,
                 from ../deps/cld/internal/offsetmap.cc:24:
/nix/store/rww78vdn2rkayrnqsjl8ib5iq2vfm3sw-gcc-6.4.0/include/c++/6.4.0/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
                         ^

@matthiasbeyer
Copy link
Contributor Author

matthiasbeyer commented Dec 12, 2017

I'm lost here. I cloned the patchwork repository and used the expression @baldo provided for building it. I don't know how to package this and would love if someone could take over. Of course I'd maintain it then and ship updates as soon as possible.

@matthiasbeyer
Copy link
Contributor Author

@yegortimoshenko I was told (on irc) that you have experience with electron? Care to help?

@lukateras lukateras self-assigned this Dec 20, 2017
@matthiasbeyer
Copy link
Contributor Author

@yegortimoshenko I'm still interested in this... could you please help me?

@mguentner
Copy link
Contributor

Any progress on this?

@manveru
Copy link
Contributor

manveru commented Feb 22, 2018

Since I packaged a couple of electron apps already, I'll give it a try today.

@manveru manveru mentioned this pull request Feb 22, 2018
8 tasks
@manveru
Copy link
Contributor

manveru commented Feb 22, 2018

@matthiasbeyer can you try #35334 and see if it works for you?

@matthiasbeyer
Copy link
Contributor Author

On it.

@lukateras
Copy link
Member

Superseded by #35334.

@lukateras lukateras closed this Oct 13, 2018
@matthiasbeyer matthiasbeyer deleted the add-patchwork branch October 13, 2018 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please package patchwork
9 participants