This repository was archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
76 lines (69 loc) · 1.77 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 = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils = {
url = "github:numtide/flake-utils";
};
};
outputs =
{
self,
nixpkgs,
utils,
fenix,
}:
utils.lib.eachDefaultSystem (
system:
let
lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages.${system};
fenix' = pkgs.callPackage fenix { };
rustPlatform = pkgs.makeRustPlatform {
cargo = fenix'.latest.cargo;
rustc = fenix'.latest.rustc;
};
crate = rustPlatform.buildRustPackage {
name = "dp-backend";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
nativeBuildInputs = [ pkgs.protobuf ];
buildInputs = lib.optionals pkgs.stdenv.isDarwin (
with pkgs.darwin.apple_sdk; [ frameworks.SystemConfiguration ]
);
useNextest = true;
# unknown variant `2024`, expected one of `2015`, `2018`, `2021`
auditable = false;
strictDeps = true;
};
in
{
checks = {
inherit crate;
};
packages.default = crate;
packages.docker = pkgs.dockerTools.buildImage {
name = "dp-backend";
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [ crate ];
pathsToLink = [ "/bin" ];
};
config = {
Cmd = [ "/bin/backend" ];
ExposedPorts = {
"8080/tcp" = { };
};
Env = [ "PORT=8080" ];
};
};
}
);
}