Code Monkey home page Code Monkey logo

Comments (9)

Profpatsch avatar Profpatsch commented on July 30, 2024

Can you elaborate on your use case?

from lorri.

leotaku avatar leotaku commented on July 30, 2024

@Profpatsch I use the niv tool to keep my dependencies organized. It avoids downloading the entire git repository and instead just fetches the specified rev.

I prefer this approach to manually keeping several git repositories updated, because it is reproducible and requires much less maintenance.

from lorri.

Profpatsch avatar Profpatsch commented on July 30, 2024

Oh, you mean src = ./.?

You can overwrite the source with an argument: nix-build …/lorri/default.nix --arg src /path/to/lorri.

from lorri.

leotaku avatar leotaku commented on July 30, 2024

@Profpatsch this command unfortunately fails for me.

nix-build lorri/default.nix --arg src /full/path/to/lorri
these derivations will be built:
  /nix/store/wy37hnd66xhxfd6sm9vw4p6hd95rrxpq-lorri.drv
building '/nix/store/wy37hnd66xhxfd6sm9vw4p6hd95rrxpq-lorri.drv'...
unpacking sources
unpacking source archive /nix/store/llk09dv6pvszl0gl3kzg9k96aj389615-lorri
do not know how to unpack source archive /nix/store/llk09dv6pvszl0gl3kzg9k96aj389615-lorri
builder for '/nix/store/wy37hnd66xhxfd6sm9vw4p6hd95rrxpq-lorri.drv' failed with exit code 1
error: build of '/nix/store/wy37hnd66xhxfd6sm9vw4p6hd95rrxpq-lorri.drv' failed

This is kind of my problem: There does not seem to be an obvious way to build/install lorri from a directory that isn't git version-controlled.

What does the fetchGit function achieve in default.nix?

from lorri.

Profpatsch avatar Profpatsch commented on July 30, 2024

You have to replace the paths by the paths you need of course.

$ wget https://github.com/target/lorri/archive/e943fa403234f1a5e403b6fdc112e79abc1e29ba.tar.gz
$ ls
default.nix  e943fa403234f1a5e403b6fdc112e79abc1e29ba.tar.gz  lorri-e943fa403234f1a5e403b6fdc112e79abc1e29ba
$  cp -r lorri-e943fa403234f1a5e403b6fdc112e79abc1e29ba/nix lorri-e943fa403234f1a5e403b6fdc112e79abc1e29ba/default.nix .
$ nix-build default.nix --arg src ./lorri-e943fa403234f1a5e403b6fdc112e79abc1e29ba --arg pkgs 'import ./nixpkgs.nix {}'

We don’t have a .git directory in the tarball, it works.

from lorri.

leotaku avatar leotaku commented on July 30, 2024

Interesting. Trying to build lorri seems to fail in ways that I don't fully comprehend. I suspect it might have to do with the files being stored in the nix store, or symlinking issues. (related to my personal setup)

Still, I am interested in why lorri chooses to have fetchGit in its default.nix as I have never seen that in any other nix project.
Maybe someone could explain this to me?

In any case, this is no longer relevant to the original issue.
@Profpatsch thank you for helping me, I will now close this issue.

from lorri.

Profpatsch avatar Profpatsch commented on July 30, 2024

Still, I am interested in why lorri chooses to have fetchGit in its default.nix as I have never seen that in any other nix project.

It’s a default argument.

let f = { a ? "foo" }: a
in f {}

will be "foo", while

let f = { a ? "foo" }: a
in f { a = "bar" }

will be "bar".

You can try it out in nix repl.

from lorri.

leotaku avatar leotaku commented on July 30, 2024

@Profpatsch Yes I understand that. But why would you even try to fetchGit a local directory? It doesn't make sense to me.

from lorri.

Profpatsch avatar Profpatsch commented on July 30, 2024

But why would you even try to fetchGit a local directory? It doesn't make sense to me.

You have to ask @grahamc ;). I agree with you that it’s not a great solution, because fetchGit caches your source for up to an hour, meaning any changes are not picked up.

from lorri.

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.