201 lines
5.2 KiB
Nix
201 lines
5.2 KiB
Nix
{
|
||
inputs = {
|
||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||
|
||
flake-utils.url = "github:numtide/flake-utils";
|
||
};
|
||
|
||
outputs = { self, flake-utils, nixpkgs }: flake-utils.lib.eachDefaultSystem (system:
|
||
let
|
||
pkgs = nixpkgs.legacyPackages.${system};
|
||
in
|
||
rec {
|
||
packages = nixpkgs.lib.mapAttrs
|
||
(name: value: pkgs.python3Packages.callPackage value { })
|
||
{
|
||
lunr =
|
||
{ buildPythonPackage, fetchPypi, future, six, mock, pytest }:
|
||
|
||
buildPythonPackage rec {
|
||
pname = "lunr";
|
||
version = "0.5.8";
|
||
|
||
src = fetchPypi {
|
||
inherit pname version;
|
||
sha256 = "0vn2j5iyy40sv0f4v8nin5n5xs4a020g6gcbcgfpbxzgk0xhdyy4";
|
||
};
|
||
|
||
propagatedBuildInputs = [
|
||
future
|
||
six
|
||
];
|
||
|
||
checkInputs = [
|
||
mock
|
||
pytest
|
||
];
|
||
};
|
||
|
||
# FIXME: use nixpkgs’s mkdocs once it is ≥1.1
|
||
mkdocs =
|
||
{ buildPythonPackage
|
||
, fetchPypi
|
||
, backports_tempfile
|
||
, click
|
||
, jinja2
|
||
, livereload
|
||
, markdown
|
||
, nltk
|
||
, pyyaml
|
||
, tornado
|
||
}:
|
||
|
||
buildPythonPackage rec {
|
||
pname = "mkdocs";
|
||
version = "1.1.2";
|
||
|
||
src = fetchPypi {
|
||
inherit pname version;
|
||
sha256 = "0fgv5zawpyyv0vd4j5y8m4h058lh9jkwfcm0xy4pg7dr09a1xdph";
|
||
};
|
||
|
||
propagatedBuildInputs = [
|
||
backports_tempfile
|
||
click
|
||
jinja2
|
||
livereload
|
||
markdown
|
||
nltk
|
||
pyyaml
|
||
tornado
|
||
|
||
packages.lunr
|
||
];
|
||
|
||
doCheck = false; # circular depdendency
|
||
};
|
||
|
||
pymdown-extensions =
|
||
{ buildPythonPackage, fetchPypi, markdown }:
|
||
|
||
buildPythonPackage rec {
|
||
pname = "pymdown-extensions";
|
||
version = "8.0.1";
|
||
|
||
src = fetchPypi {
|
||
inherit pname version;
|
||
sha256 = "07p5xks6qf73nbv0qb7jrspkpmxdyr7dpxv3rnkh9p2b5l2h99wv";
|
||
};
|
||
|
||
propagatedBuildInputs = [
|
||
markdown
|
||
];
|
||
|
||
doCheck = false; # they fail?
|
||
};
|
||
|
||
mkdocs-material-extensions =
|
||
{ buildPythonPackage, fetchPypi }:
|
||
|
||
buildPythonPackage rec {
|
||
pname = "mkdocs-material-extensions";
|
||
version = "1.0.1";
|
||
|
||
src = fetchPypi {
|
||
inherit pname version;
|
||
sha256 = "13y617sql4hqs376c3dfcb6v7q41km9x7fh52k3f74a2brzzniv9";
|
||
};
|
||
|
||
# circular dependency
|
||
doCheck = false;
|
||
postPatch = ''
|
||
sed -i 's/mkdocs-material>=5.0.0//' requirements/project.txt
|
||
'';
|
||
};
|
||
|
||
mkdocs-material =
|
||
{ buildPythonPackage, fetchPypi, markdown, pygments }:
|
||
|
||
buildPythonPackage rec {
|
||
pname = "mkdocs-material";
|
||
version = "6.1.2";
|
||
|
||
src = fetchPypi {
|
||
inherit pname version;
|
||
sha256 = "0yifc1df94rsaxy72hqnhjkv4c50c30j5kg0yxybkxy07p7kafic";
|
||
};
|
||
|
||
propagatedBuildInputs = [
|
||
markdown
|
||
pygments
|
||
|
||
packages.mkdocs
|
||
packages.mkdocs-material-extensions
|
||
packages.pymdown-extensions
|
||
];
|
||
};
|
||
|
||
iosevka-web =
|
||
{ stdenv, fetchzip }:
|
||
|
||
stdenv.mkDerivation rec {
|
||
pname = "iosevka-web";
|
||
version = "3.7.1";
|
||
|
||
src = fetchzip {
|
||
url = "https://github.com/be5invis/Iosevka/releases/download/v${version}/pkg-iosevka-${version}.zip";
|
||
sha256 = "0d012aqfnyqlpl4smfa2x2qz2qmbbfxb6jr4awv8gp6r359rc9k1";
|
||
stripRoot = false;
|
||
};
|
||
|
||
dontBuild = true;
|
||
|
||
installPhase = ''
|
||
mkdir -p $out
|
||
cp -r woff woff2 ttf *.css $out
|
||
'';
|
||
};
|
||
|
||
wiki =
|
||
{ stdenv }:
|
||
|
||
stdenv.mkDerivation {
|
||
name = "wiki";
|
||
|
||
src = self;
|
||
|
||
buildPhase = ''
|
||
mkdocs build -d $out
|
||
echo "doc wiki $out" >> $out/nix-support/hydra-build-products
|
||
'';
|
||
|
||
installPhase = ''
|
||
mkdir -p $out/assets/fonts
|
||
ln -s ${packages.iosevka-web} $out/assets/fonts/iosevka
|
||
'';
|
||
|
||
nativeBuildInputs = [
|
||
packages.mkdocs
|
||
packages.mkdocs-material
|
||
];
|
||
};
|
||
};
|
||
|
||
defaultPackage = packages.wiki;
|
||
|
||
apps = {
|
||
serve = pkgs.writeShellScriptBin "serve" ''
|
||
${pkgs.miniserve}/bin/miniserve --index index.html ${packages.wiki}
|
||
'';
|
||
};
|
||
|
||
# My hydra only has x86_64-linux builders
|
||
hydraJobs =
|
||
if builtins.elem system [ "x86_64-linux" ]
|
||
then {
|
||
build = packages.wiki;
|
||
}
|
||
else { };
|
||
});
|
||
}
|