Open I-Want-ToBelieve opened 1 year ago
Is it possible to mount these paths as read-only?
This seems to allow archlinux to read and execute programs in nixos-specific paths. Since archlinux does not have write permissions on these paths, it will not affect nixos.
Another option is to explore the possibility of home-manager being compatible with distrobox.
One form is that home-manager does not use distro-dependent paths, for example /etc/profiles/per-user/i.want.to.believe/bin/starship
can be directly replaced by starship
.
Another form is to install nix in archlinux and also use home-manager to manage the home directory. Put nixos' flake config into archlinux and build it to generate a path similar to nixos. This can be called isomorphism
The last way I can think of is for distrobox to provide an option whether to integrate nixos home into archlinux
I think it probably is easier to just source certain things in your ~/.profile or ~/.bashrc or ~/.zshrc only if NOT in the container
For example:
if [ ! -e /run/.toolboxenv ]; then
do_my_awesome_stuff_on_host
else
do_other_stuff_in_container
fi
This way you only source stuff when needed
I mean the issue at hand is that the host's PATH and probably a few other environment variables are reused inside the container created by distrobox. I don't think you'd want that regardless of what distribution you're using distrobox on. Docker and podman don't reuse the environment by default, so why do these environment variables end up in the container?
This is more about the problem that the configuration files(dotfiles) in the home directory use hard-coded host paths and these paths do not exist in the container. It should not be related to the issue of environment variables.
NixOS is not fhs
Imagine if you use an ArchLinux container on a host running Ubuntu, then when the container is created, since the container reuses the host's home directory, and some software in the configuration files in the home directory does not exist in the container, command not found
will be reported, but this is easy to solve. I only need to install these missing software in the ArchLinux container, but this does not work in NixOS. The path of NixOS is not /usr/bin but Special /nix/store and /etc/profiles/per-user
I thought of another way, what if the host's home directory is used as the lowerdir in overlayfs and the one to be used by the distrobox is used as the upperdir?
This is more about the problem that the configuration files(dotfiles) in the home directory use hard-coded host paths
You're right. The ticket's description is different from my issue. Please disregard.
I have encountered this problem as well. As an immutable distribution, NixOS greatly needs Distrobox. Immutable distributions are becoming increasingly popular.
This question currently have solution or not? Can through not mounting/home directory temporarily solve it?
The idea of distrobox is to integrate the host's home directory into the container system, but the configuration files in the NixOS home directory have many paths to /nix/store/ and /etc/profiles/per-user/, and these paths are not included in the container. It does not exist. If these paths are mounted into the container, there will be bigger problems. Is there any solution to get rid of this dilemma?