From 0db069e6f6992a544f9dda7657cb6367113a8fcf Mon Sep 17 00:00:00 2001 From: DJ O'Leary Date: Thu, 6 Mar 2025 02:10:32 +0100 Subject: feat: Replace OCaml shell with flake --- 2024/OCaml/.envrc | 2 +- 2024/OCaml/flake.lock | 27 +++++++++++++++++++++++++++ 2024/OCaml/flake.nix | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2024/OCaml/shell.nix | 35 ----------------------------------- 4 files changed, 72 insertions(+), 36 deletions(-) create mode 100644 2024/OCaml/flake.lock create mode 100644 2024/OCaml/flake.nix delete mode 100644 2024/OCaml/shell.nix diff --git a/2024/OCaml/.envrc b/2024/OCaml/.envrc index 1d953f4..3550a30 100644 --- a/2024/OCaml/.envrc +++ b/2024/OCaml/.envrc @@ -1 +1 @@ -use nix +use flake diff --git a/2024/OCaml/flake.lock b/2024/OCaml/flake.lock new file mode 100644 index 0000000..b7695d9 --- /dev/null +++ b/2024/OCaml/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1741010256, + "narHash": "sha256-WZNlK/KX7Sni0RyqLSqLPbK8k08Kq7H7RijPJbq9KHM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ba487dbc9d04e0634c64e3b1f0d25839a0a68246", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/2024/OCaml/flake.nix b/2024/OCaml/flake.nix new file mode 100644 index 0000000..74a5dc6 --- /dev/null +++ b/2024/OCaml/flake.nix @@ -0,0 +1,44 @@ +{ + description = "Advent of Code 2024: OCaml"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = + { nixpkgs, ... }: + let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + in + { + devShells.x86_64-linux.default = + let + ocamlPackages = pkgs.ocaml-ng.ocamlPackages_5_2; + in + pkgs.mkShell { + # build tools + nativeBuildInputs = with ocamlPackages; [ + pkgs.opam + ocaml + findlib + dune_3 + ]; + # dependencies + buildInputs = with ocamlPackages; [ + bisect_ppx + findlib + menhir + ocaml-lsp + earlybird + ocamlformat + ocamlgraph + odoc + ounit2 + re2 + utop + + pkgs.gh # GitHub CLI + ]; + }; + }; +} diff --git a/2024/OCaml/shell.nix b/2024/OCaml/shell.nix deleted file mode 100644 index bd9cc09..0000000 --- a/2024/OCaml/shell.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ }: -let - config = { - allowUnfree = true; - }; - pkgs = import { inherit config; }; - - # choose the ocaml version you want to use - ocamlPackages = pkgs.ocaml-ng.ocamlPackages_5_2; -in -pkgs.mkShell { - # build tools - nativeBuildInputs = with ocamlPackages; [ - pkgs.opam - ocaml - findlib - dune_3 - ]; - # dependencies - buildInputs = with ocamlPackages; [ - bisect_ppx - findlib - menhir - ocaml-lsp - earlybird - ocamlformat - ocamlgraph - odoc - ounit2 - re2 - utop - - pkgs.gh # GitHub CLI - ]; -} -- cgit v1.2.3