iamb/flake.nix

45 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2023-03-24 10:32:14 +00:00
{
description = "iamb";
nixConfig.bash-prompt = "\[nix-develop\]$ ";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
# We only need the nightly overlay in the devShell because .rs files are formatted with nightly.
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
2024-03-09 12:03:55 +08:00
rustNightly = pkgs.rust-bin.nightly."2024-03-08".default;
in
2023-03-24 10:32:14 +00:00
with pkgs;
{
2024-03-09 12:03:55 +08:00
packages.default = rustPlatform.buildRustPackage {
2023-03-24 10:32:14 +00:00
pname = "iamb";
2024-03-09 12:03:55 +08:00
version = self.shortRev or self.dirtyShortRev;
2023-03-24 10:32:14 +00:00
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
2024-03-09 12:03:55 +08:00
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [ AppKit Security ]);
2023-03-24 10:32:14 +00:00
};
2024-03-09 12:03:55 +08:00
2023-03-24 10:32:14 +00:00
devShell = mkShell {
buildInputs = [
(rustNightly.override {
2024-03-09 12:03:55 +08:00
extensions = [ "rust-src" "rust-analyzer-preview" "rustfmt" "clippy" ];
})
2023-03-24 10:32:14 +00:00
pkg-config
cargo-tarpaulin
cargo-watch
2023-03-24 10:32:14 +00:00
];
};
});
}