2019-02-03 16:07:42 +03:00
|
|
|
{ writeText
|
|
|
|
, runCommand
|
|
|
|
, lib
|
|
|
|
, snack-lib
|
|
|
|
}:
|
|
|
|
rec
|
|
|
|
{ niv = snack-lib.executable ../package.yaml;
|
|
|
|
readme = writeText "README.md"
|
|
|
|
(with
|
|
|
|
{ template = builtins.readFile ../README.tpl.md;
|
|
|
|
niv_help = builtins.readFile
|
|
|
|
(runCommand "niv_help" { buildInputs = [ niv ]; }
|
|
|
|
"niv --help > $out"
|
|
|
|
);
|
2019-02-08 21:29:48 +03:00
|
|
|
niv_cmd_help = cmd: builtins.readFile
|
|
|
|
(runCommand "niv_${cmd}_help" { buildInputs = [ niv ]; }
|
|
|
|
"niv ${cmd} --help > $out"
|
2019-02-03 16:07:42 +03:00
|
|
|
);
|
2019-02-08 21:29:48 +03:00
|
|
|
cmds = [ "add" "update" "drop" "init" "show" ];
|
2019-02-03 16:07:42 +03:00
|
|
|
};
|
|
|
|
lib.replaceStrings
|
2019-02-08 21:29:48 +03:00
|
|
|
([ "replace_niv_help" ] ++ (map (cmd: "replace_niv_${cmd}_help") cmds))
|
|
|
|
([ niv_help ] ++ (map niv_cmd_help cmds))
|
2019-02-03 16:07:42 +03:00
|
|
|
template
|
|
|
|
);
|
|
|
|
readme-test = runCommand "README-test" {}
|
|
|
|
"diff ${../README.md} ${readme} && echo dummy > $out";
|
|
|
|
}
|