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