makeScriptWriter: init

This commit is contained in:
tv 2016-06-13 01:30:06 +02:00
parent e769ff0838
commit 0cfce6d18d

View File

@ -28,20 +28,20 @@ rec {
execveBin = name: cfg: execve name (cfg // { destination = "/bin/${name}"; }); execveBin = name: cfg: execve name (cfg // { destination = "/bin/${name}"; });
writeBash = name: text: pkgs.writeScript name '' makeScriptWriter = interpreter: name: text:
#! ${pkgs.bash}/bin/bash assert (with types; either absolute-pathname filename).check name;
${text} pkgs.writeOut (baseNameOf name) {
''; ${optionalString (types.absolute-pathname.check name) name} = {
executable = true;
text = "#! ${interpreter}\n${text}";
};
};
writeBashBin = name: text: pkgs.writeTextFile { writeBash = makeScriptWriter "${pkgs.bash}/bin/bash";
executable = true;
destination = "/bin/${name}"; writeBashBin = name:
name = name; assert types.filename.check name;
text = '' pkgs.writeBash "/bin/${name}";
#! ${pkgs.bash}/bin/bash
${text}
'';
};
writeC = name: { destination ? "" }: src: pkgs.runCommand name {} '' writeC = name: { destination ? "" }: src: pkgs.runCommand name {} ''
PATH=${makeBinPath (with pkgs; [ PATH=${makeBinPath (with pkgs; [
@ -56,20 +56,11 @@ rec {
strip --strip-unneeded "$exe" strip --strip-unneeded "$exe"
''; '';
writeDash = name: text: pkgs.writeScript name '' writeDash = makeScriptWriter "${pkgs.dash}/bin/dash";
#! ${pkgs.dash}/bin/dash
${text}
'';
writeDashBin = name: text: pkgs.writeTextFile { writeDashBin = name:
executable = true; assert types.filename.check name;
destination = "/bin/${name}"; pkgs.writeDash "/bin/${name}";
name = name;
text = ''
#! ${pkgs.dash}/bin/dash
${text}
'';
};
writeEximConfig = name: text: pkgs.runCommand name { writeEximConfig = name: text: pkgs.runCommand name {
inherit text; inherit text;