nix: move overlay to the top level

This commit is contained in:
Dmitriy Pleshevskiy 2022-09-25 17:02:16 +03:00
parent 1f57ca0c97
commit dc66d1a643
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215

View file

@ -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; };
});
}