writers: add rust
This commit is contained in:
parent
e4dae65515
commit
c6ff4f7143
@ -76,8 +76,8 @@ rec {
|
|||||||
contentPath = content;
|
contentPath = content;
|
||||||
}) ''
|
}) ''
|
||||||
${compileScript}
|
${compileScript}
|
||||||
${ lib.optionalString strip
|
${lib.optionalString strip
|
||||||
"${pkgs.binutils-unwrapped}/bin/strip --strip-unneeded $out" }
|
"${pkgs.binutils-unwrapped}/bin/strip --strip-unneeded $out"}
|
||||||
${optionalString (types.path.check nameOrPath) ''
|
${optionalString (types.path.check nameOrPath) ''
|
||||||
mv $out tmp
|
mv $out tmp
|
||||||
mkdir -p $out/$(dirname "${nameOrPath}")
|
mkdir -p $out/$(dirname "${nameOrPath}")
|
||||||
@ -111,7 +111,10 @@ rec {
|
|||||||
# return 0;
|
# return 0;
|
||||||
# }
|
# }
|
||||||
# ''
|
# ''
|
||||||
writeC = name: { libraries ? [] }:
|
writeC = name: {
|
||||||
|
libraries ? [],
|
||||||
|
strip ? true
|
||||||
|
}:
|
||||||
makeBinWriter {
|
makeBinWriter {
|
||||||
compileScript = ''
|
compileScript = ''
|
||||||
PATH=${makeBinPath [
|
PATH=${makeBinPath [
|
||||||
@ -134,6 +137,7 @@ rec {
|
|||||||
-x c \
|
-x c \
|
||||||
"$contentPath"
|
"$contentPath"
|
||||||
'';
|
'';
|
||||||
|
inherit strip;
|
||||||
} name;
|
} name;
|
||||||
|
|
||||||
# writeCBin takes the same arguments as writeC but outputs a directory (like writeScriptBin)
|
# writeCBin takes the same arguments as writeC but outputs a directory (like writeScriptBin)
|
||||||
@ -166,7 +170,8 @@ rec {
|
|||||||
writeHaskell = name: {
|
writeHaskell = name: {
|
||||||
libraries ? [],
|
libraries ? [],
|
||||||
ghc ? pkgs.ghc,
|
ghc ? pkgs.ghc,
|
||||||
ghcArgs ? []
|
ghcArgs ? [],
|
||||||
|
strip ? true
|
||||||
}:
|
}:
|
||||||
makeBinWriter {
|
makeBinWriter {
|
||||||
compileScript = ''
|
compileScript = ''
|
||||||
@ -174,12 +179,29 @@ rec {
|
|||||||
${ghc.withPackages (_: libraries )}/bin/ghc ${lib.escapeShellArgs ghcArgs} tmp.hs
|
${ghc.withPackages (_: libraries )}/bin/ghc ${lib.escapeShellArgs ghcArgs} tmp.hs
|
||||||
mv tmp $out
|
mv tmp $out
|
||||||
'';
|
'';
|
||||||
|
inherit strip;
|
||||||
} name;
|
} name;
|
||||||
|
|
||||||
# writeHaskellBin takes the same arguments as writeHaskell but outputs a directory (like writeScriptBin)
|
# writeHaskellBin takes the same arguments as writeHaskell but outputs a directory (like writeScriptBin)
|
||||||
writeHaskellBin = name:
|
writeHaskellBin = name:
|
||||||
writeHaskell "/bin/${name}";
|
writeHaskell "/bin/${name}";
|
||||||
|
|
||||||
|
writeRust = name: {
|
||||||
|
rustc ? pkgs.rustc,
|
||||||
|
rustcArgs ? [],
|
||||||
|
strip ? true
|
||||||
|
}:
|
||||||
|
makeBinWriter {
|
||||||
|
compileScript = ''
|
||||||
|
cp "$contentPath" tmp.rs
|
||||||
|
PATH=${makeBinPath [pkgs.gcc]} ${lib.getBin rustc}/bin/rustc ${lib.escapeShellArgs rustcArgs} -o "$out" tmp.rs
|
||||||
|
'';
|
||||||
|
inherit strip;
|
||||||
|
} name;
|
||||||
|
|
||||||
|
writeRustBin = name:
|
||||||
|
writeRust "/bin/${name}";
|
||||||
|
|
||||||
# writeJS takes a name an attributeset with libraries and some JavaScript sourcecode and
|
# writeJS takes a name an attributeset with libraries and some JavaScript sourcecode and
|
||||||
# returns an executable
|
# returns an executable
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user