Nixpkgs: packaging request: texlab

Created on 2 Sep 2019  路  12Comments  路  Source: NixOS/nixpkgs

Project description
An LSP server for latex. Rust + node I think

Metadata

packaging request TeX

Most helpful comment

I'm still trying to figure out the issue with vendoring ducc, but I haven't made any progress.

I tried generating a nix derivation using carnix, but it also failed on ducc, this time with:
Could not translate target.

I'm assuming the issue is related to the dependency using a git repo rather than crates.io, but it's not clear how it should be fixed.

All 12 comments

I don't use LaTeX as much as I did in university, but this looks awesome! I will try packing this and report any progress here.

I'm running into an issue that requires some investigation. It looks like cargo vendor fails when trying to build the ducc dependency.

Vendoring ducc v0.1.0 (https://github.com/SkylerLipthay/ducc?rev=558a0ec83cbb8aff57043cfafdb3d728cd509211#558a0ec8) (/build/source/cargo-home.waU/git/checkouts/ducc-19f01d0c414a7f8f/558a0ec/ducc) to /nix/store/1zb7yxnqjn8rn02qhd7mfh5kbl70w16j-texlab-1.5.0-vendor/ducc
error: failed to sync

Caused by:
  failed to copy over vendored sources for: ducc v0.1.0 (https://github.com/SkylerLipthay/ducc?rev=558a0ec83cbb8aff57043cfafdb3d728cd509211#558a0ec8)

Caused by:
  failed to copy `/build/source/cargo-home.waU/git/checkouts/ducc-19f01d0c414a7f8f/558a0ec/ducc/LICENSE` to `/nix/store/1zb7yxnqjn8rn02qhd7mfh5kbl70w16j-texlab-1.5.0-vendor/ducc/LICENSE`

Caused by:
  Too many levels of symbolic links (os error 40)

I have pushed my progress so far to: https://github.com/MetaDark/nixpkgs/blob/texlab/pkgs/development/tools/misc/texlab/default.nix

Building the project manually, it also looks like texlab depends on nightly rust and won't build with the RUSTC_BOOTSTRAP = 1 workaround. The variable shouldn't be used unless bootstrapping rustc anyway.

I managed to generate a rustPlatform using same toolchain defined in the rust-toolchain file (using the nixpkgs-mozilla overlay), but I don't know if that's the best solution. There should be a better way to build with a nightly compiler...

thanks for looking into this. I don't know much about either rust or the node ecosystem (else I would have it packaged). This is what I get

   Vendoring deflate v0.7.20 (/build/source/cargo-home.rST/registry/src/github.com-1ecc6299db9ec823/deflate-0.7.20) to /nix/store/1zb7yxnqjn8rn02qhd7mfh5kbl70w16j-texlab-1.5.0-vendor/deflate
   Vendoring ducc v0.1.0 (https://github.com/SkylerLipthay/ducc?rev=558a0ec83cbb8aff57043cfafdb3d728cd509211#558a0ec8) (/build/source/cargo-home.rST/git/checkouts/ducc-19f01d0c414a7f8f/558a0ec/ducc) to /nix/store/1zb7yxnqjn8rn02qhd7mfh5kbl70w16j-texlab-1.5.0-vendor/ducc
error: failed to sync

Caused by:
  failed to copy over vendored sources for: ducc v0.1.0 (https://github.com/SkylerLipthay/ducc?rev=558a0ec83cbb8aff57043cfafdb3d728cd509211#558a0ec8)

Caused by:
  failed to copy `/build/source/cargo-home.rST/git/checkouts/ducc-19f01d0c414a7f8f/558a0ec/ducc/LICENSE` to `/nix/store/1zb7yxnqjn8rn02qhd7mfh5kbl70w16j-texlab-1.5.0-vendor/ducc/LICENSE`

Caused by:
  Too many levels of symbolic links (os error 40)
Traceback (most recent call last):
  File "/nix/store/wxvxg9pr09lizvi0ysfs6119q8g2b4xb-cargo-vendor-normalise/bin/.cargo-vendor-normalise-wrapped", line 42, in <module>
    main()
  File "/nix/store/wxvxg9pr09lizvi0ysfs6119q8g2b4xb-cargo-vendor-normalise/bin/.cargo-vendor-normalise-wrapped", line 17, in main
    assert list(data.keys()) == ["source"]

nb: I had packaged https://github.com/astoff/digestif but it now crahes plus texlab now has a coc-texlab plugin.

@teto No problem :smile:

It looks like the traceback in cargo-vendor-normalize is caused by the failure in cargo vendor:

https://github.com/NixOS/nixpkgs/blob/3dd112c97e242d9ae7910178e1e1c62febfb6819/pkgs/build-support/rust/fetchcargo.nix#L46

The toml response comes back empty, so the script doesn't find a source key.

Building with nix-build --keep-failed I noticed that the LICENSE file symlinks to itself, which is probably what is causing the failure. Although, I'm not sure how it gets to that state in the first place.

I'm still trying to figure out the issue with vendoring ducc, but I haven't made any progress.

I tried generating a nix derivation using carnix, but it also failed on ducc, this time with:
Could not translate target.

I'm assuming the issue is related to the dependency using a git repo rather than crates.io, but it's not clear how it should be fixed.

I wanted to package texlab as well and I've encountered exactly the same errors .I've found out though that 8 days ago, ducc was released on crates.io. I've suggested citeproc to use it and I intend to try to build texlab when that's updated ~but I get some build errors which are not related to any of the dependencies updates.~ but I'm not sure whether it'll be worth it to wait for the next release. See discussion here: https://github.com/latex-lsp/texlab/issues/97#issuecomment-536212624

@doronbehar As @efoerster mentioned in https://github.com/latex-lsp/texlab/issues/97, texlab expects a nightly compiler to build. I tried building with RUSTC_BOOTSTRAP = 1 which is what the rls and racer packages use to force nightly features on a stable compiler, but it still wouldn't build.

It's possible to use the nightly overlay from https://github.com/mozilla/nixpkgs-mozilla/, but it may be better to wait until Rust 1.39 is released.

So I guess we'll wait until both of them are released.. I'll subscribe to https://github.com/rust-lang/rust/releases.atom in the meantime.

I think Texlab can now be packaged, rustc 1.39.0 is released and merged to master, see #72980.

@doronbehar I was able to build the package with nix-shell in a non sandboxed environment, but trying to build in nix-shell <nixpkgs> --pure -A texlab or with nix-build <nixpkgs> -A texlab fails.

error: couldn't read src/citeproc/js/dist/citeproc.js: No such file or directory (os error 2)
 --> src/citeproc/mod.rs:8:23
  |
8 | const JS_CODE: &str = include_str!("js/dist/citeproc.js");
  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: could not compile `texlab`.

It looks like build.rs fails to create a dist package of citeproc in the sandboxed environment. I'll keep looking into this.

See https://github.com/MetaDark/nixpkgs/commit/421461aaa38f0aa135c2bcf0f832c48d3e786c5a

I managed to come up with a solution to a similar issue with gotify-server in https://github.com/NixOS/nixpkgs/pull/70441 where technically a separate ("private") package which consisted of a node_modules directory was needed for the build to work inside the sandbox.

A similar workaround is needed here, but with node2nix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

copumpkin picture copumpkin  路  3Comments

vaibhavsagar picture vaibhavsagar  路  3Comments

langston-barrett picture langston-barrett  路  3Comments

grahamc picture grahamc  路  3Comments

sid-kap picture sid-kap  路  3Comments