Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building brim with nix expression on nixos. #695

Closed
GTrunSec opened this issue Apr 28, 2020 · 7 comments
Closed

Building brim with nix expression on nixos. #695

GTrunSec opened this issue Apr 28, 2020 · 7 comments

Comments

@GTrunSec
Copy link

GTrunSec commented Apr 28, 2020

Using https://github.com/svanderburg/node2nix to query package.json of brim. I have no idea with this error output.

delegate@3.2.0 /nix/store/wmxp06hz6g93nr6x4xwzhmailx38ssv0-node_Brim-0.8.0/lib/node_modules/Brim/node_modules/delegate                   
good-listener@1.2.2 /nix/store/wmxp06hz6g93nr6x4xwzhmailx38ssv0-node_Brim-0.8.0/lib/node_modules/Brim/node_modules/good-listener         
select@1.1.2 /nix/store/wmxp06hz6g93nr6x4xwzhmailx38ssv0-node_Brim-0.8.0/lib/node_modules/Brim/node_modules/select                       
tiny-emitter@2.1.0 /nix/store/wmxp06hz6g93nr6x4xwzhmailx38ssv0-node_Brim-0.8.0/lib/node_modules/Brim/node_modules/tiny-emitter           
zq@ /nix/store/wmxp06hz6g93nr6x4xwzhmailx38ssv0-node_Brim-0.8.0/lib/node_modules/Brim/node_modules/zq                                    
clipboard@2.0.4 /nix/store/wmxp06hz6g93nr6x4xwzhmailx38ssv0-node_Brim-0.8.0/lib/node_modules/Brim/node_modules/clipboard                 
   ...........] / remove:zq: sill doSerial remove 2ncludeDevK                                                                            
> Brim@0.8.0 postinstall /nix/store/wmxp06hz6g93nr6x4xwzhmailx38ssv0-node_Brim-0.8.0/lib/node_modules/Brim                               
> node scripts/download-zdeps                                                                                                            
                                                                                                                                         
internal/modules/cjs/loader.js:638                                                                                                       
    throw err;                                                                                                                           
    ^                                                                                                                                    
                                                                                                                                         
Error: Cannot find module 'got'                                                                                                          
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)                                                          
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)                                                                     
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/nix/store/wmxp06hz6g93nr6x4xwzhmailx38ssv0-node_Brim-0.8.0/lib/node_modules/Brim/scripts/download-zdeps/index
.js:4:13)
  • Nodejs (nodejs-12_x)
@GTrunSec GTrunSec added the bug Something isn't working label Apr 28, 2020
@alfred-landrum
Copy link
Contributor

alfred-landrum commented Apr 28, 2020

hi @GTrunSec : I'm not a NixOS user or familiar with the tooling, but I did install and try to run node2nix locally (version 1.8.0) in a brim git checkout, and saw a different error than the one you report:

$ node2nix
fetching local directory: ./. from .
info attempt registry request try #1 at 7:10:16 PM
http request GET https://registry.npmjs.org/animejs
http 200 https://registry.npmjs.org/animejs
...
http request GET https://registry.npmjs.org/zq
http 200 https://registry.npmjs.org/zq
Cannot resolve version: zq@undefined

So, I'm not sure if the error you saw above was perhaps something temporary, or perhaps because we're using different node2nix versions?

However, the error I see locally (Cannot resolve version: zq@undefined) may be related to how we specify the zq dependency, to the zq github repo:

 "zq": "brimsec/zq#v0.12.0"

@GTrunSec
Copy link
Author

GTrunSec commented Apr 28, 2020

hi @GTrunSec : I'm not a NixOS user or familiar with the tooling, but I did install and try to run node2nix locally (version 1.8.0) in a brim git checkout, and saw a different error than the one you

try to use node2nix -l package-lock.json
then nix-build

if you didn't add nix-channel. please run these commands

nix-channel --add https://github.com/NixOS/nixpkgs/archive/master.tar.gz nixpkgs
nix-channel --update

@alfred-landrum
Copy link
Contributor

The node2nix -l package-lock.json command does get farther along, and it errors out now as it's trying to spawn nix-hash. I'm not going to go farther the nix tooling, but I hope you can now run the node2nix command yourself.

@GTrunSec
Copy link
Author

GTrunSec commented Apr 28, 2020

The node2nix -l package-lock.json command does get farther along, and it errors out now as it's trying to spawn nix-hash. I'm not going to go farther the nix tooling, but I hope you can now run the node2nix command yourself.

thank you for helping. I replaced "zq": "brimsec/zq#v0.12.0" to "zq": "git://github.com/brimsec/zq#v0.12.0" . it's working.

@alfred-landrum alfred-landrum removed the bug Something isn't working label Apr 28, 2020
@alfred-landrum
Copy link
Contributor

by the way @GTrunSec : I saw this PR of yours for Nix:
NixOS/nixpkgs#81479

that hit this Zeek issue:
zeek/zeek#804

We saw a similar issue when we recently did some research into creating a flatpak package:
#685
and filed zeek/zeek#928 .

We filed that issues because Brim includes a small Zeek installation - look under the zdeps directory after you do an npm install, and we hit the same issue you did with duplicate scripts.

@GTrunSec
Copy link
Author

We filed that issues because Brim includes a small Zeek installation - look under the zdeps directory after you do an npm install, and we hit the same issue you did with duplicate scripts.

first of all, my PR is one of a solution to this issue. you should patch it before you run ./configure.

secondly, I did a test to analyze the zeek/zeek#804 (comment) between (zeek and Nix )script-loading mechanism and order-loading mechanism.
no issue test.
sudo zeek -b -i eno1 base/frameworks/dpd/ base/protocols/dce-rpc/

if you switch the dcep-rpc order the issue appered in here:
sudo zeek -b -i eno1 base/protocols/dce-rpc/ base/protocols/dce-rpc/

I think this investigation would help you to find another way to solve it.

@GTrunSec
Copy link
Author

GTrunSec commented Apr 28, 2020

sudo zeek -b -i eno1 base/frameworks/dpd/ base/protocols/dce-rpc/ ...  ...  ..(all of the base scripts here). 

your job is to do a test in which Zeek's base scripts running in a correct order-loading.

Advantage: do not need to modify any files in upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants