The wrapper allows me to pick and choose what to install and also to set some extra environment variables if necessary. A separate wrapper derivation prevents the hefty rebuild of the entire plan9port derivation when making changes. Change-Id: I3f96cc3e31baf3bd37ae419578c5789aa093e578 Reviewed-on: https://cl.tvl.fyi/c/depot/+/13038 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Autosubmit: sterni <sternenseemann@systemli.org>
70 lines
1.7 KiB
Nix
70 lines
1.7 KiB
Nix
{ depot, pkgs, lib, ... }:
|
|
|
|
let
|
|
patchesFromDir = dir:
|
|
lib.filter
|
|
(lib.hasSuffix ".patch")
|
|
(lib.mapAttrsToList
|
|
(name: _: dir + "/${name}")
|
|
(builtins.readDir dir));
|
|
|
|
mkbqnkeyboard' = pkgs.writeShellScript "mkbqnkeyboard'" ''
|
|
exec ${pkgs.cbqn}/bin/BQN ${../mkbqnkeyboard.bqn} -s -i \
|
|
"${pkgs.srcOnly pkgs.mbqn}/editors/inputrc" "$1"
|
|
'';
|
|
|
|
inherit (depot.users.sterni.acme) plan9port;
|
|
in
|
|
|
|
pkgs.plan9port.overrideAttrs (old: {
|
|
patches = old.patches or [ ] ++ patchesFromDir ./.;
|
|
postPatch = old.postPatch or "" + ''
|
|
${mkbqnkeyboard'} lib/keyboard
|
|
|
|
cp --reflink=auto ${./../plumb}/* plumb/
|
|
mv plumb/sterni.plumbing plumb/initial.plumbing
|
|
'';
|
|
|
|
passthru = old.passthru or { } // {
|
|
wrapper =
|
|
let
|
|
PLAN9 = "${plan9port}/plan9";
|
|
globalBins = [
|
|
"9p"
|
|
"9pfuse"
|
|
];
|
|
in
|
|
pkgs.runCommandNoCC "${old.pname}-wrapper-${old.version}"
|
|
{
|
|
nativeBuildInputs = [
|
|
pkgs.buildPackages.makeWrapper
|
|
];
|
|
}
|
|
''
|
|
mkdir -p "$out/bin"
|
|
|
|
ln -s "${plan9port}/bin/9" "$out/bin/"
|
|
for cmd in ${lib.escapeShellArgs globalBins}; do
|
|
makeWrapper "${PLAN9}/bin/$cmd" "$out/bin/$cmd" \
|
|
--set PLAN9 "${PLAN9}"
|
|
done
|
|
|
|
'';
|
|
};
|
|
|
|
doInstallCheck = true;
|
|
installCheckPhase = old.installCheckPhase or "" + ''
|
|
export NAMESPACE="$(mktemp -d)"
|
|
"$out/bin/9" plumber -f &
|
|
pid="$!"
|
|
until [[ -e "$NAMESPACE/plumb" ]]; do
|
|
sleep 0.1
|
|
done
|
|
"$out/bin/9" 9p write plumb/rules < ${./../plumb}/sterni.plumbing
|
|
kill "$pid"
|
|
'';
|
|
|
|
meta = old.meta or { } // {
|
|
ci.targets = [ "wrapper" ];
|
|
};
|
|
})
|