diff --git a/Makefile b/Makefile index 8aaefaf..8e0856a 100644 --- a/Makefile +++ b/Makefile @@ -27,4 +27,8 @@ promote: fmt: dune build @fmt --auto-promote +.PHONY: nix/opam-selection.nix +nix/opam-selection.nix: + nix-shell -A resolve default.nix + .PHONY: default install uninstall reinstall clean test diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9cb1313 --- /dev/null +++ b/flake.lock @@ -0,0 +1,76 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-filter": { + "locked": { + "lastModified": 1694857738, + "narHash": "sha256-bxxNyLHjhu0N8T3REINXQ2ZkJco0ABFPn6PIe2QUfqo=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "41fd48e00c22b4ced525af521ead8792402de0ea", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1695732165, + "narHash": "sha256-dj/F0iQzyP0+fJ17uIwxywZh3zVdCJpMNzhYmo62yhY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d490800f0f2140bbd1ad5bb87fbb7c38ed36fc6f", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nix-filter": "nix-filter", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3807833 --- /dev/null +++ b/flake.nix @@ -0,0 +1,32 @@ +{ + description = "spawn Nix Flake"; + + inputs.nix-filter.url = "github:numtide/nix-filter"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.nixpkgs.url = "github:nixos/nixpkgs"; + + outputs = { self, nixpkgs, flake-utils, nix-filter }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages."${system}"; + inherit (pkgs.ocamlPackages) buildDunePackage; + in + rec { + packages = rec { + default = spawn; + spawn = buildDunePackage { + pname = "spawn"; + version = "n/a"; + src = ./.; + duneVersion = "3"; + propagatedBuildInputs = with pkgs.ocamlPackages; [ ]; + checkInputs = with pkgs.ocamlPackages; [ ppx_expect ppx_bench ]; + doCheck = true; + }; + }; + devShells.default = pkgs.mkShell { + inputsFrom = pkgs.lib.attrValues packages; + buildInputs = with pkgs.ocamlPackages; [ ocaml-lsp pkgs.ocamlformat_0_19_0 ]; + }; + }); +}