89 lines
1.9 KiB
Nix
89 lines
1.9 KiB
Nix
{
|
|
lib,
|
|
bun,
|
|
pkgs,
|
|
deps,
|
|
fable,
|
|
version,
|
|
dotnet-sdk,
|
|
netrcConfig,
|
|
nodeModules,
|
|
nix-gitignore,
|
|
packageSources,
|
|
dotnet-runtime,
|
|
buildDotnetModule,
|
|
}:
|
|
let
|
|
root = ../../.;
|
|
|
|
src = nix-gitignore.gitignoreSource [ ] root;
|
|
# src = lib.cleanSource root;
|
|
|
|
pname = "Atlantis";
|
|
|
|
in
|
|
buildDotnetModule {
|
|
inherit dotnet-sdk dotnet-runtime;
|
|
inherit src version;
|
|
pname = "${pname}-Client";
|
|
|
|
projectFile = "src/Atlantis/src/Client/Client.fsproj";
|
|
dotnetRestoreFlags = "--force-evaluate";
|
|
# nugetDeps = ./atlantis-client.json; # nix-build -A packages.atlantis-client.fetch-deps && ./result src/Atlantis/nix/atlantis-client.json
|
|
nugetDeps = deps {
|
|
inherit
|
|
pkgs
|
|
netrcConfig
|
|
packageSources
|
|
;
|
|
name = "${pname}-Client";
|
|
lockfiles = [
|
|
../../src/Atlantis/src/Client/packages.lock.json
|
|
];
|
|
};
|
|
|
|
# Skip the default dotnet build since we're using Fable
|
|
dontDotnetBuild = true;
|
|
|
|
buildInputs = [
|
|
fable
|
|
bun
|
|
];
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
cp -r ${nodeModules}/node_modules ./.
|
|
chmod -R u+rw node_modules
|
|
|
|
chmod -R u+x node_modules/.bin
|
|
patchShebangs node_modules/.bin
|
|
export PATH="./node_modules/.bin:$PATH"
|
|
|
|
cd src/Atlantis/src/Client
|
|
|
|
# NOTE(mrtz): Uses fable from nixpkgs instead of dotnet (Could be out of sync). --MSBuildCracker
|
|
${lib.getExe fable} -e .jsx -o build
|
|
|
|
# Run vite from the Atlantis directory with proper config, always bundle for prod
|
|
${lib.getExe bun} ../../../../node_modules/.bin/vite build -c ../../vite.config.js --outDir dist/public --mode Production
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
# Copy output (*.js, *.css and *.html) to `/public`.
|
|
mkdir -p $out/public
|
|
cp -r dist/public/* $out/public/
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
dontFixup = true;
|
|
dontPatchELF = true;
|
|
dontStrip = true;
|
|
} |