1

I’m trying to build a static binary that depends on libudev.

Unfortunately nix-env -iA nixpkgs.pkgsStatic.libudev fails with: error: p11-kit cannot be used as a static library.

Is there a better way of doing this?

ouflak
  • 2,458
  • 10
  • 44
  • 49
dnalor
  • 11
  • 1
  • libudev is part of systemd so you're actually trying to build a static systemd. Not sure if this still applies, but it seems that static systemd is not possible: https://lists.freedesktop.org/archives/systemd-devel/2014-March/017493.html – Henri Menke Nov 28 '21 at 14:09
  • I have a [Nix expression for compiling `libudev` as a static library here](https://github.com/DavidEGrayson/nixcrpkgs/tree/master/pkgs/libudev). I don't think it will be easy for you to just use it directly, but you could look at the commands I ran and the patches I installed, and do something similar in your nixpkgs-based environment. – David Grayson Dec 05 '21 at 17:07

1 Answers1

0

On more recent nixpkgs versions you don't get the above error but several compile errors. If you are familiar with static compiling feel free to submit PRs to fix those.

SuperSandro2000
  • 581
  • 10
  • 20