about summary refs log tree commit diff
path: root/pkgs/sternenseemann
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-03-23 21:26:43 +0100
committersternenseemann <sternenseemann@systemli.org>2022-03-23 21:36:28 +0100
commitf5f600e3908b4b00714a9658c2708b825322a137 (patch)
treed25056e42c7bff3d96e5c545cdc9ee30d58f1149 /pkgs/sternenseemann
parent146474e922f654655392f457af3c57b6856ff877 (diff)
pkgs/sternenseemann/acme: init at 2021-10-19
* Patch plan9port most notably including a patch that fixes the
  interpretation of X11 key events. This resolves the problem that using
  the shift key of the neo layout would cause acme to start interpreting
  left mouse button as right mouse button.

* Add a wrapper derivation that puts acme and all executables it
  absolutely requires in PATH. The full Plan 9 userland can still be
  accessed via the 9 executable, but this allows executing just acme and
  access e.g. the GNU coreutils from inside of it — in case you do want
  to use cat -v.

machines/sternenseemann/wolfgang: install acme
Diffstat (limited to 'pkgs/sternenseemann')
-rw-r--r--pkgs/sternenseemann/acme/default.nix22
-rw-r--r--pkgs/sternenseemann/acme/neo-modifier-fix.patch24
-rw-r--r--pkgs/sternenseemann/acme/no-usr-local-plan9.patch162
-rw-r--r--pkgs/sternenseemann/default.nix12
4 files changed, 220 insertions, 0 deletions
diff --git a/pkgs/sternenseemann/acme/default.nix b/pkgs/sternenseemann/acme/default.nix
new file mode 100644
index 00000000..711e2810
--- /dev/null
+++ b/pkgs/sternenseemann/acme/default.nix
@@ -0,0 +1,22 @@
+{ lib
+, runCommand
+, plan9port
+, makeWrapper
+}:
+
+runCommand "acme-${plan9port.version}" {
+  pname = "acme";
+  inherit (plan9port) version;
+
+  nativeBuildInputs = [
+    makeWrapper
+  ];
+
+  meta = plan9port.meta // {
+    description = "Standalone version of Plan 9 from Userspace's acme";
+  };
+} ''
+  for cmd in 9 9pserve acme devdraw win; do
+    makeWrapper "${plan9port}/plan9/bin/$cmd" "$out/bin/$cmd" --prefix PATH : "$out/bin"
+  done
+''
diff --git a/pkgs/sternenseemann/acme/neo-modifier-fix.patch b/pkgs/sternenseemann/acme/neo-modifier-fix.patch
new file mode 100644
index 00000000..f5e587d5
--- /dev/null
+++ b/pkgs/sternenseemann/acme/neo-modifier-fix.patch
@@ -0,0 +1,24 @@
+commit 139924014d126578e5a008f1df7a55831e668287
+Author: sternenseemann <sternenseemann@systemli.org>
+Date:   Sat Mar 19 15:52:59 2022 +0100
+
+    cmd/devdraw: Don't use X11 standard interpretation for modifiers
+    
+    This patch is based on a similar one [1] for drawterm by Sören Tempel.
+    
+    [1]: https://github.com/nmeum/aports/blob/master/8pit/drawterm/modifier-fix.patch
+
+diff --git a/src/cmd/devdraw/x11-screen.c b/src/cmd/devdraw/x11-screen.c
+index 0bbc25d6..511fc093 100644
+--- a/src/cmd/devdraw/x11-screen.c
++++ b/src/cmd/devdraw/x11-screen.c
+@@ -408,6 +408,9 @@ runxevent(XEvent *xev)
+ 	case KeyPress:
+ 		ke = (XKeyEvent*)xev;
+ 		XLookupString(ke, NULL, 0, &k, NULL);
++		/* dont use standard interpretation for modifiers */
++		if(IsModifierKey(k))
++			k = XLookupKeysym(ke, 0);
+ 		c = ke->state;
+ 		switch(k) {
+ 		case XK_Alt_L:
diff --git a/pkgs/sternenseemann/acme/no-usr-local-plan9.patch b/pkgs/sternenseemann/acme/no-usr-local-plan9.patch
new file mode 100644
index 00000000..a6769671
--- /dev/null
+++ b/pkgs/sternenseemann/acme/no-usr-local-plan9.patch
@@ -0,0 +1,162 @@
+From 24df3a48ccf9551ee54ed45cf0fe7250e243e4d8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
+Date: Sun, 31 Oct 2021 00:06:02 +0100
+Subject: [PATCH 1/4] INSTALL: Always set PLAN9_TARGET environment variable
+
+That is, not only when -r was given. This allows using this veriable in
+mkfiles across the code base.
+---
+ INSTALL          | 5 ++++-
+ lib/moveplan9.sh | 1 -
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/INSTALL b/INSTALL
+index 79c0745fa..f2ce6ecfe 100755
+--- a/INSTALL
++++ b/INSTALL
+@@ -16,7 +16,7 @@ x-c)
+ 	;;
+ x-r)
+ 	shift
+-	PLAN9_TARGET=$1 export PLAN9_TARGET
++	PLAN9_TARGET=$1
+ 	;;
+ *)
+ 	echo 'usage: INSTALL [-b | -c] [-r path]' 1>&2
+@@ -32,6 +32,9 @@ rm -f config
+ 
+ PLAN9=`pwd` export PLAN9
+ PATH=/bin:/usr/bin:$PLAN9/bin:$PATH export PATH
++[ -z "$PLAN9_TARGET" ] && PLAN9_TARGET="$PLAN9"
++export PLAN9_TARGET
++
+ case `uname` in
+ SunOS)
+ 	awk=nawk
+diff --git a/lib/moveplan9.sh b/lib/moveplan9.sh
+index b22801958..958b7135a 100644
+--- a/lib/moveplan9.sh
++++ b/lib/moveplan9.sh
+@@ -12,7 +12,6 @@ case $# in
+ 	exit 1
+ esac
+ 
+-[ -z "$PLAN9_TARGET" ] && PLAN9_TARGET="$PLAN9"
+ new=`cleanname $PLAN9_TARGET`
+ 
+ if [ X"$new" = X"" ]
+
+From 0d85d9f45c12afa2dacfde029def223d4af1623b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
+Date: Sun, 31 Oct 2021 06:01:30 +0100
+Subject: [PATCH 2/4] lib9: pass $PLAN9_TARGET via CPP for get9root fallback
+ value
+
+Allows this function to always return the proper path in situations
+where the $PLAN9 environment variable is not set, i.e. a rc login shell.
+---
+ src/lib9/get9root.c | 3 +--
+ src/lib9/mkfile     | 3 +++
+ src/mkmk.sh         | 2 +-
+ 3 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/lib9/get9root.c b/src/lib9/get9root.c
+index 07e2872c5..3e7b10501 100644
+--- a/src/lib9/get9root.c
++++ b/src/lib9/get9root.c
+@@ -11,7 +11,6 @@ get9root(void)
+ 
+ 	if((s = getenv("PLAN9")) != 0)
+ 		return s;
+-	/* could do better - search $PATH */
+-	s = "/usr/local/plan9";
++	s = PLAN9_TARGET;
+ 	return s;
+ }
+diff --git a/src/lib9/mkfile b/src/lib9/mkfile
+index db267dfed..ed4315ff4 100644
+--- a/src/lib9/mkfile
++++ b/src/lib9/mkfile
+@@ -175,6 +175,9 @@ HFILES=\
+ %.$O: utf/%.c
+ 	$CC $CFLAGS utf/$stem.c
+ 
++get9root.$O: get9root.c
++	$CC $CFLAGS -DPLAN9_TARGET=\"$PLAN9_TARGET\" get9root.c
++
+ XLIB=$PLAN9/lib/$LIB
+ 
+ testfmt: testfmt.$O $XLIB
+diff --git a/src/mkmk.sh b/src/mkmk.sh
+index dfccd3694..897186489 100644
+--- a/src/mkmk.sh
++++ b/src/mkmk.sh
+@@ -36,7 +36,7 @@ echo cd `pwd`
+ 9c  exitcode.c
+ 9c  fcallfmt.c
+ 9c  frand.c
+-9c  get9root.c
++9c  -DPLAN9_TARGET=\"$PLAN9_TARGET\" get9root.c
+ 9c  getcallerpc.c
+ 9c  getenv.c
+ 9c  getfields.c
+
+From 9d1459d5be85b0e8b0eee7c45597c08f3e7f30bb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
+Date: Sun, 31 Oct 2021 01:30:46 +0100
+Subject: [PATCH 3/4] sam: use get9root instead of duplicating the logic
+
+---
+ src/cmd/sam/sam.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/src/cmd/sam/sam.c b/src/cmd/sam/sam.c
+index 84e015f51..a660e4e32 100644
+--- a/src/cmd/sam/sam.c
++++ b/src/cmd/sam/sam.c
+@@ -152,9 +152,7 @@ rescue(void)
+ 			free(c);
+ 		}else
+ 			sprint(buf, "nameless.%d", nblank++);
+-		root = getenv("PLAN9");
+-		if(root == nil)
+-			root = "/usr/local/plan9";
++		root = get9root();
+ 		fprint(io, "#!/bin/sh\n%s/bin/samsave '%s' $* <<'---%s'\n", root, buf, buf);
+ 		addr.r.p1 = 0, addr.r.p2 = f->b.nc;
+ 		writeio(f);
+
+From 8ae7fa2c1105ca79f7c57ab3357b558c4d3f51b5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
+Date: Sun, 31 Oct 2021 17:46:35 +0100
+Subject: [PATCH 4/4] upas: don't hardcode path for rc(1)
+
+---
+ src/cmd/upas/nfs/imap.c | 3 ++-
+ src/cmd/upas/nfs/mkfile | 2 ++
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/cmd/upas/nfs/imap.c b/src/cmd/upas/nfs/imap.c
+index 5249e2e78..fbd232fef 100644
+--- a/src/cmd/upas/nfs/imap.c
++++ b/src/cmd/upas/nfs/imap.c
+@@ -825,7 +825,8 @@ imapdial(char *server, int mode)
+ 		fd[0] = dup(p[0], -1);
+ 		fd[1] = dup(p[0], -1);
+ 		fd[2] = dup(2, -1);
+-		if(threadspawnl(fd, "/usr/local/plan9/bin/rc", "rc", "-c", server, nil) < 0){
++		/* could do better - use get9root for rc(1) path */
++		if(threadspawnl(fd, PLAN9_TARGET "/bin/rc", "rc", "-c", server, nil) < 0){
+ 			close(p[0]);
+ 			close(p[1]);
+ 			close(fd[0]);
+diff --git a/src/cmd/upas/nfs/mkfile b/src/cmd/upas/nfs/mkfile
+index 7716ab58d..a8f2d8e64 100644
+--- a/src/cmd/upas/nfs/mkfile
++++ b/src/cmd/upas/nfs/mkfile
+@@ -16,3 +16,5 @@ HFILES=a.h box.h imap.h sx.h
+ 
+ <$PLAN9/src/mkone
+ 
++imap.$O: imap.c
++	$CC $CFLAGS -DPLAN9_TARGET=\"$PLAN9_TARGET\" imap.c
diff --git a/pkgs/sternenseemann/default.nix b/pkgs/sternenseemann/default.nix
index 55af2db4..4dabc41f 100644
--- a/pkgs/sternenseemann/default.nix
+++ b/pkgs/sternenseemann/default.nix
@@ -78,6 +78,11 @@ lib.fix (self: {
     inherit (profpatsch) getBins;
   };
 
+  # customized third party software
+  acme = callPackage ./acme {
+    inherit (self) plan9port;
+  };
+
   pass = (pkgs.pass.override {
     waylandSupport = true;
     x11Support = false;
@@ -89,6 +94,13 @@ lib.fix (self: {
     '';
   });
 
+  plan9port = pkgs.plan9port.overrideAttrs (old: {
+    patches = old.patches or [] ++ [
+      ./acme/no-usr-local-plan9.patch
+      ./acme/neo-modifier-fix.patch
+    ];
+  });
+
   texlive = pkgs.texlive.combine {
     inherit (pkgs.texlive)
       scheme-medium minted titlesec units collection-bibtexextra wrapfig