Giter Club home page Giter Club logo

Comments (5)

hraban avatar hraban commented on June 19, 2024 1

In case you're curious, here's an example of a clearer PR which solves this issue from scratch: seppeljordan/nix-prefetch-github#45

This also suggests another way to solve it:

              mac-app-util = inputs.mac-app-util.packages.${pkgs.stdenv.system}.default.overrideAttrs (old: {
                postInstall = old.postInstall + ''
                  wrapProgram "$out/bin/mac-app-util" --suffix PATH : "${pkgs.jq}/bin"
                '';
              });

I used to complain about git having poor UI... 🤷‍♀️

from mac-app-util.

matthewess avatar matthewess commented on June 19, 2024

side note: I think the tool may also be leaving some files around in my cwd when crashing, but I imagine that may be because of the crash

from mac-app-util.

matthewess avatar matthewess commented on June 19, 2024

I tried adding jq to the build inputs of the CL package derivation using overrideAttrs, e.g.

mac-app-util = inputs.mac-app-util.packages.${system}.default.overrideAttrs (old: {
# tried with both of these
    buildInputs = old.buildInputs ++ [ jq ];
    propagatedBuildInputs = [ jq ];
});

but this doesn't seem to work?

edit: even installing jq via homebrew doesn't seem to fix this for me :/

from mac-app-util.

hraban avatar hraban commented on June 19, 2024

I tried adding jq to the build inputs of the CL package derivation using overrideAttrs, e.g.

mac-app-util = inputs.mac-app-util.packages.${system}.default.overrideAttrs (old: {
# tried with both of these
    buildInputs = old.buildInputs ++ [ jq ];
    propagatedBuildInputs = [ jq ];
});

but this doesn't seem to work?

That's a great attempt, but it doesn't work because in the end buildInputs is just a way for the nixpkgs stdenv mkderivation builder to make certain packages available to the build environment, and thereby to setuphooks. It doesn't magically bake the PATH, or do anything, really--the magic happens generally in other setuphooks. E.g.: adding a package to your buildInputs makes it available to the C compiler.. how? Because the C compiler has a setup hook which reads that buildInputs and adds it to an environment variable that the C compiler later reads.

However, none of this persists to the final binary or library, unless you tell it to. You have to explicitly bake paths into binaries, if you want them available. For libraries this is done using patchelf, but for hooking stuff into the PATH, you have to create a wrapper. See 19b3e7a for the solution.

(For completeness' sake: if you wanted to do this without my involvement (say you just want to patch some obstinate upstream project which won't change), you could create a derivation which is just a wrapper of my mac-app-util, and which adds jq to the path.)

edit: even installing jq via homebrew doesn't seem to fix this for me :/

Yeah this makes sense: brew stuff gets installed in /usr/local/bin or /opt/homebrew/bin, neither of which is in the PATH during nix builds.

side note: I think the tool may also be leaving some files around in my cwd when crashing, but I imagine that may be because of the crash

I'd love to hear more about this 👂 👀

from mac-app-util.

hraban avatar hraban commented on June 19, 2024

side note: I think the tool may also be leaving some files around in my cwd when crashing, but I imagine that may be because of the crash

oops you're right I found it. fixed, thanks.

from mac-app-util.

Related Issues (3)

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.