-
Notifications
You must be signed in to change notification settings - Fork 23
/
flake.nix
77 lines (67 loc) · 2.31 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
72
73
74
75
76
77
{
description = "corrosion2-dev";
## Specify the flake environment inputs
inputs = {
## The fenix flake gives us access to nightly rust toolchains
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
## Specify flake environment outputs
##
## The flake-utils harness is used to make supporting different
## architectures (x86_64-linux, aarch64-darwin, etc) easier.
outputs = { flake-utils, nixpkgs, fenix, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
rust-latest = fenix.packages."${system}".latest;
in
{
packages.mdbook-shell = pkgs.mkShell {
buildInputs = with pkgs; [ mdbook mdbook-linkcheck mdbook-admonish ];
shellHook = ''
mdbook serve
'';
};
## Here we declare the only flake output to be a nix build
## of the corrosion crate tree
packages.default =
pkgs.rustPlatform.buildRustPackage {
name = "corrosion2";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
# Needed for vendored dependencies
allowBuiltinFetchGit = true;
};
# Include a shell hook to run when we use `nix develop`
#
# NOTE: this depends on /etc/security/limits.conf
# setting an appropriate soft or hard-limit. Without it
# users can't override their personal limits.
shellHook = ''
ulimit -n 65536
'';
# Useful when doing development builds
doCheck = false;
buildType = "debug";
## Build environment dependencies
nativeBuildInputs = [
pkgs.pkg-config
pkgs.mold
pkgs.clang
rust-latest.toolchain
];
## Dependencies for the linked binary
buildInputs = with pkgs; [
openssl
sqlite
libgit2
];
};
});
}