refactor(sterni/plan9port): move custom install logic into wrapper
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>
This commit is contained in:
parent
58cafde03d
commit
975b9603cc
1 changed files with 32 additions and 11 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, lib, ... }:
|
{ depot, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
patchesFromDir = dir:
|
patchesFromDir = dir:
|
||||||
|
|
@ -12,6 +12,8 @@ let
|
||||||
exec ${pkgs.cbqn}/bin/BQN ${../mkbqnkeyboard.bqn} -s -i \
|
exec ${pkgs.cbqn}/bin/BQN ${../mkbqnkeyboard.bqn} -s -i \
|
||||||
"${pkgs.srcOnly pkgs.mbqn}/editors/inputrc" "$1"
|
"${pkgs.srcOnly pkgs.mbqn}/editors/inputrc" "$1"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
inherit (depot.users.sterni.acme) plan9port;
|
||||||
in
|
in
|
||||||
|
|
||||||
pkgs.plan9port.overrideAttrs (old: {
|
pkgs.plan9port.overrideAttrs (old: {
|
||||||
|
|
@ -23,17 +25,32 @@ pkgs.plan9port.overrideAttrs (old: {
|
||||||
mv plumb/sterni.plumbing plumb/initial.plumbing
|
mv plumb/sterni.plumbing plumb/initial.plumbing
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
|
passthru = old.passthru or { } // {
|
||||||
pkgs.buildPackages.makeWrapper
|
wrapper =
|
||||||
];
|
let
|
||||||
|
PLAN9 = "${plan9port}/plan9";
|
||||||
|
globalBins = [
|
||||||
|
"9p"
|
||||||
|
"9pfuse"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
pkgs.runCommandNoCC "${old.pname}-wrapper-${old.version}"
|
||||||
|
{
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.buildPackages.makeWrapper
|
||||||
|
];
|
||||||
|
}
|
||||||
|
''
|
||||||
|
mkdir -p "$out/bin"
|
||||||
|
|
||||||
# Make some tools (that don't clash) available in PATH directly
|
ln -s "${plan9port}/bin/9" "$out/bin/"
|
||||||
postInstall = old.postInstall or "" + ''
|
for cmd in ${lib.escapeShellArgs globalBins}; do
|
||||||
for cmd in 9p 9pfuse; do
|
makeWrapper "${PLAN9}/bin/$cmd" "$out/bin/$cmd" \
|
||||||
makeWrapper "$out/plan9/bin/$cmd" "$out/bin/$cmd" \
|
--set PLAN9 "${PLAN9}"
|
||||||
--set PLAN9 "$out/plan9"
|
done
|
||||||
done
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
doInstallCheck = true;
|
doInstallCheck = true;
|
||||||
installCheckPhase = old.installCheckPhase or "" + ''
|
installCheckPhase = old.installCheckPhase or "" + ''
|
||||||
|
|
@ -46,4 +63,8 @@ pkgs.plan9port.overrideAttrs (old: {
|
||||||
"$out/bin/9" 9p write plumb/rules < ${./../plumb}/sterni.plumbing
|
"$out/bin/9" 9p write plumb/rules < ${./../plumb}/sterni.plumbing
|
||||||
kill "$pid"
|
kill "$pid"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
meta = old.meta or { } // {
|
||||||
|
ci.targets = [ "wrapper" ];
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue