Skip to content

Commit

Permalink
✨ Added a LaTeX Nix template
Browse files Browse the repository at this point in the history
  • Loading branch information
theobori committed Nov 18, 2024
1 parent 46cc931 commit c64f662
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 7 deletions.
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
templates = {
xdp-c.description = "My template for building a XDP program in C";
python.description = "My template for a base project in Python";
latex.description = "My template for a base project in Latex";
};
};
}
5 changes: 0 additions & 5 deletions modules/home/cli/shells/fish/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ in
eval $pokemon_command
'';

hmg = ''
set current_gen (home-manager generations | head -n 1 | awk '{print $7}')
home-manager generations | awk '{print $7}' | tac | fzf --preview "echo {} | xargs -I % sh -c 'nvd --color=always diff $current_gen %' | xargs -I{} bash {}/activate"
'';

fish_command_not_found = ''
# If you run the command with comma, running the same command
# will not prompt for confirmation for the rest of the session
Expand Down
37 changes: 37 additions & 0 deletions templates/latex/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{ stdenv, texlive }:
stdenv.mkDerivation {
pname = "pname";
version = "0.0.1";

src = ./.;

buildInputs = [
(texlive.combine {
inherit (texlive)
scheme-medium
fourier
lastpage
etaremune
datetime2
;
})
];

buildPhase = ''
runHook preBuild
pdflatex my_pdf.tex
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out
mv my_pdf.pdf $out
runHook postInstall
'';
}
38 changes: 38 additions & 0 deletions templates/latex/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
treefmt-nix.url = "github:numtide/treefmt-nix";
flake-utils.url = "github:numtide/flake-utils";
};

outputs =
{
self,
nixpkgs,
treefmt-nix,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};

treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
{
packages = {
default = pkgs.callPackage ./. { };
};

devShells = {
default = pkgs.mkShell { packages = self.packages.${system}.default.buildInputs; };
};

formatter = treefmtEval.config.build.wrapper;

checks = {
formatting = treefmtEval.config.build.check self;
};
}
);
}
5 changes: 5 additions & 0 deletions templates/latex/treefmt.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ ... }:
{
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
}
2 changes: 1 addition & 1 deletion templates/python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}:
buildPythonPackage {
pname = "pname";
version = "version";
version = "0.0.1";
pyproject = true;

src = ./.;
Expand Down
2 changes: 1 addition & 1 deletion templates/xdp-c/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}:
stdenv.mkDerivation {
pname = "pname";
version = "version";
version = "0.0.1";

src = ./.;

Expand Down

0 comments on commit c64f662

Please sign in to comment.