summaryrefslogtreecommitdiff
path: root/2024/OCaml
diff options
context:
space:
mode:
authorDJ O'Leary <dijitol@proton.me>2025-03-06 02:10:32 +0100
committerDJ O'Leary <dijitol@proton.me>2025-03-06 02:10:32 +0100
commit0db069e6f6992a544f9dda7657cb6367113a8fcf (patch)
tree21b4163ced89e6ed4bfb43744d351086ff801d2f /2024/OCaml
parent2996ab249a6ae29b2644061c366f88c2157652f2 (diff)
feat: Replace OCaml shell with flake
Diffstat (limited to '2024/OCaml')
-rw-r--r--2024/OCaml/.envrc2
-rw-r--r--2024/OCaml/flake.lock27
-rw-r--r--2024/OCaml/flake.nix44
-rw-r--r--2024/OCaml/shell.nix35
4 files changed, 72 insertions, 36 deletions
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 <nixpkgs> { 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
- ];
-}