Is it possible to use Nix (packages on top of another OS) if my home directory is shared between multiple machines via NFS? I will need to be able to log into different machines and work equally well.
I presume that this could be made reasonably harmless for the machines which have no Nix install at all with a simple test in .profile. I’m worried about the case when I do “nix-env -i” or “home-manager switch” on one machine and the /nix/store does not match on another machine.
i suppose you could, you can share the nix/store over nfs (single user mode nix only)…
however…there maybe dragons with that configuration.
but why would you wan’t to, it’s quite easy to install, remove packages, as they are self contained containers, in fact they are actually containers without using containers.
Diskspace is fairly cheap these days, so just ‘install’ your stuff on a remote machine rather than pull it over the network, nix/OS made it’s easy to share a configuration or nix-shell or some nix code to reproduce what you have one machine to another machine.
Use that power, rewrite your brain from ‘the difficultly and frustration of package management’ , to the Eelco way!
Once you get good, try a deployment tool to copy a flake onto a remote machine and build it, if you use
it generates a shell script so you can see how exactly how it does it…and then you can write your own deployment tool!
I should have said not to tell me to configure the machines differently. They’re already there and I don’t have control of that. I can ask nicely to install /nix and the daemon and that’s it.
I’m currently using LinuxBrew to get fresher or additional software, but Nix would be superior … if I can make it fit.
i’m sorry you don’t own your machine, or have administration rights on them, that always quite a blocker to any kind of productivity…
could you tell me more about your environment?
It’s a pretty standard corporate setup in which there are a bunch of similar build machines, all running Ubuntu, all with NFS /home (snapshots, backups, quotas, etc.) for permanent data, and all with a large local drive for ephemeral data, such as builds.
I can probably get them to install multi-user nix, with /nix located on the local drive. That would work fine for one machine, but what happens if I log into another machine?
Well, I’ve done a bit more investigation, and I find that “~/.nix-profile” is a link into /nix, so it is actually already machine-specific, and crucially that link doesn’t include any kind of hash or magic numbers, so I think nix-env might Just Work (if I explicitly install the packages I want on each machine). nix-shell too (shell.nix is probably the way to go for my use case anyway). The channel data is in /home, so I couldn’t easily have one machine on a different channel to the others, but I can probably live with that.
I think home-manager is probably a bridge to far. Flakes I don’t know enough about.
although nix-env is available, i and many others regard it as a bit of anti-pattern.
It’s takes a declarative system, and turns into an imperative system again!!
I don’t really have this problem, because the first thing i do with any system is convert it to NixOS.
however, to get you started, and if your not using NixOS yet then you on the right track. Things can get a bit hairly with collisions, inpure shells and multiple channels… .but YMWV.
I suggest you get take a look at flakes, they make a lot more sense, and can really help you with your reproduciblity problems that you are most likely having with Ubuntu.
Also, don’t rule out some paid professional nix support, there are many companies that have experience of rolling out nix in these environments.
I like NFS, but i never rely on it, because networks are unreliable and nix changes the game when it comes to ‘installing’ programs, so the need to share executables etc etc over NFS , becomes something of anti pattern, when you can just build the same environments, on a local disk, and give the network a bit of rest… (also you can still get work done when your NFS server decides to have a bad day ).
Wasn’t systemd-homed supposed to allow this? It seems to have
Not sure what happens if the network connection is cut off while you work.