-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
50 lines (47 loc) · 1.52 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay/stable";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
app = pkgs.rustPlatform.buildRustPackage {
name = "discord-dearrow-bot";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
};
layeredImageOptions = {
name = "discord-dearrow-bot";
tag = "latest";
contents = [ pkgs.cacert ];
config = {
Cmd = [ "${app}/bin/discord-dearrow-bot" ];
};
};
dockerImage = pkgs.dockerTools.buildLayeredImage layeredImageOptions;
dockerImageStreaming = pkgs.dockerTools.streamLayeredImage layeredImageOptions;
in with pkgs; rec {
devShells.default = mkShell rec {
nativeBuildInputs = [
(rust-bin.stable.latest.default.override {
extensions = [ "rust-analyzer" "rust-src" ];
})
cargo-bloat
];
buildInputs = [];
packages = [];
};
packages = {
inherit app dockerImage dockerImageStreaming;
default = app;
};
});
}