Skip to content

Commit

Permalink
fix: make sure corepack uses same node version (#150)
Browse files Browse the repository at this point in the history
* fix: make sure corepack uses same node version

* use `corepack` + remove `flake-utils`

as suggested by @tim-smart #150 (comment)
  • Loading branch information
sectore authored Aug 2, 2024
1 parent 9598fca commit 5559b6b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 66 deletions.
40 changes: 3 additions & 37 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 14 additions & 29 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,35 +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};
corepackEnable = pkgs.runCommand "corepack-enable" {} ''
mkdir -p $out/bin
${pkgs.nodejs-18_x}/bin/corepack enable --install-directory $out/bin
'';
in {
formatter = pkgs.alejandra;
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs_22
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
];
};
});
};
}

0 comments on commit 5559b6b

Please sign in to comment.