From 424f07f328f2b696aa316da6b0302eae4152b46d Mon Sep 17 00:00:00 2001 From: Pasquale Date: Tue, 23 Nov 2021 22:32:31 +0100 Subject: [PATCH 1/6] xxh: init at 0.8.7 --- pkgs/tools/networking/xxh/default.nix | 20 ++++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 pkgs/tools/networking/xxh/default.nix diff --git a/pkgs/tools/networking/xxh/default.nix b/pkgs/tools/networking/xxh/default.nix new file mode 100644 index 00000000000..99a0cc17e06 --- /dev/null +++ b/pkgs/tools/networking/xxh/default.nix @@ -0,0 +1,20 @@ +{ lib, fetchFromGitHub, buildPythonApplication, pexpect, pyyaml, openssh }: +buildPythonApplication rec{ + pname = "xxh"; + version = "0.8.7"; + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = version; + hash = "sha256-AKfiFBaV8DC/Z7Bc+ZpwcJor/mzYomUaQKKobKXICn4="; + }; + propagatedBuildInputs = [ pexpect pyyaml openssh ]; + meta = with lib; { + description = "Bring your favorite shell wherever you go through the ssh"; + homepage = "https://github.com/xxh/xxh"; + license = licenses.bsd2; + maintainers = [ maintainers.pasqui23 ]; + platforms = platforms.all; + }; + +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 76b708f76c8..aee55157350 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10165,6 +10165,8 @@ in { inherit (pkgs.xorg) xorgserver; }; + xxh = callPackage ../tools/networking/xxh { }; + xxhash = callPackage ../development/python-modules/xxhash { }; yahooweather = callPackage ../development/python-modules/yahooweather { }; From 510ef1697788b82d3caa5d60b84ffab3263a2418 Mon Sep 17 00:00:00 2001 From: pasqui23 Date: Wed, 24 Nov 2021 20:36:26 +0000 Subject: [PATCH 2/6] xxh:platform set by python Co-authored-by: legendofmiracles <30902201+legendofmiracles@users.noreply.github.com> --- pkgs/tools/networking/xxh/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/tools/networking/xxh/default.nix b/pkgs/tools/networking/xxh/default.nix index 99a0cc17e06..c6a7769fd0b 100644 --- a/pkgs/tools/networking/xxh/default.nix +++ b/pkgs/tools/networking/xxh/default.nix @@ -14,7 +14,6 @@ buildPythonApplication rec{ homepage = "https://github.com/xxh/xxh"; license = licenses.bsd2; maintainers = [ maintainers.pasqui23 ]; - platforms = platforms.all; }; } From a37d5183204a2587780691b52955a31487a17753 Mon Sep 17 00:00:00 2001 From: pasqui23 Date: Thu, 25 Nov 2021 16:57:45 +0000 Subject: [PATCH 3/6] xxh: formatting Co-authored-by: Sandro --- pkgs/tools/networking/xxh/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/tools/networking/xxh/default.nix b/pkgs/tools/networking/xxh/default.nix index c6a7769fd0b..3cc862cb48e 100644 --- a/pkgs/tools/networking/xxh/default.nix +++ b/pkgs/tools/networking/xxh/default.nix @@ -1,14 +1,18 @@ { lib, fetchFromGitHub, buildPythonApplication, pexpect, pyyaml, openssh }: + buildPythonApplication rec{ pname = "xxh"; version = "0.8.7"; + src = fetchFromGitHub { owner = pname; repo = pname; rev = version; hash = "sha256-AKfiFBaV8DC/Z7Bc+ZpwcJor/mzYomUaQKKobKXICn4="; }; + propagatedBuildInputs = [ pexpect pyyaml openssh ]; + meta = with lib; { description = "Bring your favorite shell wherever you go through the ssh"; homepage = "https://github.com/xxh/xxh"; From 6024d6cc61064ed231e2b0e89416ec2fe873fc0e Mon Sep 17 00:00:00 2001 From: pasqui23 Date: Sun, 28 Nov 2021 14:41:30 +0000 Subject: [PATCH 4/6] xxh: better description Co-authored-by: legendofmiracles <30902201+legendofmiracles@users.noreply.github.com> --- pkgs/tools/networking/xxh/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/tools/networking/xxh/default.nix b/pkgs/tools/networking/xxh/default.nix index 3cc862cb48e..0799f8cfe94 100644 --- a/pkgs/tools/networking/xxh/default.nix +++ b/pkgs/tools/networking/xxh/default.nix @@ -14,10 +14,9 @@ buildPythonApplication rec{ propagatedBuildInputs = [ pexpect pyyaml openssh ]; meta = with lib; { - description = "Bring your favorite shell wherever you go through the ssh"; + description = "Bring your favorite shell wherever you go through ssh"; homepage = "https://github.com/xxh/xxh"; license = licenses.bsd2; maintainers = [ maintainers.pasqui23 ]; }; - } From 5e9f0c1e979eafe21808905a2830c0c628e6bef5 Mon Sep 17 00:00:00 2001 From: Pasquale Date: Sat, 1 Jan 2022 21:49:11 +0100 Subject: [PATCH 5/6] xxh: 0.8.7 -> 0.8.8 --- pkgs/tools/networking/xxh/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/networking/xxh/default.nix b/pkgs/tools/networking/xxh/default.nix index 0799f8cfe94..1e9464ce844 100644 --- a/pkgs/tools/networking/xxh/default.nix +++ b/pkgs/tools/networking/xxh/default.nix @@ -2,13 +2,13 @@ buildPythonApplication rec{ pname = "xxh"; - version = "0.8.7"; + version = "0.8.8"; src = fetchFromGitHub { owner = pname; repo = pname; rev = version; - hash = "sha256-AKfiFBaV8DC/Z7Bc+ZpwcJor/mzYomUaQKKobKXICn4="; + hash = "sha256-TzC8GTDmnYN56Rp5DyZxh+yGrkgWr6Xt86a/jyB3j5k="; }; propagatedBuildInputs = [ pexpect pyyaml openssh ]; From 45db27da2ee6b8923c2ad5fcde2af1d82215fb69 Mon Sep 17 00:00:00 2001 From: Pasquale Date: Sat, 1 Jan 2022 22:16:13 +0100 Subject: [PATCH 6/6] xxh: added tests --- nixos/tests/all-tests.nix | 1 + nixos/tests/xxh.nix | 67 +++++++++++++++++++++++++++ pkgs/tools/networking/xxh/default.nix | 6 ++- pkgs/top-level/all-packages.nix | 2 + 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/xxh.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index b8219416dc4..edf0a17cf69 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -504,6 +504,7 @@ in xrdp = handleTest ./xrdp.nix {}; xss-lock = handleTest ./xss-lock.nix {}; xterm = handleTest ./xterm.nix {}; + xxh = handleTest ./xxh.nix {}; yabar = handleTest ./yabar.nix {}; yggdrasil = handleTest ./yggdrasil.nix {}; zfs = handleTest ./zfs.nix {}; diff --git a/nixos/tests/xxh.nix b/nixos/tests/xxh.nix new file mode 100644 index 00000000000..3af8e53779e --- /dev/null +++ b/nixos/tests/xxh.nix @@ -0,0 +1,67 @@ +import ./make-test-python.nix ({ pkgs, lib, ... }: + + let + inherit (import ./ssh-keys.nix pkgs) snakeOilPrivateKey snakeOilPublicKey; + xxh-shell-zsh = pkgs.stdenv.mkDerivation { + pname = "xxh-shell-zsh"; + version = ""; + src = pkgs.fetchFromGitHub { + owner = "xxh"; + repo = "xxh-shell-zsh"; + # gets rarely updated, we can then just replace the hash + rev = "91e1f84f8d6e0852c3235d4813f341230cac439f"; + sha256 = "sha256-Y1FrIRxTd0yooK+ZzKcCd6bLSy5E2fRXYAzrIsm7rIc="; + }; + + postPatch = '' + substituteInPlace build.sh \ + --replace "echo Install wget or curl" "cp ${zsh-portable-binary} zsh-5.8-linux-x86_64.tar.gz" \ + --replace "command -v curl" "command -v this-should-not-trigger" + ''; + + installPhase = '' + mkdir -p $out + mv * $out/ + ''; + }; + + zsh-portable-binary = pkgs.fetchurl { + # kept in sync with https://github.com/xxh/xxh-shell-zsh/tree/master/build.sh#L27 + url = "https://github.com/romkatv/zsh-bin/releases/download/v3.0.1/zsh-5.8-linux-x86_64.tar.gz"; + sha256 = "sha256-i8flMd2Isc0uLoeYQNDnOGb/kK3oTFVqQgIx7aOAIIo="; + }; + in + { + name = "xxh"; + meta = with lib.maintainers; { + maintainers = [ lom ]; + }; + + nodes = { + server = { ... }: { + services.openssh.enable = true; + users.users.root.openssh.authorizedKeys.keys = [ snakeOilPublicKey ]; + }; + + client = { ... }: { + programs.zsh.enable = true; + users.users.root.shell = pkgs.zsh; + environment.systemPackages = with pkgs; [ xxh git ]; + }; + }; + + testScript = '' + start_all() + + client.succeed("mkdir -m 700 /root/.ssh") + + client.succeed( + "cat ${snakeOilPrivateKey} > /root/.ssh/id_ecdsa" + ) + client.succeed("chmod 600 /root/.ssh/id_ecdsa") + + server.wait_for_unit("sshd") + + client.succeed("xxh server -i /root/.ssh/id_ecdsa +hc \'echo $0\' +i +s zsh +I xxh-shell-zsh+path+${xxh-shell-zsh} | grep -Fq '/root/.xxh/.xxh/shells/xxh-shell-zsh/build/zsh-bin/bin/zsh'") + ''; + }) diff --git a/pkgs/tools/networking/xxh/default.nix b/pkgs/tools/networking/xxh/default.nix index 1e9464ce844..c03708f08a3 100644 --- a/pkgs/tools/networking/xxh/default.nix +++ b/pkgs/tools/networking/xxh/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, buildPythonApplication, pexpect, pyyaml, openssh }: +{ lib, fetchFromGitHub, buildPythonApplication, pexpect, pyyaml, openssh, nixosTests }: buildPythonApplication rec{ pname = "xxh"; @@ -13,6 +13,10 @@ buildPythonApplication rec{ propagatedBuildInputs = [ pexpect pyyaml openssh ]; + passthru.tests = { + inherit (nixosTests) xxh; + }; + meta = with lib; { description = "Bring your favorite shell wherever you go through ssh"; homepage = "https://github.com/xxh/xxh"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 24b91291488..4aed44a93ac 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29219,6 +29219,8 @@ with pkgs; gtk = gtk2; }; + xxh = with python3Packages; toPythonApplication xxh; + kodiPackages = recurseIntoAttrs (kodi.packages); kodi = callPackage ../applications/video/kodi {