Skip to content

Commit

Permalink
Add nix.flake for easy devshell.
Browse files Browse the repository at this point in the history
  • Loading branch information
frekw committed Aug 20, 2024
1 parent 2679b11 commit 9b8492d
Show file tree
Hide file tree
Showing 4 changed files with 310 additions and 1 deletion.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,6 @@ Sessionx.vim
*~
.*.swp
# Auto-generated tag files
tags
tags
# nix flake stuff
.direnv
173 changes: 173 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

133 changes: 133 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
# hiwell
description = "neoburgh";

inputs = {
nixpkgs = {
url = "github:nix-ocaml/nix-overlays";
inputs.flake-utils.follows = "flake-utils";
};

ocaml-overlay = {
url = "github:nix-ocaml/nix-overlays";
inputs.nixpkgs.follows = "nixpkgs";
};

flake-utils = {
url = "github:numtide/flake-utils";
};

quickjs = {
type = "git";
url = "https://github.com/ml-in-barcelona/quickjs.ml.git";
submodules = true;
flake = false;
};

server-reason-react = {
url = "github:ml-in-barcelona/server-reason-react";
flake = false;
};
};

outputs =
inputs@{
self,
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
version = "0.59.2+dev";
pkgs = nixpkgs.legacyPackages."${system}".extend (
self: super: {
ocaml = super.ocaml-ng.ocamlPackages_5_1;
ocamlPackages = super.ocaml-ng.ocamlPackages_5_1;
# .overrideScope (
# oself: osuper: { ppxlib = osuper.ppxlib.override ({ version = "0.32.1"; }); }
# );
}
);
inherit (pkgs) ocamlPackages mkShell;
inherit (ocamlPackages) buildDunePackage;

quickjs = buildDunePackage {
pname = "quickjs";
version = "";
propagatedBuildInputs = with ocamlPackages; [
dune_3
ocaml
integers
ctypes
];
src = inputs.quickjs;
};

server-reason-react = buildDunePackage {
pname = "server-reason-react";
version = "";
nativeBuildInputs = with ocamlPackages; [
reason
melange
];
propagatedBuildInputs = with ocamlPackages; [
dune_3
ocaml
ppxlib
melange
quickjs
lwt
lwt_ppx
integers
uri
];
src = inputs.server-reason-react;
};
in
{
devShells = {
default = mkShell.override { stdenv = pkgs.clang18Stdenv; } {
buildInputs = with ocamlPackages; [
dune_3
ocaml
utop
ocamlformat
];
inputsFrom = [ self.packages."${system}".default ];
packages = builtins.attrValues {
inherit (pkgs) clang_18 clang-tools_18 pkg-config;
inherit (ocamlPackages) ocaml-lsp ocamlformat-rpc-lib;
};
};
};
packages = {
default = buildDunePackage {
inherit version;
pname = "styled-ppx";
nativeBuildInputs = with ocamlPackages; [ ];
propagatedBuildInputs = with ocamlPackages; [
alcotest
dune_3
fmt
melange
menhir
ocaml
ppx_deriving
ppx_deriving_yojson
ppxlib
reason
reason-react
reason-react-ppx
sedlex
server-reason-react
yojson
];
src = ./.;
};
};
formatter = pkgs.alejandra;
}
);
}

0 comments on commit 9b8492d

Please sign in to comment.