forked from Neptune-Crypto/neptune-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
81 lines (78 loc) · 2.36 KB
/
Copy pathflake.nix
File metadata and controls
81 lines (78 loc) · 2.36 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
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
{
description = "Flake for neptune-core";
inputs = {
nixpks.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
rust-overlay,
flake-utils,
naersk,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
rust = pkgs.rust-bin.stable.latest.default;
naerskLib = pkgs.callPackage naersk {
cargo = rust;
rustc = rust;
};
buildInputs = with pkgs; [
rust
cmake
pkg-config
openssl
];
tooling = with pkgs; [
cargo-nextest
cargo-mutants
alejandra # Nix code formatter
deadnix # Nix Dead code detection
statix # Nix static checks
taplo # Toml toolkit and formatter
];
mkPackage = pname:
naerskLib.buildPackage {
cargoBuildFlags = ["--bin" "${pname}"];
src = ./.;
inherit buildInputs pname;
};
mkApp = pname:
flake-utils.lib.mkApp {
drv = self.packages.${system}.${pname};
};
in
with pkgs; {
# Build the packages with `nix build` or `nix build .#neptune-core` for example.
packages = rec {
default = neptune-core;
neptune-core = mkPackage "neptune-core";
neptune-cli = mkPackage "neptune-core-cli";
neptune-dashboard = mkPackage "neptune-dashboard";
};
# Run the packages with `nix run` or `nix run .#neptune-core` for example.
apps = rec {
default = neptune-core;
neptune-core = mkApp "neptune-core";
neptune-cli = mkApp "neptune-cli";
neptune-dashboard = mkApp "neptune-dashboard";
};
# Enter the reproducible development shell using `nix develop` (automatically done with `direnv allow` if available)
devShells.default = mkShell {
buildInputs = buildInputs ++ tooling;
};
}
);
}