Files
quixos-protocol/flake.nix
T

75 lines
2.3 KiB
Nix
Raw Permalink Normal View History

2026-07-12 12:55:03 -07:00
{
description = "Shared Quixos protobuf protocol definitions";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
2026-07-12 12:55:03 -07:00
let
pkgs = import nixpkgs { inherit system; };
nodejs = pkgs.nodejs_24;
quixos-protocol = import ./default.nix {
inherit pkgs;
nixpkgsNarHash = nixpkgs.narHash;
2026-07-12 12:55:03 -07:00
};
in
{
2026-07-12 12:55:03 -07:00
packages.default = quixos-protocol;
packages.inspector = (pkgs.callPackage ./yarn-project.nix { inherit nodejs; }) {
src = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./package.json
./yarn.lock
./.yarnrc.yml
./.yarn/plugins
./src
];
};
overrideAttrs = old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.esbuild ];
doCheck = false;
buildPhase = ''
esbuild src/capability-language/inspect-cli.ts --bundle --platform=node --target=node24 --format=esm --outfile=inspect.mjs
'';
installPhase = ''
mkdir -p "$out/bin" "$out/lib"
cp inspect.mjs "$out/lib/inspect.mjs"
printf '#!${pkgs.runtimeShell}\nexec ${nodejs}/bin/node --max-old-space-size=128 %s/lib/inspect.mjs\n' "$out" > "$out/bin/quixos-qx-inspect"
chmod +x "$out/bin/quixos-qx-inspect"
'';
};
};
checks.default = quixos-protocol;
2026-07-12 12:55:03 -07:00
devShells.default = pkgs.mkShell {
packages = [
nodejs
2026-07-12 12:55:03 -07:00
pkgs.protobuf
quixos-protocol.yarn-freestanding
2026-07-12 12:55:03 -07:00
quixos-protocol
];
shellHook = ''
if [ -n "''${PS1-}" ]; then
if [ -n "''${QX_DEV_SHELL_PROMPT-}" ]; then
PS1="''${PS1#\[qx:''${QX_DEV_SHELL_PROMPT}\] }"
fi
export QX_DEV_SHELL_PROMPT="quixos-protocol"
PS1="[qx:quixos-protocol] $PS1"
fi
export QUIXOS_PROTO_PATH="${pkgs.protobuf}/include:$PWD/proto''${QUIXOS_PROTO_PATH:+:$QUIXOS_PROTO_PATH}"
'';
};
}
);
2026-07-12 12:55:03 -07:00
}