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

Fix: allow top-level empty follows (#50)

authored by oeiuwq.com and committed by

GitHub ea470406 22d82d5e

+17 -4
+4 -2
dev/modules/_lib/default.nix
··· 41 41 _: input: 42 42 mergeNonEmptyAttrs input { 43 43 follows = { 44 - testEmpty = v: v == null; # allow empty follows string 44 + testEmpty = v: !builtins.isString v; 45 45 }; 46 46 inputs = nonEmptyInputs input; 47 47 } ··· 68 68 flake = false; 69 69 }; 70 70 }; 71 - follows = { }; 71 + follows = { 72 + testEmpty = x: !builtins.isString x; 73 + }; 72 74 inputs = nonEmptyInputs input; 73 75 } 74 76 );
+11
dev/modules/unit-tests/inputsExpr.nix
··· 68 68 }; 69 69 }; 70 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 + 71 82 in 72 83 { 73 84 flake = { inherit tests; };
+2 -2
modules/options/inputs.nix
··· 2 2 let 3 3 follows-option = lib.mkOption { 4 4 description = "flake input path to follow"; 5 - default = ""; 6 - type = lib.types.str; 5 + default = null; 6 + type = lib.types.nullOr lib.types.str; 7 7 }; 8 8 9 9 inputs-follow-option = lib.mkOption {