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

zettlr: 1.7.5 -> 1.8.7 #106074

Merged
merged 1 commit into from Feb 18, 2021
Merged

Conversation

sternenseemann
Copy link
Member

Motivation for this change
Things done
  • 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.

@sternenseemann
Copy link
Member Author

cc @tfmoraes

@tfmoraes
Copy link
Contributor

tfmoraes commented Dec 6, 2020

Hi @sternenseemann, I tested here and it's working correctly.

❯ nix-shell -p nixpkgs-review --run "nixpkgs-review pr 106074"                  
these 11 paths will be fetched (3.20 MiB download, 15.78 MiB unpacked):
  /nix/store/2j41iacjcpdy47wyynpbiwkl8xprry9d-nix-2.3.8-man
  /nix/store/4fqaq99gnqmc4vr9rjbyslq4gn9ckl3k-nixpkgs-review-2.4.2
  /nix/store/8bgqvkqs7jm1k1z12sa0ndrbdh859x2f-nix-2.3.8
  /nix/store/fwr8jsgnrpvplvd1nb4bfwnyslvg9pkn-aws-checksums-0.1.7
  /nix/store/i8q3x671kxp40wy3dgvl3li0j13sw00y-aws-c-event-stream-0.1.1
  /nix/store/phjj29ppcccwxlr1fv8pwfkxyn0hah4x-busybox-1.31.1-x86_64-unknown-linux-musl
  /nix/store/q0wr6hrhf09bdb09jll95mzzd64awv0l-aws-sdk-cpp-1.7.90
  /nix/store/vqykf0xcrdpsbmm8f49kkpbbqfn6j2k1-editline-1.17.0
  /nix/store/wzd4hqwb653673acavgrvpzqigl7cjzi-boehm-gc-8.0.4
  /nix/store/xwwgs95misy6q6xbfjzjrvpzml5ik9xd-libsodium-1.0.18
  /nix/store/yi6wrn7j7m60q21hrgf5ac2wlm5nx6l1-aws-c-common-0.3.11
copying path '/nix/store/phjj29ppcccwxlr1fv8pwfkxyn0hah4x-busybox-1.31.1-x86_64-unknown-linux-musl' from 'https://cache.nixos.org'...
copying path '/nix/store/2j41iacjcpdy47wyynpbiwkl8xprry9d-nix-2.3.8-man' from 'https://cache.nixos.org'...
copying path '/nix/store/wzd4hqwb653673acavgrvpzqigl7cjzi-boehm-gc-8.0.4' from 'https://cache.nixos.org'...
copying path '/nix/store/vqykf0xcrdpsbmm8f49kkpbbqfn6j2k1-editline-1.17.0' from 'https://cache.nixos.org'...
copying path '/nix/store/yi6wrn7j7m60q21hrgf5ac2wlm5nx6l1-aws-c-common-0.3.11' from 'https://cache.nixos.org'...
copying path '/nix/store/fwr8jsgnrpvplvd1nb4bfwnyslvg9pkn-aws-checksums-0.1.7' from 'https://cache.nixos.org'...
copying path '/nix/store/xwwgs95misy6q6xbfjzjrvpzml5ik9xd-libsodium-1.0.18' from 'https://cache.nixos.org'...
copying path '/nix/store/i8q3x671kxp40wy3dgvl3li0j13sw00y-aws-c-event-stream-0.1.1' from 'https://cache.nixos.org'...
copying path '/nix/store/q0wr6hrhf09bdb09jll95mzzd64awv0l-aws-sdk-cpp-1.7.90' from 'https://cache.nixos.org'...
copying path '/nix/store/8bgqvkqs7jm1k1z12sa0ndrbdh859x2f-nix-2.3.8' from 'https://cache.nixos.org'...
copying path '/nix/store/4fqaq99gnqmc4vr9rjbyslq4gn9ckl3k-nixpkgs-review-2.4.2' from 'https://cache.nixos.org'...
$ git -c fetch.prune=false fetch --force https://github.com/NixOS/nixpkgs master:refs/nixpkgs-review/0 pull/106074/head:refs/nixpkgs-review/1
remote: Enumerating objects: 4527, done.
remote: Counting objects: 100% (4527/4527), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 8977 (delta 4511), reused 4512 (delta 4504), pack-reused 4450
Receiving objects: 100% (8977/8977), 4.65 MiB | 8.36 MiB/s, done.
Resolving deltas: 100% (6785/6785), completed with 1148 local objects.
From https://github.com/NixOS/nixpkgs
   b863ef1e5f3..82294a1f2b1  master                -> refs/nixpkgs-review/0
 + d97be39275c...94faa9875fa refs/pull/106074/head -> refs/nixpkgs-review/1  (forced update)
