Excellent! I've got it working now. For the curious ones, I pasted my successful package below.
Now, another question. After I install the Heroku Toolbelt, the `heroku` command is available on the command-line. But, I can't run it because I haven't installed Ruby. Question 4: Is there some way to tell Nix that Ruby is a run-time dependency of this package, and it should install the `ruby` package? If that's the wrong idea, I want to know why. Is it that, each `nix-env --install` command should expose only one application? I agree that Ruby is an app, but is Heroku Toolbelt an app? The Toolbelt is just a Ruby script, which is useless without Ruby. So...installing the Toolbelt should also install Ruby, right? Help me understand the logic here. Question 5: Why must I specify the "patchShebangs" function? The NixPkgs manual says the "fixupPhase" does this automatically. "It rewrites the interpreter paths of shell scripts to paths found in PATH". See NixPkgs Manual: 3.4.8. The Fixup Phase: http://nixos.org/nixpkgs/manual/#idp638240 stdenv.mkDerivation rec { name = "heroku-toolbelt"; src = fetchurl { url = " https://s3.amazonaws.com/assets.heroku.com/heroku-client/heroku-client.tgz"; sha256 = "00zqj9jwcklfyq5k3v81dwlzrrjm8axkgx7mixcb1kghjjlsdzv2"; }; # The "heroku" command is a Ruby script, so do we need to include `ruby` here? # Ruby isn't necessary to build it, so why include it in the "BuildInputs"? #nativeBuildInputs = [ ruby ]; installPhase = " mkdir -p $out; mv ./* $out; "; # The docs say the "fixupPhase" does this. Can I just use that? #postInstall = "patchShebangs $out;"; phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; meta = { <snip> }; } On Thu, Nov 14, 2013 at 5:57 PM, Vladimír Čunát <[email protected]> wrote: > On 11/14/2013 10:44 AM, Alex Berg wrote: > >> [chexxor@nixos:~]$ nix-build /my-sources/pkgs/top-level/all-packages.nix >> -A heroku-toolbelt >> these derivations will be built: >> /nix/store/226khb1zh9kb94wwc27as2kxiyrqmqkj-heroku-toolbelt.drv >> building path(s) >> `/nix/store/ibh9r574dd14wd01xpmldy90c69z8lfh-heroku-toolbelt' >> building /nix/store/ibh9r574dd14wd01xpmldy90c69z8lfh-heroku-toolbelt >> unpacking sources >> punpacking source archive >> /nix/store/dfryky194z2bv179pd4jf3ny2gn9di02-heroku-client.tgz >> source root is heroku-client >> builder for >> `/nix/store/226khb1zh9kb94wwc27as2kxiyrqmqkj-heroku-toolbelt.drv' failed >> to produce output path >> `/nix/store/ibh9r574dd14wd01xpmldy90c69z8lfh-heroku-toolbelt' >> error: build of >> `/nix/store/226khb1zh9kb94wwc27as2kxiyrqmqkj-heroku-toolbelt.drv' failed >> > > The error just means that the builder didn't create anything in the output > path (passed in $out variable). But it doesn't seem you even wanted to do > that yet ;-) > > Q1: the script can't be used as it is, because it installs into wrong > paths (/usr/local/...). > > Q2: the source of the tarball doesn't really matter. It needs to always > have the same hash. (You can even specify multiple sources, for the case > that some are unavailable.) > > > If the program is a ruby script, then you need to patch its shebang to use > ruby from nix store and not #!/usr/bin/ruby. For that it should be enough > to have postInstall = "patchShebangs $out"; with ruby in buildInputs and > assuming you get the scripts into $out in installPhase. > > > Vlada > > > > _______________________________________________ > nix-dev mailing list > [email protected] > http://lists.science.uu.nl/mailman/listinfo/nix-dev > >
_______________________________________________ nix-dev mailing list [email protected] http://lists.science.uu.nl/mailman/listinfo/nix-dev
