flake_env/flake.nix
2024-08-08 08:08:58 -04:00

87 lines
2.2 KiB
Nix

{
description = "Yet another flake plugin for direnv";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-filter = { url = "github:numtide/nix-filter"; };
};
outputs =
inputs @ { flake-parts
, nix-filter
, git-hooks
, ...
}:
flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }: {
systems = [
"aarch64-linux"
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
imports = [ git-hooks.flakeModule ];
perSystem =
{ config
, pkgs
, self'
, ...
}: {
packages = {
flake_env = pkgs.ocamlPackages.callPackage ./default.nix {
inherit nix-filter;
};
default = config.packages.flake_env;
};
devShells.default = pkgs.mkShell {
inputsFrom = [ self'.packages.default ];
packages = builtins.attrValues {
inherit (pkgs)
just
nil
pre-commit
;
inherit (pkgs.ocamlPackages)
dune_3
findlib
ocaml
ocaml-lsp
ocamlformat
ocamlformat-rpc-lib
;
};
shellHook = config.pre-commit.installationScript;
};
pre-commit = {
check.enable = true;
settings.hooks = {
nixpkgs-fmt.enable = true;
dune-fmt = {
enable = true;
settings = {
extraRuntimeInputs = [
pkgs.ocamlPackages.reason
];
};
};
};
};
};
flake = {
overlays.default = final: _prev: {
flake_env = final.ocamlPackages.callPackage ./default.nix {
inherit nix-filter;
};
};
};
});
}