rvl / bower2nix

Generate nix expressions to fetch bower dependencies.
Other
6 stars 10 forks source link

Bower resolution doesn't work #10

Open domenkozar opened 7 years ago

domenkozar commented 7 years ago

Bower supports resolutions if two packages are declared with different versions. bower2nix fails to account for that.

A http://sscce.org/: https://gist.github.com/domenkozar/c1a3dbc9ab86c867aa356ea6218533e0

Note that you have to use bower2nix from master:

git clone https://gist.github.com/c1a3dbc9ab86c867aa356ea6218533e0.git
cd c1a3*
bower2nix > bower-generated.nix && nix-build bower.nix

If you remove the last commit, you'll see that it also doesn't work without resolutions

@rvl

rvl commented 7 years ago

Ah. Previously I added a bodge for resolutions which worked in my project. But I think I can see what's required here. For example, if you tweak the bower-generated.nix and add the line:

  (fetchbower "purescript-maps" "1.0.0" "^1.0.0" "0r20a7ibl5izsbksd3k770mc2db6799s2lj2ajyi0xww0khwhwhd")

it will get further. So bower wants both versions of the dep available.

This project seems like it might be susceptible to a purescript edition of "cabal hell". Just checking, have you worked out a set of resolutions which lets the project work properly -- just using bower install not bower2nix?

rvl commented 7 years ago

I have a partial fix on the issue-10 branch. It will work, but bower2nix takes a while to finish generation. Bower does warn that "Code incompatibilities may occur," so I hope your chosen resolutions are OK!

domenkozar commented 7 years ago

Just tested - it works!

domenkozar commented 7 years ago

@rvl so the downside is, bower2nix is even slower using this fix.

qknight commented 5 years ago

when using bower2nix 3.2.0 with https://github.com/xwiki-labs/cryptpad/blob/38a1e5e39fb854cdbad8896333901beb85ee6510/bower.json and the fixed bower.json with this patch:

git diff
diff --git a/bower.json b/bower.json
index 79859659..3c639583 100644
--- a/bower.json
+++ b/bower.json
@@ -37,18 +37,15 @@
     "scrypt-async": "1.2.0",
     "require-css": "0.1.10",
     "less": "^3.7.1",
    "bootstrap": "^v4.0.0",
     "diff-dom": "2.1.1",
     "nthen": "^0.1.5",
     "open-sans-fontface": "^1.4.2",
     "bootstrap-tokenfield": "^0.12.1",
     "localforage": "^1.5.2",
     "html2canvas": "^0.4.1",
     "croppie": "^2.5.0",
-    "sortablejs": "#^1.6.0",
+    "sortablejs": "^1.6.0",
     "saferphore": "^0.0.1"
-  },

it still fails and pulls in bootstrap 3.1.1, see:

