From 013a8d2697bb410002e3afc020522e135bc57bad Mon Sep 17 00:00:00 2001 From: YoEight Date: Sun, 26 May 2024 11:46:08 -0400 Subject: [PATCH] Support nix shell environment. --- .envrc | 1 + flake.lock | 25 +++++++++++++++++++++++++ flake.nix | 27 +++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..1cbfc64a --- /dev/null +++ b/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1712963716, + "narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=", + "rev": "cfd6b5fc90b15709b780a5a1619695a88505a176", + "revCount": 611350, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.611350%2Brev-cfd6b5fc90b15709b780a5a1619695a88505a176/018eddfc-e6d9-74bb-a823-20f2ae60079b/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..cfd57cd0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + description = "A Nix-flake-based EventStoreDB Java client development environment"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + + outputs = { self, nixpkgs }: + let + javaVersion = 11; # Change this value to update the whole stack + overlays = [ + (final: prev: rec { + jdk = prev."jdk${toString javaVersion}"; + # gradle = prev.gradle.override { java = jdk; }; + }) + ]; + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit overlays system; }; + }); + in + { + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ jdk11 ]; + }; + }); + }; +}