1
0
Fork 0
mirror of https://github.com/NixOS/nix-pills synced 2024-09-19 04:00:13 -04:00
nix-pills/pills/20/two-hellos.nix
Nicolas Dudebout b706fc958b pill 20: make it buildable
+ refer to the old nixpkgs commit in a note but use the current nixpkgs for the
  actual examples
+ add which to the PATH
+ add `unpackPhase = "true";` to satisfy stdenv requirements
+ explain how _PATH and PATH are related
2018-04-12 07:38:14 -04:00

31 lines
621 B
Nix

let
nixpkgs = import <nixpkgs> {};
inherit (nixpkgs) stdenv fetchurl which;
actualHello = stdenv.mkDerivation {
name = "hello-2.3";
src = fetchurl {
url = mirror://gnu/hello/hello-2.3.tar.bz2;
sha256 = "0c7vijq8y68bpr7g6dh1gny0bff8qq81vnp4ch8pjzvg56wb3js1";
};
};
wrappedHello = stdenv.mkDerivation {
name = "hello-wrapper";
buildInputs = [ actualHello which ];
unpackPhase = "true";
installPhase = ''
mkdir -p "$out/bin"
echo "#! ${stdenv.shell}" >> "$out/bin/hello"
echo "exec $(which hello)" >> "$out/bin/hello"
'';
};
in wrappedHello