1{ lib
2, stdenv
3, buildPackages
4, pkg-config
5, fetchurl
6, libedit
7, runCommand
8, dash
9}:
10
11stdenv.mkDerivation (finalAttrs: {
12 pname = "dash";
13 version = "0.5.12";
14
15 src = fetchurl {
16 url = "http://gondor.apana.org.au/~herbert/dash/files/dash-${finalAttrs.version}.tar.gz";
17 hash = "sha256-akdKxG6LCzKRbExg32lMggWNMpfYs4W3RQgDDKSo8oo=";
18 };
19
20 strictDeps = true;
21
22 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isStatic [ pkg-config ];
23
24 depsBuildBuild = [ buildPackages.stdenv.cc ];
25 buildInputs = [ libedit ];
26
27 configureFlags = [ "--with-libedit" ];
28 preConfigure = lib.optional stdenv.hostPlatform.isStatic ''
29 export LIBS="$(''${PKG_CONFIG:-pkg-config} --libs --static libedit)"
30 '';
31
32 enableParallelBuilding = true;
33
34 passthru = {
35 shellPath = "/bin/dash";
36 tests = {
37 "execute-simple-command" = runCommand "dash-execute-simple-command" { } ''
38 mkdir $out
39 ${lib.getExe dash} -c 'echo "Hello World!" > $out/success'
40 [ -s $out/success ]
41 grep -q "Hello World" $out/success
42 '';
43 };
44 };
45
46 meta = with lib; {
47 homepage = "http://gondor.apana.org.au/~herbert/dash/";
48 description = "POSIX-compliant implementation of /bin/sh that aims to be as small as possible";
49 platforms = platforms.unix;
50 license = with licenses; [ bsd3 gpl2Plus ];
51 mainProgram = "dash";
52 };
53})