abacus/flake.nix
Bruno BELANYI 5c7c2af289
All checks were successful
continuous-integration/drone/push Build is passing
nix: use 'inputsFrom'
2021-10-08 15:47:26 +02:00

101 lines
2.3 KiB
Nix

{
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 {
inputsFrom = with self.packages.${system}; [
abacus
];
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
cmake
flex
ninja
pkg-config
];
checkInputs = with pkgs; [
gtest
];
doCheck = true;
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;
};
};
};
});
}