create derivation for book
This commit is contained in:
parent
770214db3c
commit
038f5e38ec
2 changed files with 31 additions and 0 deletions
20
default.nix
Normal file
20
default.nix
Normal 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
11
nginx.conf
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue