Discussion:
Using packaged Nix
(too old to reply)
Nicolas George
2024-06-28 12:10:02 UTC
Permalink
Hi.

I am trying to use Nix on Debian, with the packaged version.

My goal is to have a pristine Debian OS and the ability to install
binaries for specific versions of common software independently from the
OS.

The problem is: none of the commands I find on the web work in this
setup.

For example, I did:

nix-channel --add https://nixos.org/channels/nixos-24.05 nixos
nix-channel --update

Then I check the packages I want:

https://search.nixos.org/packages?channel=24.05&from=0&size=50&sort=relevance&type=packages&query=postgresql
https://search.nixos.org/packages?channel=24.05&from=0&size=50&sort=relevance&type=packages&query=ossp
https://search.nixos.org/packages?channel=24.05&from=0&size=50&sort=relevance&type=packages&query=boost

And type the commands they suggest:

nix-shell -p libossp_uuid

and it fails miserably:

error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

Or:

nix-env -iA nixpkgs.libossp_uuid

fails too:

error: attribute 'nixpkgs' in selection path 'nixpkgs.libossp_uuid' not found

Can somebody tell me what I am doing wrong and/or give me hints on how
to get started?

Alternatively, if you know other packages systems that can achieve a
similar goal, I can consider using it instead. But it has to handle
shared dependencies.

Thanks in advance.
--
Nicolas George
didier gaumet
2024-06-28 16:10:01 UTC
Permalink
Hello,

Disclaimer: I have never used Nix

