git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #147189 from pasqui23/xxh
commit46903948d2f440c16407d16875be03f72c21bba3 authorSandro <sandro.jaeckel@gmail.com> dateFri 28 Jan 2022, 11:40 (5 years ago) parent58ae05b45db27d
5 files changed+98
nixos/tests/all-tests.nix+1 nixos/tests/xxh.nix+67 pkgs/tools/networking/xxh/default.nix+26 pkgs/top-level/all-packages.nix+2 pkgs/top-level/python-packages.nix+2
nixos/tests/all-tests.nix+1
@@ -558,6 +558,7 @@ in
558558 xrdp = handleTest ./xrdp.nix {};
559559 xss-lock = handleTest ./xss-lock.nix {};
560560 xterm = handleTest ./xterm.nix {};
561+ xxh = handleTest ./xxh.nix {};
561562 yabar = handleTest ./yabar.nix {};
562563 yggdrasil = handleTest ./yggdrasil.nix {};
563564 zfs = handleTest ./zfs.nix {};
nixos/tests/xxh.nixnew file+67
@@ -0,0 +1,67 @@
1+import ./make-test-python.nix ({ pkgs, lib, ... }:
2+
3+ let
4+ inherit (import ./ssh-keys.nix pkgs) snakeOilPrivateKey snakeOilPublicKey;
5+ xxh-shell-zsh = pkgs.stdenv.mkDerivation {
6+ pname = "xxh-shell-zsh";
7+ version = "";
8+ src = pkgs.fetchFromGitHub {
9+ owner = "xxh";
10+ repo = "xxh-shell-zsh";
11+ # gets rarely updated, we can then just replace the hash
12+ rev = "91e1f84f8d6e0852c3235d4813f341230cac439f";
13+ sha256 = "sha256-Y1FrIRxTd0yooK+ZzKcCd6bLSy5E2fRXYAzrIsm7rIc=";
14+ };
15+
16+ postPatch = ''
17+ substituteInPlace build.sh \
18+ --replace "echo Install wget or curl" "cp ${zsh-portable-binary} zsh-5.8-linux-x86_64.tar.gz" \
19+ --replace "command -v curl" "command -v this-should-not-trigger"
20+ '';
21+
22+ installPhase = ''
23+ mkdir -p $out
24+ mv * $out/
25+ '';
26+ };
27+
28+ zsh-portable-binary = pkgs.fetchurl {
29+ # kept in sync with https://github.com/xxh/xxh-shell-zsh/tree/master/build.sh#L27
30+ url = "https://github.com/romkatv/zsh-bin/releases/download/v3.0.1/zsh-5.8-linux-x86_64.tar.gz";
31+ sha256 = "sha256-i8flMd2Isc0uLoeYQNDnOGb/kK3oTFVqQgIx7aOAIIo=";
32+ };
33+ in
34+ {
35+ name = "xxh";
36+ meta = with lib.maintainers; {
37+ maintainers = [ lom ];
38+ };
39+
40+ nodes = {
41+ server = { ... }: {
42+ services.openssh.enable = true;
43+ users.users.root.openssh.authorizedKeys.keys = [ snakeOilPublicKey ];
44+ };
45+
46+ client = { ... }: {
47+ programs.zsh.enable = true;
48+ users.users.root.shell = pkgs.zsh;
49+ environment.systemPackages = with pkgs; [ xxh git ];
50+ };
51+ };
52+
53+ testScript = ''
54+ start_all()
55+
56+ client.succeed("mkdir -m 700 /root/.ssh")
57+
58+ client.succeed(
59+ "cat ${snakeOilPrivateKey} > /root/.ssh/id_ecdsa"
60+ )
61+ client.succeed("chmod 600 /root/.ssh/id_ecdsa")
62+
63+ server.wait_for_unit("sshd")
64+
65+ 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'")
66+ '';
67+ })
pkgs/tools/networking/xxh/default.nixnew file+26
@@ -0,0 +1,26 @@
1+{ lib, fetchFromGitHub, buildPythonApplication, pexpect, pyyaml, openssh, nixosTests }:
2+
3+buildPythonApplication rec{
4+ pname = "xxh";
5+ version = "0.8.8";
6+
7+ src = fetchFromGitHub {
8+ owner = pname;
9+ repo = pname;
10+ rev = version;
11+ hash = "sha256-TzC8GTDmnYN56Rp5DyZxh+yGrkgWr6Xt86a/jyB3j5k=";
12+ };
13+
14+ propagatedBuildInputs = [ pexpect pyyaml openssh ];
15+
16+ passthru.tests = {
17+ inherit (nixosTests) xxh;
18+ };
19+
20+ meta = with lib; {
21+ description = "Bring your favorite shell wherever you go through ssh";
22+ homepage = "https://github.com/xxh/xxh";
23+ license = licenses.bsd2;
24+ maintainers = [ maintainers.pasqui23 ];
25+ };
26+}
pkgs/top-level/all-packages.nix+2
@@ -29754,6 +29754,8 @@ with pkgs;
2975429754 gtk = gtk2;
2975529755 };
2975629756
29757+ xxh = with python3Packages; toPythonApplication xxh;
29758+
2975729759 kodiPackages = recurseIntoAttrs (kodi.packages);
2975829760
2975929761 kodi = callPackage ../applications/video/kodi {
pkgs/top-level/python-packages.nix+2
@@ -10583,6 +10583,8 @@ in {
1058310583 inherit (pkgs.xorg) xorgserver;
1058410584 };
1058510585
10586+ xxh = callPackage ../tools/networking/xxh { };
10587+
1058610588 xxhash = callPackage ../development/python-modules/xxhash { };
1058710589
1058810590 yahooweather = callPackage ../development/python-modules/yahooweather { };