build: fix nix build
This commit is contained in:
parent
319b886803
commit
89f99b7324
71
flake.nix
71
flake.nix
@ -17,22 +17,75 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
system,
|
system,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
packageJson = builtins.fromJSON (builtins.readFile ./package.json);
|
||||||
|
in {
|
||||||
devShells.default = config.mk-naked-shell.lib.mkNakedShell {
|
devShells.default = config.mk-naked-shell.lib.mkNakedShell {
|
||||||
name = "musikspider-devshell";
|
name = "musikspider-devshell";
|
||||||
packages = with pkgs; [nodejs_20 bun];
|
packages = with pkgs; [nodejs-slim_latest bun];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export PATH="$PATH:$PWD/node_modules/.bin"
|
export PATH="$PATH:$PWD/node_modules/.bin"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
# packages.musikspider = pkgs.mkYarnPackage {
|
packages.musikspider-modules = pkgs.stdenv.mkDerivation {
|
||||||
# src = ./.;
|
pname = "${packageJson.name}-modules";
|
||||||
|
version = packageJson.version;
|
||||||
|
|
||||||
# buildPhase = "HOME=$TMPDIR yarn --offline build";
|
src = ./.;
|
||||||
# distPhase = "true";
|
|
||||||
# installPhase = "mv deps/musikspider/build $out";
|
outputHash = "sha256-X3+MtWZV42p1A3TmByJ6i8D2B5iY3rfbEw603Az8AUI=";
|
||||||
# };
|
outputHashAlgo = "sha256";
|
||||||
# packages.default = config.packages.musikspider;
|
outputHashMode = "recursive";
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [bun];
|
||||||
|
|
||||||
|
dontConfigure = true;
|
||||||
|
impureEnvVars = pkgs.lib.fetchers.proxyImpureEnvVars
|
||||||
|
++ [ "GIT_PROXY_COMMAND" "SOCKS_SERVER" ];
|
||||||
|
|
||||||
|
buildPhase = "bun install --no-progress --frozen-lockfile";
|
||||||
|
installPhase = "mv node_modules $out";
|
||||||
|
};
|
||||||
|
packages.musikspider = pkgs.stdenv.mkDerivation {
|
||||||
|
pname = packageJson.name;
|
||||||
|
version = packageJson.version;
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
nativeBuildInputs = [pkgs.makeBinaryWrapper];
|
||||||
|
buildInputs = [pkgs.bun];
|
||||||
|
|
||||||
|
LOCAL_MUSIKQUAD_SERVER="http://127.0.0.1:5505";
|
||||||
|
PUBLIC_MUSIKQUAD_SERVER="127.0.0.1:5505";
|
||||||
|
PUBLIC_BASEURL="localhost:5173";
|
||||||
|
|
||||||
|
configurePhase = ''
|
||||||
|
runHook preConfigure
|
||||||
|
cp -R ${config.packages.musikspider-modules} node_modules
|
||||||
|
substituteInPlace node_modules/.bin/vite \
|
||||||
|
--replace "/usr/bin/env node" "${pkgs.nodejs-slim_latest}/bin/node"
|
||||||
|
runHook postConfigure
|
||||||
|
'';
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
bun --prefer-offline run build
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out/bin
|
||||||
|
ln -s ${config.packages.musikspider-modules} $out
|
||||||
|
cp -R ./build/* $out
|
||||||
|
|
||||||
|
makeBinaryWrapper ${pkgs.bun}/bin/bun $out/bin/${packageJson.name} \
|
||||||
|
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.bun ]} \
|
||||||
|
--add-flags "run --prefer-offline --no-install --cwd $out start"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
packages.default = config.packages.musikspider;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user