from the Nix to Debian phrasebook
( https://nixos.wiki/wiki/Nix_to_Debian_phrasebook )
I would try:
$ nix-env -qaP '.*libossp_uuid.*'

As an answer to your other question (is there another package system
managing dependencies available on Debian?), I have never used NetBSD
pkgsrc/pkg on Linux but it has long been possible. And pkgsrc used to be
a source package management system but its pkg binary package management
alter ego has been introduced since then. I am not absolutely positive
that pkg (binary) can be used on Linux, but I strongly suppose so.

how to use pkgsrc on linux:
https://wiki.netbsd.org/pkgsrc/how_to_use_pkgsrc_on_linux/
Using pkgsrc (binary and source):
http://netbsd.org/docs/pkgsrc/using.html

for example, pkgsrc has no libossp_uuid package but does have a
ossp_uuid one:
https://pkgsrc.se/devel/ossp-uuid

Perhaps others more knowledgeable in pkgsrc than me will chime in :-)
https://pkgsrc.se/devel/ossp-uuid
Nicolas George
2024-07-04 13:10:01 UTC
Permalink
Post by didier gaumet
Disclaimer: I have never used Nix
Thanks for the heads up. I kind of hoped somebody who did would see this
mail.
Post by didier gaumet
from the Nix to Debian phrasebook
( https://nixos.wiki/wiki/Nix_to_Debian_phrasebook )
$ nix-env -qaP '.*libossp_uuid.*'
Unfortunately, no luck.

error: selector '.*libossp_uuid.*' matches no derivations

This phrasebook looked promising, but what it explains is how to use
Debian when you know Nix and how to use Nix when you know Debian.

What I need is something that explains how to use Nix on Debian when all
you have are documentations about Nix not on Debian.
Post by didier gaumet
As an answer to your other question (is there another package system
managing dependencies available on Debian?), I have never used NetBSD
pkgsrc/pkg on Linux but it has long been possible.
Oh, sorry, I should have been more specific: I would like binary
packages.

Thanks for the pointers, even if they do not help.

Regards,
--
Nicolas George
didier gaumet
2024-07-04 15:30:02 UTC
Permalink
Post by Nicolas George
Unfortunately, no luck.
[...]
Post by Nicolas George
What I need is something that explains how to use Nix on Debian when all
you have are documentations about Nix not on Debian.
I tried the Debian way (installing nix-setup-systemd, which install
nix-bin) without success. I then tried the method quoted in this webpage:
https://ariya.io/2020/05/nix-package-manager-on-ubuntu-or-debian
also without success but I indicate it because perhaps it will give you
more hints about what to do
Post by Nicolas George
Post by didier gaumet
As an answer to your other question (is there another package system
managing dependencies available on Debian?), I have never used NetBSD
pkgsrc/pkg on Linux but it has long been possible.
Oh, sorry, I should have been more specific: I would like binary
packages.
Thanks for the pointers, even if they do not help.
While Pkgsrc has long been source only, nowadays it is a whole packaging
system, both source and binary since the introduction of Pkgin.
This webpage seems to confirm what I was suspecting: Pkgsrc would be
able manage binary packages on linux:
https://opensource.com/article/19/11/pkgsrc-netbsd-linux
(but I was too lazy to verify by installing and trying myself)
Nicolas George
2024-07-05 09:40:01 UTC
Permalink
I tried the Debian way (installing nix-setup-systemd, which install nix-bin)
https://ariya.io/2020/05/nix-package-manager-on-ubuntu-or-debian
also without success but I indicate it because perhaps it will give you more
hints about what to do
This or something similar will be the next step if I cannot get the
packaged version to work.

It is not the first time I am left wondering why something reaches the
Debian archive if it does not work. I already noticed that the ARM
installer advertised support for the RockPi nanocomputers but did not
manage to boot at all. How?
While Pkgsrc has long been source only, nowadays it is a whole packaging
system, both source and binary since the introduction of Pkgin.
This webpage seems to confirm what I was suspecting: Pkgsrc would be able
https://opensource.com/article/19/11/pkgsrc-netbsd-linux
(but I was too lazy to verify by installing and trying myself)
Thanks.

There is another property of Nix I need: Nix never replaces a file, it
only creates new files under different directories. This is important
for me as I intend to use the same snapshot of the /nix volume connected
read-only on multiple virtual machines. That way, I can install a new
version of, say, PostgreSQL for one VM but the other VMs running the
older version will not be affected at all until I upgrade them too.

Do you know if pkgsrc can give the same guarantee?

(I have also put the Debian /usr on a separate volume with a read-only
snapshot shared between VMs. The fact that on Debian stable an upgrade
does not require change in configuration files means I can upgrade the
system, make a new snapshot and reboot the VMs on it and it will work. I
even “mv /boot /usr && ln -s usr/boot /boot”. It seems to work. At some
point I will write a blog article about it.)

Regards,
--
Nicolas George
didier gaumet
2024-07-05 10:50:01 UTC
Permalink
Le 05/07/2024 à 11:31, Nicolas George a écrit :
[...]
Post by Nicolas George
There is another property of Nix I need: Nix never replaces a file, it
only creates new files under different directories. This is important
for me as I intend to use the same snapshot of the /nix volume connected
read-only on multiple virtual machines. That way, I can install a new
version of, say, PostgreSQL for one VM but the other VMs running the
older version will not be affected at all until I upgrade them too.
Do you know if pkgsrc can give the same guarantee?
Sorry, I have used pkgsrc (on NetBSD only) really long ago, when it was
source only, and it was not an intensive use.
So I can not answer
Post by Nicolas George
(I have also put the Debian /usr on a separate volume with a read-only
snapshot shared between VMs. The fact that on Debian stable an upgrade
does not require change in configuration files means I can upgrade the
system, make a new snapshot and reboot the VMs on it and it will work. I
even “mv /boot /usr && ln -s usr/boot /boot”. It seems to work. At some
point I will write a blog article about it.)
I am not knowledgeable about this matter, neither.

Perhaps (*big* conditional here) something like rpm-ostree or a custom
combination of libostree and another package manager (the latter, I
don't even know if it is possible in real life with only a limited
effort) could be interesting to you:
https://coreos.github.io/rpm-ostree/
https://en.wikipedia.org/wiki/OSTree

didier gaumet
2024-07-04 16:50:02 UTC
Permalink
(sorry Nicolas, I first sent you a private mail instead of posting on
this list, my bad)
Post by Nicolas George
Unfortunately, no luck.
error: selector '.*libossp_uuid.*' matches no derivations
[...]

Guix, the GNU version of Nix, seems (at least basically) functional from
the start on Debian:

sudo apt install guix
guix search $PACKAGE

but while there are packages for postgresql and boost, apparently there
is none for libossp or ossp
Nicolas George
2024-07-05 09:30:01 UTC
Permalink
(sorry Nicolas, I first sent you a private mail instead of posting on this
list, my bad)
No problem, I just wondered for a few seconds why it arrived twice.
Guix, the GNU version of Nix, seems (at least basically) functional from the
sudo apt install guix
guix search $PACKAGE
but while there are packages for postgresql and boost, apparently there is
none for libossp or ossp
“GNU Guix provides 28,177 packages” — https://packages.guix.gnu.org/

“Search more than 100 000 packages” — https://search.nixos.org/packages

The GNU version seems… less mature.

Thanks for the pointer though.

Regards,
--
Nicolas George
Loading...