From 6caaee777b0639afb7c55bb77f23f62421a3027c Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 5 Feb 2024 10:20:50 +0100 Subject: [PATCH] nix: Simplify static.nix The enable-executable-static flag is set by default, so doesn't make a difference. The pkg-config improvement for libpq was merged upstream, so we can use the same here already. --- nix/static.nix | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/nix/static.nix b/nix/static.nix index 76387a321..627ff7436 100644 --- a/nix/static.nix +++ b/nix/static.nix @@ -24,19 +24,16 @@ let }; overrides = pkgs.lib.composeExtensions old.overrides (_: prev: { - postgresql-libpq = (prev.postgresql-libpq.override { + postgresql-libpq = (lib.overrideCabal prev.postgresql-libpq { + # TODO: This section can be simplified when this PR has made it's way to us: + # https://github.com/NixOS/nixpkgs/pull/286370 + # Using use-pkg-config flag, because pg_config won't work when cross-compiling + configureFlags = [ "-fuse-pkg-config" ]; # postgresql doesn't build in the fully static overlay - but the default # derivation is built with static libraries anyway. - postgresql = pkgsCross.libpq; + libraryPkgconfigDepends = [ pkgsCross.libpq ]; + librarySystemDepends = [ ]; }).overrideAttrs (_: prevAttrs: { - # Using use-pkg-config flag, because pg_config won't work when cross-compiling - configureFlags = prevAttrs.configureFlags ++ [ - "-fuse-pkg-config" - "--with-pkg-config=${pkgsStatic.pkgsBuildHost.pkg-config}/bin/${pkgsStatic.targetPlatform.config}-pkg-config" - ]; - # This needs to match where libpq is coming from above. - nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ pkgsCross.pkgsBuildHost.pkg-config ]; - buildInputs = prevAttrs.buildInputs ++ [ (pkgsStatic.libkrb5.overrideAttrs (_: prevAttrs: { configureFlags = prevAttrs.configureFlags ++ [ @@ -55,7 +52,6 @@ let }); makeExecutableStatic = drv: pkgs.lib.pipe drv [ - (lib.compose.appendConfigureFlags [ "--enable-executable-static" ]) lib.compose.justStaticExecutables # To successfully compile a redistributable, fully static executable we need to: