Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release-24.05] liblxi: fix darwin build, use finalAttrs #319868

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pkgs/development/libraries/liblxi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@
, libtirpc, rpcsvc-proto, avahi, libxml2
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "liblxi";
version = "1.20";

src = fetchFromGitHub {
owner = "lxi-tools";
repo = "liblxi";
rev = "v${version}";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The finalAttrs pattern is not really helpful to override version, because the hash is not updated at the same time. See #310373 and #315337 (comment). There is no clear path forward, yet, but migrating to the finalAttrs pattern is not an improvement, imho.

Copy link
Member

@wegank wegank Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the reasons finalAttrs appeals to me is that I can do something like this.

somePackage.overrideAttrs (previousAttrs: {
  version = newVersion;
  src = previousAttrs.src.overrideAttrs {
    outputHash = newHash;
  };
});

rev = "v${finalAttrs.version}";
hash = "sha256-jS0huNkbyKrsJ3NkenrYtjkzLakOsTJpwlgSo98ribE=";
};

postPatch = ''
# needed by darwin
sed -e 1i'#include <string.h>' \
-e 1i'#include <stdlib.h>' \
-i src/bonjour.c
'';

nativeBuildInputs = [ meson ninja cmake pkg-config rpcsvc-proto ];

buildInputs = lib.optionals (!stdenv.isDarwin) [
Expand All @@ -36,4 +43,4 @@ stdenv.mkDerivation rec {
platforms = platforms.unix;
maintainers = [ maintainers.vq ];
};
}
})