Introduce repository-backed capability workspaces
- define and validate the capability and resource-lock languages - provision workspace source repositories through Central Gitea - build package runtimes from pinned standalone sources - replace legacy schema compilation with workspace persistence plans - add stable optimistic registers and Automerge CRDT documents - modernize TypeScript/Nix package builds and runtime activation readiness
This commit is contained in:
@@ -10,26 +10,40 @@
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
quixos-protocol = pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "quixos-protocol";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
npmDeps = pkgs.importNpmLock { npmRoot = ./.; };
|
||||
npmConfigHook = pkgs.importNpmLock.npmConfigHook;
|
||||
nativeBuildInputs = [
|
||||
pkgs.importNpmLock.npmConfigHook
|
||||
pkgs.nodejs_24
|
||||
nodejs = pkgs.nodejs_24;
|
||||
quixos-protocol = (pkgs.callPackage ./yarn-project.nix { inherit nodejs; }) {
|
||||
src = pkgs.lib.cleanSource ./.;
|
||||
overrideAttrs = old: {
|
||||
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
|
||||
pkgs.esbuild
|
||||
pkgs.protobuf
|
||||
];
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
export QUIXOS_PROTO_PATH="${pkgs.protobuf}/include:$PWD/proto''${QUIXOS_PROTO_PATH:+:$QUIXOS_PROTO_PATH}"
|
||||
npm run build
|
||||
patchShebangs node_modules/.bin node_modules/@bufbuild/protoc-gen-es/bin
|
||||
yarn build
|
||||
esbuild dist/src/descriptor-check.js \
|
||||
--bundle --platform=node --target=node24 --format=esm \
|
||||
--outfile=quixos-descriptor-check.mjs
|
||||
esbuild dist/src/capability-language/cli.js \
|
||||
--bundle --platform=node --target=node24 --format=esm \
|
||||
--outfile=quixos-capability-compile.mjs
|
||||
esbuild dist/src/resource-lock/cli.js \
|
||||
--bundle --platform=node --target=node24 --format=esm \
|
||||
--outfile=quixos-lock-check.mjs
|
||||
runHook postBuild
|
||||
'';
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
yarn test
|
||||
runHook postCheck
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p "$out"
|
||||
cp --reflink=auto --recursive grammar "$out/grammar"
|
||||
cp --reflink=auto --recursive proto "$out/proto"
|
||||
cp --reflink=auto --recursive dist "$out/dist"
|
||||
cp package.json "$out/package.json"
|
||||
@@ -38,19 +52,35 @@
|
||||
#!/bin/sh
|
||||
export PATH="${pkgs.protobuf}/bin:\$PATH"
|
||||
export QUIXOS_PROTO_PATH="${pkgs.protobuf}/include:$out/proto\''${QUIXOS_PROTO_PATH:+:$QUIXOS_PROTO_PATH}"
|
||||
exec ${pkgs.nodejs_24}/bin/node "$out/dist/src/descriptor-check.js" "\$@"
|
||||
exec ${pkgs.nodejs_24}/bin/node "$out/libexec/quixos-protocol/quixos-descriptor-check.mjs" "\$@"
|
||||
EOF
|
||||
chmod +x "$out/bin/quixos-descriptor-check"
|
||||
cat > "$out/bin/quixos-capability-compile" <<EOF
|
||||
#!/bin/sh
|
||||
exec ${pkgs.nodejs_24}/bin/node "$out/libexec/quixos-protocol/quixos-capability-compile.mjs" "\$@"
|
||||
EOF
|
||||
chmod +x "$out/bin/quixos-capability-compile"
|
||||
cat > "$out/bin/quixos-lock-check" <<EOF
|
||||
#!/bin/sh
|
||||
exec ${pkgs.nodejs_24}/bin/node "$out/libexec/quixos-protocol/quixos-lock-check.mjs" "\$@"
|
||||
EOF
|
||||
chmod +x "$out/bin/quixos-lock-check"
|
||||
mkdir -p "$out/libexec/quixos-protocol"
|
||||
install -m644 quixos-descriptor-check.mjs "$out/libexec/quixos-protocol/quixos-descriptor-check.mjs"
|
||||
install -m644 quixos-capability-compile.mjs "$out/libexec/quixos-protocol/quixos-capability-compile.mjs"
|
||||
install -m644 quixos-lock-check.mjs "$out/libexec/quixos-protocol/quixos-lock-check.mjs"
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
packages.default = quixos-protocol;
|
||||
checks.default = quixos-protocol;
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = [
|
||||
pkgs.nodejs_24
|
||||
nodejs
|
||||
pkgs.protobuf
|
||||
pkgs.typescript
|
||||
quixos-protocol.yarn-freestanding
|
||||
quixos-protocol
|
||||
];
|
||||
shellHook = ''
|
||||
|
||||
Reference in New Issue
Block a user