flake.nix
40 lines · 1348 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.pkgconfig ];
27 buildInputs = [ pkgs.openssl ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin
28 (with pkgs.darwin.apple_sdk.frameworks; [ AppKit Security ]);
29 };
30 devShell = mkShell {
31 buildInputs = [
32 (rustNightly.override { extensions = [ "rust-src" ]; })
33 pkg-config
34 cargo-tarpaulin
35 rust-analyzer
36 rustfmt
37 ];
38 };
39 });
40}