1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-01 10:00:56 +00:00
nixpkgs/pkgs/servers/shellinabox/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

51 lines
1.7 KiB
Nix

{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, pam, openssl, openssh, shadow, makeWrapper }:
stdenv.mkDerivation rec {
version = "2.20";
pname = "shellinabox";
src = fetchFromGitHub {
owner = "shellinabox";
repo = "shellinabox";
rev = "v${version}";
sha256 = "1hmfayh21cks2lyj572944ll0mmgsxbnj981b3hq3nhdg8ywzjfr";
};
patches = [
./shellinabox-minus.patch
(fetchpatch {
name = "CVE-2018-16789.patch";
url = "https://github.com/shellinabox/shellinabox/commit/4f0ecc31ac6f985e0dd3f5a52cbfc0e9251f6361.patch";
sha256 = "1mpm6acxdb0fms9pa2b88fx6hp07ph87ahxi82yyqj2m7p79jx7a";
})
];
nativeBuildInputs = [ autoreconfHook makeWrapper ];
buildInputs = [ pam openssl openssh ];
# Disable GSSAPIAuthentication errors. Also, paths in certain source files are
# hardcoded. Replace the hardcoded paths with correct paths.
preConfigure = ''
substituteInPlace ./shellinabox/service.c --replace "-oGSSAPIAuthentication=no" ""
substituteInPlace ./shellinabox/launcher.c --replace "/usr/games" "${openssh}/bin"
substituteInPlace ./shellinabox/service.c --replace "/bin/login" "${shadow}/bin/login"
substituteInPlace ./shellinabox/launcher.c --replace "/bin/login" "${shadow}/bin/login"
substituteInPlace ./libhttp/ssl.c --replace "/usr/bin" "${openssl.bin}/bin"
'';
postInstall = ''
wrapProgram $out/bin/shellinaboxd \
--prefix LD_LIBRARY_PATH : ${openssl.out}/lib
mkdir -p $out/lib
cp shellinabox/* $out/lib
'';
meta = with lib; {
homepage = "https://github.com/shellinabox/shellinabox";
description = "Web based AJAX terminal emulator";
license = licenses.gpl2;
maintainers = with maintainers; [ tomberek lihop ];
platforms = platforms.linux;
};
}