Files
rustdoku/flake.nix
T

108 lines
3.3 KiB
Nix
Raw Normal View History

2024-10-15 16:52:24 -05:00
# github.com/brianmcgee has lots of great ideas for going above and beyond for this
{
2024-10-15 19:57:26 -05:00
description = "Greg's homepage";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
devshell.url = "github:numtide/devshell";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-root.url = "github:srid/flake-root";
hooks.url = "github:cachix/git-hooks.nix";
naersk.url = "github:nix-community/naersk";
};
2024-10-15 16:52:24 -05:00
2024-10-15 19:57:26 -05:00
outputs =
{ flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.devshell.flakeModule
inputs.flake-root.flakeModule
#inputs.process-compose.flakeModule
];
flake = {
# Universal things
# final: prev:
overlays.default = _: _: { };
};
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
perSystem =
{ pkgs, ... }@inputs':
let
naersk-lib = pkgs.callPackage inputs.naersk { };
in
{
_module.args.pkgs = import inputs.nixpkgs {
inherit (inputs') system;
overlays = [ ];
};
# https://numtide.github.io/devshell/intro.html
devshells.default = {
# These commands will be shown in the motd that users read
# upon entering the shell
commands = [
{
package = pkgs.cargo;
category = "tools";
help = "Rust build and package tool";
}
{
package = pkgs.rustc;
category = "languages";
help = "Rust compiler";
}
{
package = pkgs.rustfmt;
category = "tools";
help = "Standard Rust formatting tool";
}
{
package = pkgs.clippy;
category = "tools";
help = "Rust linter";
}
{
package = pkgs.stdenv.cc;
category = "languages";
help = "C compiler to help with building native code";
}
{
package = pkgs.pre-commit;
category = "tools";
help = "Tool to help enforce commits make sense";
}
];
};
2024-10-15 16:52:24 -05:00
2024-10-15 19:57:26 -05:00
checks = {
pre-commit-check = inputs.hooks.lib.${inputs'.system}.run {
src = ./.;
hooks = {
check-added-large-files.enable = true;
check-case-conflicts.enable = true;
check-merge-conflicts.enable = true;
check-symlinks.enable = true;
deadnix.enable = true;
end-of-file-fixer.enable = true;
fix-byte-order-marker.enable = true;
mixed-line-endings.enable = true;
nixfmt-rfc-style.enable = true;
trim-trailing-whitespace.enable = true;
# Rust hooks
cargo-check.enable = true;
clippy.enable = true;
rustfmt.enable = true;
};
};
};
# This is not special, this is just flakes
packages = {
rustpkg = naersk-lib.buildPackage ./.;
};
};
};
2024-10-15 16:52:24 -05:00
}