1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-01 04:23:34 +02:00
home-manager/docs/release-notes/rl-2405.md
Robert Helgesson 72fc28f1e0
WIP home-manager: avoid profile management during activation
This commit deprecates profile management from the activation script.
The profile management is instead the responsibility of the driving
software, for example, the `home-manager` tool in the case of
standalone installs.

The legacy behavior is still available for backwards compatibility but
may be removed in the future.

The new behavior resolves (or moves us closer to resolving) a number
of long standing open issues:

- `home-manager switch --rollback`, which performs a rollback to the
  previous Home Manager generation before activating. While it was
  previously possible to accomplish this by activating an old
  generation, it did always create a new profile generation.

  This option has been implemented as part of this commit.

- `home-manager switch --test`, which activates the configuration but
  does not create a new profile generation.

  This option has _not_ been implemented here since it relies on the
  current configuration being activated on login, which we do not
  currently do.

- When using the "Home Manager as a NixOS module" installation method
  we previously created an odd `home-manager` per-user "shadow
  profile" for the user. This is no longer necessary.

  This has been implemented as part of this commit.

Fixes #3450
2024-02-20 20:58:55 +01:00

117 lines
4.2 KiB
Markdown

# Release 24.05 {#sec-release-24.05}
This is the current unstable branch and the information in this section
is therefore not final.
## Highlights {#sec-release-24.05-highlights}
This release has the following notable changes:
- The `.release` file in the Home Manager project root has been
removed. Please use the `release.json` file instead.
- The {command}`home-manager uninstall` command has been reworked to,
hopefully, be more robust. The new implementation makes use of a new
Boolean configuration option [uninstall](#opt-uninstall) that can
also be used in a pure Nix Flake setup.
Specifically, if you are using a Flake only installation, then you
can clean up a Home Manager installation by adding
``` nix
uninstall = true;
```
to your existing configuration and then build and activate. This
will override any other configuration and cause, for example, the
removal of all managed files.
Please be very careful when enabling this option since activating
the built configuration will not only remove the managed files but
_all_ Home Manager state from your user environment. This includes
removing all your historic Home Manager generations!
- The use of `$DRY_RUN_CMD` and `$DRY_RUN_NULL` in activation script
blocks is now deprecated. Instead use the new shell function
{command}`run`. In most cases it is sufficient to replace
`$DRY_RUN_CMD` by {command}`run`. For example, if your configuration
currently contains
```nix
home.activation.reportChanges = config.lib.dag.entryAnywhere ''
if [[ -v oldGenPath ]]; then
$DRY_RUN_CMD nix store diff-closures $oldGenPath $newGenPath
fi
'';
```
then you are now encouraged to change to
```nix
home.activation.reportChanges = config.lib.dag.entryAnywhere ''
if [[ -v oldGenPath ]]; then
run nix store diff-closures $oldGenPath $newGenPath
fi
'';
```
See the description of [home.activation](#opt-home.activation) for
more. The deprecated variables will continue to work for now but
their use may in the future trigger a warning message and eventually
they may be removed entirely.
- Similarly, the use of `$VERBOSE_ECHO` in activation script blocks is
deprecated. Instead use the new shell function
{command}`verboseEcho`. That is,
```nix
home.activation.doThing = config.lib.dag.entryAnywhere ''
$VERBOSE_ECHO "Doing the thing"
''
```
should now be expressed
```nix
home.activation.doThing = config.lib.dag.entryAnywhere ''
verboseEcho "Doing the thing"
''
```
See the description of [home.activation](#opt-home.activation) for
more. The deprecated variable will continue to work for now but its
use may in the future trigger a warning message and eventually it
may be removed entirely.
- The `home-manager` Nix profile update that the Home Manager
activation script has previously performed is now deprecated. The
profile update is instead the responsibility of the software calling
the activation script, such as the `home-manager` tool..
The legacy behavior is the default for backwards compatibility but
may be emit a deprecation warning in the future, for eventual
removal. If you have developed tooling that directly call the
generated activation script, then you are encouraged to adapt to the
new behavior. See [Activation](#sec-internals-activation) for
details on how to call the activation script.
- The `home-manager switch` command now offers a `--rollback` option.
When given, the switch performs a rollback to the Home Manager
generation prior to the current before activating. While it was
previously possible to accomplish this by manually activating an old
generation, it always created a new profile generation. The new
behavior mirrors the behavior of `nixos-rebuild switch --rollback`.
See the [Rollbacks](#sec-usage-rollbacks) section for more.
- When using Home Manager as a NixOS or nix-darwin module we
previously created an unnecessary `home-manager` per-user "shadow
profile" for the user. This no longer happens.
## State Version Changes {#sec-release-24.05-state-version-changes}
The state version in this release includes the changes below. These
changes are only active if the `home.stateVersion` option is set to
\"24.05\" or later.
- Nothing, yet.