1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-28 01:18:32 +02:00
Commit Graph

72 Commits

Author SHA1 Message Date
Robert Helgesson
6e4b9af080
Switch to extended Nixpkg's lib
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
2020-01-21 20:47:04 +01:00
Robert Helgesson
f65510b1d1
home-environment: make home.activation public
Also improve documentation and add an example.
2020-01-16 00:16:35 +01:00
Robert Helgesson
7f87329fca
home-environment: use DAG type in activation option 2020-01-16 00:16:35 +01:00
Robert Helgesson
d6b36f12ff
keyboard: make the model option optional
Also, actually use it in the call to setxkbmap.
2019-09-05 01:56:14 +02:00
Robert Helgesson
824d31a21c
keyboard: make layout and variant optional
Also default these options to `null` for state version ≥ 19.09.

Fixes #811

Suggested-by: Sean Marshallsay <srm.1708@gmail.com>
2019-09-05 01:56:06 +02:00
Robert Helgesson
eb1b86a5ec
Replace use of stdenv.shell by runtimeShell 2019-08-22 08:35:06 +02:00
Robert Helgesson
b6e613c771
Fix type of various sessionVariables options
Unfortunately, using `attrsOf` is not possible since it results in too
eager evaluation. In particular, the

    home.sessionVariables = {
      FOO = "Hello";
      BAR = "${config.home.sessionVariables.FOO} World!";
    };

example will cause an infinite recursion.

This commit restores the option type of

- `home.sessionVariables`,
- `pam.sessionVariables`,
- `programs.bash.sessionVariables`, and
- `programs.zsh.sessionVariables`

to `attrs`. It also adds test cases for the above options to avoid
regressions.

Fixes #659
2019-04-27 01:07:09 +02:00
Robert Helgesson
b6e1d82685
home-environment: make home.keyboard optional
When set to `null` then the `xsession` module will not attempt to
manage the keyboard settings.
2019-04-11 01:09:27 +02:00
Robert Helgesson
13d2c470be
home-environment: use attrsOf instead of attrs 2019-04-03 00:09:55 +02:00
Robert Helgesson
70d4cf2cd9
Remove some use of mkDerivation
Instead use `runCommand`, which by default uses `stdenvNoCC` resulting
in a reduced dependency footprint.

Fixes #612
2019-03-18 23:09:54 +01:00
Robert Helgesson
a09196c4ae
docs: add language attribute to program listings 2019-03-06 18:52:54 +01:00
Robert Helgesson
ef168979bf
nixos module: support NixOS user packages install
When using the NixOS module we cannot guarantee that the Nix store
will be writable during startup. Installing the user packages through
`nix-env -i` will fail in these cases.

This commit adds a NixOS option `home-manager.useUserPackages` that,
when enabled, installs user packages through the NixOS

    users.users.<name?>.packages

option.

Note, when submodule support and external package install is enabled
then the installed packages are not available in `~/.nix-profile`. We
therefore set `home.profileDirectory` directly to the HM profile
packages.
2019-02-16 21:42:47 +01:00
Robert Helgesson
ea74820176
home-environment: add option home.extraProfileCommands
This _internal_ option indicates extra commands that should be run in
the `postBuild` step of the profile environment build.

Fixes #386
2018-09-14 21:08:51 +02:00
Robert Helgesson
99c900946d
Avoid substitution for some derivations
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
2018-07-31 21:16:36 +02:00
Malte Brandy
c18b1328a5
Parametrize path to profile directory 2018-07-31 16:04:19 +02: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
Robert Helgesson
9ea353569a
Remove deprecated option home.sessionVariableSetter 2018-02-08 22:54:29 +01:00
Robert Helgesson
1bc59f7290
allow Home Manager to be used as a NixOS module
This is a NixOS module that is intended to be imported into a NixOS
system configuration. It allows the system users to be set up directly
from the system configuration.

The actual profile switch is performed by a oneshot systemd unit per
configured user that acts much like the regular `home-manager switch`
command.

With this implementation, the NixOS module does not work properly with
the `nixos-rebuild build-vm` command. This can be solved by using the
`users.users.<name?>.packages` option to install packages but this
does not work flawlessly with certain Nixpkgs packages. In particular,
for programs using the Qt libraries.
2018-02-07 20:50:01 +01:00
Robert Helgesson
18159c85b9
home-environment: deprecate option home.sessionVariableSetter 2018-01-08 21:40:32 +01:00
Robert Helgesson
e624b9aa6a
home-environment: install hm-session-vars.sh file
This is a file containing all session variables exported using a
Bourne-compatible syntax.
2018-01-07 17:52:13 +01:00
Robert Helgesson
df6590abfc
home-environment: describe session variable values a bit 2018-01-07 16:59:22 +01:00
Robert Helgesson
33af9948e5
home-environment: describe session variable trickyness 2018-01-07 16:59:22 +01:00
Robert Helgesson
59f44c1189
home-environment: run activation script in $HOME
This avoids issues when starting the activation script somewhere
inaccessible.
2018-01-05 08:09:18 +01:00
Robert Helgesson
02219dcd79
home-environment: minor code simplification 2018-01-05 08:05:53 +01:00
Robert Helgesson
f0d207f380
Add dag library to config.lib
Also replace all imports of `dag.nix` by the entry in `config.lib`.
2017-12-26 17:27:21 +01:00
Robert Helgesson
e75b68e391
home-environment: make username and home directory writable
In certain cases it makes sense to override the target username and
home directory. In particular, if you're building a configuration for
a remote profile.
2017-12-13 16:31:35 +01:00
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