flake-docs/flake.nix

36 lines
1.0 KiB
Nix

{
description = "Generate documentation for NixOS modules.";
inputs.example-nix-minecraft.url = "github:12Boti/nix-minecraft";
outputs = {
self,
nixpkgs,
... } @ inputs:
let
forAllSystems = f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system: f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.legacyPackages.${system}.lib;
doc = self.lib.${system};
});
in {
inherit inputs;
lib = forAllSystems ({ pkgs, ...}: pkgs.callPackage ./lib.nix { });
packages = forAllSystems ({ pkgs, lib, doc, ...}: let
mkJSON = name: modules: lib.pipe modules [
doc.modules2options
builtins.toJSON
(pkgs.writeText "${name}.json")
];
in {
example-nix-minecraft-json = mkJSON "nix-minecraft" inputs.example-nix-minecraft.lib.baseModules;
example-nix-minecraft-html = doc.mkHTML "nix-minecraft" inputs.example-nix-minecraft inputs.example-nix-minecraft.lib.baseModules;
#example-nix-minecraft = ;
});
};
}