File tree Expand file tree Collapse file tree 4 files changed +120
-0
lines changed Expand file tree Collapse file tree 4 files changed +120
-0
lines changed Original file line number Diff line number Diff line change 57
57
pkgs . appendOverlays extraOverlays ;
58
58
59
59
overlays . default = import ./overlay nixpkgs ;
60
+
61
+ templates . opinionated = {
62
+ description =
63
+ "Opinionated setup for ocaml development" ;
64
+ path = ./templates/opinionated ;
65
+ } ;
66
+
67
+ templates . default = self . templates . opinionated ;
60
68
} // flake-utils . lib . eachDefaultSystem ( system :
61
69
{
62
70
legacyPackages = self . makePkgs { inherit system ; } ;
Original file line number Diff line number Diff line change
1
+ {
2
+ nixConfig = {
3
+ extra-substituters = "https://ocaml.nix-cache.com" ;
4
+ extra-trusted-public-keys = "ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=" ;
5
+ } ;
6
+
7
+ inputs = {
8
+ nixpkgs . url = "github:nix-ocaml/nix-overlays" ;
9
+ treefmt-nix . url = "github:numtide/treefmt-nix" ;
10
+ treefmt-nix . inputs . nixpkgs . follows = "nixpkgs" ;
11
+ nix-filter . url = "github:numtide/nix-filter" ;
12
+ } ;
13
+
14
+ outputs = inputs @ { flake-parts , ... } :
15
+ flake-parts . lib . mkFlake { inherit inputs ; } {
16
+ imports = [
17
+ inputs . treefmt-nix . flakeModule
18
+ ] ;
19
+ systems = [ "x86_64-linux" "aarch64-darwin" ] ;
20
+ perSystem =
21
+ { config
22
+ , self'
23
+ , inputs'
24
+ , pkgs
25
+ , system
26
+ , ...
27
+ } : {
28
+ treefmt = {
29
+ projectRootFile = "flake.nix" ;
30
+ programs = {
31
+ alejandra . enable = true ;
32
+ ocamlformat = {
33
+ inherit pkgs ;
34
+ configFile = ./.ocamlformat ;
35
+ enable = true ;
36
+ } ;
37
+ } ;
38
+ } ;
39
+
40
+ packages = pkgs . ocamlPackages . callPackage ./nix {
41
+ inherit ( inputs ) nix-filter ;
42
+ doCheck = true ;
43
+ } ;
44
+
45
+ devShells . default = pkgs . mkShell {
46
+ inputsFrom = with self' . packages ; [
47
+ self' . packages . package
48
+ ] ;
49
+
50
+ packages = with pkgs . ocamlPackages ; [
51
+ ocaml
52
+ dune
53
+
54
+ ocaml-lsp
55
+
56
+ ocamlformat
57
+ dune-release
58
+ odoc
59
+ ] ;
60
+ } ;
61
+ } ;
62
+ } ;
63
+ }
Original file line number Diff line number Diff line change
1
+ { pkgs
2
+ , stdenv
3
+ , lib
4
+ , nix-filter
5
+ , ocamlPackages
6
+ , static ? false
7
+ , doCheck
8
+ ,
9
+ } :
10
+ with ocamlPackages ; rec {
11
+ package = buildDunePackage {
12
+ pname = "package" ;
13
+ version = "1.0.0" ;
14
+
15
+ src = with nix-filter . lib ;
16
+ filter {
17
+ # Root of the project relative to this file
18
+ root = ./.. ;
19
+ # If no include is passed, it will include all the paths.
20
+ include = [
21
+ # Include the "src" path relative to the root.
22
+ "src"
23
+ "test"
24
+ # Include this specific path. The path must be under the root.
25
+ ../package.opam
26
+ ../dune-project
27
+ ] ;
28
+ } ;
29
+
30
+ checkInputs = [
31
+ # Put test dependencies here
32
+ ] ;
33
+
34
+ propagatedBuildInputs = [
35
+ # Put dependencies here
36
+ ] ;
37
+
38
+ buildInputs = [
39
+ # Put build-time dependencies here
40
+ ] ;
41
+
42
+ inherit doCheck ;
43
+
44
+ meta = {
45
+ description = "Describe your project here" ;
46
+ # license = stdenv.lib.licenses.bsd3;
47
+ } ;
48
+ } ;
49
+ }
You can’t perform that action at this time.
0 commit comments