From dc070723767e9e560da149271aa254208a60e185 Mon Sep 17 00:00:00 2001 From: jk <47693+sectore@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:47:00 +0200 Subject: [PATCH 1/2] fix: make sure corepack uses same node version --- flake.lock | 6 +++--- flake.nix | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 1aa6da9..89c9165 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1715037484, - "narHash": "sha256-OUt8xQFmBU96Hmm4T9tOWTu4oCswCzoVl+pxSq/kiFc=", + "lastModified": 1722415718, + "narHash": "sha256-5US0/pgxbMksF92k1+eOa8arJTJiPvsdZj9Dl+vJkM4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ad7efee13e0d216bf29992311536fce1d3eefbef", + "rev": "c3392ad349a5227f4a3464dce87bcc5046692fce", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e74df65..26c082e 100644 --- a/flake.nix +++ b/flake.nix @@ -17,16 +17,17 @@ }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; + node = pkgs.nodejs_22; corepackEnable = pkgs.runCommand "corepack-enable" {} '' mkdir -p $out/bin - ${pkgs.nodejs-18_x}/bin/corepack enable --install-directory $out/bin + ${node}/bin/corepack enable --install-directory $out/bin ''; in { formatter = pkgs.alejandra; devShells = { default = pkgs.mkShell { buildInputs = with pkgs; [ - nodejs_22 + node corepackEnable ]; }; From 3b14c5709b2383102bff8b714cb7ee9070ea67fb Mon Sep 17 00:00:00 2001 From: jk <47693+sectore@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:17:42 +0200 Subject: [PATCH 2/2] use `corepack` + remove `flake-utils` as suggested by @tim-smart https://github.com/tim-smart/effect-rx/pull/150#issuecomment-2265034112 --- flake.lock | 34 ---------------------------------- flake.nix | 44 ++++++++++++++------------------------------ 2 files changed, 14 insertions(+), 64 deletions(-) diff --git a/flake.lock b/flake.lock index 89c9165..f394fea 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,5 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1722415718, @@ -36,24 +18,8 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 26c082e..c818d66 100644 --- a/flake.nix +++ b/flake.nix @@ -1,36 +1,20 @@ { inputs = { - nixpkgs = { - url = "github:nixos/nixpkgs/nixpkgs-unstable"; - }; - - flake-utils = { - url = "github:numtide/flake-utils"; - }; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; }; - - outputs = { - self, - nixpkgs, - flake-utils, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; - node = pkgs.nodejs_22; - corepackEnable = pkgs.runCommand "corepack-enable" {} '' - mkdir -p $out/bin - ${node}/bin/corepack enable --install-directory $out/bin - ''; - in { - formatter = pkgs.alejandra; - devShells = { - default = pkgs.mkShell { - buildInputs = with pkgs; [ - node - corepackEnable - ]; - }; + outputs = {nixpkgs, ...}: let + forAllSystems = function: + nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed + (system: function nixpkgs.legacyPackages.${system}); + in { + formatter = forAllSystems (pkgs: pkgs.alejandra); + devShells = forAllSystems (pkgs: { + default = pkgs.mkShell { + packages = with pkgs; [ + corepack + nodejs_22 + ]; }; }); + }; }