Commit graph

17 commits

Author SHA1 Message Date
Robert Helgesson 1b8bf5c327
home-manager: avoid stray error message
Failure to create the global profiles directory is not actually an
error since we can recover. Therefore, avoid printing the mkdir error
message.
2023-03-19 23:32:23 +01:00
Robert Helgesson f69816489d
home-manager: handle missing per-user profiles directory
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.
2023-03-07 23:53:06 +01:00
Naïm Favier d6b1d42682
activation-init.sh: remove shebang, execute bit
This is not a standalone script, it's only meant to be included from the
activation script.
2023-02-07 21:47:19 +01:00
Robert Helgesson 8eaa3ba56e
lib/bash: remove unused Bash library files
The color echo functions are provided by `lib/bash/home-manager.sh`.
2022-10-13 11:56:46 +02:00
Moises Nessim 2f58d0a3de
nix: add support for nix profile
PR #2833

Co-authored-by: David Arnold <dar@xoe.solutions>
Co-authored-by: Florian Franzen <Florian.Franzen@gmail.com>
2022-03-26 15:11:28 +01:00
Robert Helgesson 8e7a10602d
treewide: make a few more strings translatable 2022-01-02 11:56:52 +01:00
Robert Helgesson 9bcad20013
home-manager: add basic i18n support
The support for translated strings is, for now, limited to strings
generated in Bash code.
2021-12-13 21:47:28 +01:00
Robert Helgesson ae8cb242f2
home-environment: use declare -gr in activation init
This marks the setup variables as read-only. Just to add a bit extra
safety.
2021-07-27 23:50:33 +02:00
Teo Ljungberg 69e2693342
home-manager: respect NO_COLOR environment variable
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/
2021-03-03 23:28:06 +01: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 8c7811a213
Credit original source for shell color code 2017-05-14 20:35:13 +02:00
Robert Helgesson 3ee505179f
home-environment: colorize activation output slightly 2017-05-14 16:17:38 +02:00