fc-scripts: more fine-grained packaging
It makes sense to put each individual script into its own derivation, as some of the scripts require certain other dependencies that others don't.
This commit is contained in:
parent
4b11a0c633
commit
a87738a2ff
2 changed files with 72 additions and 13 deletions
|
|
@ -1,27 +1,80 @@
|
|||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
runCommand,
|
||||
python3,
|
||||
stdenvNoCC,
|
||||
makeWrapper,
|
||||
git,
|
||||
openssh,
|
||||
mosh,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "fc-scripts";
|
||||
version = "20260202";
|
||||
let
|
||||
src = fetchFromGitHub {
|
||||
owner = "flyingcircusio";
|
||||
repo = "scripts";
|
||||
rev = "887f066006829fc3ee44b3cfbe748c578ea2e7c1";
|
||||
hash = "sha256-mrL/dULb0NKw8cH9ferzfDdRjhWANrWQg/u7FNCtzWw=";
|
||||
};
|
||||
version = "20260202";
|
||||
mkFcScriptDrv =
|
||||
{
|
||||
pname,
|
||||
propagatedBuildInputs,
|
||||
python ? python3,
|
||||
...
|
||||
}@args:
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
inherit (args)
|
||||
pname
|
||||
propagatedBuildInputs
|
||||
;
|
||||
inherit src version; # not passed via function args, but can be overridden later via overrideAttrs
|
||||
dontBuild = true;
|
||||
dontConfigure = true;
|
||||
buildInputs = [ python ]; # the python interpreter utilised by patchShebangs
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
buildInputs = [ python3 ];
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
install -m 0755 ${pname}* $out/bin/${pname}
|
||||
''
|
||||
+ lib.optionalString (finalAttrs.propagatedBuildInputs != [ ]) ''
|
||||
wrapProgram $out/bin/${pname} --prefix PATH : \
|
||||
${lib.makeBinPath finalAttrs.propagatedBuildInputs}
|
||||
''
|
||||
+ "runHook postInstall";
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp *.py $out/bin/
|
||||
meta.mainProgram = pname;
|
||||
});
|
||||
in
|
||||
{
|
||||
git-tree-sync = mkFcScriptDrv {
|
||||
pname = "git-tree-sync";
|
||||
propagatedBuildInputs = [
|
||||
git
|
||||
openssh
|
||||
];
|
||||
};
|
||||
ssh-multi-proxy = mkFcScriptDrv {
|
||||
pname = "ssh-multi-proxy";
|
||||
propagatedBuildInputs = [ openssh ];
|
||||
};
|
||||
mosh-tunnel = mkFcScriptDrv {
|
||||
pname = "mosh-tunnel";
|
||||
propagatedBuildInputs = [
|
||||
mosh
|
||||
openssh
|
||||
];
|
||||
python = python3.withPackages (ps: [ ps.asyncio-dgram ]);
|
||||
};
|
||||
mosh-dualstack-proxy = mkFcScriptDrv {
|
||||
pname = "mosh-dualstack-proxy";
|
||||
propagatedBuildInputs = [
|
||||
python3
|
||||
mosh
|
||||
openssh
|
||||
];
|
||||
};
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue