flake.nix
39 lines · 1245 bytes
1{
2 description = "iamb";
3 nixConfig.bash-prompt = "\[nix-develop\]$ ";
4
5 inputs = {
6 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
7 flake-utils.url = "github:numtide/flake-utils";
8 rust-overlay.url = "github:oxalica/rust-overlay";
9 };
10
11 outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }:
12 flake-utils.lib.eachDefaultSystem (system:
13 let
14 # We only need the nightly overlay in the devShell because .rs files are formatted with nightly.
15 overlays = [ (import rust-overlay) ];
16 pkgs = import nixpkgs { inherit system overlays; };
17 rustNightly = pkgs.rust-bin.nightly."2023-03-17".default;
18 in
19 with pkgs;
20 {
21 packages.default = pkgs.rustPlatform.buildRustPackage {
22 pname = "iamb";
23 version = "0.0.7";
24 src = ./.;
25 cargoLock.lockFile = ./Cargo.lock;
26 nativeBuildInputs = [ pkgs.openssl pkgs.pkgconfig ];
27 buildInputs = [ pkgs.openssl ];
28 };
29 devShell = mkShell {
30 buildInputs = [
31 (rustNightly.override { extensions = [ "rust-src" ]; })
32 pkg-config
33 cargo-tarpaulin
34 rust-analyzer
35 rustfmt
36 ];
37 };
38 });
39}