From 2e4d7b7ad23ce9e95d828fe02d9ef5be3dd9e7be Mon Sep 17 00:00:00 2001 From: ocfox Date: Thu, 25 Jan 2024 12:23:53 +0800 Subject: [PATCH] nixosTests.transfer-sh: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/transfer-sh.nix | 20 ++++++++++++++++++++ pkgs/by-name/tr/transfer-sh/package.nix | 14 +++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/transfer-sh.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 1453a3875f6e..f8aa5d9e0fb5 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -901,6 +901,7 @@ in { tor = handleTest ./tor.nix {}; traefik = handleTestOn ["aarch64-linux" "x86_64-linux"] ./traefik.nix {}; trafficserver = handleTest ./trafficserver.nix {}; + transfer-sh = handleTest ./transfer-sh.nix {}; transmission = handleTest ./transmission.nix { transmission = pkgs.transmission; }; transmission_4 = handleTest ./transmission.nix { transmission = pkgs.transmission_4; }; # tracee requires bpf diff --git a/nixos/tests/transfer-sh.nix b/nixos/tests/transfer-sh.nix new file mode 100644 index 000000000000..f4ab7d28858e --- /dev/null +++ b/nixos/tests/transfer-sh.nix @@ -0,0 +1,20 @@ +import ./make-test-python.nix ({ pkgs, lib, ... }: { + name = "transfer-sh"; + + meta = { + maintainers = with lib.maintainers; [ ocfox ]; + }; + + nodes.machine = { pkgs, ... }: { + services.transfer-sh = { + enable = true; + settings.LISTENER = ":1234"; + }; + }; + + testScript = '' + machine.wait_for_unit("transfer-sh.service") + machine.wait_for_open_port(1234) + machine.succeed("curl --fail http://localhost:1234/") + ''; +}) diff --git a/pkgs/by-name/tr/transfer-sh/package.nix b/pkgs/by-name/tr/transfer-sh/package.nix index b30486848070..d3b15ae2465b 100644 --- a/pkgs/by-name/tr/transfer-sh/package.nix +++ b/pkgs/by-name/tr/transfer-sh/package.nix @@ -1,4 +1,9 @@ -{ lib, fetchFromGitHub, buildGoModule }: +{ lib +, fetchFromGitHub +, buildGoModule +, nix-update-script +, nixosTests +}: buildGoModule rec { pname = "transfer-sh"; @@ -13,6 +18,13 @@ buildGoModule rec { vendorHash = "sha256-C8ZfUIGT9HiQQiJ2hk18uwGaQzNCIKp/Jiz6ePZkgDQ="; + passthru = { + tests = { + inherit (nixosTests) transfer-sh; + }; + updateScript = nix-update-script { }; + }; + meta = with lib; { description = "Easy and fast file sharing and pastebin server with access from the command-line"; homepage = "https://github.com/dutchcoders/transfer.sh";