stylix/docs/default.nix
Daniel Thwaites bf31640f49
doc: specify commit message format
I've noticed quite a few pull requests are being submitted with formats
such as feat(abc): or target: at the start of the message.

It will be helpful to have a specific format for this to keep things
consistent.
2024-01-23 21:06:14 +00:00

57 lines
1.5 KiB
Nix

{ pkgs, lib, inputs, ... }:
let
makeOptionsDoc = configuration: pkgs.nixosOptionsDoc {
inherit (configuration) options;
# Filter out any options not beginning with `stylix`
transformOptions = option: option // {
visible = option.visible &&
builtins.elemAt option.loc 0 == "stylix";
};
};
nixos = makeOptionsDoc
(lib.nixosSystem {
inherit (pkgs) system;
modules = [
inputs.home-manager.nixosModules.home-manager
inputs.self.nixosModules.stylix
./settings.nix
];
});
homeManager = makeOptionsDoc
(inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
inputs.self.homeManagerModules.stylix
./settings.nix
{
home = {
homeDirectory = "/home/book";
stateVersion = "22.11";
username = "book";
};
}
];
});
in pkgs.stdenvNoCC.mkDerivation {
name = "stylix-book";
src = ./.;
patchPhase = ''
cp ${../README.md} src/README.md
cp ${../CONTRIBUTING.md} src/contributing.md
# The "declared by" links point to a file which only exists when the docs
# are built locally. This removes the links.
sed '/*Declared by:*/,/^$/d' <${nixos.optionsCommonMark} >>src/options/nixos.md
sed '/*Declared by:*/,/^$/d' <${homeManager.optionsCommonMark} >>src/options/hm.md
'';
buildPhase = ''
${pkgs.mdbook}/bin/mdbook build --dest-dir $out
'';
}