flake.nix (2009B)
1 { 2 description = "Yann Mickael DOY's Bachelor Thesis flake"; 3 4 inputs = { 5 nixpkgs.url = "github:nixos/nixpkgs"; 6 }; 7 8 outputs = { self, nixpkgs }: 9 let 10 # Systems supported by this flake 11 systems = [ 12 "aarch64-darwin" 13 "aarch64-linux" 14 "x86_64-darwin" 15 "x86_64-linux" 16 ]; 17 18 # Map function for all systems 19 forAll = function: 20 nixpkgs.lib.genAttrs systems (system: 21 function nixpkgs.legacyPackages.${system} self.packages.${system}); 22 in 23 { 24 # Nix Formatter 25 formatter = forAll (pkgs: selfpkgs: pkgs.nixpkgs-fmt); 26 27 # Shells 28 devShells = forAll (pkgs: selfpkgs: { 29 default = pkgs.mkShell { 30 buildInputs = with selfpkgs; [ 31 deno 32 tesseract 33 mailcatcher 34 postgresql 35 bfhlatex 36 bfh-texlive 37 ]; 38 }; 39 }); 40 41 # My Flake Packages 42 packages = forAll (pkgs: selfpkgs: { 43 # Dependencies 44 deno = pkgs.deno; 45 tesseract = pkgs.tesseract; 46 mailcatcher = pkgs.mailcatcher; 47 postgresql = pkgs.postgresql; 48 49 # BFH Latex Distribution (texlive) 50 bfh-texlive = pkgs.texlive.combined.scheme-full.withPackages ( 51 ps: with ps; [ biblatex bfh-ci ] 52 ); 53 54 # LaTeX Build Script 55 bfhlatex = 56 let 57 bash = pkgs.stdenv.shell; 58 pdflatex = "${self.packages.${pkgs.system}.bfh-texlive}/bin/pdflatex"; 59 makeglossaries = "${self.packages.${pkgs.system}.bfh-texlive}/bin/makeglossaries"; 60 biber = "${pkgs.biber}/bin/biber"; 61 in 62 pkgs.writeScriptBin "bfhlatex" '' 63 #!${bash} 64 mkdir -p build 65 ${pdflatex} -halt-on-error -output-directory build $1.ltx \ 66 && ${biber} build/$1 \ 67 && ${makeglossaries} -d build $1 \ 68 && ${pdflatex} -halt-on-error -output-directory build $1.ltx 69 ''; 70 }); 71 }; 72 }