-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
61 lines (53 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
51
52
53
54
55
56
57
58
59
60
61
{
description = "Flake for Rust version of food";
inputs = {
nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; };
utils = {
url = "github:numtide/flake-utils";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
naersk = {
url = "github:nix-community/naersk";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
};
outputs = { self, nixpkgs, utils, rust-overlay, naersk }:
utils.lib.eachDefaultSystem (system:
let
naersk-lib = naersk.lib."${system}";
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
in
with pkgs;
rec {
packages.food = naersk-lib.buildPackage {
pname = "food";
root = ./.;
doCheck = true;
checkInputs = [ pkgs.cargo pkgs.rustc ];
};
defaultPackage = packages.food;
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
hyperfine
wasm-pack
nodePackages.npm
nodejs
(rust-bin.nightly.latest.default.override {
targets = [ "wasm32-unknown-unknown" ];
extensions = [ "rust-src" "clippy" "rustfmt" ];
})
];
};
apps.food= utils.lib.mkApp {
drv = packages.food;
};
defaultApp = apps.food;
});
}