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>
This makes Home Manager respect the NO_COLOR environment variable to
disable coloring from output generated by Home Manager.
This initiative can be found more on https://no-color.org/
The quoted `$EDITOR` causes errors when using values containing
arguments, eg. "code --wait". This is in contrast to the majority of
tools (git, etc.) that do support this usage.
Fixes#1496
This option used to make the `home-manager` command use the `nix` tool
from Nix 2. Unfortunately the `nix` tool is a bit experimental and it
is best to await its stabilization before supporting it in Home
Manager.
It can be useful to simply instantiate a Home Manager configuration
without actually building it, for example for the purpose of
pre-building it with some custom command.
PR #1099
Presently, if you pass an argument with spaces in it to `doBuildAttr`,
it will be split it into multiple arguments to `nix build` or
`nix-build`. This situation arises, for example, on systems with
spaces in `XDG_DATA_HOME`.
Specifically, the `home-manager` script errors out in trying to
address the `read-news` state file. With this change, argument
separation should be preserved properly in `doBuildAttr`.
PR #1044
This forces the `home.file` option to be completely empty when
switching to the uninstall configuration. This is necessary to guard
against files are added by default in Home Manager, such as
`$XDG_CACHE_HOME/.keep`.
This sets the state version in recent installs to the latest released
version. It is beneficial for people to be aware of this option and it
is also good to help new users get a more recent setup.
This commit adds a "build" command to the install derivation that
tells the user that `nix-shell` should be used.
A derivation attribute `shellHookOnly = true` is also added with the
intent to indicate that the shell hook is the entire point of the
derivation.
This rewrite allows "long options" but unfortunately does not allow
merged options such as `-vn`.
Also improve the home-manager manual page, with this it should include
all sub-commands and arguments.
Finally, include the home-manager manual page in the generated HTML
documentation.
When a configuration file would be written to an existing file, rather
than failing switch (and having the user have to move or delete those
files), move the files automatically to a new path.
Closes#585
With this change, running
home-manager edit
opens `$HOME_MANAGER_CONFIG` in `$EDITOR`.
This is mainly for convenience. Users should not have to remember the
exact location of the Home Manager configuration.
This avoids the uncontrollable nature of fetching the tarball as part
of the evaluation. Instead the user can decide when to update and also
perform rollbacks, if necessary.
This adds a new command to the home-manager shell script that allows
generations to be removed that are older than an given absolute or
relative date.
This allows users to manage the expiration of their home-manager
generations separately from their system or user profiles via
nix-collect-garbage. It is most important if the user desires to have
a convenient way to have different expiration times for Home Manager
generations than other system or user profiles.
In particular, don't bother attempting to do substitution of the home
files and home generation derivations since these rarely, if ever,
could be substituted.
Fixes#330
It was previously possible to create the news information and lose it
in a Nix GC before being able to view it. This also causes a switch to
error out. This change makes the news information a root in the
garbage collector.
Note, this change also removes the need for `nix eval` so the
`doBuildAttr` function is simplified accordingly.
Fixes#327
Home Manager needs an absolute and resolved path to its configuration
file. The default configuration path is absolute but not necessarily
resolved. For example, some users may have `~/.config` be a symbolic
link to somewhere else. We therefore run the default configuration
path through the `realpath` tool to resolve it.
Fixes#304
This adds an experimantal, undocumented, and unsupported flag `-2` for
the `home-manager` command that enables the use of the new `nix`
command instead of `nix-build`.