Open drupol opened 6 months ago
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/convert-nixos-configuration-into-an-image/15576/6
Today I made another attempt with this:
And when I try to run the activate
script in the container:
admin@73baae165978 ~> /nix/store/whl6bybnbyfmdd2lxxbf44h4fs8fp2yd-home-manager-generation/activate
Starting Home Manager activation
warning: '/nix/var/nix' does not exist, so Nix will use '/home/admin/.local/share/nix/root' as a chroot store
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
installing 'home-manager-path'
don't know how to build these paths:
/nix/store/shszch1r8skskjf8qxk4lga4qlyh7p54-home-manager-path
error: path '/nix/store/shszch1r8skskjf8qxk4lga4qlyh7p54-home-manager-path' does not exist and cannot be created
Oops, Nix failed to install your new Home Manager profile!
Perhaps there is a conflict with a package that was installed using
"nix-env -i"? Try running
nix-env -q
and if there is a conflicting package you can remove it with
nix-env -e {package name}
Then try activating your Home Manager configuration again.
admin@73baae165978 ~ [1]>
Then I found this thread, thinking that nix-env
might be the issue: https://discourse.nixos.org/t/make-home-manager-not-use-nix-env-i-for-packages/18016
I also tried it, without luck.
I'm honestly running out of ideas, and curious to know/learn why it is simply not possible to install in a container.
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
@drupol I believe you can find an example that covers the case you describe in https://github.com/cameronraysmith/nixpod. There, images are built on a modified version of https://github.com/NixOS/nix/blob/2.23.3/docker.nix that supports adding multiple users. These images include the s6 init system but do not yet use it to manage the nix daemon.
In particular, a home-manager configuration is activated in each of the images where /activate
is executed (e.g. https://github.com/cameronraysmith/nixpod/blob/v0.4.10/flake.nix#L354). Please feel free to submit an issue there if there is a better proposal for doing this.
Also note that example should not be used in any security-sensitive context. Indeed, it represents the epitome of insecurity.
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Hello,
I'm looking for a way to install a Home Manager profile in an OCI container built with Nix. So far, none of the stuff I tried are working. Here's my
flake.nix
, where I stripped out all the irrelevant part:To build it:
nix build .#oci-nix-shell
./result | docker load
nix run -it oci-nix-shell:latest
Here's the full log:
I don't know if the method I'm using to build such an OCI container is the best method, feel free to suggest better method to do so.