nix-community / yarn2nix

Generate nix expressions from a yarn.lock file [maintainer=???]
GNU General Public License v3.0
123 stars 61 forks source link

Pre Install script #120

Open husseinraoouf opened 4 years ago

husseinraoouf commented 4 years ago

I am trying to install @angular/cli with yarn2nix but it fails because of google analytics prompt in the postinstall script

Luckily i can disable it by setting the environment variable NG_CLI_ANALYTICS=ci

but i don't know where to put it in the mkYarnPackage

thanks

zimbatm commented 4 years ago

try this argument:


mkYarnPackage {
  # ... the usual here ...
  yarnPreBuild = ''
    export NG_CLI_ANALYTICS=ci
  '';
}
husseinraoouf commented 4 years ago

sorry for late reply i have tried what you suggested but it didn't solve the problem

that is how i am using mkYarnPackage

node.nix

{ pkgs ? import <nixpkgs> {} }:

with (import (builtins.fetchTarball https://github.com/moretea/yarn2nix/archive/master.tar.gz) { inherit pkgs; });

mkYarnPackage {
    src = ./.;
    yarnPreBuild = ''
        export NG_CLI_ANALYTICS=ci
    '';
}

configuration.nix

{ config, pkgs, system, ... }:

let
  nodePackages = pkgs.nodePackages // import ./node.nix { inherit pkgs; };
in
{
    # emited code
    environment.systemPackages = with pkgs; [
        nodePackages."@angular/cli"
        # emited code
    ];
    # emited code
}