Giter Club home page Giter Club logo

Comments (9)

tgunnoe avatar tgunnoe commented on July 4, 2024

You can run dream2nix in the root repo and use packageOverrides to make a patch to copy the library over then patch the sources to point to the library's new location. kind of like this https://github.com/nix-community/dream2nix/blob/main/overrides/nodejs/default.nix#L809

from dream2nix.

omerbenamram avatar omerbenamram commented on July 4, 2024

@tgunnoe by "run dream2nix in the root repo" you mean settings config.projectRoot to ../..?
Also - this means patching (using text find replace) each dependency individually AFAIK, which is a little cumbersome.

Also I'm not sure how it will affect caching - but it's a separate issue i suppose.
I was wondering if there is anything that could be done to make this more like poetry2nix (which supports this already).

from dream2nix.

omerbenamram avatar omerbenamram commented on July 4, 2024

@DavHau @yusdacra I've checked this out but this doesn't really solve what I was aiming for.
It still fails in the example repository when trying to build inside service/binary.

I wanted to avoid keeping a single flake.nix file at the root of the monorepo.

Note that all the sources are still available in the nix store when running it with config.projectRoot = ../...

Thanks a lot for the effort!

from dream2nix.

DavHau avatar DavHau commented on July 4, 2024

I wanted to avoid keeping a single flake.nix file at the root of the monorepo.

Why do you want that? I didn't even know it was possible to access parent directories from a flake. But it seems to work as long as it's part of the same repo

from dream2nix.

omerbenamram avatar omerbenamram commented on July 4, 2024

There are tens of services being managed in the repo, and a few dozen libraries - some of them have customizations in the flake, different target systems etc. There is common nix tooling which is being imported by many of the flakes.

It's the same reason they are not sharing a cargo workspace.

from dream2nix.

DavHau avatar DavHau commented on July 4, 2024

@omerbenamram I just tested with your repo and both the top level flake as well as the one in ./service/binary work without any problem.
see: https://github.com/DavHau/dream2nix-issue-113
Maybe you just forgot to update dream2nix when you tested.

from dream2nix.

omerbenamram avatar omerbenamram commented on July 4, 2024

@DavHau My bad! I've tried setting config.projectRoot to ../.. - but in your working example it's source under makeFlakeOutputs.

It's building fine on my linux machine - but it breaks on mac with:

❯ nix build .#packages.aarch64-darwin.binary

error: builder for '/nix/store/0i9km7lz45i10h5frnskmybpnjgm0z72-binary-0.1.0.drv' failed with exit code 1;
       last 9 log lines:
       > unpacking sources
       > unpacking source archive /nix/store/x1p22sam64s7rpj07mfz2difxiav4mw7-fvywq19s7rnscjljnka87knyklvrpfxn-source/service/binary
       > source root is binary
       > Executing cargoSetupPostUnpackHook
       > Finished cargoSetupPostUnpackHook
       > patching sources
       > updateAutotoolsGnuConfigScriptsPhase
       > configuring
       > mv: cannot stat '/build/.cargo/config': No such file or directory
       For full logs, run 'nix log /nix/store/0i9km7lz45i10h5frnskmybpnjgm0z72-binary-0.1.0.drv'.

Maybe you have an idea where this could happen 😅?

from dream2nix.

yusdacra avatar yusdacra commented on July 4, 2024

@DavHau My bad! I've tried setting config.projectRoot to ../.. - but in your working example it's source under makeFlakeOutputs.

It's building fine on my linux machine - but it breaks on mac with:

❯ nix build .#packages.aarch64-darwin.binary

error: builder for '/nix/store/0i9km7lz45i10h5frnskmybpnjgm0z72-binary-0.1.0.drv' failed with exit code 1;
       last 9 log lines:
       > unpacking sources
       > unpacking source archive /nix/store/x1p22sam64s7rpj07mfz2difxiav4mw7-fvywq19s7rnscjljnka87knyklvrpfxn-source/service/binary
       > source root is binary
       > Executing cargoSetupPostUnpackHook
       > Finished cargoSetupPostUnpackHook
       > patching sources
       > updateAutotoolsGnuConfigScriptsPhase
       > configuring
       > mv: cannot stat '/build/.cargo/config': No such file or directory
       For full logs, run 'nix log /nix/store/0i9km7lz45i10h5frnskmybpnjgm0z72-binary-0.1.0.drv'.

Maybe you have an idea where this could happen 😅?

This is because of the hardcoded /build path... I thought I fixed this, but apparently I missed one. I'll fix this when I have time later.

from dream2nix.

yusdacra avatar yusdacra commented on July 4, 2024

@omerbenamram can you try PR #130 and see if that works out for you?

from dream2nix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.