config-perso/machines/kat-son/doc/hugo-theme-extranix-options-search.nix

70 lines
2.8 KiB
Nix

{
fetchFromGitHub,
stdenv,
lib,
fetchurl,
}:
stdenv.mkDerivation {
name = "hugo-theme-extranix-options-search";
src = fetchFromGitHub {
owner = "mipmip";
repo = "hugo-theme-extranix-options-search";
rev = "3252b5bd98adcbbe629327d72c8416c25014a0d6";
hash = "sha256-XV7Js1KaBiWv9qao8iyzQ546nT1KkwCtvyAs++oeXFo=";
};
patches = [
./0001-revert-don-t-parse-md-in-js.patch
./0002-chore-remove-useless-dependencies.patch
./0003-feat-separate-HTML-description-of-MD-description.patch
./0004-fix-indentation-of-ul.patch
];
installPhase =
let
js-search = fetchurl {
url = "https://unpkg.com/js-search@2.0.1/dist/umd/js-search.min.js";
hash = "sha256-LD9UsSATk+xTzAbk8nD2gA2bjHKvetXtCMDAFkM2K5Q=";
};
jquery = fetchurl {
url = "https://code.jquery.com/jquery-3.7.1.slim.min.js";
hash = "sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=";
};
bootstrap.css.main = fetchurl {
url = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css";
hash = "sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=";
};
bootstrap.css.theme = fetchurl {
url = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css";
hash = "sha256-ZT4HPpdCOt2lvDkXokHuhJfdOKSPFLzeAJik5U/Q+l4=";
};
bootstrap.js = fetchurl {
url = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js";
hash = "sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=";
};
in
''
mkdir $out
rm static/images/favicon.*
cp -r * $out
cp ${js-search} $out/static/js/js-search.min.js
cp ${jquery} $out/static/js/jquery.slim.min.js
cp ${bootstrap.css.main} $out/static/css/bootstrap.min.css
cp ${bootstrap.css.theme} $out/static/css/bootstrap-theme.min.css
cp ${bootstrap.js} $out/static/js/bootstrap.min.js
substituteInPlace $out/layouts/index.html \
--replace-fail 'https://unpkg.com/js-search@2.0.1/dist/umd/js-search.min.js' js/js-search.min.js \
--replace-fail 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js' js/jquery.slim.min.js \
--replace-fail 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' css/bootstrap.min.css \
--replace-fail 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css' css/bootstrap-theme.min.css \
--replace-fail 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js' js/bootstrap.min.js \
'';
meta = {
description = "Theme which implements a nix modules options search machine.";
homepage = "https://github.com/mipmip/hugo-theme-extranix-options-search";
license = lib.licenses.asl20;
maintainers = [ ];
};
}