{ 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; doCheck = true; }; docker = pkgs.dockerTools.buildLayeredImage { name = "pleshevskiy/vnetod"; tag = cargoToml.package.version; config = { Volumes."/data" = { }; WorkingDir = "/data"; Entrypoint = [ "${vnetod}/bin/vnetod" ]; }; }; 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; }; }); }