mirror of
https://github.com/nix-community/naersk
synced 2024-11-10 06:04:17 +00:00
readme: Fix ./script/gen
I've accidentally broken the script during the recent test refactoring, since now test.nix doesn't evaluate to an attrset.
This commit is contained in:
parent
f21309b38e
commit
66883c7d6d
3 changed files with 43 additions and 26 deletions
40
readme.nix
Normal file
40
readme.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
# This script is used to test & generate `README.md`.
|
||||
|
||||
let
|
||||
sources = import ./nix/sources.nix;
|
||||
|
||||
pkgs = import ./nix {
|
||||
system = builtins.currentSystem;
|
||||
nixpkgs = "nixpkgs";
|
||||
};
|
||||
|
||||
naersk = pkgs.callPackage ./default.nix {
|
||||
inherit (pkgs.rustPackages) cargo rustc;
|
||||
};
|
||||
|
||||
docparse = naersk.buildPackage {
|
||||
root = ./docparse;
|
||||
|
||||
src = builtins.filterSource (
|
||||
p: t:
|
||||
let
|
||||
p' = pkgs.lib.removePrefix (toString ./docparse + "/") p;
|
||||
in
|
||||
p' == "Cargo.lock" || p' == "Cargo.toml" || p' == "src" || p' == "src/main.rs"
|
||||
) ./docparse;
|
||||
};
|
||||
|
||||
in rec {
|
||||
body = pkgs.runCommand "readme-body" {
|
||||
buildInputs = [ docparse ];
|
||||
} ''
|
||||
cat ${./README.tpl.md} > $out
|
||||
docparse ${./config.nix} >> gen
|
||||
sed -e '/GEN_CONFIGURATION/{r gen' -e 'd}' -i $out
|
||||
'';
|
||||
|
||||
test = pkgs.runCommand "readme-test" {} ''
|
||||
diff ${./README.md} ${body}
|
||||
touch $out
|
||||
'';
|
||||
}
|
|
@ -7,6 +7,6 @@ set -euo pipefail
|
|||
|
||||
echo "Updating README"
|
||||
|
||||
cat $(nix-build ./test.nix -A readme) > README.md
|
||||
cat $(nix-build ./readme.nix -A body) > README.md
|
||||
|
||||
echo done
|
||||
|
|
|
@ -1,25 +1,2 @@
|
|||
{ naersk, pkgs, ... }:
|
||||
let
|
||||
docparse = naersk.buildPackage {
|
||||
root = ../../../docparse;
|
||||
|
||||
src = builtins.filterSource (
|
||||
p: t:
|
||||
let
|
||||
p' = pkgs.lib.removePrefix (toString ../../../docparse + "/") p;
|
||||
in
|
||||
p' == "Cargo.lock" || p' == "Cargo.toml" || p' == "src" || p' == "src/main.rs"
|
||||
) ../../../docparse;
|
||||
};
|
||||
|
||||
readme = pkgs.runCommand "readme-gen" {} ''
|
||||
cat ${../../../README.tpl.md} > $out
|
||||
${docparse}/bin/docparse ${../../../config.nix} >> gen
|
||||
sed -e '/GEN_CONFIGURATION/{r gen' -e 'd}' -i $out
|
||||
'';
|
||||
|
||||
in
|
||||
pkgs.runCommand "readme-test" {} ''
|
||||
diff ${../../../README.md} ${readme}
|
||||
touch $out
|
||||
''
|
||||
{ ... }:
|
||||
(import ../../../readme.nix).test
|
||||
|
|
Loading…
Reference in a new issue