From 0d767c96ab3734f0442c3fd321be1068ba36d431 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 8 Oct 2023 04:20:00 +0000 Subject: [PATCH 1/2] opensnitch: use buildGo121Module --- pkgs/top-level/all-packages.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dc8f53aa9b8a..63c8135b5b5e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11465,9 +11465,7 @@ with pkgs; openfortivpn = callPackage ../tools/networking/openfortivpn { }; opensnitch = callPackage ../tools/networking/opensnitch/daemon.nix { - # Build currently fails on Go > 1.18 - # See https://github.com/evilsocket/opensnitch/issues/851 - buildGoModule = buildGo118Module; + buildGoModule = buildGo121Module; }; opensnitch-ui = libsForQt5.callPackage ../tools/networking/opensnitch/ui.nix { }; From 69ebb04365ad1c6b4bbaefcfebc957d8b50f813f Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 8 Oct 2023 04:20:00 +0000 Subject: [PATCH 2/2] opensnitch: fix test version --- pkgs/tools/networking/opensnitch/daemon.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/tools/networking/opensnitch/daemon.nix b/pkgs/tools/networking/opensnitch/daemon.nix index 1d81627bf29c..98c7f51ba71e 100644 --- a/pkgs/tools/networking/opensnitch/daemon.nix +++ b/pkgs/tools/networking/opensnitch/daemon.nix @@ -27,6 +27,11 @@ buildGoModule rec { hash = "sha256-C8Uuz2FC7Zu07ZmFpp+ejpNxkyC3/mM9J2dc5FUKx64="; }; + postPatch = '' + # Allow configuring Version at build time + substituteInPlace daemon/core/version.go --replace "const " "var " + ''; + modRoot = "daemon"; buildInputs = [ @@ -65,6 +70,8 @@ buildGoModule rec { --replace "/bin/mkdir" "${coreutils}/bin/mkdir" ''; + ldflags = [ "-s" "-w" "-X github.com/evilsocket/opensnitch/daemon/core.Version=${version}" ]; + postInstall = '' wrapProgram $out/bin/opensnitchd \ --prefix PATH : ${lib.makeBinPath [ iptables ]}