general/other Nix package manager on Freebsd with Podman

The Nix package manager can be installed on Freebsd using Podman


Code:
doas podman run -it --os linux --network host nixos/nix

Its also possible to enable flakes in the Podman container
which allows you to pin all the dependencies to a specific version for an application

Its also possible to pin applications to a specific git commit as well

You can run nix develop in the same directory as the flake.nix file
which creates a shell with all the dependencies needed to run the application

Nixos has the largest software repo on Linux

You cant use the Nix Podman container with Nvidia/Cuda
because the nvidia-libs on the Linuxulator are built with a different glib version

However a use case is creating dev environment for different languages
such as c, rust etc

Or installing applications that have a web interface like Invidious
or gui applications that arent available on Freebsd

At the moment i have enabled flakes in the container which is running as root like this this
After entering the container with the Podman run command listed above

Code:
mkdir -p /root/.config/nix
echo "experimental-features = nix-command flakes" >> /root/.config/nix/nix.conf

You have to disable the sandbox so it works with the Linuxulator syscalls

Code:
echo "sandbox = false" >> /etc/nix/nix.conf
echo "filter-syscalls = false" >> /etc/nix/nix.conf

Im just working on create Dockerfile and compose.yaml files
to run the container as a non root user

And create a flakes directory to store all the flakes files
which would be mounted from Freebsd so the flakes are stored on the Freebsd side for persistent storage

Also a working directory that would be mounted from Freebsd
into the container for file access

I should be able to enable Wayland/X11 support for gui applications
and pulseaudio/pipewire for audio

The advantage is you could have one Nix podman container
which you could use with different flakes to create reproducible dev environments

Is also easy to create a project on github with the Dockerfile and compose.yaml files
and some flake files, so you could just clone the project and be ready to go

It would also mean you wouldnt have to set up Poudrire to enable options for packages
that arent the enabled by default

Having access to all the nix packages on Freebsd
would gives us access to a lot more software

Any thoughts, feedback
Applications you would like to be able to run i could create flake file for
 
I have got the Nix package manager working in Podman container on Freebsd as a non root user

Using a Makefile to pass the uid and gid of your user on Freebsd
so the user in the Podman container is the same as on the Freebsd host

flakes directory mounted from Freebsd to the container
workspace directory mounted from Freebsd to the container for file access

Using a Podman volume for the nix store so the installed flakes persist across Podman restarts
so you dont have to rebuild them after stopping and starting the Podman container

The Cow has spoken

Code:
cowsay "Nix Flakes are working in a Podman container on Freebsd, and persist across podman restarts"

Code:
 ____________________________________
/ Nix Flakes are working in a Podman \
| container on Freebsd, and persist  |
\ across podman restarts             /
 ------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Making progress
 
Isn't that Red Hat cloud?

No its not Red Hat

Its the Nixos package manager running in a Podman container on Freebsd

What can you do with it in FreeBSD?

It makes it possible to run Nix packages on Freebsd


I have just got nix flakes working


Which you use to create reproducible environments
whose dependencies are version-pinned in a lock file
 
Euerka

nvidia-smi showing cuda

Nix package manager in a Podman container
with the Nvidia driver accessed with devfs rules

And the rocky linux nvidia libs mounted into the container
and then symlinking only the nvidia-libs into a new directory

which is appended to the LD_LIBRARY_PATH

Code:
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/nvidia'

Code:
sh-5.3$ nvidia-smi
Tue Aug  4 14:12:22 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 595.84                 Driver Version: 595.84         CUDA Version: 13.2     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1650        Off |   00000000:01:00.0 Off |                  N/A |
| N/A   56C    P8              2W /   50W |       0MiB /   4096MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+

Now ill have to use some python code with torch to see if it can see cuda

If that works then we should be on
 
Wayland working with the Nix package manager in a Podman container

Installed qt5ct with the nix shell

Code:
nix-shell -p libsForQt5.qt5ct

launched qt5ct

Code:
qt5ct

20260804_19h45m49s_grim.png
 
translatelocally

Fast and secure translation on your local machine with a GUI,
powered by marian and Bergamot.

Installed using the Nix package manager with Podman on Freebsd
with Cuda support and you can add repositories to download the models

or you can manually download models and install them

you can also use it on the command line
instead of the qt gui

Code:
[nix-shell:~]$ echo "Hello, how are you?" | translateLocally -m en-de-base

Hallo, wie geht es dir?

The same thing that Firefox uses for translation

Good alternative to translateshell which use google

Installed using the nix shell

Code:
nix-shell -p translatelocally


20260805_23h56m51s_grim.png



English

Hello my name is Napoleowils0n

wow this is very impressive
translate as i type, very cool

Im running translatelocally in a nix podman container on Freebsd
with Cuda support and its running locally without needing to connect to the internet

I can download different models to translate between different languages

This is the qt application but you can also use it on the command line

To German

Hallo, mein Name ist Napoleowils0n

wow das ist sehr beeindruckend
übersetzen, wie ich Typ, sehr cool

Im Laufen übersetzen in einem nix podman Container auf Freebsd
mit Cuda-Unterstützung und seinem Laufen vor Ort, ohne sich mit dem Internet verbinden zu müssen

Ich kann verschiedene Modelle herunterladen, um zwischen verschiedenen Sprachen zu übersetzen

Dies ist die qt-Anwendung, aber Sie können es auch auf der Kommandozeile verwenden
 
Making progress

Using config.nix to preinstall applications
needed to set dark theme for qt and gtk applications

Code:
{
  allowUnfree = true;

  packageOverrides = pkgs: with pkgs; {
    myPackages = pkgs.buildEnv {
      name = "my-packages";
      paths = [
        adwaita-icon-theme
        adwaita-qt
        adwaita-qt6
        libsForQt5.qt5ct
        qt6Packages.qt6ct
      ];
    };
  };
}

20260807_15h11m00s_grim.png
 
Back
Top