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