nix-update icon indicating copy to clipboard operation
nix-update copied to clipboard

[Feature Request] Some way to copy files from src to the nix code folder

Open lucasew opened this issue 11 months ago • 6 comments

The problem:

Packages built with buildFlutterApplication need to vendor the pubspec.lock as a JSON file to be used in the builder. The issue is that there is no simple way to setup this in a r-ryantm friendly way.

What I suggest is something like a function that gets defined in passthru that receives the src and returns the stuff that should be copied in the Nix code folder.

Example:

...

passthru = {
    updateScript = nix-update-script { };
    updateReducer = src: stdenv.mkDerivation {
       name = "source-reducer";
       dontUnpack = true;
       installPhase = ''
           mkdir $out
           cp $src/pubspec.lock $out/pubspec.lock
      '';
    };
};
...

That pubspec.lock will be copied to the location where the nix file defining the derivation is located in a cp $src/* $out fashion. It seems the primitives are already there but I need to study more the code to find out where should I put it and write a prototype.

lucasew avatar Mar 21 '24 13:03 lucasew