Add initial docs website

This commit is contained in:
Alex David 2025-06-07 12:45:48 -07:00
commit 6854d37560
3 changed files with 70 additions and 0 deletions

1
website/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/result

27
website/flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1749024892,
"narHash": "sha256-OGcDEz60TXQC+gVz5sdtgGJdKVYr6rwdzQKuZAJQpCA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8f1b52b04f2cb6e5ead50bd28d76528a2f0380ef",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

42
website/flake.nix Normal file
View file

@ -0,0 +1,42 @@
{
# This is a separate flake file from the one at the root because we don't
# want to depend on nixpkgs
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
outputs = { nixpkgs, ... }: let
pkgs = import nixpkgs { system = "x86_64-linux"; };
lib = pkgs.lib;
combinatorDocs = lib.pipe
{
pkgs = throw "Docs must not depend on pkgs";
lib = throw "Docs must not depend on lib";
helpers = throw "Docs must not depend on helpers";
}
[
(import ../combinators.nix)
(lib.filterAttrs (_: v: !(v ? deprecated && v.deprecated)))
(lib.mapAttrsToList (k: v: "## ${k}\n**${k} :: ${v.sig}**\n\n${v.doc}"))
(lib.concatStringsSep "\n\n")
(docs: "# Combinators\n\n${docs}")
];
mkdocsSettings = {
site_name = "jail-nix";
repo_url = "https://git.sr.ht/~alexdavid/jail.nix";
theme = {
name = "readthedocs";
hljs_languages = [ "nix" ];
};
};
in {
packages.x86_64-linux.default = pkgs.runCommand "website" { buildInputs = [ pkgs.mkdocs ]; } ''
mkdir -p docs
cp ${../README.md} docs/index.md
echo ${lib.escapeShellArg combinatorDocs} > docs/combinators.md
echo ${lib.escapeShellArg (builtins.toJSON mkdocsSettings)} > mkdocs.yml
mkdocs build
mv site $out
'';
};
}