Created
January 18, 2024 15:15
-
-
Save schickling/61599cd357922e7a80d50c62d8c9004a to your computer and use it in GitHub Desktop.
Node.js 16 Nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/release-23.11"; | |
nixpkgsOld.url = "github:NixOS/nixpkgs/release-23.05"; | |
nixpkgsUnstable.url = "github:NixOS/nixpkgs/nixos-unstable"; | |
flake-utils.url = "github:numtide/flake-utils"; | |
}; | |
outputs = { self, nixpkgs, nixpkgsOld, nixpkgsUnstable, flake-utils }: | |
flake-utils.lib.eachDefaultSystem (system: | |
let | |
pkgs = nixpkgs.legacyPackages.${system}; | |
# pkgsOld = nixpkgsOld.legacyPackages.${system}; | |
pkgsOld = import nixpkgsOld { | |
inherit system; | |
config.permittedInsecurePackages = [ | |
# TODO: Node 16 is EOL. We should get the importer working on modern Node. | |
"nodejs-16.20.2" | |
]; | |
}; | |
pkgsUnstable = import nixpkgsUnstable { inherit system; }; | |
corepack = pkgs.runCommand "corepack-enable" {} '' | |
mkdir -p $out/bin | |
${pkgsOld.nodejs_16}/bin/corepack enable --install-directory $out/bin | |
''; | |
in | |
{ | |
# use `corepack prepare pnpm@latest --activate` to update pnpm | |
devShell = with pkgs; pkgs.mkShell { | |
buildInputs = [ | |
pkgsOld.nodejs_16 | |
corepack | |
]; | |
# See version https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/web/playwright/driver.nix#L33 | |
PLAYWRIGHT_BROWSERS_PATH = pkgsUnstable.playwright-driver.browsers; | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment