/ docs / reference / templates.md
templates.md
  1  # Templates Reference
  2  
  3  Source: `nix/templates/`
  4  
  5  Available templates for `nix flake init`.
  6  
  7  ## default
  8  
  9  Full aleph setup with formatter, linter, devshell, and prelude.
 10  
 11  ```bash
 12  nix flake init -t github:straylight-software/aleph
 13  ```
 14  
 15  Features:
 16  
 17  - All flake modules imported
 18  - Formatter enabled
 19  - Devshell enabled
 20  - Prelude access via `config.aleph.prelude`
 21  
 22  ## minimal
 23  
 24  Just nixpkgs with aleph overlays. No formatter, no devshell.
 25  
 26  ```bash
 27  nix flake init -t github:straylight-software/aleph#minimal
 28  ```
 29  
 30  Features:
 31  
 32  - Only `nixpkgs` module imported
 33  - Minimal configuration
 34  - Good for adding straylight to existing projects
 35  
 36  ## nv
 37  
 38  NVIDIA development setup with CUDA SDK.
 39  
 40  ```bash
 41  nix flake init -t github:straylight-software/aleph#nv
 42  ```
 43  
 44  Features:
 45  
 46  - NVIDIA SDK enabled
 47  - CUDA packages available
 48  - GPU stdenvs accessible
 49  
 50  ## dhall-configured
 51  
 52  Configuration via Dhall instead of Nix.
 53  
 54  ```bash
 55  nix flake init -t github:straylight-software/aleph#dhall-configured
 56  ```
 57  
 58  ## nickel-configured
 59  
 60  Configuration via Nickel instead of Nix.
 61  
 62  ```bash
 63  nix flake init -t github:straylight-software/aleph#nickel-configured
 64  ```
 65  
 66  ## Template Contents
 67  
 68  ### default/flake.nix
 69  
 70  ```nix
 71  {
 72    description = "Project powered by aleph";
 73  
 74    inputs = {
 75      aleph.url = "github:straylight-software/aleph";
 76      nixpkgs.follows = "aleph/nixpkgs";
 77      flake-parts.follows = "aleph/flake-parts";
 78    };
 79  
 80    outputs = inputs@{ flake-parts, aleph, ... }:
 81      flake-parts.lib.mkFlake { inherit inputs; } {
 82        imports = [ aleph.modules.flake.default ];
 83        systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
 84  
 85        aleph = {
 86          formatter.enable = true;
 87          devshell.enable = true;
 88          nixpkgs.allow-unfree = true;
 89        };
 90  
 91        perSystem = { config, pkgs, ... }:
 92          let
 93            inherit (config.aleph) prelude;
 94          in {
 95            packages.default = pkgs.hello;
 96          };
 97      };
 98  }
 99  ```
100  
101  ### minimal/flake.nix
102  
103  ```nix
104  {
105    description = "Minimal project with aleph nixpkgs";
106  
107    inputs = {
108      aleph.url = "github:straylight-software/aleph";
109      nixpkgs.follows = "aleph/nixpkgs";
110      flake-parts.follows = "aleph/flake-parts";
111    };
112  
113    outputs = inputs@{ flake-parts, aleph, ... }:
114      flake-parts.lib.mkFlake { inherit inputs; } {
115        imports = [ aleph.modules.flake.nixpkgs ];
116        systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
117  
118        aleph.nixpkgs.allow-unfree = true;
119  
120        perSystem = { pkgs, ... }: {
121          packages.default = pkgs.hello;
122        };
123      };
124  }
125  ```