From 038f5e38ec0a05c3ff5273d3d2519a6a83c5fe0b Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Tue, 11 Jul 2023 23:07:36 +0530 Subject: [PATCH] create derivation for book --- default.nix | 20 ++++++++++++++++++++ nginx.conf | 11 +++++++++++ 2 files changed, 31 insertions(+) create mode 100644 default.nix create mode 100644 nginx.conf diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..69053a0 --- /dev/null +++ b/default.nix @@ -0,0 +1,20 @@ +{ + stdenvNoCC, + mdbook, +}: +stdenvNoCC.mkDerivation { + pname = "wiki"; + version = "latest"; + src = ./.; + buildInputs = [mdbook]; + buildPhase = '' + mdbook build + ''; + installPhase = '' + mkdir -p $out/share/nginx + cp -r book $out/share/nginx/html + mkdir -p $out/etc/nginx/conf.d + cp nginx.conf $out/etc/nginx/conf.d/default.conf + sed -i "s@/usr@$out@" $out/etc/nginx/conf.d/default.conf + ''; +} diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..80944b8 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,11 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } +}