nixos/shadowsocks: add test without plugin

gstqt5
Henri Menke 2020-09-09 10:15:59 +12:00 committed by Benno Fünfstück
parent e587b5a8a8
commit 9d60354fae
4 changed files with 32 additions and 12 deletions

View File

@ -147,7 +147,7 @@ in
description = "shadowsocks-libev Daemon";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
path = [ pkgs.shadowsocks-libev cfg.plugin ] ++ optional (cfg.passwordFile != null) pkgs.jq;
path = [ pkgs.shadowsocks-libev ] ++ optional (cfg.plugin != null) cfg.plugin ++ optional (cfg.passwordFile != null) pkgs.jq;
serviceConfig.PrivateTmp = true;
script = ''
${optionalString (cfg.passwordFile != null) ''

View File

@ -309,7 +309,7 @@ in
sanoid = handleTest ./sanoid.nix {};
sddm = handleTest ./sddm.nix {};
service-runner = handleTest ./service-runner.nix {};
shadowsocks = handleTest ./shadowsocks.nix {};
shadowsocks = handleTest ./shadowsocks {};
shattered-pixel-dungeon = handleTest ./shattered-pixel-dungeon.nix {};
shiori = handleTest ./shiori.nix {};
signal-desktop = handleTest ./signal-desktop.nix {};

View File

@ -1,5 +1,10 @@
import ./make-test-python.nix ({ pkgs, lib, ... }: {
name = "shadowsocks";
{ name
, plugin ? null
, pluginOpts ? ""
}:
import ../make-test-python.nix ({ pkgs, lib, ... }: {
inherit name;
meta = {
maintainers = with lib.maintainers; [ hmenke ];
};
@ -22,8 +27,9 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
port = 8488;
fastOpen = false;
mode = "tcp_and_udp";
plugin = "${pkgs.shadowsocks-v2ray-plugin}/bin/v2ray-plugin";
pluginOpts = "server;host=nixos.org";
} // lib.optionalAttrs (plugin != null) {
inherit plugin;
pluginOpts = "server;${pluginOpts}";
};
services.nginx = {
enable = true;
@ -42,10 +48,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
description = "connect to shadowsocks";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
path = with pkgs; [
shadowsocks-libev
shadowsocks-v2ray-plugin
];
path = with pkgs; [ shadowsocks-libev ];
script = ''
exec ss-local \
-s 192.168.0.1 \
@ -54,8 +57,9 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
-k 'pa$$w0rd' \
-m chacha20-ietf-poly1305 \
-a nobody \
--plugin "${pkgs.shadowsocks-v2ray-plugin}/bin/v2ray-plugin" \
--plugin-opts "host=nixos.org"
${lib.optionalString (plugin != null) ''
--plugin "${plugin}" --plugin-opts "${pluginOpts}"
''}
'';
};
};

View File

@ -0,0 +1,16 @@
{ system ? builtins.currentSystem
, config ? { }
, pkgs ? import ../../.. { inherit system config; }
}:
{
"basic" = import ./common.nix {
name = "basic";
};
"v2ray-plugin" = import ./common.nix {
name = "v2ray-plugin";
plugin = "${pkgs.shadowsocks-v2ray-plugin}/bin/v2ray-plugin";
pluginOpts = "host=nixos.org";
};
}