aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.envrc1
-rw-r--r--.gitignore2
-rw-r--r--README.md3
-rw-r--r--class/.gitignore5
-rw-r--r--class/flake.nix31
-rw-r--r--flake.lock111
-rw-r--r--flake.nix55
-rw-r--r--haskell/.envrc1
-rw-r--r--haskell/app/Main.hs6
-rw-r--r--haskell/flake.nix74
-rw-r--r--haskell/package.yaml54
-rw-r--r--haskell/src/Prolog.hs54
-rw-r--r--paper/.envrc1
-rw-r--r--paper/.gitignore3
-rw-r--r--paper/flake.nix44
-rw-r--r--slides/.envrc1
-rw-r--r--slides/.gitignore3
-rw-r--r--slides/flake.nix47
-rw-r--r--tex/.envrc1
-rw-r--r--tex/.gitignore2
-rw-r--r--tex/flake.nix34
21 files changed, 533 insertions, 0 deletions
diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..a5dbbcb
--- /dev/null
+++ b/.envrc
@@ -0,0 +1 @@
+use flake .
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2bbdbfe
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.direnv
+result
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6ccb995
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# Templates
+
+Various project templates for use with `nix flake init -t git://git.mathematicaster.org/templates#<template>`.
diff --git a/class/.gitignore b/class/.gitignore
new file mode 100644
index 0000000..8c9f564
--- /dev/null
+++ b/class/.gitignore
@@ -0,0 +1,5 @@
+lectures/*.pdf
+result
+.direnv
+.latex-build
+*/.latex-build
diff --git a/class/flake.nix b/class/flake.nix
new file mode 100644
index 0000000..fa9cc16
--- /dev/null
+++ b/class/flake.nix
@@ -0,0 +1,31 @@
+{
+ description = "TeX project";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ latex-utils.url = "github:jmmaloney4/latex-utils";
+ systems.url = "github:nix-systems/default";
+ };
+
+ outputs =
+ inputs@{ self, flake-parts, ... }:
+ flake-parts.lib.mkFlake { inherit self inputs; } {
+ systems = import inputs.systems;
+
+ imports = [ inputs.latex-utils.modules.flake.latex-utils ];
+
+ latex-utils = {
+ enableVSCode = false;
+ extraTexPackages = [ "scheme-full" ];
+ };
+
+ perSystem =
+ { pkgs, config, ... }:
+ {
+
+ devShells.default = pkgs.mkShellNoCC { inputsFrom = [ config.latex-utils.unifiedTexShell ]; };
+
+ };
+ };
+}
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..df1bfa5
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,111 @@
+{
+ "nodes": {
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": "nixpkgs-lib"
+ },
+ "locked": {
+ "lastModified": 1769996383,
+ "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "57928607ea566b5db3ad13af0e57e921e6b12381",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1772033997,
+ "narHash": "sha256-Xot3pxYB8kBUc1EQPVgiG+oxF4GdX7xCHVIJyw6iOmw=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "2d2a3ff32c216e3f85934fb9a61b6687828d3493",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-lib": {
+ "locked": {
+ "lastModified": 1769909678,
+ "narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=",
+ "owner": "nix-community",
+ "repo": "nixpkgs.lib",
+ "rev": "72716169fe93074c333e8d0173151350670b824c",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "nixpkgs.lib",
+ "type": "github"
+ }
+ },
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1770107345,
+ "narHash": "sha256-tbS0Ebx2PiA1FRW8mt8oejR0qMXmziJmPaU1d4kYY9g=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "4533d9293756b63904b7238acb84ac8fe4c8c2c4",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-parts": "flake-parts",
+ "nixpkgs": "nixpkgs",
+ "systems": "systems",
+ "treefmt-nix": "treefmt-nix"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ },
+ "treefmt-nix": {
+ "inputs": {
+ "nixpkgs": "nixpkgs_2"
+ },
+ "locked": {
+ "lastModified": 1770228511,
+ "narHash": "sha256-wQ6NJSuFqAEmIg2VMnLdCnUc0b7vslUohqqGGD+Fyxk=",
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "rev": "337a4fe074be1042a35086f15481d763b8ddc0e7",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..ed95723
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,55 @@
+{
+ description = "Project templates";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ treefmt-nix.url = "github:numtide/treefmt-nix";
+ systems.url = "github:nix-systems/default";
+ };
+
+ outputs =
+ inputs@{ self, flake-parts, ... }:
+ flake-parts.lib.mkFlake { inherit self inputs; } {
+ systems = import inputs.systems;
+
+ imports = [ inputs.treefmt-nix.flakeModule ];
+
+ flake.templates = {
+ class = {
+ description = "Class template";
+ path = ./class;
+ };
+ paper = {
+ description = "TeX paper template";
+ path = ./paper;
+ };
+ tex = {
+ description = "Generic TeX projects";
+ path = ./tex;
+ };
+ };
+
+ perSystem =
+ { config, pkgs, ... }:
+ {
+ treefmt = {
+ programs = {
+ nixfmt = {
+ enable = true;
+ strict = true;
+ };
+ };
+ };
+
+ devShells.default = pkgs.mkShellNoCC {
+ inputsFrom = [ config.treefmt.build.devShell ];
+ nativeBuildInputs = with pkgs; [
+ nixd
+ deadnix
+ ];
+ };
+
+ };
+ };
+}
diff --git a/haskell/.envrc b/haskell/.envrc
new file mode 100644
index 0000000..a5dbbcb
--- /dev/null
+++ b/haskell/.envrc
@@ -0,0 +1 @@
+use flake .
diff --git a/haskell/app/Main.hs b/haskell/app/Main.hs
new file mode 100644
index 0000000..571a6f1
--- /dev/null
+++ b/haskell/app/Main.hs
@@ -0,0 +1,6 @@
+module Main
+ ( main
+ ) where
+
+main :: IO ()
+main = undefined
diff --git a/haskell/flake.nix b/haskell/flake.nix
new file mode 100644
index 0000000..a637cde
--- /dev/null
+++ b/haskell/flake.nix
@@ -0,0 +1,74 @@
+{
+ description = "Haskell project";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs";
+ nix-filter.url = "github:numtide/nix-filter";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ systems.url = "github:nix-systems/default";
+ };
+
+ outputs =
+ inputs@{
+ self,
+ flake-parts,
+ nixpkgs,
+ nix-filter,
+ ...
+ }:
+ flake-parts.lib.mkFlake { inherit self inputs; } {
+ systems = import inputs.systems;
+
+ flake.overlays.default = final: prev: {
+ haskellPackages = prev.haskellPackages.extend (
+ hfinal: _hprev: {
+ PROJECT =
+ let
+ src = nix-filter {
+ root = ./.;
+ include = [
+ "src"
+ "app"
+ "package.yaml"
+ "PROJECT.cabal"
+ ];
+ };
+ in
+ hfinal.callCabal2nix "PROJECT" src { };
+ }
+ );
+ };
+
+ perSystem =
+ {
+ config,
+ pkgs,
+ system,
+ ...
+ }:
+ {
+ _module.args.pkkgs = import nixpkgs {
+ inherit system;
+ overlays = [ self.overlays.default ];
+ };
+
+ packages = rec {
+ default = PROJECT;
+ inherit (pkgs.haskellPackages) PROJECT;
+ };
+
+ devShells.default = pkgs.haskellPackages.shellFor {
+ packages = ps: [ ];
+ withHoogle = true;
+ buildInputs = with pkgs.haskellPackages; [
+ cabal-install
+ hpack
+ hlint
+ fast-tags
+ pkgs.haskell-language-server
+ ];
+ };
+
+ };
+ };
+}
diff --git a/haskell/package.yaml b/haskell/package.yaml
new file mode 100644
index 0000000..878a29b
--- /dev/null
+++ b/haskell/package.yaml
@@ -0,0 +1,54 @@
+name: PROJECT
+version: 0.1.0.0
+license: MIT
+author: Chris Wells
+maintainer: "chris@mathematicaster.org"
+copyright: "2026 Chris Wells"
+
+dependencies:
+ - base >= 4.7 && < 5
+
+language: GHC2021
+
+ghc-options:
+ - -Wall
+ - -Wcompat
+ - -Widentities
+ - -Wincomplete-record-updates
+ - -Wincomplete-uni-patterns
+ - -Wmissing-home-modules
+ - -Wpartial-fields
+ - -Wredundant-constraints
+
+default-extensions:
+ - BangPatterns
+ - DeriveGeneric
+ - DeriveLift
+ - DerivingStrategies
+ - DerivingVia
+ - DefaultSignatures
+ - FunctionalDependencies
+ - GADTs
+ - LambdaCse
+ - MultiWayIf
+ - OverloadedStrings
+ - PatternSynonyms
+ - RecordWildCards
+ - TypeFamilies
+ - UndecidableInstances
+ - ViewPatterns
+
+library:
+ source-dirs: src
+ dependencies:
+ - mtl
+
+executables:
+ PROJECT:
+ main: Main.hs
+ source-dirs: app
+ ghc-otpions:
+ - -threaded
+ - -O2
+ dependencies:
+ - PROJECT
diff --git a/haskell/src/Prolog.hs b/haskell/src/Prolog.hs
new file mode 100644
index 0000000..b435c5a
--- /dev/null
+++ b/haskell/src/Prolog.hs
@@ -0,0 +1,54 @@
+module Prolog
+ (
+ -- * Modules
+ module Control.Applicative
+ , module Control.Monad
+ , module Control.Monad.Identity
+ , module Control.Monad.IO.Class
+ , module Data.Bool
+ , module Data.Either
+ , module Data.Function
+ , module Data.Functor
+ , module Data.Maybe
+ -- * Types
+ , Generic
+ , Generic1
+ , Typeable
+ , Generically (..)
+ , IsString (..)
+ -- * Functions
+ , ffmap
+ , (<<$>>)
+ , (<<&>>)
+ ) where
+
+import Control.Applicative
+import Control.Monad
+import Control.Monad.Identity
+import Control.Monad.IO.Class
+import Data.Bool
+import Data.Either
+import Data.Function
+import Data.Functor
+import Data.Maybe
+import Data.Typeable (Typeable)
+import Data.String (IsString (..))
+import GHC.Generics
+
+
+-- | 'fmap' over nested functors
+ffmap :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
+ffmap = fmap fmap fmap
+{-# INLINE ffmap #-}
+
+-- | infix version of 'fmap'
+(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
+infixl 4 <<$>>
+(<<$>>) = ffmap
+{-# INLINE (<<$>>) #-}
+
+-- | flipped '(<<$>>)'
+(<<&>>) :: (Functor f, Functor g) => f (g a) -> (a -> b) -> f (g b)
+infixl 1 <<&>>
+(<<&>>) = flip (<<$>>)
+{-# INLINE (<<&>>) #-}
diff --git a/paper/.envrc b/paper/.envrc
new file mode 100644
index 0000000..a5dbbcb
--- /dev/null
+++ b/paper/.envrc
@@ -0,0 +1 @@
+use flake .
diff --git a/paper/.gitignore b/paper/.gitignore
new file mode 100644
index 0000000..3a2e38f
--- /dev/null
+++ b/paper/.gitignore
@@ -0,0 +1,3 @@
+.latex-build
+.direnv
+result
diff --git a/paper/flake.nix b/paper/flake.nix
new file mode 100644
index 0000000..db9d50f
--- /dev/null
+++ b/paper/flake.nix
@@ -0,0 +1,44 @@
+{
+ description = "TeX paper";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ latex-utils.url = "github:jmmaloney4/latex-utils";
+ systems.url = "github:nix-systems/default";
+ };
+
+ outputs =
+ inputs@{
+ self,
+ flake-parts,
+ latex-utils,
+ ...
+ }:
+ flake-parts.lib.mkFlake { inherit self inputs; } {
+ systems = import inputs.systems;
+
+ imports = [ latex-utils.modules.flake.latex-utils ];
+
+ latex-utils = {
+ enableVSCode = false;
+ documents = [
+ {
+ name = "main.pdf";
+ src = ./.;
+ extraTexPackages = [ ];
+ }
+ ];
+ };
+
+ perSystem =
+ { config, pkgs, ... }:
+ {
+ devShells.default = pkgs.mkShellNoCC {
+ inputsFrom = [ config.latex-utils.unifiedTexShell ];
+ nativeBuildInputs = [ ];
+ };
+ };
+
+ };
+}
diff --git a/slides/.envrc b/slides/.envrc
new file mode 100644
index 0000000..a5dbbcb
--- /dev/null
+++ b/slides/.envrc
@@ -0,0 +1 @@
+use flake .
diff --git a/slides/.gitignore b/slides/.gitignore
new file mode 100644
index 0000000..3a2e38f
--- /dev/null
+++ b/slides/.gitignore
@@ -0,0 +1,3 @@
+.latex-build
+.direnv
+result
diff --git a/slides/flake.nix b/slides/flake.nix
new file mode 100644
index 0000000..f96e412
--- /dev/null
+++ b/slides/flake.nix
@@ -0,0 +1,47 @@
+{
+ description = "TeX paper";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ latex-utils.url = "github:jmmaloney4/latex-utils";
+ systems.url = "github:nix-systems/default";
+ };
+
+ outputs =
+ inputs@{
+ self,
+ nixpkgs,
+ flake-parts,
+ latex-utils,
+ ...
+ }:
+ flake-parts.lib.mkFlake { inherit self inputs; } {
+ systems = import inputs.systems;
+
+ imports = [ latex-utils.modules.flake.latex-utils ];
+
+ latex-utils = {
+ enableVSCode = false;
+ documents = [
+ {
+ name = "slides.pdf";
+ src = ./.;
+ extraTexPackages = [ "beamer" ];
+ }
+ ];
+ };
+
+ perSystem =
+ { config, pkgs, ... }:
+ {
+
+ devShells.default = pkgs.mkShellNoCC {
+ inputsFrom = [ config.latex-utils.unifiedTexShell ];
+ nativeBuildInputs = [ ];
+ };
+
+ };
+
+ };
+}
diff --git a/tex/.envrc b/tex/.envrc
new file mode 100644
index 0000000..a5dbbcb
--- /dev/null
+++ b/tex/.envrc
@@ -0,0 +1 @@
+use flake .
diff --git a/tex/.gitignore b/tex/.gitignore
new file mode 100644
index 0000000..f8a9891
--- /dev/null
+++ b/tex/.gitignore
@@ -0,0 +1,2 @@
+.latex-build
+.direnv
diff --git a/tex/flake.nix b/tex/flake.nix
new file mode 100644
index 0000000..c5d9ed9
--- /dev/null
+++ b/tex/flake.nix
@@ -0,0 +1,34 @@
+{
+ description = "TeX project";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ latex-utils.url = "github:jmmaloney4/latex-utils";
+ systems.url = "github:nix-systems/default";
+ };
+
+ outputs =
+ inputs@{ self, flake-parts, ... }:
+ flake-parts.lib.mkFlake { inherit self inputs; } {
+ systems = import inputs.systems;
+
+ imports = [ inputs.latex-utils.modules.flake.latex-utils ];
+
+ latex-utils = {
+ enableVSCode = false;
+ extraTexPackages = [ "scheme-full" ];
+ };
+
+ perSystem =
+ { pkgs, config, ... }:
+ {
+
+ devShells.default = pkgs.mkShellNoCC {
+ inputsFrom = [ config.latex-utils.unifiedTexShell ];
+ nativeBuildInputs = [ ];
+ };
+
+ };
+ };
+}