1{ stdenv, lib, fetchFromGitHub, openssh, debugLevel ? 0 }:
2
3stdenv.mkDerivation {
4 pname = "scponly";
5 version = "4.8";
6
7 src = fetchFromGitHub {
8 owner = "scponly";
9 repo = "scponly";
10 rev = "d8ca58257b9905186aa5706f35813d5f80ea07c1";
11 sha256 = "U0K7lOp18ytNjh3KVFmc6vL+/tG4ETnwLEPQEhM4lXE=";
12 };
13
14 patches = [ ./scponly-fix-make.patch ];
15
16 strictDeps = true;
17
18 # chroot doesn't seem to work, so not enabling
19 # rsync could also be optionally enabled
20 configureFlags = [
21 "--enable-winscp-compat"
22 "scponly_PROG_SFTP_SERVER=${lib.getBin openssh}/libexec/sftp-server"
23 "scponly_PROG_SCP=${lib.getBin openssh}/bin/scp"
24 ];
25
26 postInstall = lib.optionalString (debugLevel > 0) ''
27 mkdir -p $out/etc/scponly && echo ${
28 toString debugLevel
29 } > $out/etc/scponly/debuglevel
30 '';
31
32 passthru.shellPath = "/bin/scponly";
33
34 meta = with lib; {
35 description = "A shell that only permits scp and sftp-server";
36 homepage = "https://github.com/scponly/scponly";
37 license = with licenses; [ bsd2 ];
38 maintainers = with maintainers; [ wmertens ];
39 };
40}