Default user nix-profile on multi-user Ubuntu desktop

Hi,

I have a multi-user Ubuntu desktop and I’m thinking about using nix for some packages. How can I install system-wide packages on Ubuntu with nix ? I would like some applications to be available for all users (ideally without requiring users to nix-env -i <___>).

I think this is tantamount to making a default nix-profile for all users.

As far as I remember everything that is installed for root will be available in all users local profiles.

Still, You should try to avoid imperative package installation through nix-env but instead use a declarative approach.

Thanks, it works, I was confused by the Cheatsheet (2nd line).

I installed nix in multi-user mode and then did

sudo su && export PATH=/nix/var/nix/profiles/default/bin:$PATH

Then, I could install some packages in the default profile.

All users have the default profile in their environment throught

NIX_PROFILES=/nix/var/nix/profiles/default /home/myuser/.nix-profile
PATH=/home/myuser/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

You should try to avoid imperative package installation through nix-env but instead use a declarative approach.

I would love to. Can you point me to the relevant documentation ?

Did you ever find a solution for this?

I’m using nixos on one system, which is obviously well integrated, but also want to “replicate” on my Manjaro Linux install the combination of home-manager and a global configuration.nix (in that case only a kind of globally declared environment.systemPackages I guess?).

In other words, that would mean the question becomes: “how to define a global package env on a non-nixos multi user linux?”, or more specifically, can we use a certain file that takes the role of a partial configuration.nix and then something like sudo nix-... switch to apply the packages defined there to /nix/var/nix/profiles/default/?