Formatting

This commit is contained in:
Nox Sluijtman 2025-04-18 13:51:02 +02:00
parent 57d373b305
commit fc54843031
Signed by: Egg
SSH key fingerprint: SHA256:2sG9X3C7Xvq2svGumz1/k7cm8l4G9+qAtAeugqB4J9M
4 changed files with 139 additions and 104 deletions

View file

@ -1,23 +1,26 @@
{ description = "My collection of flake templates"; {
outputs = { self }: { description = "My collection of flake templates";
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";
}; };
defaultTemplate = self.templates.trivial;
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;
};
} }

View file

@ -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 = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils}: outputs =
flake-utils.lib.eachDefaultSystem (system: {
let pkgs = import nixpkgs { inherit system; }; self,
compiler = throw "add compiler version here"; nixpkgs,
in { flake-utils,
packages = { }:
default = pkgs.haskell.packages.${compiler}.mkDerivation rec { flake-utils.lib.eachDefaultSystem (
pname = throw "insert haskell package name here\nderived from the .cabal file"; system:
version = "0.1.0.0"; let
src = ./.; pkgs = import nixpkgs { inherit system; };
isLibrary = false; compiler = throw "add compiler version here";
isExecutable = true; in
executableHaskellDepends = with pkgs.haskellPackages; [ {
base packages = {
]; default = pkgs.haskell.packages.${compiler}.mkDerivation rec {
license = pkgs.lib.licenses.agpl3Only; pname = throw "insert haskell package name here\nderived from the .cabal file";
mainProgram = pname; 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 { devShells.default = pkgs.mkShell {
buildInputs = with pkgs.haskellPackages; [ buildInputs = with pkgs.haskellPackages; [
base base
cabal-install cabal-install
ghc ghc
haskell-language-server haskell-language-server
cabal2nix cabal2nix
]; ];
}; };
}); }
);
} }

View file

@ -1,48 +1,60 @@
# inspired by https://flyx.org/nix-flakes-latex/ # inspired by https://flyx.org/nix-flakes-latex/
{ description = "A latex template"; {
description = "A latex template";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils}: outputs =
flake-utils.lib.eachDefaultSystem (system: {
let pkgs = import nixpkgs { inherit system; }; self,
texInput = "main"; nixpkgs,
# If you're not lazy, figure out what dependencies you need. flake-utils,
# If you are lazy, just take the full scheme. }:
tex = (pkgs.texlive.combine { flake-utils.lib.eachDefaultSystem (
inherit (pkgs.texlive) scheme-full; system:
#scheme-basic latex-bin latexmk; let
}); pkgs = import nixpkgs { inherit system; };
in { texInput = "main";
packages = rec { # If you're not lazy, figure out what dependencies you need.
document = pkgs.stdenvNoCC.mkDerivation rec { # If you are lazy, just take the full scheme.
pname = throw "put document name here"; tex = (
version = "0.0"; pkgs.texlive.combine {
src = ./src; inherit (pkgs.texlive) scheme-full;
buildInputs = [ #scheme-basic latex-bin latexmk;
tex }
]; );
buildPhase = '' in
mkdir -p .cache/texmf-var {
env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \ packages = rec {
latexmk -interaction=nonstopmode -lualatex \ document = pkgs.stdenvNoCC.mkDerivation rec {
${texInput}.tex pname = throw "put document name here";
''; version = "0.0";
installPhase = '' src = ./src;
mkdir -p $out buildInputs = [
cp ${texInput}.pdf $out/${pname}.pdf tex
''; ];
}; buildPhase = ''
default = document; 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 { devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
texlab # my language server of choice texlab # my language server of choice
tex tex
]; ];
}; };
}); }
);
} }

View file

@ -1,21 +1,31 @@
{ description = "Extremely basic flake"; {
description = "Extremely basic flake";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils}: outputs =
flake-utils.lib.eachDefaultSystem (system: {
let pkgs = import nixpkgs { inherit system; }; self,
in { nixpkgs,
packages = { flake-utils,
default = throw "put derivation information here"; }:
}; flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
packages = {
default = throw "put derivation information here";
};
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
(throw "put packages here") (throw "put packages here")
]; ];
}; };
}); }
);
} }