diff options
author | nia <nia@pkgsrc.org> | 2022-05-01 08:03:40 +0000 |
---|---|---|
committer | nia <nia@pkgsrc.org> | 2022-05-01 08:03:40 +0000 |
commit | eac44bfb6349e444c6bccd0aade3d4b31b4a4188 (patch) | |
tree | 3ffddf483f5c87c6692bc574a4ce967d5e46e130 /mk/bsd.prefs.mk | |
parent | 51f04f8fee0a38cc69bc55474d435fbfc4314f09 (diff) | |
download | pkgsrc-eac44bfb6349e444c6bccd0aade3d4b31b4a4188.tar.gz |
mk: Initial support for NixOS (Linux variant)
A particular challenge for pkgsrc on NixOS is that it usurps all
Unix conventions and stores its system binaries and libraries in
a crazy system of hashed sub-directories:
$ which ls
/run/current-system/sw/bin/ls
$ ls -l /run/current-system/sw/bin/ls
Lrwxrwxrwx 1 root root 65 Jan 1 1970 /run/current-system/sw/bin/ls -> /nix/store/xs02fpnpkq
frhqqfsxx3lpj48wrapd00-coreutils-8.32/bin/ls
We can make a "best effort" attempt to accomodate this by invoking
the compiler to figure out where libc is. In general, it's required to
adjust the Linux files to make fewer assumptions about the layout of the
filesystem.
However, since using a compiler and libc from NixOS results in /nix/store
paths being embedded in binaries, running the NixOS "garbage collector"
can result in binaries installed from pkgsrc becoming unusable. Use with
care:
$ readelf -a ~/pkg/bin/perl | grep nix
[Requesting program interpreter: /nix/store/p5sam91qwz995pi0160rfr7dkh6pibil-glibc-2.32
-39/lib/ld-linux-aarch64.so.1]
0x000000000000001d (RUNPATH) Library runpath: [/home/nia/pkg/lib:/home/nia/pkg/li
b/perl5/5.32.0/aarch64-linux/CORE:/nix/store/p5sam91qwz995pi0160rfr7dkh6pibil-glibc-2.32-39/l
ib:/nix/store/vv9nz0bwv1pfl70w14k7dgz6yx7hjwxk-gcc-9.3.0-lib/lib]
Apparently, the "stdenv.cc" package must be installed prior to
bootstrapping pkgsrc.
I worked on this patch last year for a friend who wanted to test
something on pkgsrc but had no other system available.
Diffstat (limited to 'mk/bsd.prefs.mk')
-rw-r--r-- | mk/bsd.prefs.mk | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk index 1317e136ba2..02493bae144 100644 --- a/mk/bsd.prefs.mk +++ b/mk/bsd.prefs.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prefs.mk,v 1.420 2022/04/30 21:27:57 tnn Exp $ +# $NetBSD: bsd.prefs.mk,v 1.421 2022/05/01 08:03:40 nia Exp $ # # This file includes the mk.conf file, which contains the user settings. # @@ -81,6 +81,8 @@ _CLEANING:= ${"${.TARGETS:C,( [[:alnum:]-]*clean[[:alnum:]-]*)+$,,W:M*clean*}":? UNAME=/usr/bin/uname .elif exists(/bin/uname) UNAME=/bin/uname +.elif exists(/run/current-system/sw/bin/uname) +UNAME=/run/current-system/sw/bin/uname .else UNAME=echo Unknown .endif |