From b60c01f4405ec3b5cc4a740fe994c3b9f39cf01f Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 16 Jan 2025 17:32:52 +0900 Subject: fortify: switch to static linking Signed-off-by: Ophestra --- package.nix | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'package.nix') diff --git a/package.nix b/package.nix index 51e29c6f..85a3859d 100644 --- a/package.nix +++ b/package.nix @@ -1,15 +1,11 @@ { lib, buildGoModule, - makeBinaryWrapper, xdg-dbus-proxy, bubblewrap, + pkgsStatic, pkg-config, - acl, - wayland, wayland-scanner, - wayland-protocols, - xorg, }: buildGoModule rec { @@ -27,19 +23,13 @@ buildGoModule rec { lib.attrsets.foldlAttrs ( ldflags: name: value: - ldflags - ++ [ - "-X" - "git.gensokyo.uk/security/fortify/internal.${name}=${value}" - ] + ldflags ++ [ "-X git.gensokyo.uk/security/fortify/internal.${name}=${value}" ] ) [ - "-s" - "-w" - "-X" - "main.Fmain=${placeholder "out"}/libexec/fortify" - "-X" - "main.Fshim=${placeholder "out"}/libexec/fshim" + "-s -w" + "-extldflags '-static'" + "-X main.Fmain=${placeholder "out"}/libexec/fortify" + "-X main.Fshim=${placeholder "out"}/libexec/fshim" ] { Version = "v${version}"; @@ -51,17 +41,26 @@ buildGoModule rec { # nix build environment does not allow acls GO_TEST_SKIP_ACL = 1; - buildInputs = [ - acl - wayland - wayland-protocols - xorg.libxcb - ]; + buildInputs = + # cannot find a cleaner way to do this + with pkgsStatic; + [ + musl + libffi + acl + wayland + wayland-protocols + ] + ++ (with xorg; [ + libxcb + libXau + libXdmcp + ]); nativeBuildInputs = [ pkg-config wayland-scanner - makeBinaryWrapper + pkgsStatic.makeBinaryWrapper ]; preConfigure = '' -- cgit v1.3.1