nix flake

This commit is contained in:
xenofem 2023-07-21 23:55:01 -04:00
parent 686e3b8f33
commit 1f4583eab6
2 changed files with 99 additions and 0 deletions

38
flake.nix Normal file
View file

@ -0,0 +1,38 @@
{
description = "collection of simple unix tools";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }: let
cargoData = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pname = cargoData.package.name;
version = cargoData.package.version;
in utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
in rec {
packages.${pname} = pkgs.rustPlatform.buildRustPackage {
inherit pname version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
};
packages.default = packages.${pname};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustc
cargo
cargo-audit
clippy
rustfmt
];
};
}
);
}