1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-23 18:29:47 +01:00

keybase, kbfs: add modules

This commit is contained in:
Tad Fisher 2017-11-21 15:29:30 -08:00 committed by Robert Helgesson
parent 7876d533cf
commit 7a5b9152e9
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86
4 changed files with 112 additions and 0 deletions

View file

@ -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'
'';
}
];
};
}

View file

@ -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
View 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;
};
}

View 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" ];
};
};
};
}