tusd: embed version in binary (#409019)

* nixosTests.tusd: Fix network race condition

Fixes error:

client # curl: (7) Failed to connect to server port 1080 after 8 ms: Could not connect to server
client # [ 5.621267] network-addresses-eth1-start[795]: adding address 192.168.1.1/24... done

* tusd: embed version in binary

Currently, tusd reports 'n/a' when its version is queried using `tusd -version`.
This change embeds the current version during the build process, so it correctly
reports the value.

See https://github.com/tus/tusd/blob/8e66333a019e500eb1c5a0b9843342606382ef5e/scripts/build_funcs.sh#L20

---------

Co-authored-by: Niklas Hambüchen <mail@nh2.me>

authored by Marius Kleidl Niklas Hambüchen and committed by GitHub eb394bfc 7cbb56ff

+5
+1
nixos/tests/tusd/default.nix
··· 43 client.succeed("${pkgs.coreutils}/bin/truncate --size=100M file-100M.bin") 44 45 # Upload it. 46 client.succeed("${./tus-curl-upload.sh} file-100M.bin http://server:${toString port}/files/") 47 48 print("Upload succeeded")
··· 43 client.succeed("${pkgs.coreutils}/bin/truncate --size=100M file-100M.bin") 44 45 # Upload it. 46 + client.wait_for_unit("network.target") 47 client.succeed("${./tus-curl-upload.sh} file-100M.bin http://server:${toString port}/files/") 48 49 print("Upload succeeded")
+4
pkgs/by-name/tu/tusd/package.nix
··· 18 19 vendorHash = "sha256-YununGyB72zE0tmqO3BREJeMTjCuy/1fhPHC5r8OLjg="; 20 21 # Tests need the path to the binary: 22 # https://github.com/tus/tusd/blob/0e52ad650abed02ec961353bb0c3c8bc36650d2c/internal/e2e/e2e_test.go#L37 23 preCheck = ''
··· 18 19 vendorHash = "sha256-YununGyB72zE0tmqO3BREJeMTjCuy/1fhPHC5r8OLjg="; 20 21 + ldflags = [ 22 + "-X github.com/tus/tusd/v2/cmd/tusd/cli.VersionName=v${version}" 23 + ]; 24 + 25 # Tests need the path to the binary: 26 # https://github.com/tus/tusd/blob/0e52ad650abed02ec961353bb0c3c8bc36650d2c/internal/e2e/e2e_test.go#L37 27 preCheck = ''