1{
2 lib,
3 stdenv,
4 haskellPackages,
5 fetchFromGitHub,
6}:
7
8stdenv.mkDerivation {
9 pname = "nix-script";
10 version = "2020-03-23";
11
12 src = fetchFromGitHub {
13 owner = "bennofs";
14 repo = "nix-script";
15 rev = "7706b45429ff22c35bab575734feb2926bf8840b";
16 sha256 = "0yiqljamcj9x8z801bwj7r30sskrwv4rm6sdf39j83jqql1fyq7y";
17 };
18
19 strictDeps = true;
20 nativeBuildInputs = [
21 (haskellPackages.ghcWithPackages (hs: with hs; [ posix-escape ]))
22 ];
23
24 buildPhase = ''
25 runHook preBuild
26
27 mkdir -p $out/bin
28 ghc -O2 $src/nix-script.hs -o $out/bin/nix-script -odir . -hidir .
29
30 runHook postBuild
31 '';
32 installPhase = ''
33 runHook preInstall
34
35 ln -s $out/bin/nix-script $out/bin/nix-scripti
36
37 runHook postInstall
38 '';
39
40 meta = with lib; {
41 description = "Shebang for running inside nix-shell";
42 homepage = "https://github.com/bennofs/nix-script";
43 license = licenses.bsd3;
44 maintainers = with maintainers; [
45 bennofs
46 rnhmjoj
47 ];
48 platforms = haskellPackages.ghc.meta.platforms;
49 };
50}