Generate flake.nix from module options. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/
dendrix.oeiuwq.com/Dendritic.html
dendritic
nix
inputs
1{ inputs, ... }:
2{
3 flake-file.inputs.devshell = {
4 url = "github:numtide/devshell";
5 inputs.nixpkgs.follows = "nixpkgs";
6 };
7
8 imports = [
9 inputs.devshell.flakeModule
10 ];
11
12 perSystem =
13 { pkgs, self', ... }:
14 {
15 devshells.default.commands = [
16 {
17 help = "regen all flake.nix on this repo";
18 package = self'.packages.regen;
19 }
20 {
21 help = "run a command on each sub flake";
22 package = self'.packages.each;
23 }
24 {
25 name = "fmt";
26 help = "format all files in repo";
27 command = "nix run ./dev#fmt --override-input flake-file .";
28 }
29 {
30 name = "update";
31 help = "update all flakes and prune locks";
32 command = ''
33 ${pkgs.lib.getExe self'.packages.each} nix run .#write-flake
34 ${pkgs.lib.getExe self'.packages.each} nix flake update
35 ${pkgs.lib.getExe self'.packages.each} nix run .#write-flake
36 '';
37 }
38 {
39 name = "check";
40 help = "run flake check";
41 command = "nix flake check ./dev --override-input flake-file .";
42 }
43 ];
44 };
45}