1 { config, lib, pkgs, ... }:
3 cfg = config.services.u9fs;
11 enable = lib.mkOption {
12 type = lib.types.bool;
14 description = "Whether to run the u9fs 9P server for Unix.";
17 listenStreams = lib.mkOption {
18 type = lib.types.listOf lib.types.str;
20 example = [ "192.168.16.1:564" ];
22 Sockets to listen for clients on.
23 See {command}`man 5 systemd.socket` for socket syntax.
30 description = "User to run u9fs under.";
33 extraArgs = lib.mkOption {
38 Extra arguments to pass on invocation,
39 see {command}`man 4 u9fs`
47 config = lib.mkIf cfg.enable {
51 description = "U9fs Listening Socket";
52 wantedBy = [ "sockets.target" ];
53 after = [ "network.target" ];
54 inherit (cfg) listenStreams;
55 socketConfig.Accept = "yes";
58 description = "9P Protocol Server";
59 reloadIfChanged = true;
60 requires = [ "u9fs.socket" ];
62 { ExecStart = "-${pkgs.u9fs}/bin/u9fs ${cfg.extraArgs}";
63 StandardInput = "socket";
64 StandardError = "journal";
66 AmbientCapabilities = "cap_setuid cap_setgid";