Generate flake.nix from module options. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ dendrix.oeiuwq.com/Dendritic.html
dendritic nix inputs

Fix typos and update option docs in readme (#41)

authored by

Peter Esselius and committed by
GitHub
6a7da815 c8fe40c4

+35 -15
+35 -15
README.md
··· 103 103 # That's it! Importing this module will add dendritic-setup inputs to your flake. 104 104 imports = [ inputs.flake-file.flakeModules.dendritic ]; 105 105 106 - # Define flake attributes on any flake-pars module: 106 + # Define flake attributes on any flake-parts module: 107 107 flake-file = { 108 108 description = "My Awesome Flake"; 109 109 inputs.nixpkgs.url = lib.mkDefault "github:NixOS/nixpkgs/nixpkgs-unstable"; ··· 146 146 - Enables [`flake-parts`](https://github.com/hercules-ci/flake-parts). 147 147 - Enables [`flake-aspects`](https://github.com/vic/flake-aspects). 148 148 - Enables [`den`](https://github.com/vic/den). 149 - - Sets `output` function to `import-tree ./modules`. 149 + - Sets `outputs` to `inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules)`. 150 150 - Adds `treefmt-nix` input. 151 - - Enables formatters: `nixfmt`, `deadnix`, and `nixf-diagnose`. 151 + - Enables formatters: `nixfmt`, `deadnix`, `prettier` and `nixf-diagnose`. 152 152 153 153 ### Flake Templates 154 154 ··· 194 194 195 195 Options use the same attributes as the flake schema. See below for details. 196 196 197 - | Option | Description | 198 - | ----------------------------------------------- | --------------------------------- | 199 - | `flake-file.description` | Sets the flake description | 200 - | `flake-file.nixConfig` | Attrset for flake-level nixConfig | 201 - | `flake-file.inputs.<name>.url` | URL for a flake input | 202 - | `flake-file.inputs.<name>.flake` | Boolean, is input a flake? | 203 - | `flake-file.inputs.<name>.inputs.<dep>.follows` | Tree of dependencies to follow | 197 + | Option | Description | 198 + | ------------------------------------------------- | ----------------------------------------------------------- | 199 + | `flake-file.description` | Sets the flake description | 200 + | `flake-file.nixConfig` | Flake-level `nixConfig` (typed attrset) | 201 + | `flake-file.outputs` | Literal Nix code for `outputs` function | 202 + | `flake-file.formatter` | Function: `pkgs -> program` to format generated `flake.nix` | 203 + | `flake-file.do-not-edit` | Header comment added atop generated file | 204 + | `flake-file.inputs.<name>.url` | Source URL (e.g. `github:owner/repo`) | 205 + | `flake-file.inputs.<name>.type` | Reference type (`github`, `path`, etc.) | 206 + | `flake-file.inputs.<name>.owner` | Owner (for typed VCS refs) | 207 + | `flake-file.inputs.<name>.repo` | Repo name | 208 + | `flake-file.inputs.<name>.path` | Local path reference | 209 + | `flake-file.inputs.<name>.id` | Flake registry id | 210 + | `flake-file.inputs.<name>.dir` | Subdirectory within repo/path | 211 + | `flake-file.inputs.<name>.narHash` | NAR hash pin | 212 + | `flake-file.inputs.<name>.rev` | Commit hash pin | 213 + | `flake-file.inputs.<name>.ref` | Branch or tag pin | 214 + | `flake-file.inputs.<name>.host` | Custom host for git forges | 215 + | `flake-file.inputs.<name>.submodules` | Whether to fetch git submodules | 216 + | `flake-file.inputs.<name>.flake` | Boolean: is it a flake? (default true) | 217 + | `flake-file.inputs.<name>.follows` | Follow another input's value | 218 + | `flake-file.inputs.<name>.inputs.<dep>.follows` | Nested input follow tree | 219 + | `flake-file.inputs.<name>.inputs.<dep>.inputs...` | Recursively follow deeper deps | 220 + | `flake-file.write-hooks` | List of ordered hooks (by `index`) after writing | 221 + | `flake-file.check-hooks` | List of ordered hooks (by `index`) during check | 222 + | `flake-file.prune-lock.enable` | Enable automatic flake.lock pruning | 223 + | `flake-file.prune-lock.program` | Function building pruning executable | 204 224 205 225 Example: 206 226 207 227 ```nix 208 228 flake-file = { 209 229 description = "my awesome flake"; 210 - nixConfig = {}; # an attrset. currently not typed. 230 + nixConfig = {}; # attrset (free-form, typed as attrs) 211 231 inputs.<name>.url = "github:foo/bar"; 212 232 inputs.<name>.flake = false; 213 233 inputs.<name>.inputs.nixpkgs.follows = "nixpkgs"; ··· 219 239 220 240 --- 221 241 222 - ## About the Flake `output` function 242 + ## About the Flake `outputs` function 223 243 224 - The `flake-file.output` option is a literal Nix expression. You cannot convert a Nix function value into a string for including in the generated flake file. 244 + The `flake-file.outputs` option is a literal Nix expression. You cannot convert a Nix function value into a string for including in the generated flake file. 225 245 226 246 It defaults to: 227 247 ··· 273 293 274 294 ## Automatic flake.lock flattening 275 295 276 - You can use the `prune-lock` [options](https://github.com/vic/flake-file/blob/main/modules/options.nix) 296 + You can use the `prune-lock` [options](https://github.com/vic/flake-file/blob/main/modules/options/prune-lock.nix) 277 297 to specify a command that `flake-file` will use whenever your flake.nix file is generated 278 298 to flatten your flake.lock dependency tree. 279 299 ··· 288 308 imports = [ 289 309 inputs.flake-file.flakeModules.nix-auto-follow 290 310 # or optionally 291 - #inputs.flake-file.flakeModules.allfollow 311 + # inputs.flake-file.flakeModules.allfollow 292 312 ]; 293 313 } 294 314 ```