$ git worktree add /home/thiago/.cache/nixpkgs-review/pr-106074/nixpkgs 82294a1f2b1bd817163510f0353498499d5026b1
Preparing worktree (detached HEAD 82294a1f2b1)
HEAD is now at 82294a1f2b1 neatvnc: 0.3.2 -> 0.4.0
$ git merge --no-commit 94faa9875fad147f3226c7881b271bde42154f38
Automatic merge went well; stopped before committing as requested
warning: unknown setting 'experimental-features'
warning: unknown setting 'preallocate-contents'
warning: unknown setting 'experimental-features'
warning: unknown setting 'preallocate-contents'
$ nix build --no-link --keep-going --option build-use-sandbox relaxed -f /home/thiago/.cache/nixpkgs-review/pr-106074/build.nix
warning: unknown setting 'experimental-features'
warning: unknown setting 'preallocate-contents'
[12 built, 417 copied (1663.9 MiB), 350.3 MiB DL]
https://github.com/NixOS/nixpkgs/pull/106074
1 package built:
zettlr

warning: unknown setting 'experimental-features'
warning: unknown setting 'preallocate-contents'
$ nix-shell /home/thiago/.cache/nixpkgs-review/pr-106074/shell.nix
warning: unknown setting 'experimental-features'
warning: unknown setting 'preallocate-contents'
these paths will be fetched (0.42 MiB download, 2.39 MiB unpacked):
  /nix/store/63fv8bz35y6nkyif07mym7646n6qk4ns-bash-interactive-4.4-p23-dev
  /nix/store/82lxhlys1kvkvk9xlf8qd3ri6lwa43d3-bash-interactive-4.4-p23-info
  /nix/store/ab516d4hzp1z7nq8wqq3igzgagmnrc8j-bash-interactive-4.4-p23-doc
copying path '/nix/store/82lxhlys1kvkvk9xlf8qd3ri6lwa43d3-bash-interactive-4.4-p23-info' from 'https://cache.nixos.org'...
copying path '/nix/store/ab516d4hzp1z7nq8wqq3igzgagmnrc8j-bash-interactive-4.4-p23-doc' from 'https://cache.nixos.org'...
copying path '/nix/store/63fv8bz35y6nkyif07mym7646n6qk4ns-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...

@tfmoraes
Copy link
Contributor

tfmoraes commented Dec 6, 2020

@sternenseemann, I think it's a good idea to add pandoc and latex as dependencies since Zettlr uses them to export to pdf, html, odf, doc, etc. I did a little adaptation to your derivation but it's not adding pandoc neither latex into the AppImage FHS. Maybe it's necessary more adaptions:

{ appimageTools
, lib
, fetchurl
, gtk3
, gsettings-desktop-schemas
, withPandoc ? true
, pandoc
, haskellPackages
, withLatex ? true
, texlive
}:
let
  pname = "zettlr";
  version = "1.8.1";
  name = "${pname}-${version}";
  src = fetchurl {
    url = "https://github.com/Zettlr/Zettlr/releases/download/v${version}/Zettlr-${version}-x86_64.appimage";
    sha256 = "0r4w6jbhgs0z7shl44lr31j9n0x6j8nlj20shlmchwkf83wksffx";
  };
  appimageContents = appimageTools.extractType2 {
    inherit name src;
  };
