Skip to content

Commit

Permalink
apply changes from project template
Browse files Browse the repository at this point in the history
  • Loading branch information
CobaltCause committed Jun 21, 2024
1 parent e9b5695 commit 3b17c94
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 141 deletions.
82 changes: 79 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,85 @@
[workspace.lints.rust]
elided_lifetimes_in_paths = "warn"
explicit_outlives_requirements = "warn"
macro_use_extern_crate = "warn"
missing_abi = "warn"
missing_docs = "warn"
noop_method_call = "warn"
pointer_structural_match = "warn"
single_use_lifetimes = "warn"
unit_bindings = "warn"
unreachable_pub = "warn"
unsafe_op_in_unsafe_fn = "warn"
unused_extern_crates = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"
unused_macro_rules = "warn"
unused_qualifications = "warn"

[workspace.lints.clippy]
pedantic = "warn"

as_conversions = "warn"
assertions_on_result_states = "warn"
dbg_macro = "warn"
default_union_representation = "warn"
deref_by_slicing = "warn"
empty_drop = "warn"
empty_enum_variants_with_brackets = "warn"
empty_structs_with_brackets = "warn"
error_impl_error = "warn"
exit = "warn"
filetype_is_file = "warn"
float_cmp_const = "warn"
format_push_string = "warn"
get_unwrap = "warn"
if_then_some_else_none = "warn"
impl_trait_in_params = "warn"
infinite_loop = "warn"
let_underscore_must_use = "warn"
let_underscore_untyped = "warn"
lossy_float_literal = "warn"
map_err_ignore = "warn"
mem_forget = "warn"
missing_assert_message = "warn"
missing_docs_in_private_items = "warn"
mod_module_files = "warn"
multiple_inherent_impl = "warn"
mutex_atomic = "warn"
negative_feature_names = "warn"
pub_without_shorthand = "warn"
rc_buffer = "warn"
rc_mutex = "warn"
redundant_feature_names = "warn"
redundant_type_annotations = "warn"
ref_patterns = "warn"
rest_pat_in_fully_bound_structs = "warn"
same_name_method = "warn"
semicolon_inside_block = "warn"
str_to_string = "warn"
string_add = "warn"
string_lit_chars_any = "warn"
string_slice = "warn"
string_to_string = "warn"
suspicious_xor_used_as_pow = "warn"
tests_outside_test_module = "warn"
try_err = "warn"
undocumented_unsafe_blocks = "warn"
unnecessary_safety_comment = "warn"
unnecessary_safety_doc = "warn"
unnecessary_self_imports = "warn"
unneeded_field_pattern = "warn"
unseparated_literal_suffix = "warn"
unwrap_used = "warn"
verbose_file_reads = "warn"
wildcard_dependencies = "warn"

[package]
name = "ghat"
description = "GitHub Actions Test"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = [
"Charles Hall <charles@computer.surgery>",
]

[lints]
workspace = true
9 changes: 8 additions & 1 deletion engage.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,11 @@ script = "cargo clippy --workspace --all-targets --color=always -- -D warnings"
[[task]]
name = "cargo"
group = "tests"
script = "cargo test --workspace --all-targets --color=always -- --color=always"
script = """
cargo llvm-cov \
--workspace \
--all-targets \
--color=always \
-- \
--color=always
"""
96 changes: 35 additions & 61 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 30 additions & 38 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
{
inputs = {
crane = { url = "github:ipetkov/crane?ref=master"; inputs.nixpkgs.follows = "nixpkgs"; };
fenix = { url = "github:nix-community/fenix?ref=main"; inputs.nixpkgs.follows = "nixpkgs"; };
flake-utils.url = "github:numtide/flake-utils?ref=main";
nix-filter.url = "github:numtide/nix-filter?ref=main";
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";

fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};

crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};

outputs =
{ self
, nixpkgs
, flake-utils

, fenix
, crane
}: flake-utils.lib.eachDefaultSystem (system:
outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgs = inputs.nixpkgs.legacyPackages.${system};
stdenv =
if pkgs.stdenv.isLinux then
pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv
else
pkgs.stdenv;

mkToolchain = fenix.packages.${system}.combine;
mkToolchain = inputs.fenix.packages.${system}.combine;

toolchain = fenix.packages.${system}.stable;
toolchain = inputs.fenix.packages.${system}.stable;

buildToolchain = mkToolchain (with toolchain; [
cargo
Expand All @@ -43,43 +28,50 @@
devToolchain = mkToolchain (with toolchain; [
cargo
clippy
llvm-tools
rust-src
rustc

# Always use nightly rustfmt because most of its options are unstable
fenix.packages.${system}.latest.rustfmt
inputs.fenix.packages.${system}.latest.rustfmt
]);

builder =
((crane.mkLib pkgs).overrideToolchain buildToolchain).buildPackage;
builder = (
(inputs.crane.mkLib pkgs).overrideToolchain buildToolchain
).buildPackage;
in
{
packages.default = builder {
src = ./.;
src = let filter = inputs.nix-filter.lib; in filter {
root = ./.;
include = [
"Cargo.lock"
"Cargo.toml"
"README.md"
"src"
];
};

inherit stdenv;
};

devShells.default = (pkgs.mkShell.override { inherit stdenv; }) {
# Rust Analyzer needs to be able to find the path to default crate
# sources, and it can read this environment variable to do so. The
# `rust-src` component is required in order for this to work.
RUST_SRC_PATH = "${devToolchain}/lib/rustlib/src/rust/library";
env = {
# Rust Analyzer needs to be able to find the path to default crate
# sources, and it can read this environment variable to do so. The
# `rust-src` component is required in order for this to work.
RUST_SRC_PATH = "${devToolchain}/lib/rustlib/src/rust/library";
};

# Development tools
nativeBuildInputs = [
packages = [
devToolchain
] ++ (with pkgs; [
cargo-llvm-cov
engage
nixpkgs-fmt
]) ++ (with pkgs.nodePackages; [
markdownlint-cli
]);
};

checks = {
packagesDefault = self.packages.${system}.default;
devShellsDefault = self.devShells.${system}.default;
};
});
}
Loading

0 comments on commit 3b17c94

Please sign in to comment.