-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script fails due to missing jq
binary
#1
Comments
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 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 :/ |
Thanks @mathewess for the bugreport in #1
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.)
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.
I'd love to hear more about this 👂 👀 |
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... 🤷♀️ |
Thanks also to github user @matthewess for putting me onto this in #1.
oops you're right I found it. fixed, thanks. |
Just tried this out and was faced with the following error:
Seems like the CL program expects
jq
to be installed as a system dependency, but I think it would be more correct to make it available by way of the nix environment, rather than expecting it to be ambiently available.Curiously, I do have
jq
in my user PATH, but it's installed by nix, so I wonder if that makes it hard for the CL program to find.The text was updated successfully, but these errors were encountered: