www
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYestin L. Harrison <yestin@ylh.io>2022-06-24 21:30:18 -0700
committerYestin L. Harrison <yestin@ylh.io>2022-06-24 21:30:18 -0700
commitac41e008080959adb8c435557079847c723adbec (patch)
tree8365e999794c00df4d885e09f03624fdff387225
parent82bc93b399c824cd336a79589c1e18b5e7514439 (diff)
downloaddyn-ac41e008080959adb8c435557079847c723adbec.tar.gz
dyn-ac41e008080959adb8c435557079847c723adbec.tar.xz
dyn-ac41e008080959adb8c435557079847c723adbec.zip
mypkgs: add sbase & 9base
-rw-r--r--overlays/20-mypkgs/_9base.nix83
-rw-r--r--overlays/20-mypkgs/sbase.nix35
2 files changed, 118 insertions, 0 deletions
diff --git a/overlays/20-mypkgs/_9base.nix b/overlays/20-mypkgs/_9base.nix
new file mode 100644
index 0000000..e87901b
--- /dev/null
+++ b/overlays/20-mypkgs/_9base.nix
@@ -0,0 +1,83 @@
+{ lib, stdenv, fetchgit, ed, mksh, plan9port }:
+assert stdenv.hostPlatform.isStatic;
+let
+ pwd = builtins.fetchurl {
+ url = "https://raw.githubusercontent.com/0intro/plan9/main/sys/src/cmd/pwd.c";
+ sha256 = "15ixlnkl8v642skz2qjn3djxcg91f5gjc0dppmsdzjhgcxgn0gph";
+ };
+in stdenv.mkDerivation rec {
+ pname = "_9base";
+ version = "2019-09-11";
+ src = fetchgit {
+ url = "git://git.suckless.org/9base";
+ rev = "63916da7bd6d73d9a405ce83fc4ca34845667cce";
+ sha256 = "04j8js4s3jmlzi3m46q81bq76rn41an58ffhkbj9p5wwr5hvplh8";
+ };
+
+ nativeBuildInputs = [ ed ];
+
+ postPatch = let
+ ed = f: s: ''
+ ed -s ${f} <<EOF
+ ${s}wq
+ EOF
+ '';
+ in ''
+ ${ed "config.mk" ''
+ /^PREFIX/s,/usr/local,$out,
+ /386/s/^/#/
+ /x86_64/s/^#//
+ /^LDFLAGS/d
+ /^AR/s/ar/$AR/
+ /^CC/d
+ ''}
+ ${ed "lib9/u.h" ''
+ /_BSD_SOURCE/d
+ /_SVID/s//_DEFAULT/
+ ''}
+ ${ed "std.mk" ''
+ /strip/s//''${STRIP}/
+ ''}
+ ${ed "sam/Makefile" ''
+ /strip/s//''${STRIP}/
+ ''}
+
+ mkdir pwd
+ cat <${pwd} >pwd/pwd.c
+ ${ed "pwd/pwd.c" ''
+ /USED/d
+ ''}
+ cp pbd/pbd.1 pwd/pwd.1
+ cp pbd/Makefile pwd/Makefile
+ ${ed "pwd/Makefile" ''
+ g/pbd/s//pwd/g
+ ''}
+ ${ed "Makefile" ''
+ /pbd/y
+ ??x
+ s//pwd/
+ ''}
+ '';
+
+ dontConfigure = true;
+ dontPatchShebangs = true;
+
+ postFixup = ''
+ for i in bin/9{,.rc}; do
+ substitute ${plan9port.src}/$i $out/plan9/$i --replace /usr/local $out
+ chmod +x $out/plan9/$i
+ done
+ mkdir -p $out/bin
+ substituteInPlace $out/plan9/bin/9 --replace /bin/sh ${mksh}/bin/mksh
+ cp $out/{plan9/,}bin/9
+ '';
+
+ meta = with lib; {
+ description = "revived minimalist port of Plan 9 userland to Unix";
+ homepage = "https://tools.suckless.org/9base/";
+ # TODO: tell upstream that plan 9 has been relicensed to mit
+ license = with licenses; [ mit lpl-102 ];
+ platforms = platforms.linux;
+ maintainers = [ maintainers.ylh ];
+ };
+}
diff --git a/overlays/20-mypkgs/sbase.nix b/overlays/20-mypkgs/sbase.nix
new file mode 100644
index 0000000..60240f8
--- /dev/null
+++ b/overlays/20-mypkgs/sbase.nix
@@ -0,0 +1,35 @@
+{ lib, stdenv, fetchgit, ed }:
+assert stdenv.hostPlatform.isStatic;
+stdenv.mkDerivation rec {
+ pname = "sbase";
+ version = "2022-06-20";
+
+ src = fetchgit {
+ url = "git://git.suckless.org/sbase";
+ rev = "63271b47f7e045cdee3fa90178560f982b70c218";
+ sha256 = "0zra49ad2ajq26vidqxaxdx2l2xrzn4f27il0x2z8gznm3j77ppw";
+ };
+
+ nativeBuildInputs = [ ed ];
+
+ postPatch = ''
+ ed -s config.mk <<EOF
+ /^PREFIX/s,/usr/local,$out,
+ /^CC/s,cc,$CC,
+ /^AR/s,ar,$AR,
+ /^RANLIB/s,ranlib,$RANLIB,
+ /LDFLAGS/d
+ wq
+ EOF
+ '';
+
+ dontConfigure = true;
+
+ meta = with lib; {
+ description = "suckless unix tools";
+ homepage = "http://git.suckless.org/sbase/";
+ license = licenses.mit;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.ylh ];
+ };
+}