No equivalent to `nix-env --set` for `nix profile`
rycee opened this issue · comments
Is your feature request related to a problem? Please describe.
Home Manager uses nix-env --set
to manage its profile directory. We now support both nix-env
and nix profile
for this purpose but the nix profile
solution is quite unpleasant due to there seemingly is no equivalent to nix-env --set
.
See the files
HM module for the nix profile
and nix-env --set
code paths.
Describe the solution you'd like
I don't have any concrete solution in mind. I guess something like nix profile set
or nix profile replace
would be nice?
Describe alternatives you've considered
Well, the alternative would be to keep doing it with an unholy combination of nix profile list
, nix profile remove
, and nix profile install
😉
I would be open to any other solution.
A strong +1 from me on retaining this feature in nix profile
.
It's worth noting that nixos-rebuild
itself uses nix-env --set
so if nix-env
is ever going away this will have to be implemented at some point.
That said, even if not for necessity's sake there are numerous usecases for managing profiles without using nix profile
's "imperative package manager" model, from just declaratively managing your user profile (building it using buildEnv
) to managing your apache webroot.
Check out this piece of arcane magic: nix build --profile
Check out this piece of arcane magic:
nix build --profile
Could you please share more information about this usage? Using remote NixOS, I'm getting an error:
nix build --impure --store ssh-ng://huananzhi --eval-store auto .#nixosConfigurations.huananzhi.config.system.build.toplevel --profile /nix/var/nix/profiles/system --print-out-paths
/nix/store/g0a1cvjd62lr6ah28klm4s99fc22f1k5-nixos-system-huananzhi-23.05.20230506.897876e
error: '--profile' is not supported for this Nix store