shithub: 9pro

Download patch

ref: 54ff6c3406e158066ebe40b243e698ccbd4f2f51
parent: dc8c3343ee6a06343bc75f58c693d86f924d66a7
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Jan 10 16:15:59 EST 2020

add docs to run 9pex on NixOS

diff: cannot open b/nixos//null: file does not exist: 'b/nixos//null'
--- /dev/null
+++ b/nixos/README.md
@@ -1,0 +1,61 @@
+# Read-only 9pex in NixOS
+
+```
+sudo mkdir -p /etc/nixos/pkgs
+sudo cp ninepex.nix /etc/nixos/pkgs/
+```
+
+And change `/etc/nixos/configuration.nix`:
+
+```
+{ config, pkgs, ... }:
+
+let
+  ninepex = pkgs.callPackage ./pkgs/ninepex.nix {};
+in
+{
+
+.................
+
+  services.xinetd = {
+    enable = true;
+    services = [
+      {
+        name = "9pfs";
+        port = 564;
+        user = "none";
+        server = "${ninepex}/bin/9pex";
+        serverArgs = "/home/9";
+        flags = "KEEPALIVE REUSE";
+        extraConfig = ''
+          instances = UNLIMITED
+        '';
+      }
+    ];
+  };
+
+.................
+
+  users.users.none = {
+    isNormalUser = false;
+    isSystemUser = false;                                                                                              
+    createHome = true;
+    home = "/home/9";
+    shell = "${pkgs.shadow}/bin/nologin";
+  };
+
+```
+
+Files go to `/home/9`. With `rsync` it can be done as so:
+
+```
+rsync -iCaR \
+        --exclude='.git*' \
+        --exclude='*.out' \
+        --exclude='*.[0125678vqki]' \
+        --exclude='[0125678vqki].*' \
+        --delete-excluded --delete \
+        --chown none:nogroup \
+	dir1 dir2 dir3 \
+        root@host:/home/9/
+```
--- /dev/null
+++ b/nixos/ninepex.nix
@@ -1,0 +1,17 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "9pex";
+  src = fetchFromGitHub {
+    owner = "ftrvxmtrx";
+    repo = "9pro";
+    rev = "dc8c3343ee6a06343bc75f58c693d86f924d66a7";
+    sha256 = "1w08l0rm8hyijf00glscyii15cgn73wafrqrb06h59sx2af53jcn";
+  };
+
+  installPhase = ''
+    ./build.sh
+    mkdir -p "$out/bin"
+    cp 9pex "$out/bin/"
+  '';
+}