-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
48 lines (44 loc) · 1.35 KB
/
flake.nix
File metadata and controls
48 lines (44 loc) · 1.35 KB
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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
systems.url = "github:nix-systems/default"; # can run on all systems
};
outputs = { self, nixpkgs, systems, ... }:
let
eachSystem = fn: nixpkgs.lib.genAttrs (import systems) (system: fn system (import nixpkgs {
inherit system;
}));
in
{
packages = eachSystem (system: pkgs: rec {
default = terralux-backend;
terralux-backend = pkgs.rustPlatform.buildRustPackage {
name = "terralux-backend";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with pkgs; [
pkg-config # to find buildInputs
];
buildInputs = with pkgs; [
openssl # required by reqwest
];
};
});
devShells = eachSystem (system: pkgs: {
default = let
inherit (self.packages.${system}.default) nativeBuildInputs buildInputs;
in pkgs.mkShell {
buildInputs = buildInputs;
nativeBuildInputs = nativeBuildInputs ++ (with pkgs; [
cargo
clippy
cargo-edit # provides `cargo upgrade` for dependencies
]);
# enable logging
RUST_LOG = "error,terralux_backend=debug";
# fix rust-analyzer in vscode
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
});
};
}