added nix flake template and modefied .gitignore
This commit is contained in:
parent
33dc65dce4
commit
49e91f2e1e
3 changed files with 115 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -301,3 +301,5 @@ TSWLatexianTemp*
|
||||||
# Uncomment the next line to have this generated file ignored.
|
# Uncomment the next line to have this generated file ignored.
|
||||||
#*Notes.bib
|
#*Notes.bib
|
||||||
|
|
||||||
|
# Nix buid output
|
||||||
|
/result
|
||||||
|
|
109
flake.nix
Normal file
109
flake.nix
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
{
|
||||||
|
description = "Put a short description here";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs = {
|
||||||
|
type = "indirect";
|
||||||
|
id = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {self, nixpkgs} :
|
||||||
|
let
|
||||||
|
#Generate a user-friendly version number.
|
||||||
|
version = builtins.substring 0 8 self.lastModifiedDate;
|
||||||
|
|
||||||
|
# System types to support.
|
||||||
|
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;
|
||||||
|
|
||||||
|
# Nixpkgs instantiated for supported system types.
|
||||||
|
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||||
|
|
||||||
|
in {
|
||||||
|
packages = forAllSystems (system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgsFor.${system};
|
||||||
|
# LaTex package dependencies
|
||||||
|
latexdeps = {inherit (pkgs.texlive) scheme-small;};
|
||||||
|
latex = pkgs.texlive.combine latexdeps;
|
||||||
|
latexrun = pkgs.latexrun;
|
||||||
|
in {
|
||||||
|
default = pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
name = "output.pdf";
|
||||||
|
buildInputs = [latex latexrun];
|
||||||
|
src = self;
|
||||||
|
buildPhase = ''
|
||||||
|
latexrun -o output.pdf src/Main.tex
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
cp output.pdf $out/output.pdf
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
devShells = forAllSystems (system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgsFor.${system};
|
||||||
|
# Needs to be in sync with latex dependencie above, Don't
|
||||||
|
# know how to fix this as we need to now the system to get
|
||||||
|
# the packages. The plus side is you can have different packages in your
|
||||||
|
# development environment than in your build one.
|
||||||
|
latexdeps = {inherit (pkgs.texlive) scheme-small;};
|
||||||
|
latex = pkgs.texlive.combine latexdeps;
|
||||||
|
latexrun = pkgs.latexrun;
|
||||||
|
|
||||||
|
in {
|
||||||
|
default =
|
||||||
|
let
|
||||||
|
texlab = pkgs.texlab;
|
||||||
|
myKakoune =
|
||||||
|
let
|
||||||
|
# this could also be done by generating toml with the
|
||||||
|
# nixpkgs lib, but I'm lazy
|
||||||
|
kak-lsp-config = pkgs.writeTextFile {
|
||||||
|
name = "kak-lsp-config.toml";
|
||||||
|
text = ''
|
||||||
|
[language.latex]
|
||||||
|
filetypes = ["latex"]
|
||||||
|
roots = [".git"]
|
||||||
|
command = "texlab"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
config = pkgs.writeTextFile (rec {
|
||||||
|
name = "kakrc.kak";
|
||||||
|
destination = "/share/kak/autoload/${name}";
|
||||||
|
text = ''
|
||||||
|
colorscheme solarized-dark
|
||||||
|
set global tabstop 2
|
||||||
|
set global indentwidth 2
|
||||||
|
eval %sh{kak-lsp --kakoune --session $kak_session -c ${kak-lsp-config}}
|
||||||
|
hook global WinSetOption filetype=(latex) %{
|
||||||
|
lsp-auto-hover-enable
|
||||||
|
lsb-enable-window
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
in
|
||||||
|
pkgs.kakoune.override {
|
||||||
|
plugins = with pkgs.kakounePlugins; [kak-lsp config];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.mkShellNoCC {
|
||||||
|
packages = [myKakoune texlab pkgs.git latex latexrun];
|
||||||
|
shellHook = ''
|
||||||
|
alias ..="cd .."
|
||||||
|
export KAKOUNE_CONFIG_DIR="/this/does/not/exist"
|
||||||
|
kak -d -s latexPackage &
|
||||||
|
alias vim="kak -c latexPackage"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
4
src/Main.tex
Normal file
4
src/Main.tex
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
\documentclass{scrartcl}
|
||||||
|
\begin{document}
|
||||||
|
Hi
|
||||||
|
\end{document}
|
Loading…
Reference in a new issue