tas/flake.nix

32 lines
914 B
Nix
Raw Normal View History

2022-08-21 14:40:22 +03:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
2022-09-06 00:06:54 +03:00
outputs = { self, nixpkgs, utils }:
2022-08-21 14:40:22 +03:00
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
2022-09-06 00:06:54 +03:00
cargoToml = with builtins; (fromTOML (readFile ./Cargo.toml));
2022-08-21 14:40:22 +03:00
in
rec {
2022-09-06 00:06:54 +03:00
packages.default = pkgs.rustPlatform.buildRustPackage {
inherit (cargoToml.package) name version;
src = nixpkgs.lib.cleanSource ./.;
doCheck = true;
cargoLock.lockFile = ./Cargo.lock;
2022-08-21 14:40:22 +03:00
};
2022-09-06 00:06:54 +03:00
apps.default = utils.lib.mkApp {
inherit (cargoToml.package) name;
drv = packages.default;
2022-08-21 14:40:22 +03:00
};
devShell = with pkgs; mkShell {
2022-09-06 00:06:54 +03:00
packages = [ cargo rustc rustfmt clippy rust-analyzer ];
2022-08-21 14:40:22 +03:00
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
});
}