in
appimageTools.wrapType2 rec {
  inherit name src;

  profile = ''
    export XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS
  '';

  multiPkgs = null; # no 32bit needed
  extraPkgs = p: (appimageTools.defaultFhsEnvArgs.multiPkgs p)
    ++ lib.optional withPandoc [
    p.hello
    p.pandoc
    p.haskellPackages.pandoc-citeproc
  ]
    ++ lib.optional withLatex [
    p.texlive.combined.scheme-medium
  ];

  extraInstallCommands = ''
    mv $out/bin/{${name},${pname}}
    install -m 444 -D ${appimageContents}/Zettlr.desktop $out/share/applications/zettlr.desktop
    install -m 444 -D ${appimageContents}/Zettlr.png $out/share/icons/hicolor/512x512/apps/zettlr.png
    substituteInPlace $out/share/applications/zettlr.desktop --replace 'Exec=AppRun' 'Exec=${pname}'
  '';

  meta = with lib; {
    description = "A markdown editor for writing academic texts and taking notes";
    homepage = "https://www.zettlr.com";
    platforms = [ "x86_64-linux" ];
    license = licenses.gpl3;
    maintainers = with maintainers; [ tfmoraes ];
  };
}

@tfmoraes
Copy link
Contributor

tfmoraes commented Dec 6, 2020

Doing this it works, but latex and pandoc are not optional anymore:

  extraPkgs = p: (appimageTools.defaultFhsEnvArgs.multiPkgs p)
    ++ [
    p.pandoc
    p.haskellPackages.pandoc-citeproc
    p.texlive.combined.scheme-medium
  ];

@sternenseemann
Copy link
Member Author

I think making this optional isn't really necessary, since exporting is a pretty vital function, isn't it? I'd do the texlive differently though, so it's easier to override in case someone wants to use their system texlive rather than scheme-medium. What do you think?

I think the best solution is to do something like this in all-packages.nix:

   zettlr = callPackage ../applications/misc/zettlr {
    texlive = texlive.combined.scheme-medium;
   };

@tfmoraes
Copy link
Contributor

tfmoraes commented Dec 6, 2020

I think you are correct.

@sternenseemann
Copy link
Member Author

LaTeX based export is still broken (PDF). Will have to investigate further.

@tfmoraes
Copy link
Contributor

tfmoraes commented Dec 7, 2020

If it's the same problem I have here it's because Zettlr is not finding Times new roman font. I changed to Liberation Serif and it not worked too.

@sternenseemann
Copy link
Member Author

Seems like adding the needed font to extraPackages is necessary… I've force pushed a solution, but I don't really like it and there is probably a better way to do this, but I don't really know anything about appimage and appimage tools in nixpkgs…

@tfmoraes
Copy link
Contributor

I tested here and it's working. It's not a bad solution, your solution allows to override the fonts. I think it would be better if AppImage exported all system fonts to the FHS, but I think it's not possible to do that today. My review is positive, congratulations.

@tfmoraes
Copy link
Contributor

/marvin opt-in
/status needs_reviewer

@thiagokokada
Copy link
Contributor

@sternenseemann Can you solve the merge conflict?

@tfmoraes
Copy link
Contributor

Everything is working:

nix-shell -p nixpkgs-review --run "nixpkgs-review pr 106074"                                                                          
this path will be fetched (0.04 MiB download, 0.15 MiB unpacked):
  /nix/store/hma4whbv7bq92xysiz8lafpvcw9xfr96-nixpkgs-review-2.5.0
copying path '/nix/store/hma4whbv7bq92xysiz8lafpvcw9xfr96-nixpkgs-review-2.5.0' from 'https://cache.nixos.org'...
$ git -c fetch.prune=false fetch --force https://github.com/NixOS/nixpkgs master:refs/nixpkgs-review/0 pull/106074/head:refs/nixpkgs-review/1
remote: Enumerating objects: 2162, done.
remote: Counting objects: 100% (2162/2162), done.
remote: Total 3873 (delta 2162), reused 2162 (delta 2162), pack-reused 1711
Receiving objects: 100% (3873/3873), 2.60 MiB | 2.31 MiB/s, done.
Resolving deltas: 100% (2813/2813), completed with 825 local objects.
From https://github.com/NixOS/nixpkgs
   ae46445e624..e71df047a0e  master                -> refs/nixpkgs-review/0
 + d27486656c3...4e95613bcc8 refs/pull/106074/head -> refs/nixpkgs-review/1  (forced update)
$ git worktree add /home/thiago/.cache/nixpkgs-review/pr-106074-1/nixpkgs e71df047a0e0244a6b84bba506d0284fd093deb5
Preparing worktree (detached HEAD e71df047a0e)
HEAD is now at e71df047a0e Merge pull request #107896 from mmahut/terraform-provider-vercel
$ nix-env -f /home/thiago/.cache/nixpkgs-review/pr-106074-1/nixpkgs -qaP --xml --out-path --show-trace
$ git merge --no-commit 4e95613bcc801419e2c73c67174831751553fe1a
Updating e71df047a0e..4e95613bcc8
Fast-forward
 pkgs/applications/misc/zettlr/default.nix | 15 +++++++++------
 pkgs/top-level/all-packages.nix           |  5 ++++-
 2 files changed, 13 insertions(+), 7 deletions(-)
$ nix-env -f /home/thiago/.cache/nixpkgs-review/pr-106074-1/nixpkgs -qaP --xml --out-path --show-trace --meta
1 package updated:
zettlr (1.7.5 → 1.8.1)

$ nix --experimental-features nix-command build --no-link --keep-going --option build-use-sandbox relaxed -f /home/thiago/.cache/nixpkgs-review/pr-106074-1/build.nix

Link to currently reviewing PR:
https://github.com/NixOS/nixpkgs/pull/106074

1 package built:
zettlr

@thiagokokada
Copy link
Contributor

Result of nixpkgs-review pr 106074 1

1 package built:
  • zettlr

@thiagokokada
Copy link
Contributor

There is a version 1.8.4 available, but we could merge this first and update it in another PR.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/312

@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 106074 run on x86_64-linux 1

1 package built:
  • zettlr

Some files in the appimage changed from 'zettlr' to 'Zettlr', keeping
them as lowercase in package output for consistency.

Add texlive and pandoc{,-citeproc} for PDF export.
@sternenseemann sternenseemann changed the title zettlr: 1.7.5 -> 1.8.1 zettlr: 1.7.5 -> 1.8.7 Feb 16, 2021
@sternenseemann
Copy link
Member Author

Finally had some motivation to look at this again. I've updated to 1.8.7 which has come out in the meantime and investigated the fonts issue again. Seems like this was possibly a Zettlr bug since buildFHSUserEnvBubbleWrap does bind /etc/fonts in the output image, so globally installed fonts should work as expected.

Anyways, with 1.8.7 PDF export works again without adding a list of fonts to the image!

@tfmoraes
Copy link
Contributor

Cool @sternenseemann! I tested here and it's working, exporting to PDF and ODT. Thanks!

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/349

@SuperSandro2000 SuperSandro2000 merged commit f5e69e0 into NixOS:master Feb 18, 2021
@sternenseemann sternenseemann deleted the zettlr-1.8.1 branch February 18, 2021 11:40
@sternenseemann sternenseemann restored the zettlr-1.8.1 branch July 24, 2021 13:36
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.

None yet

5 participants