abacus/flake.nix

104 lines
2.4 KiB
Nix
Raw Permalink Normal View History

2021-08-19 21:33:04 +02:00
{
description = "A simple calculator";
inputs = {
futils = {
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "master";
};
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixos-unstable";
};
pre-commit-hooks = {
type = "github";
owner = "cachix";
repo = "pre-commit-hooks.nix";
ref = "master";
inputs = {
flake-utils.follows = "futils";
nixpkgs.follows = "nixpkgs";
};
};
};
outputs = { self, futils, nixpkgs, pre-commit-hooks }:
2022-02-17 10:27:11 +01:00
{
2023-12-06 12:58:17 +01:00
overlays.default = final: prev: {
2022-02-17 10:27:11 +01:00
abacus = final.stdenv.mkDerivation {
pname = "abacus";
version = "0.0.0";
src = self;
nativeBuildInputs = with final; [
bison
cmake
flex
ninja
pkg-config
];
checkInputs = with final; [
gtest
];
doCheck = true;
meta = with final.lib; {
description = "A simple calculator using big numbers";
homepage = "https://gitea.belanyi.fr/ambroisie/abacus";
license = licenses.mit;
maintainers = [ ambroisie ];
platforms = platforms.unix;
};
};
};
} // futils.lib.eachDefaultSystem (system:
2021-08-19 21:33:04 +02:00
let
2023-12-06 12:58:17 +01:00
pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; };
2021-08-19 21:33:04 +02:00
in
{
checks = {
inherit (self.packages.${system}) abacus;
pre-commit = pre-commit-hooks.lib.${system}.run {
src = self;
hooks = {
nixpkgs-fmt = {
enable = true;
};
clang-format = {
enable = true;
name = "clang-format";
entry = "${pkgs.clang-tools}/bin/clang-format -style=file -i";
types = [ "text" "c++" ];
language = "system";
};
};
};
};
2023-12-06 12:58:17 +01:00
devShells.default = pkgs.mkShell {
2021-10-08 15:47:26 +02:00
inputsFrom = with self.packages.${system}; [
abacus
];
2021-08-19 21:33:04 +02:00
inherit (self.checks.${system}.pre-commit) shellHook;
};
packages = futils.lib.flattenTree {
2022-02-17 10:27:11 +01:00
inherit (pkgs) abacus;
2023-12-06 12:58:17 +01:00
default = pkgs.abacus;
2021-08-19 21:33:04 +02:00
};
});
}