This repository has been archived by the owner on Dec 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
71 lines (67 loc) · 2.1 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils, rust-overlay }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.rust-bin.stable.latest.default;
rustc = pkgs.rust-bin.stable.latest.default;
};
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
in
rec
{
packages = {
bot = rustPlatform.buildRustPackage {
pname = manifest.name;
version = if (self ? rev) then self.shortRev else "dirty";
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
buildInputs = [
pkgs.openssl
pkgs.libopus
];
nativeBuildInputs = [
pkgs.pkg-config
];
doCheck = false;
};
docker = pkgs.dockerTools.buildLayeredImage {
name = "registry.digitalocean.com/johnnybot/bot";
tag = if (self ? rev) then self.shortRev else "dirty";
config.Cmd = [ "${packages.bot}/bin/bot" ];
contents = [ packages.bot ];
};
};
defaultPackage = packages.bot;
devShell = with pkgs; mkShell {
# LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath [ pkgs.openssl ];
buildInputs = [
python3
doctl
pkg-config
(rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
})
bashInteractive
cargo-watch
sqlx-cli
opentofu
libopus
];
# RUST_SRC_PATH = rustPlatform.rustLibSrc;
shellHook = ''
export OPENSSL_DIR="${openssl.dev}"
export OPENSSL_LIB_DIR="${openssl.out}/lib"
'';
};
});
}