about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/system/boot/systemd/homed.nix
blob: b216820c0c0cdd68166c37184337a8ffca749282 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ config, lib, pkgs, ... }:

let
  cfg = config.services.homed;
in
{
  options.services.homed.enable = lib.mkEnableOption (lib.mdDoc ''
    systemd home area/user account manager
  '');

  config = lib.mkIf cfg.enable {
    assertions = [
      {
        assertion = config.services.nscd.enable;
        message = "systemd-homed requires the use of systemd nss module. services.nscd.enable must be set to true,";
      }
    ];

    systemd.additionalUpstreamSystemUnits = [
      "systemd-homed.service"
      "systemd-homed-activate.service"
    ];

    # This is mentioned in homed's [Install] section.
    #
    # While homed appears to work without it, it's probably better
    # to follow upstream recommendations.
    services.userdbd.enable = lib.mkDefault true;

    systemd.services = {
      systemd-homed = {
        # These packages are required to manage encrypted volumes
        path = config.system.fsPackages;
        aliases = [ "dbus-org.freedesktop.home1.service" ];
        wantedBy = [ "multi-user.target" ];
      };

      systemd-homed-activate = {
        wantedBy = [ "systemd-homed.service" ];
      };
    };
  };
}