enable github like alerts

This commit is contained in:
Adithya 2024-07-02 01:29:55 +05:30
parent 0a59eac9a0
commit de9509047e
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
5 changed files with 36 additions and 9 deletions

View file

@ -4,3 +4,5 @@ language = "en"
multilingual = false multilingual = false
src = "src" src = "src"
title = "/usr/share/doc" title = "/usr/share/doc"
[preprocessor.alerts]

View file

@ -1,12 +1,13 @@
{ stdenvNoCC { stdenvNoCC
, mdbook , mdbook
, mdbook-alerts
, ,
}: }:
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
pname = "wiki"; pname = "wiki";
version = "2023-12-04"; version = "2023-12-04";
src = ./.; src = ./.;
buildInputs = [ mdbook ]; buildInputs = [ mdbook mdbook-alerts ];
buildPhase = '' buildPhase = ''
mdbook build mdbook build
''; '';

View file

@ -21,11 +21,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1705242415, "lastModified": 1719826879,
"narHash": "sha256-a8DRYrNrzTudvO7XHUPNJD89Wbf1ZZT0VbwCsPnHWaE=", "narHash": "sha256-xs7PlULe8O1SAcs/9e/HOjeUjBrU5FNtkAF/bSEcFto=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ea780f3de2d169f982564128804841500e85e373", "rev": "b9014df496d5b68bf7c0145d0e9b0f529ce4f2a8",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -18,7 +18,8 @@
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
}; };
package = pkgs.callPackage ./default.nix { }; mdbook-alerts = pkgs.callPackage ./mdbook-alerts.nix { };
package = pkgs.callPackage ./default.nix { inherit mdbook-alerts; };
app = pkgs.writeShellScriptBin "app" '' app = pkgs.writeShellScriptBin "app" ''
trap 'kill "''${child_pid}"; wait "''${child_pid}";' SIGINT SIGTERM trap 'kill "''${child_pid}"; wait "''${child_pid}";' SIGINT SIGTERM
${pkgs.merecat}/bin/merecat -n -p 8080 ${package}/share/web & ${pkgs.merecat}/bin/merecat -n -p 8080 ${package}/share/web &
@ -29,13 +30,13 @@
{ {
formatter = pkgs.nixpkgs-fmt; formatter = pkgs.nixpkgs-fmt;
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
packages = with pkgs; [ packages = [
mdbook pkgs.mdbook
tailwindcss-language-server mdbook-alerts
]; ];
}; };
packages = { packages = {
inherit app; inherit app mdbook-alerts;
default = package; default = package;
}; };
} }

23
mdbook-alerts.nix Normal file
View file

@ -0,0 +1,23 @@
{ lib, fetchFromGitHub, rustPlatform }:
rustPlatform.buildRustPackage rec {
pname = "mdbook-alerts";
version = "0.5.2";
src = fetchFromGitHub {
owner = "lambdalisue";
repo = "rs-mdbook-alerts";
rev = "v${version}";
hash = "sha256-YlCvsDdWuoajuXt2hOGx7jW+lmLeMOSQ809bG9ZBaBY=";
};
cargoHash = "sha256-OuZo8QTE5Z1991S5CEkfxlXghQbnalt1UGNs4KozmEk=";
meta = with lib; {
description = "mdBook preprocessor to add GitHub Flavored Markdown's Alerts to your book";
mainProgram = "mdbook-alerts";
license = licenses.mit;
maintainers = with maintainers; [ adtya ];
homepage = "https://github.com/lambdalisue/rs-mdbook-alerts";
};
}