Link [ pkgsrc | NetBSD | pkgsrc git mirror | PR fulltext-search | netbsd commit viewer ]


   
        usage: [branch:branch] [user:user] [path[@revision]] keyword [... [-excludekeyword [...]]] (e.g. branch:MAIN pkgtools/pkg)




switch to index mode

recent branches: MAIN (1h)  pkgsrc-2024Q1 (11d)  pkgsrc-2023Q4 (58d)  pkgsrc-2023Q2 (91d)  pkgsrc-2023Q3 (170d) 

2024-05-29 12:57:00 UTC Now

2022-05-01 08:03:41 UTC MAIN commitmail json YAML

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.

(nia)