vnetod/flake.nix

42 lines
1.1 KiB
Nix
Raw Normal View History

2022-07-31 23:24:46 +03:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
let
cargoToml = with builtins; (fromTOML (readFile ./Cargo.toml));
version = "${cargoToml.package.version}_${builtins.substring 0 8 self.lastModifiedDate}_${self.shortRev or "dirty"}";
in
utils.lib.eachDefaultSystem
(system:
let
inherit (nixpkgs) lib;
pkgs = import nixpkgs { inherit system; };
vnetod = pkgs.rustPlatform.buildRustPackage {
name = "vnetod-${version}";
src = lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
2022-07-31 23:24:46 +03:00
doCheck = true;
2022-07-31 23:24:46 +03:00
};
in
{
apps.default = {
type = "app";
program = "${vnetod}/bin/vnetod";
};
packages.default = vnetod;
2022-07-31 23:24:46 +03:00
devShell = pkgs.mkShell {
packages = with pkgs; [ cargo rustc rustfmt clippy rust-analyzer ];
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
};
});
2022-07-31 23:24:46 +03:00
}