How to copy nix profile

Can I copy a Nix user profile or configuration to other users or hosts?

I mean, let's say I installed the package using nix-env -i. How can I copy this environment and use it somewhere else? The same question for configuring NixOs. I can create a new configuration by changing /etc/nixos/configurtion.nix. But what if I added some package using nix-env -i. Can I create a configuration (or its equivalent) that matches this new environment?

+4
source share
2 answers

In general, you should use configuration.nixto have a declarative configuration that you can migrate.

nix-env -q.

nix-copy-closure --help, ~/.nix-profile.

+2

All Articles