writeFSharp
pkgs.writers.writeFSharp
Functor
Docs pulled from | This Revision | 31 minutes ago
Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.
Noogle detected
This is a Functor
Learn about functors
Implementation
The following is the current implementation of this function.
nameOrPath:
let
fname = last (builtins.split "/" nameOrPath);
path = if strings.hasSuffix ".fsx" nameOrPath then nameOrPath else "${nameOrPath}.fsx";
_nugetDeps = mkNugetDeps {
name = "${fname}-nuget-deps";
nugetDeps = libraries;
};
nuget-source = mkNugetSource {
name = "${fname}-nuget-source";
description = "Nuget source with the dependencies for ${fname}";
deps = [ _nugetDeps ];
};
fsi = writeBash "fsi" ''
set -euo pipefail
export HOME=$NIX_BUILD_TOP/.home
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1
export DOTNET_SKIP_WORKLOAD_INTEGRITY_CHECK=1
script="$1"; shift
(
${lib.getExe dotnet-sdk} new nugetconfig
${lib.getExe dotnet-sdk} nuget disable source nuget
) > /dev/null
${lib.getExe dotnet-sdk} fsi --quiet --nologo --readline- ${fsi-flags} "$@" < "$script"
'';
in
content:
makeScriptWriter
(
(removeAttrs args [
"dotnet-sdk"
"fsi-flags"
"libraries"
])
// {
interpreter = fsi;
}
)
path
''
#i "nuget: ${nuget-source}/lib"
${content}
exit 0
''