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 }:
|
|
|
|
futils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultPackage = self.packages.${system}.abacus;
|
|
|
|
|
|
|
|
devShell = pkgs.mkShell {
|
|
|
|
inherit (self.defaultPackage.${system})
|
2021-08-23 00:51:07 +02:00
|
|
|
checkInputs
|
2021-08-19 21:33:04 +02:00
|
|
|
nativeBuildInputs
|
|
|
|
;
|
|
|
|
|
|
|
|
inherit (self.checks.${system}.pre-commit) shellHook;
|
|
|
|
};
|
|
|
|
|
|
|
|
packages = futils.lib.flattenTree {
|
|
|
|
abacus = pkgs.stdenv.mkDerivation {
|
|
|
|
pname = "abacus";
|
|
|
|
version = "0.0.0";
|
|
|
|
|
|
|
|
src = self;
|
|
|
|
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
bison
|
2021-09-01 19:35:54 +02:00
|
|
|
cmake
|
2021-08-19 21:33:04 +02:00
|
|
|
flex
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2021-08-23 00:51:07 +02:00
|
|
|
checkInputs = with pkgs; [
|
2021-08-19 21:33:04 +02:00
|
|
|
gtest
|
|
|
|
];
|
|
|
|
|
2021-09-01 19:34:33 +02:00
|
|
|
doCheck = true;
|
|
|
|
|
2021-08-19 21:33:04 +02:00
|
|
|
meta = with pkgs.lib; {
|
|
|
|
description = "A simple calculator using big numbers";
|
|
|
|
homepage = "https://gitea.belanyi.fr/ambroisie/abacus";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ ambroisie ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|