From d92ca417a2e6c254d4c9a4d972950174cdd19597 Mon Sep 17 00:00:00 2001 From: Aliervo Date: Mon, 17 Jul 2023 15:52:49 -0500 Subject: [PATCH] Add node-latest environment --- node-latest/.envrc | 1 + node-latest/flake.lock | 27 +++++++++++++++++++++++++++ node-latest/flake.nix | 27 +++++++++++++++++++++++++++ node/flake.nix | 2 +- 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 node-latest/.envrc create mode 100644 node-latest/flake.lock create mode 100644 node-latest/flake.nix diff --git a/node-latest/.envrc b/node-latest/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/node-latest/.envrc @@ -0,0 +1 @@ +use flake diff --git a/node-latest/flake.lock b/node-latest/flake.lock new file mode 100644 index 0000000..0f56f8b --- /dev/null +++ b/node-latest/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1689261696, + "narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "df1eee2aa65052a18121ed4971081576b25d6b5c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/node-latest/flake.nix b/node-latest/flake.nix new file mode 100644 index 0000000..8d16d33 --- /dev/null +++ b/node-latest/flake.nix @@ -0,0 +1,27 @@ +{ + description = "A Nix-flake-based Node.js development environment"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + outputs = { self, nixpkgs }: + let + overlays = [ + (final: prev: rec { + nodejs = prev.nodejs_20; + pnpm = prev.nodePackages.pnpm; + yarn = (prev.yarn.override { inherit nodejs; }); + }) + ]; + 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; [ node2nix nodejs pnpm yarn ]; + }; + }); + }; +} diff --git a/node/flake.nix b/node/flake.nix index f255c1f..23552a1 100644 --- a/node/flake.nix +++ b/node/flake.nix @@ -7,7 +7,7 @@ let overlays = [ (final: prev: rec { - nodejs = prev.nodejs-18_x; + nodejs = prev.nodejs; pnpm = prev.nodePackages.pnpm; yarn = (prev.yarn.override { inherit nodejs; }); })