1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-20 04:31:52 +00:00

Merge pull request #147189 from pasqui23/xxh

This commit is contained in:
Sandro 2022-01-28 11:40:03 +01:00 committed by GitHub
commit 46903948d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 98 additions and 0 deletions

View file

@ -558,6 +558,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 {};

67
nixos/tests/xxh.nix Normal file
View file

@ -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'")
'';
})

View file

@ -0,0 +1,26 @@
{ lib, fetchFromGitHub, buildPythonApplication, pexpect, pyyaml, openssh, nixosTests }:
buildPythonApplication rec{
pname = "xxh";
version = "0.8.8";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = version;
hash = "sha256-TzC8GTDmnYN56Rp5DyZxh+yGrkgWr6Xt86a/jyB3j5k=";
};
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";
license = licenses.bsd2;
maintainers = [ maintainers.pasqui23 ];
};
}

View file

@ -29754,6 +29754,8 @@ with pkgs;
gtk = gtk2;
};
xxh = with python3Packages; toPythonApplication xxh;
kodiPackages = recurseIntoAttrs (kodi.packages);
kodi = callPackage ../applications/video/kodi {

View file

@ -10583,6 +10583,8 @@ in {
inherit (pkgs.xorg) xorgserver;
};
xxh = callPackage ../tools/networking/xxh { };
xxhash = callPackage ../development/python-modules/xxhash { };
yahooweather = callPackage ../development/python-modules/yahooweather { };