-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
76 lines (71 loc) · 1.9 KB
/
flake.nix
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs =
{
self,
flake-utils,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
pkg = self.packages.${system}.default;
in
{
packages = {
default = pkgs.stdenvNoCC.mkDerivation {
name = "waiter-docs";
src = ./.;
nativeBuildInputs = with pkgs; [
mdbook
mdbook-i18n-helpers
];
buildPhase = ''
mdbook build -d $out
'';
};
docker =
let
caddyfile = pkgs.writeText "Caddyfile" ''
:8080 {
root * ${pkg}
file_server
handle_errors {
rewrite * /{err.status_code}.html
file_server
}
log
# much performance
encode zstd gzip
# such secure
header {
X-Frame-Options DENY
X-XSS-Protection 0
X-Content-Type-Options nosniff
Referrer-Policy strict-origin-when-cross-origin
Strict-Transport-Security max-age=31536000
}
}
'';
in
pkgs.dockerTools.buildLayeredImage {
name = "waiter-docs";
config = {
User = "1000";
Cmd = [
(lib.getExe pkgs.caddy)
"run"
"--adapter=caddyfile"
"--config=${caddyfile}"
];
};
};
};
}
);
}