-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
94 lines (81 loc) · 2.32 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
description = "TheSchedule development flake";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.fenix.url = "github:nix-community/fenix";
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, nixpkgs, flake-utils, fenix }:
flake-utils.lib.eachDefaultSystem (system: let
toolchain = fenix.packages.${system}.latest.toolchain;
fenixpkgs = fenix.packages.${system};
pkgs = nixpkgs.legacyPackages.${system};
in rec {
devShells.default = pkgs.mkShell {
buildInputs =
let
pkgs = import nixpkgs {
inherit system;
};
rust = fenixpkgs.complete.withComponents [
"cargo"
"clippy"
"rust-src"
"rust-analyzer"
"rustc"
"rustfmt"
];
in
with pkgs;
[
rust
openssl
pkg-config
gcc
nodejs
nodePackages.pnpm
];
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
};
the-backend-bin = (pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
}).buildRustPackage {
pname = "the-backend";
version = "0.1.0";
src = ./backend/.;
nativeBuildInputs = with pkgs; [
openssl
pkg-config
gcc
];
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
cargoLock = {
lockFile = ./backend/Cargo.lock;
outputHashes = {
"actix-governor-0.5.0" = "sha256-3i0EZIjjPLzrONKKLZWTXRFIEMqpDYo6oEZWE7jQS/A=";
};
};
};
containerImage = pkgs.dockerTools.buildImage {
name = "ghcr.io/ixhbinphoenix/bne";
tag = "latest";
created = "now"; # Fuck binary compatibility
copyToRoot = with pkgs.dockerTools; [
usrBinEnv
binSh
caCertificates
pkgs.lsd
./backend/email-templates
];
config = {
Cmd = [
"${the-backend-bin}/bin/the-backend"
];
Env = [
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
];
};
};
packages.default = containerImage;
});
}