From e41a6a0d03266a745c3277dba075733f951399cf Mon Sep 17 00:00:00 2001 From: Jeffrey Hales Date: Sat, 6 Jun 2026 20:21:27 -0700 Subject: [PATCH] env: add nix flake and lock files --- flake.lock | 25 +++++++++++++++++++++++++ flake.nix | 25 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..91a254e --- /dev/null +++ b/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1728018373, + "narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=", + "rev": "bc947f541ae55e999ffdb4013441347d83b00feb", + "revCount": 688563, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.688563%2Brev-bc947f541ae55e999ffdb4013441347d83b00feb/01925b66-3b70-71bd-b277-924a6c208ba7/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 0000000..1154860 --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "A Nix-flake-based Node.js development environment"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + + outputs = { self, nixpkgs }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; }; + }); + in + { + overlays.default = final: prev: rec { + nodejs = prev.nodejs; + yarn = (prev.yarn.override { inherit nodejs; }); + }; + + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ node2nix nodejs nodePackages.pnpm yarn ]; + }; + }); + }; +}