2017-05-22 01:14:12 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.keybase;
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.keybase = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Whether to start the Keybase service.";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
2019-12-19 00:02:41 +00:00
|
|
|
# Upstream: https://github.com/keybase/client/blob/master/packaging/linux/systemd/keybase.service
|
2017-05-22 01:14:12 +01:00
|
|
|
systemd.user.services.keybase = {
|
|
|
|
description = "Keybase service";
|
2017-10-23 09:50:29 +01:00
|
|
|
unitConfig.ConditionUser = "!@system";
|
2019-12-19 00:02:41 +00:00
|
|
|
environment.KEYBASE_SERVICE_TYPE = "systemd";
|
2017-05-22 01:14:12 +01:00
|
|
|
serviceConfig = {
|
2019-12-19 00:02:41 +00:00
|
|
|
Type = "notify";
|
|
|
|
EnvironmentFile = [
|
|
|
|
"-%E/keybase/keybase.autogen.env"
|
|
|
|
"-%E/keybase/keybase.env"
|
|
|
|
];
|
|
|
|
ExecStart = "${pkgs.keybase}/bin/keybase service";
|
2017-05-22 01:14:12 +01:00
|
|
|
Restart = "on-failure";
|
|
|
|
PrivateTmp = true;
|
|
|
|
};
|
2017-10-06 23:49:58 +01:00
|
|
|
wantedBy = [ "default.target" ];
|
2017-05-22 01:14:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.keybase ];
|
|
|
|
};
|
|
|
|
}
|