diff --git a/flake.lock b/flake.lock index eac0715..3dde1a7 100644 --- a/flake.lock +++ b/flake.lock @@ -83,11 +83,29 @@ }, "parent": [] }, + "quixosNixHelpers": { + "flake": false, + "locked": { + "lastModified": 1783884081, + "narHash": "sha256-cxM6C4VDTu0uV3Vymz/ZTkTdk+K5RMzpmz6WQWYgCbg=", + "ref": "refs/heads/master", + "rev": "8dde1f6b82197e5c508ad4260e258ffecc7828a9", + "revCount": 4, + "type": "git", + "url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git" + }, + "original": { + "rev": "8dde1f6b82197e5c508ad4260e258ffecc7828a9", + "type": "git", + "url": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "quixos-protocol": "quixos-protocol" + "quixos-protocol": "quixos-protocol", + "quixosNixHelpers": "quixosNixHelpers" } }, "systems": { diff --git a/flake.nix b/flake.nix index a6592a4..5c28353 100644 --- a/flake.nix +++ b/flake.nix @@ -5,57 +5,32 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; quixos-protocol.url = "path:../../quixos-protocol"; + quixosNixHelpers = { + url = "git+https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-nix-helpers.git?rev=8dde1f6b82197e5c508ad4260e258ffecc7828a9"; + flake = false; + }; }; - outputs = { self, nixpkgs, flake-utils, quixos-protocol, ... }: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { inherit system; }; - protocol = quixos-protocol.packages.${system}.default; - runtimeSource = pkgs.stdenvNoCC.mkDerivation { - name = "quixos-camino-package-runtime-source"; - src = pkgs.lib.cleanSource ./.; - dontConfigure = true; - dontBuild = true; - installPhase = '' - runHook preInstall - cp -R . "$out" - runHook postInstall - ''; - }; - runtimeProject = (pkgs.callPackage ./yarn-project.nix { }) { - src = ./.; - overrideAttrs = old: { - nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ - pkgs.protobuf - ]; - buildPhase = '' - runHook preBuild - export QUIXOS_PROTO_PATH="${pkgs.protobuf}/include:${protocol}/proto''${QUIXOS_PROTO_PATH:+:$QUIXOS_PROTO_PATH}" - yarn build - runHook postBuild - ''; - }; - }; - in { - packages.default = runtimeProject; - packages.source = runtimeSource; - devShells.default = pkgs.mkShell { - packages = [ - pkgs.nodejs_24 - pkgs.protobuf - pkgs.yarn-berry_4 - ]; - 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="camino-package-runtime" - PS1="[qx:camino-package-runtime] $PS1" - fi - export QUIXOS_PROTO_PATH="${pkgs.protobuf}/include:$PWD/../../quixos-protocol/proto''${QUIXOS_PROTO_PATH:+:$QUIXOS_PROTO_PATH}" - ''; - }; - }); + outputs = inputs@{ nixpkgs, flake-utils, quixosNixHelpers, ... }: + let + quixosHelpers = import "${quixosNixHelpers}/quixos-package-helpers.nix"; + in + quixosHelpers.mkCaminoTsYarnNixifyFlake { + inherit inputs nixpkgs flake-utils; + packageRoot = ./.; + sourceName = "quixos-camino-package-runtime-source"; + promptName = "camino-package-runtime"; + nativeBuildInputs = { pkgs, ... }: [ + pkgs.protobuf + ]; + buildEnv = { inputs, pkgs, system }: { + QUIXOS_PROTO_PATH = "${pkgs.protobuf}/include:${inputs.quixos-protocol.packages.${system}.default}/proto"; + }; + devShellPackages = { pkgs, ... }: [ + pkgs.protobuf + ]; + devShellHook = { pkgs, ... }: '' + export QUIXOS_PROTO_PATH="${pkgs.protobuf}/include:$PWD/../../quixos-protocol/proto''${QUIXOS_PROTO_PATH:+:$QUIXOS_PROTO_PATH}" + ''; + }; }