Skip to content

Commit

Permalink
nix-flake: Add documentation as flake output
Browse files Browse the repository at this point in the history
Signed-off-by: Sarah Renkhoff <[email protected]>
  • Loading branch information
Irockasingranite committed Feb 22, 2024
1 parent eee8d4a commit 78cdbec
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 100 deletions.
60 changes: 60 additions & 0 deletions doc.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{ lib
, stdenv
, west2nixHook
, pythonEnv
, cmake
, ninja
, doxygen
, mscgen
, graphviz
, git
, zephyr
, bridle
}:

stdenv.mkDerivation {

name = "bridle-doc";
src = bridle;
unpackPhase = ''
cp -r ${bridle} bridle
chmod +w -R bridle
cd bridle
git init
git config user.email "[email protected]"
git config user.name "Foo"
git checkout -b fake-branch
git add -A
git commit -m "Fake Commnit"
cd ..
'';

nativeBuildInputs = [
west2nixHook
pythonEnv
cmake
ninja
doxygen
mscgen
graphviz
git
];

dontUseCmakeConfigure = true;

CMAKE_PREFIX_PATH = "/build/bridle/share/bridle-package:/build/zephyr/share/zephyr-package";

buildPhase = ''
cd /build
chmod +w -R ./*
west build --cmake-only -b none -d build bridle/doc
west build -t zephyr-doxygen -b none -d build
west build -t bridle-doxygen -b none -d build
west build -t build-all -b none -d build
'';

installPhase = ''
mkdir $out
cp -r build/html $out/
'';
}
116 changes: 16 additions & 100 deletions flake.lock

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

2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@
packages.west2nix = inputs.west2nix.packages.${system}.default;

devShells.default = callPackage ./shell.nix { };

packages.doc = callPackage ./doc.nix { };
}));
}

0 comments on commit 78cdbec

Please sign in to comment.