added latexmk (because texlab ignores my config) and helix

This commit is contained in:
Dennis Frieberg 2025-05-14 15:24:18 +02:00
parent 19be2c3635
commit 79baa1b95a
Signed by: nerf
GPG key ID: 7C58AFED036072C5
4 changed files with 185 additions and 110 deletions

9
.helix/config.toml Normal file
View file

@ -0,0 +1,9 @@
theme = "dracula"
[editor]
text-width = 120
[editor.soft-wrap]
enable = true
wrap-at-text-width = true

19
.helix/languages.toml Normal file
View file

@ -0,0 +1,19 @@
# This does not work, i do not know why
# [language-server.texlab]
# command = "texlab"
# args = ["-vvv", "--log-file", "/tmp/texlabLog"]
# [language-server.texlab.config]
# build.onSave = true
# build.executable = "latexrun"
# build.args = ["--bibtex-cmd", "biber", "--latex-args","'-synctex=1'","%f"]
# build.forwardSearcAfter = true
# forwardSearch.executable = "zathura"
# forwardSearch.args = ["--synctex-forward", "%l:1:%f", "%p"]
# [language-server.ltex-ls-plus]
# command = "ltex-ls-plus"
# args = ["--log-file=", "/tmp/ltex.log"]
[[language]]
name = "latex"
language-servers = [ "texlab", "ltex-ls-plus" ]

View file

@ -8,7 +8,8 @@
}; };
}; };
outputs = {self, nixpkgs} : outputs =
{ self, nixpkgs }:
let let
# name to be used as identifier for editor environments and such # name to be used as identifier for editor environments and such
name = "Name"; name = "Name";
@ -16,7 +17,12 @@
version = builtins.substring 0 8 self.lastModifiedDate; version = builtins.substring 0 8 self.lastModifiedDate;
# System types to support. # System types to support.
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems; forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
@ -24,39 +30,61 @@
# Nixpkgs instantiated for supported system types. # Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in
in { {
packages = forAllSystems (system: packages = forAllSystems (
system:
let let
pkgs = nixpkgsFor.${system}; pkgs = nixpkgsFor.${system};
# LaTex package dependencies # LaTex package dependencies
latexdeps = {inherit (pkgs.texlive) scheme-small;}; latexdeps = { inherit (pkgs.texlive) scheme-full; };
latex = pkgs.texlive.combine latexdeps; latex = pkgs.texlive.combine latexdeps;
latexrun = pkgs.latexrun; latexrun = pkgs.latexrun;
in { in
{
default = pkgs.stdenvNoCC.mkDerivation { default = pkgs.stdenvNoCC.mkDerivation {
name = "output.pdf"; name = "output.pdf";
buildInputs = [latex latexrun pkgs.biber]; buildInputs = [
latex
latexrun
pkgs.biber
];
src = self; src = self;
buildPhase = '' buildPhase = ''
latexrun -o output.pdf src/Main.tex cd src
latexrun -o ../output.pdf Main.tex
''; '';
installPhase = '' installPhase = ''
cd ..
mkdir -p $out mkdir -p $out
cp output.pdf $out/output.pdf cp output.pdf $out/output.pdf
''; '';
}; };
} }
); );
devShells = forAllSystems (system: devShells = forAllSystems (
system:
let let
pkgs = nixpkgsFor.${system}; pkgs = nixpkgsFor.${system};
in ( rec { in
(rec {
# This sets the default devShell # This sets the default devShell
default = kakoune; default = helix;
helix = pkgs.mkShellNoCC {
inputsFrom = [ self.outputs.packages.${system}.default ];
packages = [
pkgs.helix
pkgs.ltex-ls-plus
pkgs.texlab
pkgs.git
pkgs.zathura
pkgs.fzf
];
};
kakoune = kakoune =
let let
texlab = pkgs.texlab; texlab = pkgs.callPackage (import ./texLab.nix) { };
latexTmpDir = "src/latex.out/"; latexTmpDir = "src/latex.out/";
myKakoune = myKakoune =
let let
@ -69,7 +97,7 @@
filetypes = ["latex"] filetypes = ["latex"]
roots = [".git"] roots = [".git"]
command = "texlab" command = "texlab"
# args = ["-vvvv", "--log-file", "/tmp/texlabLog"] args = ["-vvvv", "--log-file", "/tmp/texlabLog"]
settings_section = "texlab" settings_section = "texlab"
[language.latex.settings.texlab.build] [language.latex.settings.texlab.build]
onSave = true onSave = true
@ -102,12 +130,22 @@
}); });
in in
pkgs.kakoune.override { pkgs.kakoune.override {
plugins = with pkgs.kakounePlugins; [fzf-kak kak-lsp config]; plugins = with pkgs.kakounePlugins; [
fzf-kak
kakoune-lsp
config
];
}; };
in in
pkgs.mkShellNoCC { pkgs.mkShellNoCC {
inputsFrom = [self.outputs.packages.${system}.default]; inputsFrom = [ self.outputs.packages.${system}.default ];
packages = [myKakoune texlab pkgs.git pkgs.zathura pkgs.fzf]; packages = [
myKakoune
texlab
pkgs.git
pkgs.zathura
pkgs.fzf
];
# TODO only try to start the kakoune session if no session with that # TODO only try to start the kakoune session if no session with that
# name exists # name exists
shellHook = '' shellHook = ''
@ -118,19 +156,23 @@
alias vim="kak -c ${name}" alias vim="kak -c ${name}"
''; '';
}; };
texstudio = texstudio = pkgs.mkShellNoCC {
pkgs.mkShellNoCC { inputsFrom = [ self.outputs.packages.${system}.default ];
inputsFrom = [self.outputs.packages.${system}.default]; packages = [
packages = [pkgs.texstudio pkgs.git]; pkgs.texstudio
pkgs.git
];
shellHook = '' shellHook = ''
texstudio texstudio
''; '';
}; };
texmaker = texmaker = pkgs.mkShellNoCC {
pkgs.mkShellNoCC { inputsFrom = [ self.outputs.packages.${system}.default ];
inputsFrom = [self.outputs.packages.${system}.default]; packages = [
packages = [pkgs.texmaker pkgs.git]; pkgs.texmaker
pkgs.git
];
shellHook = '' shellHook = ''
texmaker texmaker
''; '';
@ -139,5 +181,3 @@
); );
}; };
} }

7
src/.latexmkrc Normal file
View file

@ -0,0 +1,7 @@
$pdf_mode=1;
# for lualatex
# $pdf_mode=4;
$pdf_previewer="start zathura %O %S";
$pdf_update_method=2;
$pdflatex="pdflatex --shell-escape --synctex=1 %O %S";
$lualatex="lualatex --shell-escape --synctex=1 %O %S";