NixOS / nixos-search

Search NixOS packages and options
https://search.nixos.org
MIT License
385 stars 98 forks source link

Contributing on MacOS #157

Closed hmaurer closed 3 years ago

hmaurer commented 3 years ago

Hello!

Awesome work on the new search; I noticed it being a lot snappier and headed over to this repo to figure out what changed :-) I've been trying to compile the project from source on MacOS but I run into an issue during the yarn installation step:

nixos-search % nix-shell --run "yarn dev"
these 2 derivations will be built:
  /nix/store/jkg46ddn2q9xn7rhi39ba37lx8fw3ibn-nixos-search-modules-1.0.0.drv
  /nix/store/6vrdv2am9bpdh8j76hlrx9i33vax7crh-nixos-search-yarn-1.0.0.drv
building '/nix/store/jkg46ddn2q9xn7rhi39ba37lx8fw3ibn-nixos-search-modules-1.0.0.drv'...
configuring
building
'/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/yarn_home/.node-gyp/12.18.3/include' -> '/nix/store/h8gi5368bw7rxcs153i55xb2smak5470-nodejs-12.18.3/include'
yarn config v1.22.4
success Set "yarn-offline-mirror" to "/nix/store/gqi0wz5ipx7c39y7l8hyscwkxxf9a62q-offline".
✨  Done in 0.03s.
yarn install v1.22.4
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[] 0/985[] 2/985[] 6/985[] 10/985[] 16/985[] 20/985[] 23/985[] 27/985[] 31/985[] 33/985[] 35/985[] 37/985[] 44/985[] 57/985[] 70/985[] 81/985[] 92/985[] 102/985[] 113/985[] 125/985[] 131/985[] 140/985[] 152/985[] 157/985[] 161/985[] 164/985[] 167/985[] 171/985[] 176/985[] 181/985[] 185/985[] 187/985[] 192/985[] 194/985[] 198/985[] 202/985[] 204/985[] 208/985[] 220/985[] 233/985[] 245/985[] 253/985[] 266/985[] 279/985[] 292/985[] 303/985[] 316/985[] 328/985[] 339/985[] 357/985[] 374/985[] 390/985[] 407/985[] 427/985[] 440/985[] 451/985[] 463/985[] 472/985[] 482/985[] 495/985[] 509/985[] 523/985[] 535/985[] 551/985[] 569/985[] 583/985[] 589/985[] 594/985[] 600/985[] 613/985[] 627/985[] 642/985[] 655/985[] 662/985[] 673/985[] 682/985[] 696/985[] 708/985[] 720/985[] 728/985[] 737/985[] 751/985[] 762/985[] 775/985[] 791/985[] 806/985[] 819/985[] 832/985[] 847/985[] 859/985[] 869/985[] 885/985[] 898/985[] 911/985[] 928/985[] 945/985[] 961/985[] 976/985[] 984/985info google-closure-compiler-linux@20200224.0.0: The platform "darwin" is incompatible with this module.
info "google-closure-compiler-linux@20200224.0.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info google-closure-compiler-windows@20200224.0.0: The platform "darwin" is incompatible with this module.
info "google-closure-compiler-windows@20200224.0.0" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] 🔗  Linking dependencies...
warning "workspace-aggregator-0c270498-7890-4f27-801e-2841f0d3413a > nixos-search > elm-webpack-loader@6.0.1" has unmet peer dependency "elm@^0.19.1-2 || 0.19.0-no-deps".
[] 985/985[] 0/1074[] 1/1074[] 0/17553[] 503/17553[] 895/17553[] 1268/17553[] 1658/17553[] 1906/17553[] 2271/17553[] 2537/17553[] 2902/17553[] 3297/17553[] 3682/17553[] 4193/17553[] 4721/17553[] 5311/17553[] 5875/17553[] 6432/17553[] 6964/17553[] 7492/17553[] 8054/17553[] 8403/17553[] 8879/17553[] 9381/17553[] 9874/17553[] 10356/17553[] 10757/17553[] 11137/17553[] 11658/17553[] 12263/17553[] 12869/17553[] 13145/17553[] 13180/17553[] 13761/17553[] 14046/17553[] 14639/17553[] 15159/17553[] 15336/17553[] 15870/17553[] 16452/17553[] 16941/17553[] 17490/17553[] 0/1898[] 842/1898[] 1630/1898[] 1898/1898[4/4] 🔨  Building fresh packages...
warning Ignored scripts due to flag.
✨  Done in 10.93s.
yarn run v1.22.4
$ node scripts/build.js --force
Building: /nix/store/h8gi5368bw7rxcs153i55xb2smak5470-nodejs-12.18.3/bin/node /private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext=auto --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/nix/store/h8gi5368bw7rxcs153i55xb2smak5470-nodejs-12.18.3/bin/node',
gyp verb cli   '/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=auto',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@12.18.3 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/local/bin/python2
gyp verb check python version `/usr/local/bin/python2 -c "import sys; print "2.7.15
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 12.18.3
gyp verb command install [ '12.18.3' ]
gyp verb install input version string "12.18.3"
gyp verb install installing version: 12.18.3
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 12.18.3
gyp verb build dir attempting to create "build" dir: /private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-sass/build
gyp verb build dir "build" dir needed to be created? /private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-sass/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-sass/build/config.gypi
gyp verb config.gypi checking for gypi file: /private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-sass/config.gypi
gyp verb common.gypi checking for gypi file: /private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-sass/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/local/bin/python2
gyp info spawn args [
gyp info spawn args   '/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-sass/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/yarn_home/.node-gyp/12.18.3/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/yarn_home/.node-gyp/12.18.3',
gyp info spawn args   '-Dnode_gyp_dir=/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/yarn_home/.node-gyp/12.18.3/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-sass',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
    return gyp_main(args)
  File "/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 514, in gyp_main
    options.duplicate_basename_check)
  File "/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 98, in Load
    generator.CalculateVariables(default_variables, params)
  File "/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 79, in CalculateVariables
    import gyp.generator.xcode as xcode_generator
  File "/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py", line 7, in <module>
    import gyp.xcodeproj_file
  File "/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py", line 152, in <module>
    _new_sha1 = hashlib.sha1
AttributeError: 'module' object has no attribute 'sha1'
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/nix/store/h8gi5368bw7rxcs153i55xb2smak5470-nodejs-12.18.3/bin/node" "/private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=auto" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /private/tmp/nix-build-nixos-search-modules-1.0.0.drv-0/node_modules/node-sass
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error: --- Error ------------------------------------------------------------------------------------------------------------------- nix-shell
builder for '/nix/store/jkg46ddn2q9xn7rhi39ba37lx8fw3ibn-nixos-search-modules-1.0.0.drv' failed with exit code 1
error: --- Error ------------------------------------------------------------------------------------------------------------------- nix-shell
1 dependencies of derivation '/nix/store/6vrdv2am9bpdh8j76hlrx9i33vax7crh-nixos-search-yarn-1.0.0.drv' failed to build

Any help would be appreciate!

zimbatm commented 3 years ago

I wonder why it tries to load python from /usr/local/Cellar/python@2. This seems to indicate that it's somehow escaping the sandbox.

garbas commented 3 years ago

@zimbatm this is indeed weird. I assume this comes from homebrew somehow.

I managed to get access to osx somehow (thank you kvm). And this (#166) fixed it for me, can you confirm @hmaurer?

hmaurer commented 3 years ago

@garbas thanks for looking into it (and going through the effort of setting up an osx VM). Unfortunately #166 does not appear to solve it for me (unless there's some sort of cache I should bust?)

hmaurer commented 3 years ago

The issue is clearly coming from node-sass by the way. I removed node-sass from the dependencies and substituted it for postcss. I can now run the project without issue, and without any changes to index.css.

hmaurer commented 3 years ago

This is a bit of a silly way to solve this issue but would you be open to switching to https://postcss.org/, or plain CSS? If this project is targeting evergreen browsers then using SASS (or postcss) might not be a necessity (you can use CSS custom properties in place of SASS variables, etc).

I'd be happy to open a PR; the changes are minimal.

garbas commented 3 years ago

@hmaurer Maybe removing the sass and just using plain css would be the best at this point. Later we will be using lesscss since we will use the same design elements that are being developed for new design nixos.org (https://github.com/NixOS/nixos-homepage/pull/506)

Do you maybe have time to do this?