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

typora: fix #362036

Merged
merged 2 commits into from
Dec 8, 2024
Merged

typora: fix #362036

merged 2 commits into from
Dec 8, 2024

Conversation

liberodark
Copy link
Contributor

@liberodark liberodark commented Dec 5, 2024

Fix partially : #362022

  • Fix open .md files
  • Fix LibGL issue
  • Add Launcher (Inspired by AUR)

Launcher add possibility to set :

# ~/.config/typora-flags.conf
--disable-gpu
--no-sandbox

Only is missing spell support :
https://support.typora.io/Spellcheck/
https://github.com/typora/dictionaries

If you have idea for fix this ?

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Dec 5, 2024
@liberodark liberodark force-pushed the typora branch 2 times, most recently from 7f8b5aa to 19108f6 Compare December 5, 2024 10:50
@liberodark
Copy link
Contributor Author

liberodark commented Dec 5, 2024

Also if you can backport this PR ?

@npulidomateo
Copy link
Contributor

@liberodark Thanks a lot for looking into this.

The spellcheck issue seems to be a permissions problem. Typora creates the folder ~/.config/Typora/typora-dictionaries and then tries to download the dictionaries there.

In my system that folder is created without write permissions (only read and execute permissions for everybody). If you give it write permissions then Typora installs the dictionaries with no problem.

@liberodark
Copy link
Contributor Author

@npulidomateo Thank you

What do you think with this :

launchScript = writeTextFile {
  name = "typora-launcher";
  executable = true;
  text = ''
    #!${stdenv.shell}
    
    # Configuration directory setup
    XDG_CONFIG_HOME=''${XDG_CONFIG_HOME:-~/.config}
    TYPORA_CONFIG_DIR="$XDG_CONFIG_HOME/Typora"
    TYPORA_DICT_DIR="$TYPORA_CONFIG_DIR/typora-dictionaries"
    
    # Remove existing read-only dictionary directory if it exists
    if [ -d "$TYPORA_DICT_DIR" ]; then
      rm -rf "$TYPORA_DICT_DIR"
    fi
    
    # Create config directories with proper permissions
    mkdir -p "$TYPORA_CONFIG_DIR"
    mkdir -p "$TYPORA_DICT_DIR"
    chmod 755 "$TYPORA_CONFIG_DIR"
    chmod 777 "$TYPORA_DICT_DIR"
    
    # Read user flags if they exist
    if [ -f "$XDG_CONFIG_HOME/typora-flags.conf" ]; then
      TYPORA_USER_FLAGS="$(sed 's/#.*//' "$XDG_CONFIG_HOME/typora-flags.conf" | tr '\n' ' ')"
    fi
    
    exec ${typoraFHS}/bin/typora-fhs "$@" $TYPORA_USER_FLAGS
  '';
};

@npulidomateo
Copy link
Contributor

@liberodark Sorry just read this. I like your suggestion better than mine. Let's go with yours.

@npulidomateo
Copy link
Contributor

@liberodark I checked again and Typora seems to create TYPORA_CONFIG_DIR already with write permission, so we only need to address TYPORA_DICT_DIR. I just tested it and chmod 755 "$TYPORA_DICT_DIR" already seems to work so 777 might be overkill?

Thanks again and good night!

Copy link
Contributor

@npulidomateo npulidomateo left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Contributor

@chewblacka chewblacka left a comment

Choose a reason for hiding this comment

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

LGTM

@chewblacka chewblacka added the 12.approvals: 2 This PR was reviewed and approved by two reputable people label Dec 7, 2024
@Aleksanaa Aleksanaa merged commit e90ab54 into NixOS:master Dec 8, 2024
39 of 40 checks passed
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Dec 8, 2024

Successfully created backport PR for release-24.11:

@nixpkgs-ci nixpkgs-ci bot mentioned this pull request Dec 8, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 12.approvals: 2 This PR was reviewed and approved by two reputable people backport release-24.11 Backport PR automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants