mirror of
https://github.com/danth/stylix
synced 2024-11-10 06:34:15 +00:00
7682713f6a
Add a 'stylix.enable' option to enable or disable all Stylix modules in order to resolve issues similar to [2]. To align with the default 'lib.mkEnableOption' [1] behavior, 'stylix.enable' defaults to 'false'. BREAKING CHANGE: Stylix is disabled by default. To enable it, use: stylix.enable = true; [1]: https://github.com/NixOS/nixpkgs/blob/23.11/lib/options.nix#L91-L105 [2]: https://github.com/danth/stylix/issues/216 Co-authored-by: Daniel Thwaites <danthwaites30@btinternet.com> Co-authored-by: Jalil David Salamé Messina <jalil.salame@gmail.com> Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
67 lines
1.9 KiB
Nix
67 lines
1.9 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 ${../gnome.png} src/gnome.png
|
|
cp ${../kde.png} src/kde.png
|
|
cp ${../CONTRIBUTING.md} src/contributing.md
|
|
|
|
# mdBook doesn't support this Markdown extension yet
|
|
substituteInPlace **/*.md \
|
|
--replace-quiet '> [!NOTE]' '> **Note**' \
|
|
--replace-quiet '> [!TIP]' '> **Tip**' \
|
|
--replace-quiet '> [!IMPORTANT]' '> **Important**' \
|
|
--replace-quiet '> [!WARNING]' '> **Warning**' \
|
|
--replace-quiet '> [!CAUTION]' '> **Caution**'
|
|
|
|
# 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
|
|
'';
|
|
}
|