This adds a Boolean option `uninstall`. When enabled this option will
reset side-effecting configurations to their "empty" state. The intent
is that this will cause the activation script to remove all managed
files and packages.
Doing it this way should hopefully be more robust than the previous
solution. It also allows a somewhat more convenient uninstall process
when using Flakes; put `uninstall = true` in your existing
configuration and then do a switch.
Also add simple uninstall test in CI test job.
If `nix.settings.use-xdg-base-directories` is true, the
`~/.nix-profile` directory may not exist, and `home.profileDirectory`
should be checked instead.
Co-authored-by: Bruno BELANYI <bruno@belanyi.fr>
These (and the `*MD` functions apart from `literalMD`) are now no-ops
in nixpkgs and serve no purpose other than to add additional noise and
potentially mislead people into thinking unmarked DocBook documentation
will still be accepted.
Note that if backporting changes including documentation to 23.05,
the `mdDoc` calls will need to be re-added.
To reproduce this commit, run:
$ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
nix shell nixpkgs#coreutils \
-c find . -name '*.nix' \
-exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
--strip {} +
$ ./format
This process was automated by [my fork of `nix-doc-munge`]. All
conversions were automatically checked to produce the same DocBook
result when converted back, modulo minor typographical/formatting
differences on the acceptable-to-desirable spectrum.
To reproduce this commit, run:
$ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
nix shell nixpkgs#coreutils \
-c find . -name '*.nix' \
-exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
{} +
$ ./format
[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge/tree/home-manager
The NixOS variant of Markdown doesn't make a distinction between
`<code>` and `<literal>` or `<quote>` and... quotes, and doesn't
support `<parameter>` or `<replaceable>`. These are infrequently used
(apart from `<code>`) and don't add much, so just convert them to
simpler forms to allow the options containing them to be converted
to Markdown automatically.
A few minor syntactic adjustments were also made to make
`nix-doc-munge`'s job easier.
* home-environment: add `home.sessionVariablesPackage`
Allow the `hm-session-vars.sh` derivation to be referenced from other
modules, e.g. to translate it to fish with babelfish at build time.
* fish: use babelfish for `hm-session-vars.sh`
Translate `hm-session-vars.sh` to fish at system build time,
significantly decreasing shell startup time.
Based on https://github.com/NixOS/nixpkgs/pull/108947 by @kevingriffin.
The generation activation script should be run by the user specified
in `home.username` and `home.homeDirectory`. If some other user runs
the activation script, then files may end up in the wrong place or
with the wrong owner.
This commits adds a check early in the activation script that verifies
that the running user match the user in the configuration.
Fixes#4019
Specifically, if the global per-user profiles path do not exist and we
cannot create it during the activation, then place our profile in the
Home Manager data directory. We prefer to use the global location,
though, since it makes it visible to `nix-collect-garbage`.
This is intended to improve compatibility with Nix version 2.14 and
later, which no longer creates the per-user directories.
Also, use the Home Manager data directory to manage the gcroot for the
current generation. It does not have to sit in the global per-user
gcroots directory since it should never be eligible for GC.
* home-environment: use `lazyAttrsOf` for `home.sessionVariables`
`attrs` has unreasonable merge semantics and is deprecated. `attrsOf`
doesn't support variables depending on each other as is recommended in
the option's description.
* home-environment: restrict `sessionVariables` type
The consumer is `toString`, but we don't want to accept e.g. lists.
Starting with state version 22.11 we completely reset the PATH
variable in the activation script. This is to avoid impurities and
unexpected results if the activation script accidentally uses a
command found in the user's PATH.
When using the new style profiles we get conflicts when trying to
replace the old `home-path` derivation. To avoid this conflict we
delete the old `home-path` before the install.
Unfortunately, `nix profile` does not yet have a equivalent for
`nix-env --set` and we have to do this hackish workaround. See
https://github.com/NixOS/nix/issues/6349
for the associated issue in Nix.
Fixes#2848
This commits adds a file `hm-version` to the generated generation
directory. This file will contain the release version, and if
available, the Git commit hash.
If the keyboard configuration is an empty set, don't run the setxkbmap
service.
The default values for all keyboard options are null or empty so long
as the state version is set to 19.09 or higher (21.05 being the latest
version).
When profile installation fails during activation we'll print an extra
message that explain that, if the error is due to conflicting
packages, then it may be that the user has a manually installed copy
of the package.
Fixes#1244
Implements a --flake options for build and switch, along with the usual
flake related optons (for lock-files etc).
Configurations in the flake are automatically discovered in the
following order:
1. `outputs.homeConfigurations."$flake-uri"` (the `--flake parameter`)
2. `outputs.homeConfigurations."$USERNAME@$HOSTNAME"`
3. `outputs.homeConfigurations."$USERNAME"`
Make home-manager use default configuration from
~/.config/nixpkgs/flake.nix, if it exists and nothing else is
specified.
Co-authored-by: Nicolas Berbiche <nicolas@normie.dev>
Before the profile directory value would point directly to the build
output in the Nix store. Unfortunately this would cause an infinite
loop if the user's configuration directly or indirectly refers to the
profile directory value.
Fixes#1188
This change makes use of the `extend` function inside `lib` to inject
a new `hm` field containing the Home Manager library functions. This
simplifies use of the Home Manager library in the modules and reduces
the risk of accidental infinite recursion.
PR #994