rvl / bower2nix

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

Handle relative paths #7

Open domenkozar opened 7 years ago

domenkozar commented 7 years ago

For example if bower.json contains:

...
"purescript-avm-bridge": "../web-bridge",
...

Then building results into:

error: invalid character ‘/’ in name ‘purescript-avm-bridge-../web-bridge’

cc @rvl

rvl commented 7 years ago

Interesting, thanks.

If we could support local bower deps, what would the resulting fetchbower lines look like? What would the hash be?

Would it be acceptable for bower2nix to ignore such local dependencies? Or should it go and find ../web-bridge/bower.json and include those dependencies in the output?

domenkozar commented 7 years ago

The latter would be what fits my use case. How much work is to implement that?

rvl commented 7 years ago

I'll have a crack now. Are there any other interesting deps in your bower.json?

domenkozar commented 7 years ago

Yes: https://github.com/rvl/bower2nix/issues/9

domenkozar commented 7 years ago

Thanks! :heart:

rvl commented 7 years ago

Are you able to build and test with nix-build?

rvl commented 7 years ago

It could work with a tweak to fetchbower/default.nix to handle paths in version specs. With relative path dependencies it's hard to determine a correct hash to put in the generated file.

domenkozar commented 7 years ago

You don't need a hash, you can just do ${./web-bridge} and it will pull that folder into nix store.

I'm currently getting the following after building the project with nix-build:

error: invalid character ‘/’ in name ‘purescript-avm-bridge-../web-bridge’
(use ‘--show-trace’ to show detailed location information)

So what's left to be implemented is relative path handling in fetchbower?

domenkozar commented 7 years ago

@rvl should the following work? I can fix the rest, but I think fetch-bower doesn't work with paths.

$ fetch-bower --out foo web-bride /home/ielectric/dev/web-bridge

$ tree foo
foo
├── packages
└── registry
    └── bower.herokuapp.com
        ├── list
        ├── lookup
        └── search
domenkozar commented 7 years ago

@rvl ping :)

rvl commented 7 years ago

Sorry for :snail:.

Yes I think fetchBower function in nixpkgs can be fixed to handle slashes.

Looks like the bower PackageRepository lib isn't fetching paths. I will look into fixing it.

ixmatus commented 6 years ago

@rvl has there been any progress on this issue? I'm currently in a pickle with bower-based dependencies that are relative to the bower.nix (as opposed to a git repo).

ixmatus commented 6 years ago

I'm at about the same place @domenkozar was at on Nov 10, 2016; it looks like the endpoint resolution works correctly but the fetch is not happening. Has anyone implemented a work around? When I have some time I'm going to dig into the bower PackageRepository code and see if I can understand why it isn't working.

rvl commented 6 years ago

Hi @ixmatus, no sorry I didn't make any progress on the issue of relative dependencies. A possible solution could be to not use bower. What application are you needing to build with nix?

ixmatus commented 6 years ago

@rvl that is not an option (right now, at least) because the purescript community uses bower extensively for package dependencies and the project we're building is a purescript project.