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