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