mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
76 lines
1.8 KiB
Nix
76 lines
1.8 KiB
Nix
final: prev: let
|
|
inherit (final.lib.attrsets) mapAttrs' nameValuePair;
|
|
subBuilders = {
|
|
applyPatches = args:
|
|
prev.applyPatches ({
|
|
allowSubstitutes = true;
|
|
}
|
|
// args);
|
|
writeTextFile = args:
|
|
prev.writeTextFile ({
|
|
allowSubstitutes = true;
|
|
}
|
|
// args);
|
|
writeText = name: text: final.writeTextFile' {inherit name text;};
|
|
writeShellScript = name: text:
|
|
final.writeTextFile' {
|
|
inherit name;
|
|
executable = true;
|
|
text = ''
|
|
#!${final.runtimeShell}
|
|
${text}
|
|
'';
|
|
checkPhase = ''
|
|
${final.stdenv.shellDryRun} "$target"
|
|
'';
|
|
};
|
|
writeShellScriptBin = name: text:
|
|
final.writeTextFile' {
|
|
inherit name;
|
|
destination = "/bin/${name}";
|
|
executable = true;
|
|
text = ''
|
|
#!${final.runtimeShell}
|
|
${text}
|
|
'';
|
|
checkPhase = ''
|
|
${final.stdenv.shellDryRun} "$target"
|
|
'';
|
|
};
|
|
symlinkJoin = args:
|
|
prev.symlinkJoin ({
|
|
allowSubstitutes = true;
|
|
}
|
|
// args);
|
|
linkFarm = name: entries:
|
|
(prev.linkFarm name entries).overrideAttrs (_: {
|
|
allowSubstitutes = true;
|
|
});
|
|
runCommandLocal = name: env:
|
|
final.runCommandWith {
|
|
stdenv = final.stdenvNoCC;
|
|
runLocal = true;
|
|
inherit name;
|
|
derivationArgs =
|
|
{
|
|
allowSubstitutes = true;
|
|
}
|
|
// env;
|
|
};
|
|
# TODO: writeScript, writeScriptBin, runCommandWith...
|
|
};
|
|
subBuilders' = mapAttrs' (name: nameValuePair "${name}'") subBuilders;
|
|
in {
|
|
inherit
|
|
(subBuilders')
|
|
applyPatches'
|
|
writeTextFile'
|
|
writeText'
|
|
writeShellScript'
|
|
writeShellScriptBin'
|
|
symlinkJoin'
|
|
linkFarm'
|
|
runCommandLocal'
|
|
;
|
|
__withSubBuilders = final // subBuilders;
|
|
}
|