flake_env/flake.nix
2024-03-23 08:16:51 -04:00

75 lines
1.9 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";
};
pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; };
nix-filter = { url = "github:numtide/nix-filter"; };
};
outputs =
inputs @ { flake-parts
, nix-filter
, pre-commit-hooks
, ...
}:
flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }: {
systems = [
"aarch64-linux"
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
imports = [ pre-commit-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;
};
};
};
flake = {
overlays.default = final: _prev: {
flake_env = final.ocamlPackages.callPackage ./default.nix {
inherit nix-filter;
};
};
};
});
}