keybase, kbfs: add modules
This commit is contained in:
parent
7876d533cf
commit
7a5b9152e9
|
@ -494,6 +494,15 @@ in
|
|||
package that provides the font or theme.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2017-11-26T21:57:23+00:00";
|
||||
message = ''
|
||||
Two new modules are available:
|
||||
|
||||
'services.kbfs' and 'services.keybase'
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -46,7 +46,9 @@ let
|
|||
./services/dunst.nix
|
||||
./services/gnome-keyring.nix
|
||||
./services/gpg-agent.nix
|
||||
./services/kbfs.nix
|
||||
./services/keepassx.nix
|
||||
./services/keybase.nix
|
||||
./services/network-manager-applet.nix
|
||||
./services/owncloud-client.nix
|
||||
./services/polybar.nix
|
||||
|
|
66
modules/services/kbfs.nix
Normal file
66
modules/services/kbfs.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.kbfs;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
services.kbfs = {
|
||||
enable = mkEnableOption "Keybase File System";
|
||||
|
||||
mountPoint = mkOption {
|
||||
type = types.str;
|
||||
default = "keybase";
|
||||
description = ''
|
||||
Mount point for the Keybase filesystem, relative to
|
||||
<envar>HOME</envar>.
|
||||
'';
|
||||
};
|
||||
|
||||
extraFlags = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
example = [
|
||||
"-label kbfs"
|
||||
"-mount-type normal"
|
||||
];
|
||||
description = ''
|
||||
Additional flags to pass to the Keybase filesystem on launch.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services.kbfs = {
|
||||
Unit = {
|
||||
Description = "Keybase File System";
|
||||
Requires = [ "keybase.service" ];
|
||||
After = [ "keybase.service" ];
|
||||
};
|
||||
|
||||
Service =
|
||||
let
|
||||
mountPoint = "\"%h/${cfg.mountPoint}\"";
|
||||
in {
|
||||
Environment = "PATH=/run/wrappers KEYBASE_SYSTEMD=1";
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${mountPoint}";
|
||||
ExecStart ="${pkgs.kbfs}/bin/kbfsfuse ${toString cfg.extraFlags} ${mountPoint}";
|
||||
ExecStopPost = "/run/wrappers/bin/fusermount -u ${mountPoint}";
|
||||
Restart = "on-failure";
|
||||
PrivateTmp = true;
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "default.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
services.keybase.enable = true;
|
||||
};
|
||||
}
|
35
modules/services/keybase.nix
Normal file
35
modules/services/keybase.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.keybase;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
services.keybase = {
|
||||
enable = mkEnableOption "Keybase";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services.keybase = {
|
||||
Unit = {
|
||||
Description = "Keybase service";
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.keybase}/bin/keybase service --auto-forked";
|
||||
Restart = "on-failure";
|
||||
PrivateTmp = true;
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "default.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue