# Nix package manager with Linux compatibility



## jayveesea (May 29, 2018)

I'm curious if anyone has tried (or if it would be possible) to run the Nix package manager in FreeBSD to get/install/run Linux applications in compatibility mode.


----------



## fusion809 (Sep 27, 2018)

I had the same question, must admit I'm surprised no one has answered it after all this time. I guess the answer is probably no, as while it has macOS support it may simply be incompatible with FreeBSD as the two while related, do differ significantly. I suppose if you need extra packages you should use pkgsrc (https://www.pkgsrc.org/), although to my knowledge it has half as many packages as FreeBSD's ports collection, or Ravenports (http://www.ravenports.com/), which also has fairly small repos.


----------



## drhowarddrfine (Sep 27, 2018)

> *Portability*





> Nix runs on Linux and Mac OS X.
> *NixOS*
> NixOS is a Linux distribution based on Nix.


----------



## rigoletto@ (Sep 27, 2018)

*I am not too aware of the details* but there is interest to bring NixOS like features to FreeBSD build system but:

the Nix language should be completely rewritten with a compatible license ( and others particular necessities );
someone should rewrite the FreeBSD build system, including the ports system, to work with that.
I don't believe of anyone doing that, specially in a short time, without funding. Well, I guess Marino ( the Ravenports folk ) would be able to do that as fast as possible but he is not in the project anymore...


----------



## rigoletto@ (Sep 27, 2018)

fusion809 said:


> I suppose if you need extra packages you should use pkgsrc (https://www.pkgsrc.org/), although to my knowledge it has half as many packages as FreeBSD's ports collection, or Ravenports (http://www.ravenports.com/), which also has fairly small repos.



The amount of ports is not really the most important thing. FreeBSD has 37k+ ports, a large part of it are SLAVEPORTS which means the same port with variations, so the numbers are rather _inflacted_. Also, I guess there should have at least a thousand of ports which are completely useless ( nobody use it ).

Pkgsrc seem problematic trying to support too many things/architectures ( this is why DragonFlyBSD switched to DPorts ).

Ravenports have few ports but have its variations built-in, and so it will not get inflated ( at least not too much ), but yes it has few ports; however:

it already has most of the necessary ports for server use;
the situation should improve when it hit the point it has the minimum amount of ports to DragonFlyBSD be able to switch to it ( should not take too much time ), and will not be necessary to Marino to maintain the DPorts and Ravenports ( yes, he is maintaining both almost alone ).
Cheers!


----------



## kpa (Sep 27, 2018)

FreeBSD ports has flavors which is basically the same as what many of the slave ports do, offer a variation of the main port. Unfortunately only a small portion of ports have been converted to use flavors and there is some resistance to them because portmaster (and probably portupgrade as well) for some reason can not cope with them.


----------



## rigoletto@ (Sep 27, 2018)

No! Flavors are just allowed for things like qt4-qt5, gtk2-gtk3 and similar. Transmission, for instance, cannot be flavored it should be SLAVEPORTS ( technically it can, I already FLAVORED it ) except by the qt4-qt5 version which are flavored. Just when at some point sub-packages be implemented SLAVEPORTS should be deprecated.

Also, you cannot have two different versions of the software in one port ( and install both at the same time ), like, for instance, php71 and php72 being just one port and you still be able to install both versions at the same time. You can do that with Ravenports.

*[EDIT]*

Also, even with the few number of FLAVORized ports ( in relation with the total amount of ports ) the number of packages are already _exploding_. It is not just about the building tools.


----------



## 0mp (Nov 11, 2019)

jayveesea said:


> I'm curious if anyone has tried (or if it would be possible) to run the Nix package manager in FreeBSD to get/install/run Linux applications in compatibility mode.



There is a patch pending that adds the Nix package manager to the FreeBSD ports. Some additional testing and polishing is required though: https://reviews.freebsd.org/D17766


----------



## mr123 (Feb 21, 2021)

Nix has now been added to the FreeBSD ports: https://www.freshports.org/sysutils/nix/


----------



## icodeforyou (Jun 21, 2022)

interesting, are there any news on that? Does anyone have experience with running nix on FreeBSD?


----------



## Voltaire (Sep 2, 2022)

I am also interested in this. Has anyone tested Nix on FreeBSD?
Suppose it works perfectly, then you have over 80 000 Nix packages on FreeBSD.
In that case I could install Brave or another browser that isn't in ports.


----------



## icodeforyou (Sep 3, 2022)

Voltaire I tried a little bit, but it would take a lot of effort to make it work in any meaningful way I believe. Chances are you really need to get into the details of both Nix and FreeBSD. If you are interested in experimenting, we could try looking at it together. Let me know.

As for Brave, I am running this via linux-browser-installer and it works just fine.


----------



## Voltaire (Sep 6, 2022)

icodeforyou said:


> Voltaire I tried a little bit, but it would take a lot of effort to make it work in any meaningful way I believe. Chances are you really need to get into the details of both Nix and FreeBSD. If you are interested in experimenting, we could try looking at it together. Let me know.
> 
> As for Brave, I am running this via linux-browser-installer and it works just fine.


The reason I wanted to install and learn Nix was mainly to be able to install more browsers. You solved this problem by mentioning linux-browser-installer.

I installed Brave and it is exactly 28% faster than Chromium in Speedometer 2.0. In other benchmarks like JetStream 2, Octane 2.0 and Kraken 1.1 Brave is on average 5% faster than Chromium. I find this odd because I thought native Chromium would be faster anyway, but in JavaScript the Linux version of Brave is actually faster. In terms of graphics, Chromium is also not exactly faster, or not much.

Chrome and Edge are not working properly at the moment, they both have a process that consumes around 80% of the CPU, so they have very slow performance.

Vivaldi is currently unable to install via the script, it cannot find the package. I guess I just need to make a simple change to the script for it to work. It would be helpful if you took a look at this.


----------



## icodeforyou (Sep 7, 2022)

As much as I like playing with Nix, I doubt it would have been a good solution in this case. In its present state it might need a lot of work to get something useful out of it for FreeBSD. You sadly can't expect it to just build stuff on FreeBSD that was made for Linux or macOS. Probably you would have to customize a lot of how Nix is building the individual derivations for the software you want.

However, great to know that linux-browser-installer also did the trick for you!


----------

