Skip to content

Commit

Permalink
setup: filtering of docs files for build
Browse files Browse the repository at this point in the history
  • Loading branch information
igordejanovic committed Jun 7, 2024
1 parent 3ae3c02 commit e4bd0d1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 56 deletions.
17 changes: 14 additions & 3 deletions docs/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ pkgs, mdbook-theme }:
{ pkgs, crane, mdbook-theme }:
let
inherit (pkgs) stdenv;
inherit (pkgs) stdenv lib;

mdbook-theme-pkg = pkgs.rustPlatform.buildRustPackage {
pname = "mdbook-theme";
Expand All @@ -9,6 +9,8 @@ let
src = mdbook-theme;
};

craneLib = crane.mkLib pkgs;

tex = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-small standalone qtree pict2e preview;
};
Expand All @@ -18,9 +20,18 @@ let
mdbook mdbook-admonish mdbook-plantuml
mdbook-graphviz mdbook-theme-pkg mdbook-linkcheck
plantuml graphviz tex poppler_utils];

docsFileTypes = [ ".*md$" ".*rustemo$" ".*err$" ".*ast$" ".*tex$" ".*png$" ".*css$" ".*js$" ".*sh$"];
docsFilter = path: _type: builtins.any (pattern: builtins.match pattern path != null) docsFileTypes;
docsOrCargoFilter = path: type:
(docsFilter path type) || (craneLib.filterCargoSources path type);

book = stdenv.mkDerivation {
name = "rustemo-book";
src = ../.;
src = lib.cleanSourceWith {
src = ../.;
filter = docsOrCargoFilter;
};
inherit buildInputs;

buildPhase = ''
Expand Down
57 changes: 6 additions & 51 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
};
};


crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
Expand All @@ -32,7 +31,7 @@

rev = if builtins.hasAttr "rev" self then self.rev else self.dirtyRev;
book = import ./docs {
inherit pkgs mdbook-theme;
inherit pkgs crane mdbook-theme;
};
rustemo = import ./. {
inherit crane pkgs rev;
Expand Down

0 comments on commit e4bd0d1

Please sign in to comment.