templates: add ocaml
This commit is contained in:
parent
6ca9676d36
commit
8aa4c9eb82
@ -182,5 +182,9 @@
|
||||
path = ./templates/mojo;
|
||||
description = "Perl MojoLicious template.";
|
||||
};
|
||||
templates."ocaml" = {
|
||||
path = ./templates/ocaml;
|
||||
description = "OCaml template.";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
1
templates/ocaml/.envrc
Normal file
1
templates/ocaml/.envrc
Normal file
@ -0,0 +1 @@
|
||||
use flake
|
3
templates/ocaml/.gitignore
vendored
Normal file
3
templates/ocaml/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.direnv
|
||||
*.bak
|
||||
result
|
15
templates/ocaml/LICENSE
Normal file
15
templates/ocaml/LICENSE
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Aaron Bieber <aaron@bolddaemon.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
51
templates/ocaml/flake.nix
Normal file
51
templates/ocaml/flake.nix
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
description = "thing: stuff and things";
|
||||
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-22.05";
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
supportedSystems =
|
||||
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||
in {
|
||||
packages = forAllSystems (system:
|
||||
let pkgs = nixpkgsFor.${system};
|
||||
in {
|
||||
thing = pkgs.stdenv.mkDerivation {
|
||||
pname = "thing";
|
||||
version = "v0.0.0";
|
||||
src = ./.;
|
||||
buildInputs = with pkgs;
|
||||
[ ocaml opam ocamlformat pkg-config ]
|
||||
++ (with pkgs.ocamlPackages; [ dune_3 odoc ]);
|
||||
|
||||
buildPhase = ''
|
||||
ocamlc -o thing thing.ml
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
mv thing $out/bin
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
defaultPackage = forAllSystems (system: self.packages.${system}.thing);
|
||||
devShells = forAllSystems (system:
|
||||
let pkgs = nixpkgsFor.${system};
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
shellHook = ''
|
||||
PS1='\u@\h:\@; '
|
||||
echo "OCaml `${pkgs.ocaml}/bin/ocaml --version`"
|
||||
'';
|
||||
nativeBuildInputs = with pkgs;
|
||||
[ ocaml opam ocamlformat pkg-config ]
|
||||
++ (with pkgs.ocamlPackages; [ dune_3 odoc ]);
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
2
templates/ocaml/thing.ml
Normal file
2
templates/ocaml/thing.ml
Normal file
@ -0,0 +1,2 @@
|
||||
print_string "hello thing!\n";;
|
||||
|
Loading…
Reference in New Issue
Block a user