Commit graph

329 commits

Author SHA1 Message Date
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 910cdc0537
zsh: use .zshenv for env vars 2017-08-21 18:00:58 +02:00
Nikita Uvarov 3ef56576d3
oh-my-zsh: add module 2017-08-16 15:44:27 +02:00
Nikita Uvarov cde8e02bf2
zsh: add module 2017-08-16 13:58:30 +02:00
Silvan Mosberger 1d24e96074
htop: use types.coercedTo 2017-08-02 22:22:54 +02:00
Robert Helgesson be432c8654
ssh: add control persist option 2017-07-29 17:47:18 +02:00
Silvan Mosberger 3778a69fbe
htop: add module 2017-07-24 11:42:45 +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
Robert Helgesson dba14bfe90
manual: fix man pages build on unstable NixOS 2017-07-21 21:10:32 +02:00
Robert Helgesson 2e257f40e6
home-manager: remove manually installed home-manager
If the `home-manager` module is enabled then check if the
`home-manager` package is installed using `nix-env -i` and if so then
it is automatically uninstalled before the new package environment,
which includes home-manager, is installed.
2017-07-19 00:12:34 +02:00
Robert Helgesson cdb2bec909
syncthing: expand service description
This models the user service on the upstream systemd file.
2017-07-18 13:49:02 +02:00
Utku Demir dd5061d73b
Add syncthing service 2017-07-18 12:50:30 +02:00
Robert Helgesson 7a18a0fb34
home-manager: add module
This module is a module to install and configure the home-manager
tool. By managing the home-manager tool through the Home Manager
module system it will be installed/updated on configuration
activation.
2017-07-11 20:53:42 +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
Robin Stumm e274fc732b browserpass: add module (#16)
* browserpass: add module

* apply some review requests

* browserpass: update to 1.0.5

* browserpass: install from Nixpkgs using `home.file`
2017-06-30 22:45:09 +02:00
Robert Helgesson 196db18f5b
gpg-agent: use systemd socket activation 2017-06-29 23:33:28 +02:00
Robert Helgesson acf813cadc
systemd: add support for socket units 2017-06-29 01:06:08 +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 4c85ff7ff2
xsession: rename graphical session target name
The `he` in `he-graphical-session` doesn't make much sense, change it
to `hm` for Home Manager.
2017-06-29 00:24:29 +02:00
Robert Helgesson 9c17c5ccbb
Clean up systemd units for all graphical services 2017-06-26 18:42:27 +02:00
Robert Helgesson acf8d4e985
xsession: use systemd graphical targets
The systemd targets don't allow direct startup so we create our own
target for graphical sessions managed by Home Environment.
2017-06-26 18:31:55 +02:00
Robert Helgesson a9343d8194
udiskie: remove taffybar requirement
It should be sufficient to have a graphical session going.
2017-06-26 16:59:11 +02:00
Robert Helgesson 8b5d19e6b7
random-background: actually use image directory option 2017-06-25 22:25:36 +02:00
Christopher League ff65781b84
info: add module
This is a module for managing the GNU info directory for the user
profile. See comments at the top of `modules/programs/info.nix` for
further information.
2017-05-26 00:44:55 +02:00
Robert Helgesson f60a1ed689
systemd: handle non-Linux systems better
This commit causes an error to be printed if running under a non-Linux
system when a systemd service, target, or timer is active.

It will also prevent running systemd during activation if running
under a non-Linux system.
2017-05-16 22:05:02 +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 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
Robert Helgesson a9da4575f5
home-environment: run file collision check in function 2017-05-14 14:02:11 +02:00
Robert Helgesson ecf7d91d8b
ssh: use types.str instead of types.string
The `types.string` type is deprecated due to its surprising behavior.
2017-05-13 12:23:59 +02:00
Robert Helgesson 961722c3a8
ssh: add proxy command option 2017-05-13 12:08:09 +02:00
Christopher League bce262e46e
ssh: add programs.ssh module
This module generates a `.ssh/config` file. This doesn't embed _all_
options for the ssh client, but the most common ones should be there.

Example usage:

```nix
  programs.ssh = {
    enable = true;
    forwardAgent = true;
    controlMaster = "auto";
    matchBlocks = [
      {
        host = "something.blah.edu";
        port = 1024;
        user = "cleague";
        identitiesOnly = true;
      }
      {
        host = "host1 host2 host2.net host2.com";
        port = 7422;
        hostname = "example.com";
        serverAliveInterval = 60;
      }
      {
        host = "lucian";
        forwardX11 = true;
        forwardX11Trusted = true;
        checkHostIP = false;
      };
    };
  };
```

Each entry in `programs.ssh.matchBlocks` must contain a `host` field,
which will be used for the block condition.
2017-05-13 11:41:38 +02:00
Robert Helgesson e8fb9f50ce
gnome-terminal: use attrsOf rather than loaOf
Since the attribute names carry semantic meaning we should be more
strict about the type.
2017-05-10 00:20:15 +02:00
Robert Helgesson 3c69c7589a
xsession: make windowManager option required
Also add a fairly complicated example.
2017-05-06 13:01:07 +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
Robert Helgesson beba608705
Add support for assertions and warnings 2017-02-21 21:39:53 +01:00
Robin Stumm fa73a7f916
home-environment: fix evaluation error on undefined lang.base 2017-02-12 10:41:15 +01:00
Robert Helgesson 5d49ea6d49
git: remove default signing key
It is mandatory for a user to set the signing key so it does not make
sense to set a default.
2017-02-12 10:02:06 +01:00
Robin Stumm 386d2dbd25
git: fix evaluation error on null extraConfig 2017-02-11 23:35:36 +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 119c7b2538
gnome-terminal: load configuration at right time
If the dconf service hasn't been installed then the configuration
activation will fail. Thus, make sure the activation script is run after
packages have been installed.
2017-02-05 12:01:49 +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 11ef3873cd
xsession: always source ~/.profile
It seems to be pretty standard to do this so always do it, not just when
Bash is the session variable setter.
2017-01-28 18:29:27 +01:00
Robert Helgesson 10031e16bf
gnome-terminal: rename activation command 2017-01-21 13:33:07 +01:00
Robert Helgesson deaa6d3dd4
Add configurable verbosity during activation 2017-01-21 12:27:50 +01:00
Robert Helgesson 64d6a66324
redshift: add module
This module is adapted from the Nixpkgs version.
2017-01-20 19:26:52 +01:00
Robert Helgesson 35e0a339f8
dunst: support dbus activation 2017-01-20 00:20:25 +01:00
Robert Helgesson 550d0e81c9
systemd: handle missing service directories
Before it suggested to restart a service `*.service`, which is quite
silly.
2017-01-18 09:27:28 +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 d7a70c87cd
gtk: fix bug in condition 2017-01-17 18:16:45 +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 30e30688b8
gtk: add module
Quite rough around the edges, though.
2017-01-17 00:50:18 +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 ed81b6848e
manual: add module
This module is capable of producing a bastardized NixOS configuration
manual with Home Manager configuration options instead.
2017-01-15 23:42:48 +01:00
Robert Helgesson 071e631648
Improve a few description fields 2017-01-15 23:42:48 +01:00
Robert Helgesson 6ec3026e51
xsession: improve initialization script
This adds a `graphical-session-pre` target for things that need to run
just before the main session starts. Also adds a loop during shutdown
that waits until all deactivating units are gone. Inspired by
<https://youtu.be/hq18daxTkLA>.
2017-01-15 23:42:48 +01:00
Robert Helgesson 75bb0c8efb
gpg-agent: remove deprecated argument 2017-01-15 23:42:47 +01:00
Robert Helgesson d02f8b17ef
xresources: add newline to end of file 2017-01-15 23:42:47 +01:00
Robert Helgesson 3d3a3f6d13
xresources: add module
This module adds basic support for configuring X resources.
2017-01-15 23:42:47 +01:00
Robert Helgesson 5cb1ede034
firefox: add module 2017-01-15 23:42:46 +01:00
Robert Helgesson a617aeaa73
gnome-terminal: add to packages 2017-01-15 23:42:03 +01:00
Robert Helgesson 4efbf0e090
systemd: minor activation output fix 2017-01-15 23:42:03 +01:00
Robert Helgesson a578ea9527
xsession: import XAUTHORITY into systemd env 2017-01-15 23:42:03 +01:00
Robert Helgesson 8a196bb62b
systemd: fix quoting in glob pattern 2017-01-15 23:42:02 +01:00
Robert Helgesson dd0e71d686
Rename xorg.target to graphical-session.target
Also make sure graphical-session.target is generated.
2017-01-15 23:41:53 +01:00
Robert Helgesson 06a24c37e5
systemd: add support for creating target files 2017-01-15 23:41:52 +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