2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, haskellPackages, fetchFromGitHub }:
|
2019-02-10 23:08:58 +01:00
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
stdenv.mkDerivation {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "nix-script";
|
2020-03-30 23:15:04 +02:00
|
|
|
version = "2020-03-23";
|
2019-02-10 23:08:58 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bennofs";
|
|
|
|
repo = "nix-script";
|
2020-03-30 23:15:04 +02:00
|
|
|
rev = "7706b45429ff22c35bab575734feb2926bf8840b";
|
|
|
|
sha256 = "0yiqljamcj9x8z801bwj7r30sskrwv4rm6sdf39j83jqql1fyq7y";
|
2019-02-10 23:08:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
(haskellPackages.ghcWithPackages (hs: with hs; [ posix-escape ]))
|
|
|
|
];
|
|
|
|
|
|
|
|
buildPhase = ''
|
2021-07-20 13:27:46 +02:00
|
|
|
runHook preBuild
|
|
|
|
|
2019-02-10 23:08:58 +01:00
|
|
|
mkdir -p $out/bin
|
|
|
|
ghc -O2 $src/nix-script.hs -o $out/bin/nix-script -odir . -hidir .
|
2021-07-20 13:27:46 +02:00
|
|
|
|
|
|
|
runHook postBuild
|
2019-02-10 23:08:58 +01:00
|
|
|
'';
|
|
|
|
installPhase = ''
|
2021-07-20 13:27:46 +02:00
|
|
|
runHook preInstall
|
|
|
|
|
2019-02-10 23:08:58 +01:00
|
|
|
ln -s $out/bin/nix-script $out/bin/nix-scripti
|
2021-07-20 13:27:46 +02:00
|
|
|
|
|
|
|
runHook postInstall
|
2019-02-10 23:08:58 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-10-11 07:55:05 +02:00
|
|
|
description = "A shebang for running inside nix-shell";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/bennofs/nix-script";
|
2019-02-10 23:08:58 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ bennofs rnhmjoj ];
|
|
|
|
platforms = haskellPackages.ghc.meta.platforms;
|
|
|
|
};
|
|
|
|
}
|