diff --git a/.gitignore b/.gitignore index e35d885..2a5c966 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ _build + +# nix ignores +.direnv +result +.envrc + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..3ff75b0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,63 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1708807242, + "narHash": "sha256-sRTRkhMD4delO/hPxxi+XwLqPn8BuUq6nnj4JqLwOu0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1706550542, + "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..33c7d49 --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "A pure OCaml library for manipulating colors in different color spaces"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; + perSystem = { config, self', inputs', pkgs, system, ... }: + let + inherit (pkgs) ocamlPackages mkShell; + inherit (ocamlPackages) buildDunePackage; + name = "colors"; + version = "0.0.1"; + in + { + devShells = { + default = mkShell { + buildInputs = [ ocamlPackages.utop ]; + inputsFrom = [ self'.packages.default ]; + }; + }; + + packages = { + default = buildDunePackage { + inherit version; + pname = name; + propagatedBuildInputs = with ocamlPackages; [ + (mdx.override { + inherit logs; + }) + ]; + src = ./.; + }; + }; + }; + }; +}