Generate flake.nix from module options. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/
dendrix.oeiuwq.com/Dendritic.html
dendritic
nix
inputs
1{ lib, ... }:
2let
3 inherit (import ./../_lib lib) inputsExpr;
4
5 tests.inputsExpr."test on empty inputs" = {
6 expr = inputsExpr { };
7 expected = { };
8 };
9
10 tests.inputsExpr."test on input without follows" = {
11 expr = inputsExpr {
12 foo.url = "foo";
13 };
14 expected = {
15 foo.url = "foo";
16 };
17 };
18
19 tests.inputsExpr."test on input without flake=true" = {
20 expr = inputsExpr {
21 foo.url = "foo";
22 foo.flake = true;
23 };
24 expected = {
25 foo.url = "foo";
26 };
27 };
28
29 tests.inputsExpr."test on input without flake=false" = {
30 expr = inputsExpr {
31 foo.url = "foo";
32 foo.flake = false;
33 };
34 expected = {
35 foo.url = "foo";
36 foo.flake = false;
37 };
38 };
39
40 tests.inputsExpr."test on input with follows" = {
41 expr = inputsExpr {
42 foo.url = "foo";
43 foo.inputs.bar.follows = "baz";
44 };
45 expected = {
46 foo.url = "foo";
47 foo.inputs.bar.follows = "baz";
48 };
49 };
50
51 tests.inputsExpr."test on input with self follows" = {
52 expr = inputsExpr {
53 foo.follows = "bar";
54 };
55 expected = {
56 foo.follows = "bar";
57 };
58 };
59
60 tests.inputsExpr."test on input with follows to empty" = {
61 expr = inputsExpr {
62 foo.url = "foo";
63 foo.inputs.bar.follows = "";
64 };
65 expected = {
66 foo.url = "foo";
67 foo.inputs.bar.follows = "";
68 };
69 };
70
71 tests.inputsExpr."test top-input follows empty" = {
72 expr = inputsExpr {
73 foo.url = "foo";
74 bar.follows = "";
75 };
76 expected = {
77 foo.url = "foo";
78 bar.follows = "";
79 };
80 };
81
82in
83{
84 flake = { inherit tests; };
85}