feat(nix): add derivation
This commit is contained in:
parent
14e38cb573
commit
15a46e05c0
3 changed files with 66 additions and 0 deletions
63
nix/derivation.nix
Normal file
63
nix/derivation.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
bun,
|
||||
nodejs,
|
||||
}: stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "tcl-guessr";
|
||||
version = "0.0.1";
|
||||
|
||||
src = ../.;
|
||||
|
||||
nativeBuildInputs = [bun nodejs];
|
||||
|
||||
bunDeps = stdenvNoCC.mkDerivation {
|
||||
pname = "${finalAttrs.pname}-bun-deps";
|
||||
inherit (finalAttrs) version;
|
||||
|
||||
nativeBuildInputs = [bun];
|
||||
|
||||
src = lib.fileset.toSource {
|
||||
root = finalAttrs.src;
|
||||
fileset = lib.fileset.unions [
|
||||
../package.json
|
||||
../bun.lockb
|
||||
../patches
|
||||
];
|
||||
};
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
bun install \
|
||||
--frozen-lockfile \
|
||||
--ignore-scripts \
|
||||
--backend copyfile \
|
||||
--force
|
||||
|
||||
cp -r node_modules/ $out
|
||||
'';
|
||||
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-cYbyVt2Hc96WRAIsNkgnG0vUB47m1ixbhYhHmXetaII=";
|
||||
};
|
||||
|
||||
configurePhase = ''
|
||||
cp -r $bunDeps node_modules
|
||||
chmod -R +w node_modules
|
||||
patchShebangs node_modules/{*,.*}
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
bun run build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -r .svelte-kit/cloudflare $out
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit (finalAttrs) bunDeps;
|
||||
};
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue