Commit graph

8 commits

Author SHA1 Message Date
Robert Helgesson de0070c4cf
files: add preliminary support for full paths
This represents the first step in migrating `home.file` to support
arbitrary absolute paths. This is to allow Home Manager to manage
files anywhere, provided the user has sufficient privileges.

For example, with this change the configuration

    home.file."test/one".text = "foo";
    home.file."/test/two".text = "foo";

will result in the files "$HOME/test/one" and "/test/two",
respectively. Note, a relative file name will still be relative
`$HOME`.

To allow a reasonable transition between the old and new path handling
we introduce the notion of "generation directory layout version". The
version is simply a file `version` within the generation directory
containing a number indicating the version number.

The version 0 (also implied if the version file is missing) indicates
the legacy layout where managed file paths always are relative
`$HOME`.

Version 1 indicates the new layout where managed file paths are
relative `/`.
2021-07-27 23:42:51 +02:00
Dmitry Kalinkin dc227b579d
home-manager: respect NIX_STATE_DIR
This allows to install home-manager on a system without root access.

PR #1196
2020-06-14 20:41:55 +02:00
Robert Helgesson dcbe0f2a31
home-manager: add activation sanity check of Nix
This adds an empty `nix-build` command to verify that the user is
having a good Nix install. It also, as a side effect, will create the
necessary per-user `profiles` and `gcroots` directories.

Fixes #1246
2020-05-20 22:32:35 +02:00
Robert Helgesson 9ec9f004e1
home-manager: use nix-env to list generations
Using the `nix-env` command is far more robust. It also has the
benefit that if the per-user `profiles` and `gcroots` directories do
not exist then they will be created with the correct permissions.

Because of the second point this commit also removes the `mkdir` step
of the installation instructions.

PR #1239
Closes #474, #948, #1091
2020-05-16 19:17:13 +02:00
Robert Helgesson 567b21b1d6
activation-init: sanity check oldGenNum and oldGenPath
Something is terribly wrong if one is set but not the other so error
out with a message if that happens.
2018-03-13 20:49:45 +01:00
Robert Helgesson 19b4002f25
home-environment: use nix-env from PATH
It is safest to use the system install of Nix since that will be
compatible with the running nix-daemon and/or databases.

Also add a printout of the used Nix version in the activation script
when running in verbose mode.

Fixes #218.
2018-02-27 20:31:03 +01:00
Cornelius Mika 5c098dc7ad
lib-bash: always print message announcing a dry run 2017-08-21 18:50:21 +02:00
Robert Helgesson 3ee505179f
home-environment: colorize activation output slightly 2017-05-14 16:17:38 +02:00
Renamed from modules/activation-init.sh (Browse further)