|
5 | 5 |
|
6 | 6 | inherit (lib) mkOption types;
|
7 | 7 |
|
| 8 | + portable-lib = import ./lib.nix { inherit lib; }; |
| 9 | + |
8 | 10 | dummyPkg =
|
9 | 11 | name:
|
10 | 12 | derivation {
|
|
21 | 23 | executable = "/usr/bin/echo"; # *giggles*
|
22 | 24 | args = [ "hello" ];
|
23 | 25 | };
|
| 26 | + assertions = [ |
| 27 | + { assertion = false; message = "you can't enable this for that reason"; } |
| 28 | + ]; |
| 29 | + warnings = [ |
| 30 | + "The `foo' service is deprecated and will go away soon!" |
| 31 | + ]; |
24 | 32 | };
|
25 | 33 | service2 = {
|
26 | 34 | process = {
|
|
32 | 40 | };
|
33 | 41 | service3 = {
|
34 | 42 | process = {
|
35 |
| - executable = dummyPkg "cowsay-ng" // { meta.mainProgram = "cowsay"; }; |
36 |
| - args = [ "!" ]; |
| 43 | + executable = "/bin/false"; |
| 44 | + args = []; |
| 45 | + }; |
| 46 | + services.exclacow = { |
| 47 | + process = { |
| 48 | + executable = dummyPkg "cowsay-ng" // { meta.mainProgram = "cowsay"; }; |
| 49 | + args = [ "!" ]; |
| 50 | + }; |
| 51 | + assertions = [ |
| 52 | + { assertion = false; message = "you can't enable this for such reason"; } |
| 53 | + ]; |
| 54 | + warnings = [ |
| 55 | + "The `bar' service is deprecated and will go away soon!" |
| 56 | + ]; |
37 | 57 | };
|
38 | 58 | };
|
39 | 59 | };
|
|
65 | 85 | args = [ "hello" ];
|
66 | 86 | };
|
67 | 87 | services = { };
|
| 88 | + assertions = [ |
| 89 | + { assertion = false; message = "you can't enable this for that reason"; } |
| 90 | + ]; |
| 91 | + warnings = [ |
| 92 | + "The `foo' service is deprecated and will go away soon!" |
| 93 | + ]; |
68 | 94 | };
|
69 | 95 | service2 = {
|
70 | 96 | process = {
|
71 | 97 | executable = "${dummyPkg "cowsay.sh"}";
|
72 | 98 | args = [ "world" ];
|
73 | 99 | };
|
74 | 100 | services = { };
|
| 101 | + assertions = [ ]; |
| 102 | + warnings = [ ]; |
75 | 103 | };
|
76 | 104 | service3 = {
|
77 | 105 | process = {
|
78 |
| - executable = "${dummyPkg "cowsay-ng"}/bin/cowsay"; |
79 |
| - args = [ "!" ]; |
| 106 | + executable = "/bin/false"; |
| 107 | + args = []; |
80 | 108 | };
|
81 |
| - services = { }; |
| 109 | + services.exclacow = { |
| 110 | + process = { |
| 111 | + executable = "${dummyPkg "cowsay-ng"}/bin/cowsay"; |
| 112 | + args = [ "!" ]; |
| 113 | + }; |
| 114 | + services = { }; |
| 115 | + assertions = [ |
| 116 | + { assertion = false; message = "you can't enable this for such reason"; } |
| 117 | + ]; |
| 118 | + warnings = [ "The `bar' service is deprecated and will go away soon!" ]; |
| 119 | + }; |
| 120 | + assertions = [ ]; |
| 121 | + warnings = [ ]; |
82 | 122 | };
|
83 | 123 | };
|
84 | 124 | };
|
85 | 125 |
|
| 126 | + assert |
| 127 | + portable-lib.getWarnings ["service1"] exampleEval.config.services.service1 == [ |
| 128 | + "in service1: The `foo' service is deprecated and will go away soon!" |
| 129 | + ]; |
| 130 | + |
| 131 | + assert |
| 132 | + portable-lib.getAssertions ["service1"] exampleEval.config.services.service1 == [ |
| 133 | + { message = "in service1: you can't enable this for that reason"; assertion = false; } |
| 134 | + ]; |
| 135 | + |
| 136 | + assert |
| 137 | + portable-lib.getWarnings ["service3"] exampleEval.config.services.service3 == [ |
| 138 | + "in service3.services.exclacow: The `bar' service is deprecated and will go away soon!" |
| 139 | + ]; |
| 140 | + assert |
| 141 | + portable-lib.getAssertions ["service3"] exampleEval.config.services.service3 == [ |
| 142 | + { message = "in service3.services.exclacow: you can't enable this for such reason"; assertion = false; } |
| 143 | + ]; |
| 144 | + |
| 145 | + |
86 | 146 | "ok";
|
87 | 147 |
|
88 | 148 | in
|
|
0 commit comments