1{ lib
2, stdenv
3, fetchFromGitHub
4, bzip2
5, coreutils
6, gnutar
7, gzip
8, makeWrapper
9, nix
10}:
11
12stdenv.mkDerivation rec {
13 pname = "nix-bundle";
14 version = "0.4.1";
15
16 src = fetchFromGitHub {
17 owner = "matthewbauer";
18 repo = pname;
19 rev = "v${version}";
20 sha256 = "0js8spwjvw6kjxz1i072scd035fhiyazixvn84ibdnw8dx087gjv";
21 };
22
23 nativeBuildInputs = [ makeWrapper ];
24
25 # coreutils, gnutar are needed by nix for bootstrap
26 buildInputs = [
27 bzip2
28 coreutils
29 gnutar
30 gzip
31 nix
32 ];
33
34 makeFlags = [ "PREFIX=$(out)" ];
35
36 postInstall = ''
37 mkdir -p $out/bin
38 makeWrapper $out/share/nix-bundle/nix-bundle.sh $out/bin/nix-bundle \
39 --prefix PATH : ${lib.makeBinPath buildInputs}
40 ln -s $out/share/nix-bundle/nix-run.sh $out/bin/nix-run
41 '';
42
43 meta = with lib; {
44 homepage = "https://github.com/matthewbauer/nix-bundle";
45 description = "Create bundles from Nixpkgs attributes";
46 longDescription = ''
47 nix-bundle is a way to package Nix attributes into single-file
48 executables.
49
50 Benefits:
51 - Single-file output
52 - Can be run by non-root users
53 - No runtime
54 - Distro agnostic
55 - No installation
56 '';
57 license = licenses.mit;
58 maintainers = [ maintainers.matthewbauer ];
59 platforms = platforms.all;
60 };
61}