2023-06-23 08:33:04 +02:00
|
|
|
{
|
|
|
|
description = "A Nix-flake-based Node.js development environment";
|
|
|
|
|
|
|
|
inputs = {
|
2023-12-08 16:19:17 +01:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
2023-06-23 08:33:04 +02:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs =
|
|
|
|
{ self
|
|
|
|
, nixpkgs
|
|
|
|
, flake-utils
|
|
|
|
}:
|
|
|
|
|
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
overlays = [
|
|
|
|
(self: super: rec {
|
2023-12-06 03:23:49 +01:00
|
|
|
nodejs = super.nodejs_20;
|
2023-06-23 08:33:04 +02:00
|
|
|
pnpm = super.nodePackages.pnpm;
|
|
|
|
yarn = (super.yarn.override { inherit nodejs; });
|
|
|
|
})
|
|
|
|
];
|
|
|
|
pkgs = import nixpkgs { inherit overlays system; };
|
2023-12-08 16:19:17 +01:00
|
|
|
pkgs_chromium = import nixpkgs { inherit system; };
|
2023-06-23 08:33:04 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
devShells.default = pkgs.mkShell {
|
2023-10-04 09:17:37 +02:00
|
|
|
packages = with pkgs; [ node2nix nodejs pnpm yarn git];
|
2023-06-23 08:33:04 +02:00
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
echo "node `${pkgs.nodejs}/bin/node --version`"
|
2023-08-05 09:05:56 +02:00
|
|
|
|
|
|
|
# Set Puppeteer to not download Chrome, cause it doesn't work on NixOS
|
|
|
|
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
|
|
|
|
# Set Puppeteer to use Chromium from Nixpkgs
|
2023-12-08 16:19:17 +01:00
|
|
|
export PUPPETEER_EXECUTABLE_PATH=${pkgs_chromium.chromium.outPath}/bin/chromium
|
2023-06-23 08:33:04 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
});
|
2023-08-05 09:05:56 +02:00
|
|
|
}
|