generated from DimensionDev/aws_lambda_rust_template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
flake.nix
61 lines (60 loc) · 2.23 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
{
inputs = {
naersk.url = "github:nix-community/naersk/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils, naersk }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
naersk-lib = pkgs.callPackage naersk { };
buildInputs = with pkgs; [ openssl cacert curl ];
nativeBuildInputs = with pkgs; [ pkg-config cargo rustc rustfmt rustPackages.clippy ];
rustPackage = naersk-lib.buildPackage {
inherit buildInputs nativeBuildInputs;
# China registry mirror
cratesDownloadUrl = "https://crates-io.proxy.ustclug.org";
src = ./.;
};
dockerImage = pkgs.dockerTools.buildLayeredImage {
name = "nextdotid/relation_server";
tag = "latest";
created = "now";
contents = [ rustPackage pkgs.curl pkgs.cacert ];
config = {
Workingdir = "/app";
Cmd = [ "standalone" ];
ExposedPorts = {
"8000/tcp" = {};
};
Volumes = {
"/app/config" = {};
};
Test = [ "CMD" "curl" "-s" "http://127.0.0.1:8000/" ];
Interval = 30000000000; # 30s
Timeout = 10000000000; # 10s
Retries = 3;
Labels = {
"maintainer" = "Nyk Ma <nykma@mask.io>";
"org.opencontainers.image.description" = "RelationService: relation aggregation.";
"org.opencontainers.image.source" = "https://github.com/NextDotID/relation_server";
"org.opencontainers.image.title" = "relation_server";
"org.opencontainers.image.url" = "https://github.com/NextDotID/relation_server";
};
};
};
in {
packages = {
main = rustPackage;
docker = dockerImage;
};
defaultPackage = rustPackage;
devShell = with pkgs; mkShell {
buildInputs = buildInputs ++
nativeBuildInputs ++
(with pkgs; [ act rust-analyzer pre-commit ]);
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
});
}