Giter Site home page Giter Site logo

Comments (5)

infinisil avatar infinisil commented on May 28, 2024 2

This note says that if the directory your flake.nix is in is not a Git repository, evaluating ${./.} will copy all the files under ./. into the store. If you have a large directory, this is quite wasteful. This means that fileset is particularly useful in that case

Just to clarify, this isn't right. Filesets (or any other way to filter sources) can't prevent files from being added to the store if you use Flakes. So they won't help with that. That's a Nix problem to fix, and I'm not sure even NixOS/nix#6530 helps with that.

But indeed as already mentioned by Valentin, file sets are still useful to make derivations depend on only the files they actually need, so that you don't need to build them again when e.g. the README.md or default.nix changes.

from nix.dev.

fricklerhandwerk avatar fricklerhandwerk commented on May 28, 2024

This note says that if the directory your flake.nix is in is not a Git repository, evaluating ${./.} will copy all the files under ./. into the store. If you have a large directory, this is quite wasteful. This means that fileset is particularly useful in that case. NixOS/nix#6530 is supposed to alleviate that limitation when enforcing pure evaluation, but we don't know when it will be completed.

The other note on flakes and gitTracked is where fileset indeed does not add much benefit: only files tracked by Git are copied to the store when the flakes experimental feature is enabled, so there is no point filtering for them with fileset.

from nix.dev.

ocharles avatar ocharles commented on May 28, 2024

Ok, but I'm still curious about how useful filesets are with Flakes, because it sounds like I will still end up copying the entire Git repository into the store before anything happens. Would #6530 help here too?

from nix.dev.

fricklerhandwerk avatar fricklerhandwerk commented on May 28, 2024

I will still end up copying the entire Git repository into the store before anything happens

With flakes indeed you'll copy the repo into the store, but then filesets will let you extract small store objects for compilation. Which means that if those don't change, you don't have to copy around large chunks during builds.

from nix.dev.

ocharles avatar ocharles commented on May 28, 2024

Got it, thanks!

from nix.dev.

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.