diff --git a/flake.nix b/flake.nix index 3e6529c..ce44c43 100644 --- a/flake.nix +++ b/flake.nix @@ -6,16 +6,13 @@ outputs = { self, nixpkgs, utils }: let - cargoToml = with builtins; (fromTOML (readFile ./Cargo.toml)); + inherit (builtins) fromTOML readFile substring; - 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; }; + cargoToml = fromTOML (readFile ./Cargo.toml); + version = "${cargoToml.package.version}_${substring 0 8 self.lastModifiedDate}_${self.shortRev or "dirty"}"; - vnetod = pkgs.rustPlatform.buildRustPackage { + mkVnetod = { lib, rustPlatform, ... }: + rustPlatform.buildRustPackage { name = "vnetod-${version}"; src = lib.cleanSource ./.; @@ -23,6 +20,17 @@ doCheck = true; }; + in + { + overlay = final: prev: { + vnetod = final.callPackage mkVnetod { }; + }; + } + // utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + + vnetod = pkgs.callPackage mkVnetod { }; docker = pkgs.dockerTools.buildLayeredImage { name = "pleshevskiy/vnetod"; @@ -41,7 +49,7 @@ }; packages = { - inherit docker; + inherit docker vnetod; default = vnetod; }; @@ -49,7 +57,5 @@ packages = with pkgs; [ cargo rustc rustfmt clippy rust-analyzer ]; RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; }; - - overlays = f: p: { inherit vnetod; }; }); }