Skip to content

Commit

Permalink
typora: add launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
liberodark committed Dec 5, 2024
1 parent 7625dbb commit 249abb2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pkgs/by-name/ty/typora/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
, expat
, alsa-lib
, buildFHSEnv
, writeTextFile
}:

let
Expand Down Expand Up @@ -78,6 +79,21 @@ let
'';
};

launchScript = writeTextFile {
name = "typora-launcher";
executable = true;
text = ''
#!${stdenv.shell}
XDG_CONFIG_HOME=''${XDG_CONFIG_HOME:-~/.config}
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;

Expand All @@ -88,7 +104,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
'';
Expand Down

0 comments on commit 249abb2

Please sign in to comment.