2023-10-22 08:35:09 -04:00
|
|
|
{
|
2024-04-08 11:11:05 -04:00
|
|
|
description = "A basic flake";
|
2023-10-22 08:35:09 -04:00
|
|
|
|
|
|
|
inputs = {
|
2024-04-08 11:11:05 -04:00
|
|
|
systems.url = "github:nix-systems/default-linux";
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2024-02-19 21:27:24 -05:00
|
|
|
fenix.url = "github:nix-community/fenix/monthly";
|
2024-04-08 18:45:30 -04:00
|
|
|
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
2023-10-22 08:35:09 -04:00
|
|
|
};
|
2024-04-08 11:11:05 -04:00
|
|
|
|
2024-02-19 21:27:24 -05:00
|
|
|
outputs = {
|
2024-04-08 11:11:05 -04:00
|
|
|
self,
|
|
|
|
systems,
|
2024-02-19 21:27:24 -05:00
|
|
|
nixpkgs,
|
|
|
|
fenix,
|
2024-04-08 18:45:30 -04:00
|
|
|
pre-commit-hooks,
|
|
|
|
}: let
|
2024-04-08 11:11:05 -04:00
|
|
|
eachSystem = nixpkgs.lib.genAttrs (import systems);
|
|
|
|
pkgsFor = eachSystem (system:
|
|
|
|
import nixpkgs {
|
|
|
|
localSystem.system = system;
|
|
|
|
overlays = [fenix.overlays.default];
|
|
|
|
});
|
2023-10-22 08:35:09 -04:00
|
|
|
in {
|
2024-04-08 11:11:05 -04:00
|
|
|
packages = eachSystem (system: let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2024-04-08 18:45:30 -04:00
|
|
|
inherit ((builtins.fromTOML (builtins.readFile ./Cargo.toml)).package) version;
|
2024-04-08 11:11:05 -04:00
|
|
|
in {
|
|
|
|
default = pkgsFor.${system}.rustPlatform.buildRustPackage {
|
|
|
|
pname = "forcebot_rs";
|
2024-04-08 17:59:36 -04:00
|
|
|
version = "${version}";
|
2024-04-08 11:11:05 -04:00
|
|
|
|
|
|
|
src = self;
|
|
|
|
|
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = with pkgs; [pkg-config];
|
|
|
|
buildInputs = with pkgs; [openssl];
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
};
|
|
|
|
});
|
2024-04-08 18:45:30 -04:00
|
|
|
checks = eachSystem (system: {
|
|
|
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
|
|
|
src = ./.;
|
|
|
|
hooks = {
|
|
|
|
# rust
|
|
|
|
rustfmt.enable = true;
|
|
|
|
clippy.enable = true;
|
|
|
|
# nix
|
|
|
|
statix.enable = true;
|
|
|
|
alejandra.enable = true;
|
|
|
|
deadnix.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
2024-04-08 11:11:05 -04:00
|
|
|
devShells = eachSystem (system: {
|
|
|
|
default = pkgsFor.${system}.mkShell {
|
2024-04-08 18:45:30 -04:00
|
|
|
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
2024-04-08 11:11:05 -04:00
|
|
|
packages = with pkgsFor.${system}; [
|
|
|
|
nil
|
|
|
|
alejandra
|
|
|
|
rust-analyzer-nightly
|
|
|
|
(fenix.packages.${system}.complete.withComponents [
|
|
|
|
"cargo"
|
|
|
|
"clippy"
|
|
|
|
"rust-src"
|
|
|
|
"rustc"
|
|
|
|
"rustfmt"
|
|
|
|
])
|
|
|
|
];
|
|
|
|
RUST_BACKTRACE = 1;
|
|
|
|
RUST_SRC_PATH = "${fenix.packages.${system}.complete.rust-src}/lib/rustlib/src/rust/library";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
nixosModules.default = import ./nix/module.nix {inherit self;};
|
2023-10-22 08:35:09 -04:00
|
|
|
};
|
|
|
|
}
|