From 0ed194ed532109c47bed9dba2276c4348d7ae3da Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Mon, 7 Apr 2025 15:46:20 -0700 Subject: [PATCH] Initial commit --- .envrc | 1 + .gitignore | 31 +++++++++++++++++++++++++++++++ bin/dune | 4 ++++ bin/main.ml | 1 + dune-project | 26 ++++++++++++++++++++++++++ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 36 ++++++++++++++++++++++++++++++++++++ helloworld.opam | 32 ++++++++++++++++++++++++++++++++ lib/dune | 2 ++ test/dune | 2 ++ test/test_helloworld.ml | 0 11 files changed, 162 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 bin/dune create mode 100644 bin/main.ml create mode 100644 dune-project create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 helloworld.opam create mode 100644 lib/dune create mode 100644 test/dune create mode 100644 test/test_helloworld.ml diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..8392d15 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ca170a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +*.annot +*.cmo +*.cma +*.cmi +*.a +*.o +*.cmx +*.cmxs +*.cmxa + +# ocamlbuild working directory +_build/ + +# ocamlbuild targets +*.byte +*.native + +# oasis generated files +setup.data +setup.log + +# Merlin configuring file for Vim and Emacs +.merlin + +# Dune generated files +*.install + +# Local OPAM switch +_opam/ + +.direnv/ \ No newline at end of file diff --git a/bin/dune b/bin/dune new file mode 100644 index 0000000..a971f63 --- /dev/null +++ b/bin/dune @@ -0,0 +1,4 @@ +(executable + (public_name helloworld) + (name main) + (libraries helloworld)) diff --git a/bin/main.ml b/bin/main.ml new file mode 100644 index 0000000..7bf6048 --- /dev/null +++ b/bin/main.ml @@ -0,0 +1 @@ +let () = print_endline "Hello, World!" diff --git a/dune-project b/dune-project new file mode 100644 index 0000000..5951204 --- /dev/null +++ b/dune-project @@ -0,0 +1,26 @@ +(lang dune 3.18) + +(name helloworld) + +(generate_opam_files true) + +(source + (github username/reponame)) + +(authors "Author Name ") + +(maintainers "Maintainer Name ") + +(license LICENSE) + +(documentation https://url/to/documentation) + +(package + (name helloworld) + (synopsis "A short synopsis") + (description "A longer description") + (depends ocaml) + (tags + ("add topics" "to describe" your project))) + +; See the complete stanza docs at https://dune.readthedocs.io/en/stable/reference/dune-project/index.html diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..41abcde --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1743964447, + "narHash": "sha256-nEo1t3Q0F+0jQ36HJfbJtiRU4OI+/0jX/iITURKe3EE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "063dece00c5a77e4a0ea24e5e5a5bd75232806f8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6c10356 --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = ""; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + overlays = []; + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system overlays; + }; + meta = with nixpkgs.lib; { + #homepage = "https://example.com"; + #license = [ licenses.gpl3 ]; + platforms = [ system ]; + #maintainers = with maintainers; [ ]; + }; + in { + devShells.${system}.default = with pkgs; mkShell { + #packages = []; + inputsFrom = with self.packages.${system}; [ helloworld ]; + }; + packages.${system} = { + default = self.packages.${system}.helloworld; + helloworld = pkgs.ocamlPackages.buildDunePackage rec { + pname = "helloworld"; + version = "0.1.0"; + src = ./.; + inherit meta; + }; + }; + }; +} diff --git a/helloworld.opam b/helloworld.opam new file mode 100644 index 0000000..ab7cba2 --- /dev/null +++ b/helloworld.opam @@ -0,0 +1,32 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "A short synopsis" +description: "A longer description" +maintainer: ["Maintainer Name "] +authors: ["Author Name "] +license: "LICENSE" +tags: ["add topics" "to describe" "your" "project"] +homepage: "https://github.com/username/reponame" +doc: "https://url/to/documentation" +bug-reports: "https://github.com/username/reponame/issues" +depends: [ + "dune" {>= "3.18"} + "ocaml" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/username/reponame.git" +x-maintenance-intent: ["(latest)"] diff --git a/lib/dune b/lib/dune new file mode 100644 index 0000000..ab364d0 --- /dev/null +++ b/lib/dune @@ -0,0 +1,2 @@ +(library + (name helloworld)) diff --git a/test/dune b/test/dune new file mode 100644 index 0000000..6d62cfa --- /dev/null +++ b/test/dune @@ -0,0 +1,2 @@ +(test + (name test_helloworld)) diff --git a/test/test_helloworld.ml b/test/test_helloworld.ml new file mode 100644 index 0000000..e69de29