1
0
Fork 0
mirror of https://github.com/NixOS/nix.dev.git synced 2024-10-18 14:32:43 -04:00
nix.dev/flake.nix

80 lines
2.1 KiB
Nix
Raw Normal View History

2020-06-18 11:55:26 -04:00
{
description = "nix.dev static website";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
inputs.flake-utils.url = "github:numtide/flake-utils";
2021-06-03 16:43:03 -04:00
outputs = { self, nixpkgs, flake-utils }:
2021-06-03 16:43:03 -04:00
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
2023-10-10 08:35:55 -04:00
overlays = [
# Add sphinx-sitemap from an overlay until
# it becomes available from nixpkgs-unstable
(import ./overlay.nix)
];
2021-06-03 16:43:03 -04:00
};
devmode =
let
pythonEnvironment = pkgs.python310.withPackages (ps: with ps; [
livereload
]);
script = ''
from livereload import Server, shell
server = Server()
build_docs = shell("nix build")
print("Doing an initial build of the docs...")
build_docs()
server.watch("source/*", build_docs)
server.watch("source/**/*", build_docs)
server.watch("_templates/*.html", build_docs)
server.serve(root="result/")
'';
in
pkgs.writeShellApplication {
name = "devmode";
runtimeInputs = [ pythonEnvironment ];
text = ''
python ${pkgs.writeText "live.py" script}
'';
};
in
{
2023-10-10 06:39:56 -04:00
packages.default = pkgs.stdenv.mkDerivation {
name = "nix-dev";
src = self;
2023-10-10 14:11:34 -04:00
nativeBuildInputs = with pkgs.python310.pkgs; [
2023-10-10 08:14:37 -04:00
linkify-it-py
myst-parser
sphinx
sphinx-book-theme
sphinx-copybutton
sphinx-design
2023-10-10 08:14:37 -04:00
sphinx-notfound-page
2023-10-10 08:35:55 -04:00
sphinx-sitemap
];
buildPhase = ''
make html
'';
installPhase = ''
mkdir -p $out
cp -R build/html/* $out/
'';
2020-06-18 12:42:02 -04:00
};
2023-10-10 14:11:34 -04:00
devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.default ];
packages = with pkgs.python310.pkgs; [
2023-10-10 14:11:34 -04:00
black
devmode
2023-10-10 14:11:34 -04:00
];
};
2021-06-03 16:43:03 -04:00
}
);
2020-06-18 11:55:26 -04:00
}