ci: improvements in scripting and testing
This commit is contained in:
parent
7ac8b90f27
commit
c447577eee
3 changed files with 45 additions and 43 deletions
46
flake.nix
46
flake.nix
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue