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";
|
|
|
|
};
|
|
|
|
|
2024-02-27 02:45:08 +01:00
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
flake-utils,
|
|
|
|
}:
|
|
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
2023-06-23 08:33:04 +02:00
|
|
|
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;
|
2024-02-27 02:45:08 +01:00
|
|
|
yarn = super.yarn.override {inherit nodejs;};
|
2023-06-23 08:33:04 +02:00
|
|
|
})
|
|
|
|
];
|
2024-02-27 02:45:08 +01:00
|
|
|
pkgs = import nixpkgs {inherit overlays system;};
|
|
|
|
pkgs_chromium = import nixpkgs {inherit system;};
|
|
|
|
packages = with pkgs; [node2nix nodejs pnpm yarn git];
|
|
|
|
in {
|
2023-06-23 08:33:04 +02:00
|
|
|
devShells.default = pkgs.mkShell {
|
2024-02-27 02:45:08 +01:00
|
|
|
inherit packages;
|
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
echo "node `${pkgs.nodejs}/bin/node --version`"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
devShells.export-pdf = pkgs.mkShell {
|
|
|
|
inherit packages;
|
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
|
|
|
}
|