create derivation for book

This commit is contained in:
Adithya 2023-07-11 23:07:36 +05:30
parent 770214db3c
commit 038f5e38ec
Signed by: adtya
GPG key ID: 48FC9915FFD326D0
2 changed files with 31 additions and 0 deletions

20
default.nix Normal file
View file

@ -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
'';
}

11
nginx.conf Normal file
View file

@ -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;
}
}