mfgames-conventional-commit-rs/flake.nix

81 lines
2.4 KiB
Nix

{
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
mfgames-project-setup.url = "git+https://src.mfgames.com/nixos-contrib/mfgames-project-setup-flake.git";
systems.url = "github:nix-systems/x86_64-linux";
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.systems.follows = "systems";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, nixpkgs, mfgames-project-setup, flake-utils, fenix, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
rustPlatform = (pkgs.makeRustPlatform {
inherit (fenix.packages.${system}.minimal) cargo rustc;
});
in
{
# Create a binary for the project.
packages = rec {
mfgames-conventional-commit = rustPlatform.buildRustPackage {
pname = "mfgames-conventional-commit";
version = "0.0.1";
src = ./.;
#cargoBuildFlags = "-p app";
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = [ pkgs.pkg-config ];
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
};
default = mfgames-conventional-commit;
};
apps = rec {
mfgames-conventional-commit = flake-utils.lib.mkApp { drv = self.packages.${system}.mfgames-conventional-commit; };
default = mfgames-conventional-commit;
};
# Set up the developer shell.
devShells =
let
project-config = mfgames-project-setup.lib.mkConfig {
inherit system pkgs;
contributorCovenant.enable = true;
contributorCovenant.contact = "contact@mfgames.com";
developerCertificateOfOrigin.enable = true;
rust.enable = true;
};
in
{
# Shell
default = pkgs.mkShell {
packages = [
# Rust
pkgs.rustup
# git2 crate
pkgs.pkg-config
pkgs.openssl
]
++ project-config.packages;
shellHook = project-config.shellHook;
};
};
# Formatting for the Nix files
formatter = pkgs.nixpkgs-fmt;
});
}