zaphyra's git: haumea

fork of https://github.com/nix-community/haumea

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs }:
    let
      inherit (nixpkgs.lib)
        genAttrs
        ;

      eachSystem = f: genAttrs
        [
          "aarch64-darwin"
          "aarch64-linux"
          "x86_64-darwin"
          "x86_64-linux"
        ]
        (system: f nixpkgs.legacyPackages.${system});
    in
    {
      devShells = eachSystem (pkgs: {
        default = pkgs.mkShell {
          packages = [ pkgs.mdbook ];
          shellHook = ''
            toplevel=$(git rev-parse --show-toplevel) || exit
            cd "$toplevel" || exit
            mkdir -p docs/theme
            ln -sf ${pkgs.documentation-highlighter}/highlight.pack.js docs/theme/highlight.js
            mdbook serve docs
          '';
        };
      });

      packages = eachSystem (pkgs: {
        default = pkgs.stdenv.mkDerivation {
          pname = "haumea-docs";
          version = self.shortRev or "0000000";

          src = ../.;

          nativeBuildInputs = [ pkgs.mdbook ];

          buildPhase = ''
            cd docs
            mkdir theme
            ln -s ${pkgs.documentation-highlighter}/highlight.pack.js theme/highlight.js
            mdbook build -d $out
          '';
        };
      });
    };
}