-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
64 lines (52 loc) · 1.72 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem (system:
let pkgs = import inputs.nixpkgs { inherit system; };
in rec {
formatter = pkgs.nixpkgs-fmt;
devShell = pkgs.mkShell { packages = [ ]; };
packages.config = pkgs.stdenv.mkDerivation {
name = "generator";
src = ./src;
nativeBuildInputs = [ pkgs.python3 ];
buildPhase = ''
python3 nginx_config.py sources.txt > nginx.conf
'';
installPhase = ''
mkdir -p $out/etc/nginx
mv nginx.conf $out/etc/nginx
'';
};
# for debugging, if needed
# packages.container = pkgs.dockerTools.buildLayeredImage {
packages.container = pkgs.dockerTools.streamLayeredImage {
name = "ghcr.io/bytes-zone/git-redirector";
# make /var/log/nginx so Nginx doesn't fail trying to open it (which
# it does no matter what you say in log settings, apparently.)
extraCommands = ''
mkdir -p tmp/nginx_client_body
mkdir -p var/log/nginx
'';
contents = [
pkgs.fakeNss
pkgs.nginxMainline
packages.config
# for debugging, if needed
# pkgs.dockerTools.binSh
# pkgs.coreutils
];
config = {
"ExposedPorts"."80/tcp" = { };
Entrypoint = [ "nginx" ];
Cmd = [ "-c" "/etc/nginx/nginx.conf" ];
# for debugging, if needed
# Entrypoint = "/bin/sh";
};
};
}
);
}