142 lines
3.4 KiB
Nix
142 lines
3.4 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs-oc.url = "github:nix-ocaml/nix-overlays";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
nh.url = "github:viperML/nh";
|
|
|
|
lix = {
|
|
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
|
|
flake = false;
|
|
};
|
|
|
|
lix-module = {
|
|
url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz";
|
|
inputs.nixpkgs.follows = "nixpkgs-oc";
|
|
inputs.lix.follows = "lix";
|
|
};
|
|
};
|
|
|
|
nixConfig = {
|
|
extra-substituters = "https://anmonteiro.nix-cache.workers.dev";
|
|
extra-trusted-public-keys = "ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=";
|
|
};
|
|
|
|
outputs = inputs @ {
|
|
self,
|
|
nixpkgs-oc,
|
|
flake-utils,
|
|
...
|
|
}: let
|
|
inherit (inputs) nixpkgs-oc;
|
|
lix-overlay = inputs.lix-module.overlays.default;
|
|
lix-module = inputs.lix-module.nixosModules.default;
|
|
nh-overlay = inputs.nh.overlays.default;
|
|
version = builtins.toString self.lastModified;
|
|
in
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system: let
|
|
pkgs = import nixpkgs-oc {
|
|
inherit system;
|
|
overlays = [
|
|
lix-overlay
|
|
nh-overlay
|
|
nixpkgs-oc.overlays.default
|
|
];
|
|
modules = [lix-module];
|
|
extra-substituters = "https://anmonteiro.nix-cache.workers.dev";
|
|
extra-trusted-public-keys = "ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=";
|
|
};
|
|
minimal = let
|
|
inherit
|
|
(pkgs.ocamlPackages)
|
|
dune_3
|
|
ocaml
|
|
;
|
|
in [
|
|
dune_3
|
|
ocaml
|
|
];
|
|
dev = let
|
|
inherit
|
|
(pkgs.ocamlPackages)
|
|
utop
|
|
ocaml-lsp
|
|
ocamlformat
|
|
ocamlformat-rpc-lib
|
|
;
|
|
in [
|
|
utop
|
|
ocaml-lsp
|
|
ocamlformat
|
|
ocamlformat-rpc-lib
|
|
];
|
|
inherit (pkgs) lix nh;
|
|
in {
|
|
devShells.default = let
|
|
inherit (pkgs) mkShell;
|
|
in
|
|
mkShell {
|
|
buildInputs = minimal ++ dev ++ [lix nh];
|
|
shellHook = let
|
|
justFile = ''
|
|
default:
|
|
@just --list
|
|
|
|
@build:
|
|
nix build .#debug --offline
|
|
|
|
@release:
|
|
nix build --offline
|
|
|
|
@test:
|
|
printf "\\n\\n\\t************ running nix+dune tests ************\\n\\n\\n"
|
|
nix flake check --offline
|
|
|
|
@push:
|
|
git commit -a
|
|
git push
|
|
'';
|
|
in ''
|
|
printf '${justFile}' > justfile
|
|
'';
|
|
};
|
|
|
|
packages.default = pkgs.callPackage ./nix/default.nix {
|
|
ocaml-deps = minimal;
|
|
inherit version;
|
|
};
|
|
|
|
defaultPackage = self.packages.${system}.default;
|
|
}
|
|
)
|
|
// {
|
|
nixosModules.meat = import ./nix/module.nix {
|
|
meatOverlays = [
|
|
nixpkgs-oc.overlays.default
|
|
nh-overlay
|
|
self.overlays.meat
|
|
];
|
|
lixModule = lix-module;
|
|
};
|
|
|
|
overlays.meat = final: prev: let
|
|
ocaml-deps = let
|
|
inherit
|
|
(final.ocamlPackages)
|
|
dune_3
|
|
ocaml
|
|
;
|
|
in [
|
|
dune_3
|
|
ocaml
|
|
];
|
|
in {
|
|
meat = final.callPackage ./nix/default.nix {
|
|
inherit ocaml-deps version;
|
|
};
|
|
};
|
|
};
|
|
}
|