1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-05 02:39:45 +01:00
Commit graph

96 commits

Author SHA1 Message Date
Robert Helgesson
28e00b68fd
home-environment: optionally empty PATH in activation
This adds the option `home.emptyActivationPath` that, when enabled,
will cause the activation script to ignore the calling user's `PATH`.
The option is disabled by default to match current behavior but the
intent is to change this in the future to reduce risk of accidental
dependencies of the environment.
2017-12-11 17:03:34 +01:00
Cornelius Mika
b8ddb11796
use buildCommand for single phase builds 2017-11-06 14:24:04 +01:00
Cornelius Mika
f04cc227a6
home-environment: clean up activation script creation 2017-11-06 14:24:04 +01:00
Silvan Mosberger
0f43d5df6a
home-environment: add extraBuilderCommands option 2017-10-21 00:22:05 +02:00
Robert Helgesson
30b9d7f00e
Use only tools from Nixpkgs in activation script
Note, we still pull in the user's `PATH` in case the user has defined
their own activation blocks that depend on additional tools.
Eventually this will be deprecated and removed.

See #99.
2017-10-20 19:04:33 +02:00
Robert Helgesson
b9f49cee45
home-environment: use makeBinPath for activation PATH 2017-10-19 22:44:02 +02:00
Silvan Mosberger
3bc3b34d97
home-environment: add username and homeDirectory options 2017-10-15 17:15:16 +02:00
Silvan Mosberger
f0a1d69f50
Separate home files module from home-environment.nix 2017-10-15 17:14:32 +02:00
Robert Helgesson
c07fa70d58
home-environment: add option home.extraOutputsToInstall 2017-10-15 15:58:34 +02:00
Robert Helgesson
a8e08d14bb
Mark rycee as maintainer for a bunch of modules 2017-09-26 23:40:31 +02:00
Robert Helgesson
742d1889c5
lib: make dag.nix take lib as argument 2017-09-21 13:19:29 +02:00
Robert Helgesson
6ecf9e091c
home-environment: fail if a home.file is outside $HOME 2017-09-13 15:23:43 +02:00
Robert Helgesson
e561beab44
home-environment: include home path in generation directory
Technically not necessary but it was a bit silly to leave out this
important directory from the generation directory. This also makes it
more convenient to browse the installed packages after a
`home-manager build`.
2017-08-27 00:18:13 +02:00
Richard Yang
42f5d4404d
home-environment: use relative latest profile link
Using a relative path prevents the latest version from being garbage
collected.
2017-08-22 09:23:03 +02:00
Cornelius Mika
3dba6fc95c
home-environment: replace superfluous spaces in debug messages 2017-08-21 18:50:21 +02:00
Cornelius Mika
1eee82272a
home-environment: only notify about path deletion on verbose output 2017-08-21 18:50:21 +02:00
Cornelius Mika
da5b7bea78
home-environment: fix error when deleting empty directories
With --ignore-fail-on-non-empty, non-emptiness is the only failure
that gets ignored by rmdir. In the case that rmdir reaches $HOME and
considers deleting it, it will detect insufficient permissions and
subsequently exit with an error, even if $HOME is not empty.

Prevent this by calling rmdir with a relative path that excludes
$HOME.
2017-08-21 18:43:17 +02:00
Nikita Uvarov
cde8e02bf2
zsh: add module 2017-08-16 13:58:30 +02:00
Robert Helgesson
d807a5c314
home-environment: fix cleanup of user replaced directories
We must only follow the symbolic link once (i.e., not use the `-e`
option) since otherwise the pattern will not match when
`home.file.xyz.source` is a directory.
2017-07-22 00:38:12 +02:00
Robert Helgesson
5862a05fb1
home-environment: avoid harmless but scary error message 2017-07-22 00:18:31 +02:00
Robin Stumm
89dc8c2004
home-environment: fix home.activation.checkLinkTargets
Problem
-------

We resolve symlinks from inside `/nix/store/HASH-home-manager-files`
into the nix store as `/nix/store/HASH-DRVNAME` which does not match
the pattern.

This happened to me because I pull in some repos in via `home.file`.
The `home-manager-files` derivation links to the repo's derivation in
the nix store. For example:

    let nanorcs = fetchFromGitHub {
      owner = "scopatz";
      repo = "nanorc";
      …
    }; in [
      {
        target = ".nano";
        source = nanorcs;
      }
      {
        target = ".nanorc";
        source = "${nanorcs}/nanorc";
      }
    ]

Solution
--------

Call `readlink` without `-e` to obtain only the first redirection from
`~` to `/nix/store/HASH-home-manager-files`.
2017-07-08 00:38:57 +02:00
Robert Helgesson
8af6838869
home-environment: prevent delete of non-managed files
When a file has disappeared between the previous and the next
generations then its symlink in `$HOME` is typically deleted. With
this commit we refuse to delete the path unless we are reasonably
certain it is a symlink into a Home Manager generation.
2017-06-29 01:03:39 +02:00
Robert Helgesson
02288320d0
home-environment: use explicit PATH in activation
In the activation script we expect to use the tools provided by GNU
Core Utilities and GNU Bash. This commit therefore explicitly add
these first in the `PATH` environment variable.
2017-05-16 22:04:19 +02:00
Robert Helgesson
3ee505179f
home-environment: colorize activation output slightly 2017-05-14 16:17:38 +02:00
Robert Helgesson
a9da4575f5
home-environment: run file collision check in function 2017-05-14 14:02:11 +02:00
Robert Helgesson
88ec7145ba
home-environment: prevent overwriting existing files
This should reduce the risk of overwriting an existing file in the
user's home directory. A file will only be replaced if it is a link
pointing to a home-manager tree inside the Nix store.

If an existing file is detected an error is written indicating the
file's path and the activation will terminate before any mutation
occurs.

Fixes #6
2017-05-06 13:01:01 +02:00
Robert Helgesson
7e58b6bb35
home-environment: always link new and clean old generation
Previously the home files were not linked if the generation hadn't
changed. Unfortunately, this would mean that, if a file link was
removed for some reason it would not be recreated by running a switch
command.
2017-05-06 00:43:53 +02:00
Robert Helgesson
8fab2a5d9b
Add basic directed acyclic graph data structure
Also make use of this instead of Nixpkgs's strings-with-deps library
in activation script generation.
2017-05-04 00:39:36 +02:00
Robert Helgesson
4f1eec8180
Avoid undefined variables in activation script 2017-03-29 00:11:01 +02:00
Robert Helgesson
fea693ba16
Use stricter Bash settings in activation script
For example, with these settings Bash will complain if uninitialized
variables are used. Some code has been improved to run cleanly with
these settings.
2017-03-25 21:57:03 +01:00
Robert Helgesson
207c349825
home-environment: allow directory as home file
Fixes issue #5.
2017-03-12 22:39:51 +01:00
Robert Helgesson
ee9bc66f69
home-environment: show full file path in error
The file name alone may be misleading.
2017-02-21 21:55:07 +01:00
Robert Helgesson
a3900340e4
home-environment: check files for '.' prefix
Nix does not allow files whose name start with a '.' in the Nix store.
This commit makes a not of this fact in the `home.file.source` option
and also adds an assertion verifying that no such file is given.

Closes #4
2017-02-21 21:41:05 +01:00
Robin Stumm
fa73a7f916
home-environment: fix evaluation error on undefined lang.base 2017-02-12 10:41:15 +01:00
Robert Helgesson
ebe01057f8
home-environment: reduce verbosity 2017-02-09 22:32:09 +01:00
Robert Helgesson
6794efdf68
home-environment: add link for current profile
This link is needed to make the `delete-older-than` option for
`nix-collect-garbage` work as expected.
2017-02-05 23:00:04 +01:00
Robert Helgesson
34d472886d
home-environment: do not nix-env -i on dry run 2017-02-05 11:51:33 +01:00
Robert Helgesson
deaa6d3dd4
Add configurable verbosity during activation 2017-01-21 12:27:50 +01:00
Robert Helgesson
86217419e7
home-environment: handle no home files
If no files should be installed into the home directory then an error
would occur since the directory holding the files would never be
created. With this change the directory is unconditionally created.
2017-01-17 22:12:51 +01:00
Robert Helgesson
5221dee9ce
home-environment: use Bash to set variables
Until a few more standard variables are available to PAM it is a bit
risky to default to it.
2017-01-17 01:13:31 +01:00
Robert Helgesson
5fbbbd1ea4
pam: add module
Also make it possible to set session variables using PAM rather than
Bash.
2017-01-16 23:54:45 +01:00
Robert Helgesson
f35b9a9970
Add initial section of activation script
The initial section creates some useful variables for use by later
activation sections.
2017-01-16 20:33:53 +01:00
Robert Helgesson
b1f84ada60
Support dry run in activation script
If the `DRY_RUN` variable is set then no actual change should be
performed. Only printing what actions would be taken.
2017-01-16 00:16:22 +01:00
Robert Helgesson
071e631648
Improve a few description fields 2017-01-15 23:42:48 +01:00
Robert Helgesson
43fd747ba7
Use a generation directory
Before we put only user files in the generation directory but that was
quite limiting. In particular, we lost track of the activation script.
2017-01-15 23:41:20 +01:00
Robert Helgesson
d7d02c3ce8
Initial import 2017-01-14 13:15:24 +01:00