mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-30 08:44:31 +00:00
typora: fix (#362036)
This commit is contained in:
commit
e90ab5481b
@ -16,6 +16,7 @@
|
||||
, expat
|
||||
, alsa-lib
|
||||
, buildFHSEnv
|
||||
, writeTextFile
|
||||
}:
|
||||
|
||||
let
|
||||
@ -60,6 +61,7 @@ let
|
||||
pango
|
||||
cairo
|
||||
mesa
|
||||
libGL
|
||||
expat
|
||||
libxkbcommon
|
||||
]) ++ (with pkgs.xorg; [
|
||||
@ -73,10 +75,35 @@ let
|
||||
libxcb
|
||||
]);
|
||||
runScript = ''
|
||||
Typora $*
|
||||
Typora "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
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"
|
||||
|
||||
# Create config directories with proper permissions
|
||||
mkdir -p "$TYPORA_DICT_DIR"
|
||||
chmod 755 "$TYPORA_CONFIG_DIR"
|
||||
chmod 755 "$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
|
||||
'';
|
||||
};
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
inherit pname version;
|
||||
|
||||
@ -87,7 +114,7 @@ in stdenv.mkDerivation {
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
ln -s ${typoraFHS}/bin/typora-fhs $out/bin/typora
|
||||
ln -s ${launchScript} $out/bin/typora
|
||||
ln -s ${typoraBase}/share/ $out
|
||||
runHook postInstall
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user