data endpoint for entity 90008 (aka. a website)

build(nix): split packages into their own package files for easier time setting hash [skip ci]

ptr.pet 79e0eeb7 40be2f7b

verified
Changed files
+98 -88
.vscode
nix
-15
.vscode/settings.json
···
-
{
-
"tailwindCSS.emmetCompletions": true,
-
"files.associations": {
-
"*.css": "tailwindcss"
-
},
-
"editor.quickSuggestions": {
-
"strings": "on"
-
},
-
"files.watcherExclude": {
-
"**/target": true
-
},
-
"conventionalCommits.scopes": [
-
"nix"
-
]
-
}
-10
deploy.sh
···
-
#!/usr/bin/env bash
-
-
set -x
-
-
git commit -m "$1"; git push
-
git tag -f latest && git push -f --tags
-
-
cd $HOME/ark
-
nix flake update blog
-
nix run .#nh -- os build -H wolumonde . && nix run .#apps.nixinate.wolumonde -L --show-trace
+4 -63
flake.nix
···
export PATH="$PATH:$PWD/node_modules/.bin"
'';
};
-
packages.gazesys-modules = pkgs.stdenv.mkDerivation {
-
name = "gazesys-modules";
-
-
src = ./.;
-
-
outputHash = "sha256-CO0bFv5WbNBSgucHCb+I9kIZEkh6QqWngRra0luMtSI=";
-
outputHashAlgo = "sha256";
-
outputHashMode = "recursive";
-
-
nativeBuildInputs = [pkgs.bun];
-
-
dontConfigure = true;
-
dontCheck = true;
-
dontFixup = true;
-
dontPatchShebangs = true;
-
-
buildPhase = "bun install --no-cache --no-progress --frozen-lockfile";
-
installPhase = ''
-
mkdir -p $out
-
-
cp -R ./node_modules/* $out
-
cp -R ./node_modules/.bin $out
-
ls -la $out
-
'';
-
};
-
packages.gazesys = pkgs.stdenv.mkDerivation {
-
name = "gazesys-website";
-
-
src = ./.;
-
-
nativeBuildInputs = [pkgs.makeBinaryWrapper];
-
buildInputs = [pkgs.bun];
-
-
PUBLIC_BASE_URL="http://localhost:5173";
-
-
dontCheck = true;
-
-
configurePhase = ''
-
runHook preConfigure
-
cp -R --no-preserve=ownership ${config.packages.gazesys-modules} node_modules
-
find node_modules -type d -exec chmod 755 {} \;
-
substituteInPlace node_modules/.bin/vite \
-
--replace-fail "/usr/bin/env node" "${pkgs.bun}/bin/bun --bun"
-
runHook postConfigure
-
'';
-
buildPhase = ''
-
runHook preBuild
-
bun --prefer-offline run build
-
runHook postBuild
-
'';
-
installPhase = ''
-
runHook preInstall
-
-
mkdir -p $out/bin
-
cp -R ./build/* $out
-
-
makeBinaryWrapper ${pkgs.bun}/bin/bun $out/bin/website \
-
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.bun ]} \
-
--add-flags "run --bun --no-install --cwd $out start"
-
-
runHook postInstall
-
'';
+
packages.gazesys-modules = pkgs.callPackage ./nix/modules.nix {};
+
packages.gazesys = pkgs.callPackage ./nix {
+
inherit (config.packages) gazesys-modules;
};
packages.default = config.packages.gazesys;
-
};
};
+
};
}
+58
nix/default.nix
···
+
{
+
lib,
+
stdenv,
+
bun,
+
makeBinaryWrapper,
+
gazesys-modules,
+
}:
+
stdenv.mkDerivation {
+
name = "gazesys-website";
+
+
src = lib.fileset.toSource {
+
root = ../.;
+
fileset = lib.fileset.unions [
+
../src
+
../static
+
../bun.lockb
+
../package.json
+
../postcss.config.js
+
../svelte.config.js
+
../tailwind.config.js
+
../tsconfig.json
+
../vite.config.ts
+
];
+
};
+
+
nativeBuildInputs = [makeBinaryWrapper];
+
buildInputs = [bun];
+
+
PUBLIC_BASE_URL="http://localhost:5173";
+
+
dontCheck = true;
+
+
configurePhase = ''
+
runHook preConfigure
+
cp -R --no-preserve=ownership ${gazesys-modules} node_modules
+
find node_modules -type d -exec chmod 755 {} \;
+
substituteInPlace node_modules/.bin/vite \
+
--replace-fail "/usr/bin/env node" "${bun}/bin/bun --bun"
+
runHook postConfigure
+
'';
+
buildPhase = ''
+
runHook preBuild
+
bun --prefer-offline run build
+
runHook postBuild
+
'';
+
installPhase = ''
+
runHook preInstall
+
+
mkdir -p $out/bin
+
cp -R ./build/* $out
+
+
makeBinaryWrapper ${bun}/bin/bun $out/bin/website \
+
--prefix PATH : ${lib.makeBinPath [ bun ]} \
+
--add-flags "run --bun --no-install --cwd $out start"
+
+
runHook postInstall
+
'';
+
}
+36
nix/modules.nix
···
+
{
+
lib,
+
stdenv,
+
bun,
+
}:
+
stdenv.mkDerivation {
+
name = "gazesys-modules";
+
+
src = lib.fileset.toSource {
+
root = ../.;
+
fileset = lib.fileset.unions [
+
../bun.lockb
+
../package.json
+
];
+
};
+
+
outputHash = "sha256-CO0bFv5WbNBSgucHCb+I9kIZEkh6QqWngRra0luMtSI=";
+
outputHashAlgo = "sha256";
+
outputHashMode = "recursive";
+
+
nativeBuildInputs = [bun];
+
+
dontConfigure = true;
+
dontCheck = true;
+
dontFixup = true;
+
dontPatchShebangs = true;
+
+
buildPhase = "bun install --no-cache --no-progress --frozen-lockfile";
+
installPhase = ''
+
mkdir -p $out
+
+
cp -R ./node_modules/* $out
+
cp -R ./node_modules/.bin $out
+
ls -la $out
+
'';
+
}