Home > Net >  With nixos can I install a nodejs package globally?
With nixos can I install a nodejs package globally?

Time:12-19

Say I'd like to install @squoosh/cli, this package is mentioned in nixpkgs here. Is there a way to specify the package in configuration.nix, or in the home-manager, to have it be installed by nixos-rebuild?

CodePudding user response:

Yes, the packages in node-packages.json appear in pkgs.nodePackages.

In NixOS, you can add it as follows:

{ pkgs, ... }: {

  # ...

  environment.systemPackages = [
    pkgs.nodePackages."@squoosh/cli"
  ];

}

In Home Manager it's similar, but home.packages instead of environment.systemPackages.

  • Related