ci: improvements in scripting and testing
All checks were successful
On_Push / lint_fmt (push) Successful in 54s
On_Push / lint_clippy (push) Successful in 3m59s
On_Push / build (push) Successful in 10m33s
On_Push / deploy (push) Successful in 12s

This commit is contained in:
silver 2024-08-10 03:12:09 +01:00
parent 7ac8b90f27
commit c447577eee
3 changed files with 45 additions and 43 deletions

View file

@ -2,16 +2,11 @@
description = "Skynet Discord Bot";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.05";
nixpkgs.url = "nixpkgs/nixos-unstable";
naersk.url = "github:nix-community/naersk";
utils.url = "github:numtide/flake-utils";
};
/*
sudo nano /etc/nix/nix.conf
trusted-users = {username}
*/
nixConfig = {
extra-substituters = "https://nix-cache.skynet.ie/skynet-cache";
extra-trusted-public-keys = "skynet-cache:zMFLzcRZPhUpjXUy8SF8Cf7KGAZwo98SKrzeXvdWABo=";
@ -25,20 +20,35 @@
}:
utils.lib.eachDefaultSystem (
system: let
pkgs = nixpkgs.legacyPackages."${system}";
naersk-lib = naersk.lib."${system}";
pkgs = (import nixpkgs) {inherit system;};
naersk' = pkgs.callPackage naersk {};
package_name = "skynet_discord_bot";
desc = "Skynet Discord Bot";
buildInputs = with pkgs; [
openssl
pkg-config
rustfmt
];
in rec {
# `nix build`
packages."${package_name}" = naersk-lib.buildPackage {
pname = "${package_name}";
root = ./.;
buildInputs = with pkgs; [
openssl
pkg-config
];
packages = {
# For `nix build` & `nix run`:
default = naersk'.buildPackage {
pname = "${package_name}";
src = ./.;
buildInputs = buildInputs;
};
# Run `nix build .#fmt` to run tests
fmt = naersk'.buildPackage {
src = ./.;
mode = "fmt";
buildInputs = buildInputs;
};
# Run `nix build .#clippy` to lint code
clippy = naersk'.buildPackage {
src = ./.;
mode = "clippy";
buildInputs = buildInputs;
};
};
defaultPackage = packages."${package_name}";
@ -52,7 +62,7 @@
# `nix develop`
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [rustc cargo pkg-config openssl];
nativeBuildInputs = with pkgs; [rustc cargo pkg-config openssl rustfmt];
};
nixosModule = {