Commit graph

36 commits

Author SHA1 Message Date
Robert Helgesson cda222d2ec
home-manager: present news even if assertion failed 2017-09-09 17:14:07 +02:00
Robert Helgesson ad1eee7aa5
home-manager: minor news build cleanups
- Rename the build function.

- Specify the built attribute in the build function.

- Make the news build silent.
2017-09-06 23:44:58 +02:00
Robert Helgesson 9c1b3735b4
home-manager: add news sub-command
This command allows the user to examine the news items generated by
the news module. See #52.

Many thanks to @nonsequitur and @uvNikita for suggestions and
improvements.
2017-09-05 11:37:07 +02:00
Robert Helgesson 39fc16954b
home-manager: make sure switch generation is GC root
Using `--no-out-link` is convenient but it does not set up a GC root,
so an unfortunately timed GC could remove the generation before
activation completes. Many thanks to @nonsequitur for noting this
problem.
2017-09-04 22:19:56 +02:00
Robert Helgesson 6611c16099
home-manager: print errors to stderr 2017-09-01 10:24:01 +02:00
Nikita Uvarov 5eff7f38df
home-manager: remove escaping
The Nix code that was extracted to its own file erroneously included
escaping of "${".
2017-08-28 17:56:56 +02:00
Robert Helgesson e9ca4305a6
home-manager: move Nix code to own file 2017-08-28 11:37:34 +02:00
Robert Helgesson b4fff6b9b7
home-manager: minor attribute rename
The "activation-script" attribute doesn't actually point directly at
the activation script. Renamed the attribute to be more descriptive.
2017-08-27 13:04:39 +02:00
Robert Helgesson 2245b0ac94
home-manager: simplify use of nix-build output
There is no need to specify an out link when switching to a new
generation since nix-build prints the store path on standard output.
Similarly, when just building a generation we specify no out link
since nix-build will use "result" by default.
2017-08-27 12:55:30 +02:00
Cornelius Mika 02a501705a
home-manager: show full script path on activation error
Run the activation script in its original nix-store location so that
Bash error messages show the real script location instead of 'wrkdir',
which gets deleted right after the script exits.
2017-08-20 09:50:42 +02:00
Cornelius Mika a9d9fb5d75
home-manager: exit with an error on build failure
Because 'set -e' has no effect on commands that run in an if condition,
the script was always exiting with no error when 'doBuild' failed.

As a bonus, $wrkdir is now always removed after building.
2017-08-20 09:50:37 +02:00
Cornelius Mika ffbc7e723d
home-manager: add config file attribute 2017-08-18 21:37:07 +02:00
Robert Helgesson 28d3f74614
home-manager: allow a user-defined third module path
The user-defined path will be used if present, otherwise the two
"fallback" defaults (in `.nixpkgs` and `.config/nixpkgs`) will be
used.
2017-07-11 20:53:42 +02:00
Robert Helgesson 98c7b23178
home-manager: remove unnecessary variable setting
The `NIX_PATH` variable is set by the `setHomeManagerModulesPath`
function so it is unnecessary to set it again.
2017-07-11 19:48:49 +02:00
Robert Helgesson 0aa549f07b
home-manager: support .config configuration path
This commit changes the default path of the Home Manager configuration
file from `~/.nixpkgs/home.nix` to `~/.config/nixpkgs/home.nix`. The
old path is still supported and will be used if the `.config` path
does not exist.

This aligns Home Manager with the preferred configuration directory in
NixOS 17.03.

Fixes #13.
2017-06-03 00:42:37 +02:00
Robert Helgesson 67391395ef
home-manager: use NIX_PATH to locate modules
This removes the old argument based method that Home Manager used to
find its modules by a `NIX_PATH` based method. Specifically, this adds
a `home-manager` Nix path prefix that can be overridden much like with
the `nixpkgs` path prefix.
2017-06-03 00:42:37 +02:00
Christopher League 1a491f24f7
home-manager: add coreutils to PATH
This ensures that we use the expected version of some useful tools,
such as readlink.
2017-05-16 22:04:58 +02:00
Robert Helgesson 870d1d484d
home-manager: use strict Bash evaluation
In particular, this will ensure that the whole script fails with an
error code if the activation script fails during a switch. Fixes #10.
2017-05-14 14:02:15 +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 d2e8c57bd5
home-manager: Use --show-trace only when verbose 2017-02-21 21:49:12 +01:00
Robert Helgesson ed9464258a
home-manager: add command line option -I
This options is passed on to nix-build and allows, for example, building
a user environment using a custom Nixpkgs.
2017-02-14 18:25:30 +01:00
Robert Helgesson deaa6d3dd4
Add configurable verbosity during activation 2017-01-21 12:27:50 +01:00
Robert Helgesson 8ce389ce2a
home-manager: handle missing configuration file
Make it look a little nicer than having nix-build emit the error.
2017-01-16 00:16:22 +01:00
Robert Helgesson a5c8362f7b
home-manager: improve command line option handling 2017-01-16 00:16:19 +01:00
Robert Helgesson e0fd58709c
home-manager: improve error checking a bit 2017-01-15 23:42:48 +01:00
Robert Helgesson e0a37be515
home-manager: check output path
In particular, error out if the output path already exists.
2017-01-15 23:42:47 +01:00
Robert Helgesson 8d774ec628
home-manager: clean up usage help 2017-01-15 23:42:47 +01:00
Robert Helgesson bd951cda66
home-manager: rename rebuild to switch 2017-01-15 23:42:46 +01:00
Robert Helgesson 94fd39c41c
home-manager: add build command
This will build a configuration into an `result` output directory. Does
not create a new generation.
2017-01-15 23:42:46 +01:00
Robert Helgesson cbc4188b68
home-manager: improve robustness
With this commit the activation script is run only if nix-build
succeeded.
2017-01-15 23:42:03 +01:00
Robert Helgesson e4723b51cd
home-manager: make modules path more configurable 2017-01-15 23:41:39 +01:00
Robert Helgesson 37831674e2
home-manager: minor Bash code fixes 2017-01-15 23:41:34 +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 671805009c
home-manager: use absolute path to configuration
Nix needs an absolute path and the user may have given a relative path
for the configuration file. We therefore need to expand it using the
`realpath` tool.
2017-01-15 23:40:31 +01:00
Robert Helgesson a1cb111cc3
home-manager: handle missing home-manager-path
When listing packages we have to handle the case where the rebuild
command has not yet been run.
2017-01-15 23:40:22 +01:00
Robert Helgesson d7d02c3ce8
Initial import 2017-01-14 13:15:24 +01:00