nixos-and-flakes-book/flake.nix

41 lines
1.1 KiB
Nix
Raw Normal View History

{
description = "A Nix-flake-based Node.js development environment";
inputs = {
2023-12-05 02:39:10 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self
, nixpkgs
, flake-utils
}:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [
(self: super: rec {
nodejs = super.nodejs-18_x;
pnpm = super.nodePackages.pnpm;
yarn = (super.yarn.override { inherit nodejs; });
})
];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShells.default = pkgs.mkShell {
2023-10-04 07:17:37 +00:00
packages = with pkgs; [ node2nix nodejs pnpm yarn git];
shellHook = ''
echo "node `${pkgs.nodejs}/bin/node --version`"
# 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-08-15 07:32:28 +00:00
export PUPPETEER_EXECUTABLE_PATH=${pkgs.chromium.outPath}/bin/chromium
'';
};
});
}