flake.nix
47 lines · 1629 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 = {
26 lockFile = ./Cargo.lock;
27 # Remove this once modalkit gets pinned by version again.
28 outputHashes = {
29 "modalkit-0.0.16" = "sha256-mjAD1v0r2+SzPdoB2wZ/5iJ1NZK+3OSvCYcUZ5Ef38Y=";
30 };
31 };
32 nativeBuildInputs = [ pkgs.pkg-config ];
33 buildInputs = [ pkgs.openssl ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin
34 (with pkgs.darwin.apple_sdk.frameworks; [ AppKit Security ]);
35 };
36 devShell = mkShell {
37 buildInputs = [
38 (rustNightly.override {
39 extensions = [ "rust-src" "rust-analyzer-preview" "rustfmt" "clippy" ];
40 })
41 pkg-config
42 cargo-tarpaulin
43 cargo-watch
44 ];
45 };
46 });
47}