{
description = "adnv - tracks, checks and auto-updates infrastructure dependency versions";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ nixpkgs, rust-overlay, ... }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSystem =
f:
nixpkgs.lib.genAttrs systems (
system:
f (
import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
}
)
);
manifest = (nixpkgs.lib.importTOML ./Cargo.toml).package;
in
{
packages = forEachSystem (pkgs: rec {
adnv = pkgs.rustPlatform.buildRustPackage {
pname = manifest.name;
inherit (manifest) version;
src = pkgs.lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
# cmake and perl build aws-lc-sys; git2 links a vendored libgit2 that
# wants zlib and openssl through pkg-config.
nativeBuildInputs = with pkgs; [
cmake
perl
pkg-config
];
buildInputs = with pkgs; [
openssl
zlib
];
# The suite reaches for the network and for a writable HOME.
doCheck = false;
meta = {
inherit (manifest) description;
homepage = manifest.repository;
license = pkgs.lib.licenses.agpl3Only;
mainProgram = manifest.name;
};
};
default = adnv;
});
devShells = forEachSystem (pkgs: {
default = pkgs.mkShell {
# Same toolchain as CI: rust-toolchain.toml is the single source.
packages =
[ (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml) ]
++ (with pkgs; [
cargo-llvm-cov
cmake
convco
glab
openssl
perl
pkg-config
zlib
]);
};
});
formatter = forEachSystem (pkgs: pkgs.nixfmt-rfc-style);
};
}