vnetod/flake.nix

56 lines
1.4 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
2022-09-18 23:34:38 +03:00
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;
doCheck = true;
};
docker = pkgs.dockerTools.buildLayeredImage {
name = "pleshevskiy/vnetod";
tag = cargoToml.package.version;
config = {
Volumes."/data" = { };
WorkingDir = "/data";
Entrypoint = [ "${vnetod}/bin/vnetod" ];
};
2022-09-18 23:34:38 +03:00
};
in
{
apps.default = {
type = "app";
program = "${vnetod}/bin/vnetod";
};
packages = {
inherit docker;
default = vnetod;
};
devShell = pkgs.mkShell {
packages = with pkgs; [ cargo rustc rustfmt clippy rust-analyzer ];
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
};
overlays = f: p: { inherit vnetod; };
});
2022-07-31 23:24:46 +03:00
}