graceful-fs@4.1.11 /nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0/lib/node_modules/cryptpad/node_modules/graceful-fs
jsonfile@4.0.0 /nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0/lib/node_modules/cryptpad/node_modules/jsonfile
universalify@0.1.2 /nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0/lib/node_modules/cryptpad/node_modules/universalify
replify@1.2.0 /nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0/lib/node_modules/cryptpad/node_modules/replify
saferphore@0.0.1 /nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0/lib/node_modules/cryptpad/node_modules/saferphore
sortify@1.0.4 /nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0/lib/node_modules/cryptpad/node_modules/sortify
lex@1.7.9 /nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0/lib/node_modules/cryptpad/node_modules/lex
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0
patching script interpreter paths in /nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0
/nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0/lib/node_modules/cryptpad/node_modules/mime/cli.js: interpreter directive changed from "/usr/bin/env node" to "/nix/store/lgd1lnz2yc219hmicvby3j1caljwj5a9-nodejs-6.14.3/bin/node"
checking for references to /tmp/nix-build-node-cryptpad-2.6.0.drv-0 in /nix/store/dph5qgx9gd5nb874k82clfl4cfwd09k7-node-cryptpad-2.6.0...
building '/nix/store/4hy1b9i14i31q2mmr250whjgkafswmyw-bower_components-bower.drv'...
bower components-font-awesome#^4.6.3           cached https://github.com/components/font-awesome.git#4.7.0
bower jquery#~2.1.3                            cached https://github.com/jquery/jquery-dist.git#2.1.4
bower codemirror#^5.19.0                       cached https://github.com/components/codemirror.git#5.39.2
bower requirejs#2.3.5                          cached https://github.com/jrburke/requirejs-bower.git#2.3.5
bower tweetnacl#0.12.2                         cached https://github.com/dchest/tweetnacl-js.git#0.12.2
bower ckeditor#4.7.3                           cached https://github.com/ckeditor/ckeditor-releases.git#4.7.3
bower marked#0.3.5                             cached https://github.com/chjj/marked.git#0.3.5
bower rangy#~1.3.0                             cached https://github.com/timdown/rangy-release.git#1.3.0
bower json.sortify#~2.1.0                      cached https://github.com/ThomasR/JSON.sortify.git#2.1.0
bower secure-fabric.js#secure-v1.7.9           cached https://github.com/cjdelisle/secure-fabric.js.git#secure-v1.7.9
bower hyperjson#~1.4.0                         cached https://github.com/xwiki-labs/hyperjson.git#1.4.0
bower chainpad-crypto#^0.2.0                   cached https://github.com/xwiki-labs/chainpad-crypto.git#0.2.1
bower chainpad-listmap#^0.5.0                  cached https://github.com/xwiki-labs/chainpad-listmap.git#0.5.2
bower file-saver#1.3.1                         cached https://github.com/eligrey/FileSaver.js.git#1.3.1
bower chainpad#^5.1.0                          cached https://github.com/xwiki-contrib/chainpad.git#5.1.2
bower alertifyjs#1.0.11                        cached https://github.com/alertifyjs/alertify.js.git#1.0.11
bower scrypt-async#1.2.0                       cached https://github.com/dchest/scrypt-async-js.git#1.2.0
bower less#^3.7.1                              cached https://github.com/less/less.git#3.8.1
bower require-css#0.1.10                       cached https://github.com/guybedford/require-css.git#0.1.10
bower bootstrap#^v4.0.0                        cached https://github.com/twbs/bootstrap.git#4.1.3
bower diff-dom#2.1.1                           cached https://github.com/fiduswriter/diffDOM.git#2.1.1
bower open-sans-fontface#^1.4.2                cached https://github.com/FontFaceKit/open-sans.git#1.4.2
bower nthen#^0.1.5                             cached https://github.com/cjdelisle/nthen.git#0.1.7
bower localforage#^1.5.2                       cached https://github.com/mozilla/localForage.git#1.7.2
bower sortablejs#^1.6.0                        cached https://github.com/RubaXa/Sortable.git#1.6.0
bower bootstrap-tokenfield#^0.12.1             cached https://github.com/sliptree/bootstrap-tokenfield.git#0.12.1
bower html2canvas#^0.4.1                       cached https://github.com/niklasvh/html2canvas.git#0.4.1
bower saferphore#^0.0.1                        cached https://github.com/cjdelisle/saferphore.git#0.0.1
bower croppie#^2.5.0                           cached https://github.com/Foliotek/Croppie.git#2.6.2
bower chainpad-netflux#^0.7.0                  cached https://github.com/xwiki-labs/chainpad-netflux.git#0.7.2
bower bootstrap#~3.1.1                       ENOCACHE No cached version for https://github.com/twbs/bootstrap.git#~3.1.1
builder for '/nix/store/4hy1b9i14i31q2mmr250whjgkafswmyw-bower_components-bower.drv' failed with exit code 1
cannot build derivation '/nix/store/607fx95r7grf1ac5kn247mcz793fcp45-cryptPad.drv': 1 dependencies couldn't be built
error: build of '/nix/store/607fx95r7grf1ac5kn247mcz793fcp45-cryptPad.drv' failed

and tags/v3.2.0, which is what i'm using on 18.03, contains the PR from above:

git checkout tags/v3.2.0
git branch -a --contains 2a3df62936a84f4359c80e37fcbf6278bbcdfea7
  remotes/origin/issue-10