diff --git a/pkgs/by-name/da/dae/package.nix b/pkgs/by-name/da/dae/package.nix index 1d73bd57a9cc..67e802908d7a 100644 --- a/pkgs/by-name/da/dae/package.nix +++ b/pkgs/by-name/da/dae/package.nix @@ -3,17 +3,19 @@ clang, fetchFromGitHub, buildGoModule, + versionCheckHook, nixosTests, nix-update-script, }: -buildGoModule rec { + +buildGoModule (finalAttrs: { pname = "dae"; version = "1.0.0"; src = fetchFromGitHub { owner = "daeuniverse"; repo = "dae"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-RpbWZEoGrCq3Py0hu6YDie6ErDTLS3oabqScPzhCtm0="; fetchSubmodules = true; }; @@ -33,7 +35,7 @@ buildGoModule rec { make CFLAGS="-D__REMOVE_BPF_PRINTK -fno-stack-protector -Wno-unused-command-line-argument" \ NOSTRIP=y \ - VERSION=${version} \ + VERSION=${finalAttrs.version} \ OUTPUT=$out/bin/dae runHook postBuild @@ -45,25 +47,32 @@ buildGoModule rec { postInstall = '' install -Dm444 install/dae.service $out/lib/systemd/system/dae.service substituteInPlace $out/lib/systemd/system/dae.service \ - --replace /usr/bin/dae $out/bin/dae + --replace-fail "/usr/bin/dae" "$out/bin/dae" ''; - passthru.tests = { - inherit (nixosTests) dae; + doInstallCheck = true; + + nativeInstallCheckInputs = [ versionCheckHook ]; + + versionCheckProgramArg = "--version"; + + passthru = { + tests = { + inherit (nixosTests) dae; + }; + updateScript = nix-update-script { }; }; - passthru.updateScript = nix-update-script { }; - - meta = with lib; { + meta = { description = "Linux high-performance transparent proxy solution based on eBPF"; homepage = "https://github.com/daeuniverse/dae"; - license = licenses.agpl3Only; - maintainers = with maintainers; [ + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ oluceps pokon548 luochen1990 ]; - platforms = platforms.linux; + platforms = lib.platforms.linux; mainProgram = "dae"; }; -} +})