I have a multi-boot system with Fedora, Ubuntu and Arch Linux systems.
I setup Fedora using home-manager to build my user environment and own
programs and it works well. I have a separate partition for /nix.
This was done, among other things, to build my own Haskell packages
which can take several hours to build.
It seems I should be able to mount this /nix partition read-only on
the other OS’s and be able to access the software I build on Fedora.
On NixOS my ~/.nix-profile points to
/nix/var/nix/profiles/per-user/barry/profile. But on a home-manager
only setup it seems to be a pointer to
/home/barry/.local/state/nix/profiles/profile and has its own link
farm in my home directory.
Is there any way I can cleanly move this to something like
/nix/home-manager/barry. I though about setting my XDG_STATE_HOME
directory but it seems it might be more complicated that that.
Or is the problem that I set up home-manager using the old approach
using my own login rather than a general host server that seems to be
currently recommended? Under NixOS there still is a lot of
state kept in my home directory.
You can’t share the partition across multiple systems, because paths that are valid on one system will be invalid in another and get garbage collected.
What you’re looking for is a shared binary cache, which you can search other posts on here for some ideas (attic is a common choice).
1 Like
attic is a common choice
reporting my experience here, i’ve been using attic for about 2 years and it’s performance is pretty bad
iirc attic server is a single arbitration point for both read and write paths and i was only able get about 50mbps when it’s behind cloudflare
last weekend, i switched to niks3 with fastly and i was easily able to get pull bandwidth of low gbps (niks3 is only used for cache push and return pre signed s3 url and user push straight to storage bucket, and read path go thru cdn it doesn’t even touch the api server)
1 Like
I think my intent is unclear. I don’t tend to run any nix shells or garbage collect on any other system but Fedora. The purpose it is just to get a lot of programs that I use all the time pre-built rather than having to installl and update each of them on every boot system. My /nix partition currently uses 45G of disk space, and I don’t want to have to maintain and rebuild this on every boot system.
Nix executables should ownly have dynamic references within /nix and as long as the graphical applications work with my current xwayland or wayland server, shouldn’t things just work.
The problem should be just finding the .nix-profile/ root that was setup on Fedora. probably just some /nix/store/-profile/ directory that I can link to ~/.nix-profile and do the usual path and environment setup I do on Fedora.
Where am I wrong?
That will wipe out h-m generations on other systems. Try it, you’ll see what I mean.
1 Like
Yes. That was my concern. There seem some development In nix toward moving user setup from ~/.nix-profile to referencing /nix/var/nix/profiles/per-user/$USER/profile. Its visible in the setup scripts but seem broken in some areas. This is not used in home manager, which seem to want to put everything (at least the top level in the links) under $HOME. I guess thats implicit in its name “Home Manager”.
I am odd in that I don’t use home manager for that. I had my own way of setting up my configuration files well before I heard of Nix or Nixos. I was just using Nix, (then Home Manager) to build my own applications, so I can update them without having to do a full system update, and have their dependencies on system packages kept up to date.
This seems to be a problem that nobody else has, so I will probably just forgo using Nix in this way, as a cheap way to setup my environment on little used systems, at least until memory/ssd prices drop down to more affordable levels. I spend most of my time on NixOS anyway.
I was just hoping that there was a simple way to move its generated files (other that those in $HOME/ or $HOME/.config/) to someplace else.
Not exactly what you’re asking for, but if you’re not using the nix command on your non-Fedora, could you bind mount in ~/.local/state/nix so that links to that still end in your nix store? Then you could manually ln -s ~/.nix-profile ~/.local/state/nix/profiles/profile on your non-Fedoras
Yes. I would just have to keep the Fedora partition mounted. It just seemed very fragile if it wasn’t something that the Nix and Home Manager developers consider, and prompted me to ask about it here.