aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/services/network-filesystems/kbfs.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/services/network-filesystems/kbfs.nix')
-rw-r--r--nixpkgs/nixos/modules/services/network-filesystems/kbfs.nix66
1 files changed, 66 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/services/network-filesystems/kbfs.nix b/nixpkgs/nixos/modules/services/network-filesystems/kbfs.nix
new file mode 100644
index 00000000000..263b70d04a5
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/network-filesystems/kbfs.nix
@@ -0,0 +1,66 @@
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ cfg = config.services.kbfs;
+
+in {
+
+ ###### interface
+
+ options = {
+
+ services.kbfs = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to mount the Keybase filesystem.";
+ };
+
+ mountPoint = mkOption {
+ type = types.str;
+ default = "%h/keybase";
+ example = "/keybase";
+ description = "Mountpoint for the Keybase filesystem.";
+ };
+
+ 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.
+ '';
+ };
+
+ };
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ systemd.user.services.kbfs = {
+ description = "Keybase File System";
+ requires = [ "keybase.service" ];
+ after = [ "keybase.service" ];
+ path = [ "/run/wrappers" ];
+ unitConfig.ConditionUser = "!@system";
+ serviceConfig = {
+ ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${cfg.mountPoint}";
+ ExecStart = "${pkgs.kbfs}/bin/kbfsfuse ${toString cfg.extraFlags} ${cfg.mountPoint}";
+ ExecStopPost = "/run/wrappers/bin/fusermount -u ${cfg.mountPoint}";
+ Restart = "on-failure";
+ PrivateTmp = true;
+ };
+ wantedBy = [ "default.target" ];
+ };
+
+ services.keybase.enable = true;
+
+ environment.systemPackages = [ pkgs.kbfs ];
+ };
+}