diff --git a/flake.nix b/flake.nix index 173ba69..c8b5334 100644 --- a/flake.nix +++ b/flake.nix @@ -1,23 +1,26 @@ -{ description = "My collection of flake templates"; - outputs = { self }: { - templates = { +{ + description = "My collection of flake templates"; + outputs = + { self }: + { + templates = { + + latex = { + path = ./latex; + description = "A fairly basic latex flake"; + }; + + trivial = { + path = ./trivial; + description = "What I consider to be the bare minimum flake"; + }; + + haskell = { + path = ./haskell; + description = "A basic Haskell flake"; + }; - latex = { - path = ./latex; - description = "A fairly basic latex flake"; }; - - trivial = { - path = ./trivial; - description = "What I consider to be the bare minimum flake"; - }; - - haskell = { - path = ./haskell; - description = "A basic Haskell flake"; - }; - + defaultTemplate = self.templates.trivial; }; - defaultTemplate = self.templates.trivial; - }; } diff --git a/haskell/flake.nix b/haskell/flake.nix index a1af629..7b283d9 100644 --- a/haskell/flake.nix +++ b/haskell/flake.nix @@ -1,38 +1,48 @@ -{ description = "A basic Haskell flake"; -# To be used in conjunction with cabal2nix +{ + description = "A basic Haskell flake"; + # To be used in conjunction with cabal2nix inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils}: - flake-utils.lib.eachDefaultSystem (system: - let pkgs = import nixpkgs { inherit system; }; - compiler = throw "add compiler version here"; - in { - packages = { - default = pkgs.haskell.packages.${compiler}.mkDerivation rec { - pname = throw "insert haskell package name here\nderived from the .cabal file"; - version = "0.1.0.0"; - src = ./.; - isLibrary = false; - isExecutable = true; - executableHaskellDepends = with pkgs.haskellPackages; [ - base - ]; - license = pkgs.lib.licenses.agpl3Only; - mainProgram = pname; - }; - }; + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + compiler = throw "add compiler version here"; + in + { + packages = { + default = pkgs.haskell.packages.${compiler}.mkDerivation rec { + pname = throw "insert haskell package name here\nderived from the .cabal file"; + version = "0.1.0.0"; + src = ./.; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = with pkgs.haskellPackages; [ + base + ]; + license = pkgs.lib.licenses.agpl3Only; + mainProgram = pname; + }; + }; - devShells.default = pkgs.mkShell { - buildInputs = with pkgs.haskellPackages; [ - base - cabal-install - ghc - haskell-language-server - cabal2nix - ]; - }; + devShells.default = pkgs.mkShell { + buildInputs = with pkgs.haskellPackages; [ + base + cabal-install + ghc + haskell-language-server + cabal2nix + ]; + }; - }); + } + ); } diff --git a/latex/flake.nix b/latex/flake.nix index e2f0d1e..815e563 100644 --- a/latex/flake.nix +++ b/latex/flake.nix @@ -1,48 +1,60 @@ # inspired by https://flyx.org/nix-flakes-latex/ -{ description = "A latex template"; +{ + description = "A latex template"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils}: - flake-utils.lib.eachDefaultSystem (system: - let pkgs = import nixpkgs { inherit system; }; - texInput = "main"; - # If you're not lazy, figure out what dependencies you need. - # If you are lazy, just take the full scheme. - tex = (pkgs.texlive.combine { - inherit (pkgs.texlive) scheme-full; - #scheme-basic latex-bin latexmk; - }); - in { - packages = rec { - document = pkgs.stdenvNoCC.mkDerivation rec { - pname = throw "put document name here"; - version = "0.0"; - src = ./src; - buildInputs = [ - tex - ]; - buildPhase = '' - mkdir -p .cache/texmf-var - env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \ - latexmk -interaction=nonstopmode -lualatex \ - ${texInput}.tex - ''; - installPhase = '' - mkdir -p $out - cp ${texInput}.pdf $out/${pname}.pdf - ''; - }; - default = document; - }; + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + texInput = "main"; + # If you're not lazy, figure out what dependencies you need. + # If you are lazy, just take the full scheme. + tex = ( + pkgs.texlive.combine { + inherit (pkgs.texlive) scheme-full; + #scheme-basic latex-bin latexmk; + } + ); + in + { + packages = rec { + document = pkgs.stdenvNoCC.mkDerivation rec { + pname = throw "put document name here"; + version = "0.0"; + src = ./src; + buildInputs = [ + tex + ]; + buildPhase = '' + mkdir -p .cache/texmf-var + env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \ + latexmk -interaction=nonstopmode -lualatex \ + ${texInput}.tex + ''; + installPhase = '' + mkdir -p $out + cp ${texInput}.pdf $out/${pname}.pdf + ''; + }; + default = document; + }; - devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - texlab # my language server of choice - tex - ]; - }; + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + texlab # my language server of choice + tex + ]; + }; - }); + } + ); } diff --git a/trivial/flake.nix b/trivial/flake.nix index 3efbade..ee317bd 100644 --- a/trivial/flake.nix +++ b/trivial/flake.nix @@ -1,21 +1,31 @@ -{ description = "Extremely basic flake"; +{ + description = "Extremely basic flake"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils}: - flake-utils.lib.eachDefaultSystem (system: - let pkgs = import nixpkgs { inherit system; }; - in { - packages = { - default = throw "put derivation information here"; - }; + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + packages = { + default = throw "put derivation information here"; + }; - devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - (throw "put packages here") - ]; - }; + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + (throw "put packages here") + ]; + }; - }); + } + ); }