ci: improvements to building in pipeline
This commit is contained in:
parent
7c2d392e35
commit
d8b232b546
4 changed files with 93 additions and 58 deletions
57
flake.nix
57
flake.nix
|
@ -2,8 +2,8 @@
|
|||
description = "Skynet Discord Bot";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-23.05";
|
||||
naersk.url = "github:nix-community/naersk";
|
||||
nixpkgs.url = "nixpkgs/nixos-24.05";
|
||||
crane.url = "github:ipetkov/crane";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
|
@ -21,26 +21,67 @@
|
|||
self,
|
||||
nixpkgs,
|
||||
utils,
|
||||
naersk,
|
||||
crane,
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
naersk-lib = naersk.lib."${system}";
|
||||
|
||||
package_name = "skynet_discord_bot";
|
||||
desc = "Skynet Discord Bot";
|
||||
in rec {
|
||||
# `nix build`
|
||||
packages."${package_name}" = naersk-lib.buildPackage {
|
||||
|
||||
craneLib = crane.mkLib pkgs;
|
||||
|
||||
src = craneLib.cleanCargoSource (craneLib.path ./.);
|
||||
|
||||
commonArgs = {
|
||||
src = src;
|
||||
strictDeps = true;
|
||||
|
||||
pname = "${package_name}";
|
||||
root = ./.;
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
# Add extra build inputs here, etc.
|
||||
openssl
|
||||
];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
# Add extra native build inputs here, etc.
|
||||
pkg-config
|
||||
];
|
||||
};
|
||||
|
||||
cargoArtifacts = craneLib.buildDepsOnly (commonArgs
|
||||
// {
|
||||
pname = "${package_name}-deps";
|
||||
});
|
||||
|
||||
clippy = craneLib.cargoClippy (commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||
});
|
||||
|
||||
fmt = craneLib.cargoFmt {
|
||||
inherit src;
|
||||
};
|
||||
|
||||
result = craneLib.buildPackage (commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
in rec {
|
||||
packages = {
|
||||
# nix build --verbose
|
||||
"${package_name}" = result;
|
||||
|
||||
# nix build --verbose .#clippy
|
||||
clippy = clippy;
|
||||
|
||||
# nix build --verbose .#fmt
|
||||
fmt = fmt;
|
||||
};
|
||||
|
||||
defaultPackage = packages."${package_name}";
|
||||
|
||||
# `nix run`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue