2024-07-14 03:14:22 +00:00
|
|
|
let
|
|
|
|
sources = import ../npins;
|
|
|
|
in
|
|
|
|
{ pkgs ? import sources.nixos-unstable { } }:
|
|
|
|
|
|
|
|
let
|
2024-07-31 08:48:52 +00:00
|
|
|
inherit (pkgs) nixosOptionsDoc lib;
|
2024-07-21 12:22:02 +00:00
|
|
|
|
|
|
|
# Pretty much inspired from home-manager's documentation build process.
|
|
|
|
evalDoc = args@{ modules, includeModuleSystemOptions ? false, ... }:
|
|
|
|
let
|
|
|
|
options = (pkgs.lib.evalModules {
|
2024-07-28 02:52:24 +00:00
|
|
|
modules = modules ++ [ { _module.check = false; _module.args.pkgs = pkgs; } ];
|
2024-07-21 12:22:02 +00:00
|
|
|
class = "wrapperManager";
|
|
|
|
}).options;
|
|
|
|
in
|
|
|
|
nixosOptionsDoc ({
|
|
|
|
options =
|
|
|
|
if includeModuleSystemOptions
|
|
|
|
then options
|
|
|
|
else builtins.removeAttrs options [ "_module" ];
|
|
|
|
}
|
|
|
|
// builtins.removeAttrs args [ "modules" "includeModuleSystemOptions" ]);
|
2024-07-31 08:48:52 +00:00
|
|
|
releaseConfig = lib.importJSON ../release.json;
|
2024-07-14 03:14:22 +00:00
|
|
|
|
2024-07-31 08:48:52 +00:00
|
|
|
wrapperManagerLib = (import ../. { }).lib;
|
2024-07-21 12:22:02 +00:00
|
|
|
wmOptionsDoc = evalDoc {
|
|
|
|
modules = [ ../modules/wrapper-manager ];
|
|
|
|
includeModuleSystemOptions = true;
|
|
|
|
};
|
2024-07-31 08:48:52 +00:00
|
|
|
|
|
|
|
gems = pkgs.bundlerEnv {
|
|
|
|
name = "wrapper-manager-fds-gem-env";
|
|
|
|
ruby = pkgs.ruby_3_1;
|
|
|
|
gemdir = ./.;
|
|
|
|
};
|
2024-07-21 12:22:02 +00:00
|
|
|
in
|
|
|
|
{
|
2024-07-31 08:48:52 +00:00
|
|
|
# I forgot about the fact Hugo also uses Go modules for its Hugo modules
|
|
|
|
# feature. For now, this is considered broken up until that is working and I
|
|
|
|
# know squat about Go build system. Also, Hugo has several features such as
|
|
|
|
# embedding metadata from VCS which doesn't play well with Nix that is
|
|
|
|
# requiring a clean source.
|
|
|
|
#
|
|
|
|
# For now, we're just relying on nix-shell to build it for us.
|
2024-07-21 12:22:02 +00:00
|
|
|
website =
|
|
|
|
let
|
2024-07-31 08:48:52 +00:00
|
|
|
buildHugoSite = pkgs.callPackage ./hugo-build-module.nix { };
|
2024-07-14 03:14:22 +00:00
|
|
|
|
2024-07-21 12:22:02 +00:00
|
|
|
# Now this is some dogfooding.
|
|
|
|
asciidoctorWrapped =
|
|
|
|
wrapperManagerLib.build {
|
|
|
|
inherit pkgs;
|
|
|
|
modules = [
|
|
|
|
({ config, lib, pkgs, ... }: {
|
|
|
|
wrappers.asciidoctor = {
|
|
|
|
arg0 = lib.getExe' gems "asciidoctor";
|
|
|
|
appendArgs = [
|
|
|
|
"-T" "${sources.website}/templates"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
|
|
|
in
|
|
|
|
buildHugoSite {
|
|
|
|
pname = "wrapper-manager-docs";
|
|
|
|
version = "2024-07-13";
|
2024-07-20 05:33:51 +00:00
|
|
|
|
2024-07-21 12:22:02 +00:00
|
|
|
src = lib.fileset.toSource {
|
|
|
|
root = ./.;
|
|
|
|
fileset = lib.fileset.unions [
|
|
|
|
./website/assets
|
|
|
|
./website/config
|
|
|
|
./website/content
|
|
|
|
./website/layouts
|
|
|
|
./website/go.mod
|
|
|
|
./website/go.sum
|
|
|
|
];
|
|
|
|
};
|
2024-07-14 03:14:22 +00:00
|
|
|
|
2024-07-21 12:22:02 +00:00
|
|
|
vendorHash = "sha256-vMLi8of2eF/s60B/lM3FDfSntEyieGkvJbTSMuI7Wws=";
|
|
|
|
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
asciidoctorWrapped
|
|
|
|
hugo
|
|
|
|
git
|
|
|
|
gems
|
|
|
|
gems.wrappedRuby
|
|
|
|
];
|
2024-07-14 03:14:22 +00:00
|
|
|
|
2024-07-21 12:22:02 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "wrapper-manager-fds documentation";
|
|
|
|
homepage = "https://github.com/foo-dogsquared/wrapper-manager-fds";
|
|
|
|
license = with licenses; [
|
|
|
|
mit
|
|
|
|
fdl13Only
|
|
|
|
];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
};
|
2024-07-20 05:33:51 +00:00
|
|
|
|
2024-07-21 12:22:02 +00:00
|
|
|
inherit wmOptionsDoc;
|
|
|
|
wmNixosDoc = evalDoc { modules = [ ../modules/env/nixos ]; };
|
|
|
|
wmHmDoc = evalDoc { modules = [ ../modules/env/home-manager ]; };
|
2024-07-14 03:14:22 +00:00
|
|
|
|
2024-07-31 08:48:52 +00:00
|
|
|
inherit releaseConfig;
|
|
|
|
outputs = {
|
|
|
|
manpage = pkgs.runCommand "wrapper-manager-reference-manpage" {
|
|
|
|
nativeBuildInputs = with pkgs; [ nixos-render-docs gems gems.wrappedRuby ];
|
|
|
|
} ''
|
|
|
|
mkdir -p $out/share/man/man5
|
|
|
|
asciidoctor --backend manpage ${./manpages/header.adoc} --out-file header.5
|
|
|
|
nixos-render-docs options manpage --revision ${releaseConfig.version} \
|
|
|
|
--header ./header.5 --footer ${./manpages/footer.5} \
|
|
|
|
${wmOptionsDoc.optionsJSON}/share/doc/nixos/options.json \
|
|
|
|
$out/share/man/man5/wrapper-manager.nix.5
|
|
|
|
'';
|
|
|
|
|
|
|
|
html = pkgs.runCommand "wrapper-manager-reference-html" {
|
|
|
|
nativeBuildInputs = [ gems gems.wrappedRuby ];
|
|
|
|
} ''
|
|
|
|
mkdir -p $out/share/wrapper-manager
|
|
|
|
asciidoctor --backend html ${wmOptionsDoc.optionsAsciiDoc} --out-file $out/share/wrapper-manager/options-reference.html
|
|
|
|
'';
|
|
|
|
};
|
2024-07-20 05:33:51 +00:00
|
|
|
}
|