-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
65 lines (56 loc) · 1.71 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};
outputs = { self, nixpkgs, flake-utils, naersk, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [ (import rust-overlay) ];
# Read from `rust-toolchain.toml` instead of adding `rust-bin.nightly.latest.default` to devShell `buildInputs`
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
naerskLib = pkgs.callPackage naersk {
cargo = rustToolchain;
rustc = rustToolchain;
};
pkgs = import nixpkgs {
inherit system overlays;
config = {
allowUnfree = true;
};
};
# Libraries that are mostly needed for raylib to build
libraries = with pkgs; [
cmake sqlite
];
packages = with pkgs; [
];
# Inputs needed at compile-time
nativeBuildInputs = with pkgs; [ rustToolchain ];
# Inputs needed at runtime
buildInputs = with pkgs; [ ] ++ packages ++ libraries;
in
{
packages.default = naerskLib.buildPackage {
src = ./.;
};
devShells = {
default = pkgs.mkShell {
inherit buildInputs;
nativeBuildInputs = nativeBuildInputs ++ [
pkgs.cargo-watch
];
# shellHook = ''
# export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}
# '';
};
};
});
}