mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/shadowsocks: add test without plugin
This commit is contained in:
parent
e587b5a8a8
commit
9d60354fae
4 changed files with 32 additions and 12 deletions
|
@ -147,7 +147,7 @@ in
|
||||||
description = "shadowsocks-libev Daemon";
|
description = "shadowsocks-libev Daemon";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.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;
|
serviceConfig.PrivateTmp = true;
|
||||||
script = ''
|
script = ''
|
||||||
${optionalString (cfg.passwordFile != null) ''
|
${optionalString (cfg.passwordFile != null) ''
|
||||||
|
|
|
@ -309,7 +309,7 @@ in
|
||||||
sanoid = handleTest ./sanoid.nix {};
|
sanoid = handleTest ./sanoid.nix {};
|
||||||
sddm = handleTest ./sddm.nix {};
|
sddm = handleTest ./sddm.nix {};
|
||||||
service-runner = handleTest ./service-runner.nix {};
|
service-runner = handleTest ./service-runner.nix {};
|
||||||
shadowsocks = handleTest ./shadowsocks.nix {};
|
shadowsocks = handleTest ./shadowsocks {};
|
||||||
shattered-pixel-dungeon = handleTest ./shattered-pixel-dungeon.nix {};
|
shattered-pixel-dungeon = handleTest ./shattered-pixel-dungeon.nix {};
|
||||||
shiori = handleTest ./shiori.nix {};
|
shiori = handleTest ./shiori.nix {};
|
||||||
signal-desktop = handleTest ./signal-desktop.nix {};
|
signal-desktop = handleTest ./signal-desktop.nix {};
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
{ name
|
||||||
name = "shadowsocks";
|
, plugin ? null
|
||||||
|
, pluginOpts ? ""
|
||||||
|
}:
|
||||||
|
|
||||||
|
import ../make-test-python.nix ({ pkgs, lib, ... }: {
|
||||||
|
inherit name;
|
||||||
meta = {
|
meta = {
|
||||||
maintainers = with lib.maintainers; [ hmenke ];
|
maintainers = with lib.maintainers; [ hmenke ];
|
||||||
};
|
};
|
||||||
|
@ -22,8 +27,9 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
||||||
port = 8488;
|
port = 8488;
|
||||||
fastOpen = false;
|
fastOpen = false;
|
||||||
mode = "tcp_and_udp";
|
mode = "tcp_and_udp";
|
||||||
plugin = "${pkgs.shadowsocks-v2ray-plugin}/bin/v2ray-plugin";
|
} // lib.optionalAttrs (plugin != null) {
|
||||||
pluginOpts = "server;host=nixos.org";
|
inherit plugin;
|
||||||
|
pluginOpts = "server;${pluginOpts}";
|
||||||
};
|
};
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -42,10 +48,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
||||||
description = "connect to shadowsocks";
|
description = "connect to shadowsocks";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = with pkgs; [
|
path = with pkgs; [ shadowsocks-libev ];
|
||||||
shadowsocks-libev
|
|
||||||
shadowsocks-v2ray-plugin
|
|
||||||
];
|
|
||||||
script = ''
|
script = ''
|
||||||
exec ss-local \
|
exec ss-local \
|
||||||
-s 192.168.0.1 \
|
-s 192.168.0.1 \
|
||||||
|
@ -54,8 +57,9 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
||||||
-k 'pa$$w0rd' \
|
-k 'pa$$w0rd' \
|
||||||
-m chacha20-ietf-poly1305 \
|
-m chacha20-ietf-poly1305 \
|
||||||
-a nobody \
|
-a nobody \
|
||||||
--plugin "${pkgs.shadowsocks-v2ray-plugin}/bin/v2ray-plugin" \
|
${lib.optionalString (plugin != null) ''
|
||||||
--plugin-opts "host=nixos.org"
|
--plugin "${plugin}" --plugin-opts "${pluginOpts}"
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
16
nixos/tests/shadowsocks/default.nix
Normal file
16
nixos/tests/shadowsocks/default.nix
Normal 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";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue