fork/home-manager
git clone https://git.julia.blue/fork/home-manager
b78b5843
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5{ 6options . test . asserts = { 7warnings = { 8enable = mkOption { 9type = types . bool ; 10default = true ; 11description = "Whether warning asserts are enabled." ; 12}; 13 14expected = mkOption { 15type = types . listOf types . str ; 16default = [ ]; 17description = '' 18List of expected warnings. 19'' ; 20}; 21}; 22 23assertions = { 24enable = mkOption { 25type = types . bool ; 26default = true ; 27description = "Whether assertion asserts are enabled." ; 28}; 29 30expected = mkOption { 31type = types . listOf types . str ; 32default = [ ]; 33description = '' 34List of expected assertions. 35'' ; 36}; 37}; 38}; 39 40config = mkMerge [ 41( mkIf config . test . asserts . warnings . enable { 42home . file = { 43"asserts/warnings.actual" . text = concatStringsSep '' 44 45-- 46'' config . warnings ; 47}; 48 49nmt . script = '' 50assertFileContent \ 51home-files/asserts/warnings.actual \ 52${ 53pkgs . writeText "warnings.expected" ( concatStringsSep '' 54 55-- 56'' config . test . asserts . warnings . expected ) 57} 58'' ; 59}) 60 61( mkIf config . test . asserts . assertions . enable { 62home . file = { 63"asserts/assertions.actual" . text = concatStringsSep '' 64 65-- 66'' ( map ( x :x . message ) ( filter ( x :! x . assertion ) config . assertions )); 67}; 68 69nmt . script = '' 70assertFileContent \ 71home-files/asserts/assertions.actual \ 72${ 73pkgs . writeText "assertions.expected" ( concatStringsSep '' 74 75-- 76'' config . test . asserts . assertions . expected ) 77} 78'' ; 79}) 80]; 81}