e1947b07a8 feat(windows): split host tools from target artifacts, and cross-install with --platform (#4)
* feat(windows): split host tools from target artifacts

Adds the x86_64-windows pseudo-system, and splits the two halves that
were previously keyed together:

  lgpm          -> BUILD system. It RUNS during the build to install the
                   .lgx, so on a cross target it must be a native binary.
  nix-bundle-lgx -> TARGET. It decides the variant name and the library
                   extension from its own pkgs, so keying it by the build
                   system labelled a Windows package "linux-amd64" and
                   looked for a .so payload that was really a .dll.

Getting this backwards fails in a way that names neither cause: the .lgx
build died with "main file 'capability_module_plugin.so' not found",
pointing at the payload rather than at the extension having been derived
from the wrong platform.

The install step itself is file shuffling on the builder, so it uses
pkgsBuildBuild.

NOT yet sufficient to enable installedModules on Windows: lgpm then
fail-closes with "Package does not contain variant for platform:
linux-x86_64-dev (package provides: windows-x86_64-dev)" -- which is
CORRECT behaviour. Cross-installation needs a platform override on lgpm,
which does not exist yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(windows): pass --platform when target differs from build

Completes the cross install path: lgpm runs on the builder, so it is told
which platform it is laying out. The flag is emitted ONLY when
hostPlatform != buildPlatform, so a normal build keeps the fail-closed
check that stops a package being installed for the wrong platform.

Nix doubles are <arch>-<os> and lgpm variants are <os>-<arch> with
different arch spellings, so the name is translated rather than passed
through -- x86_64-windows became "x86_64-windows-dev" and was rejected
against a package providing "windows-x86_64-dev". Unknown targets throw
rather than guess: a wrong variant name is rejected far from here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore(deps): re-pin logos-nix, nix-bundle-lgx and logos-package-manager to their merged revs

L1 (logos-nix) and L3 (nix-bundle-lgx, logos-package-manager) are on their
default branches now, so the lock can name the merged revs instead of the
pre-merge branch tips it was resolving against while those PRs were open.

This is the level where the whole transitive tree lands on the merged logos-nix:
logos-package, nix-bundle-dir and logos-package-manager all move with it.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 14:22:37 -03:00
2026-03-30 16:37:47 -03:00

nix-bundle-logos-module-install

A Nix bundler that packages a module derivation into an .lgx file and installs it via lgpm. Combines nix-bundle-lgx (LGX packaging) and lgpm (installation) into a single step.

Bundlers

#default / #dev

Bundles the derivation's lib/ directory into a dev-variant .lgx package (libraries resolve from /nix/store at runtime), then installs it via lgpm. Suitable for development environments where the Nix store is available.

nix bundle --bundler github:logos-co/nix-bundle-logos-module-install#dev github:logos-co/logos-accounts-module#lib

#portable

First passes the derivation through nix-bundle-dir to create a self-contained directory with relocated rpaths, bundles it into a portable-variant .lgx package, then installs it via lgpm. Suitable for distribution without Nix store dependency.

nix bundle --bundler github:logos-co/nix-bundle-logos-module-install#portable github:logos-co/logos-accounts-module#lib

Output

The bundler produces an installed module directory structure in $out/:

$out/
  modules/           # Core modules (type: "core")
    my_module/
      libmy_module_plugin.dylib
      manifest.json
      variant
  plugins/           # UI plugins (type: "ui", "ui_qml")
    my_ui_plugin/
      libmy_ui_plugin.dylib
      manifest.json
      variant

Module type is determined from metadata.json — core modules are installed to modules/, UI plugins to plugins/.

Expected derivation layout

Same as nix-bundle-lgx — the input derivation must expose a lib/ subdirectory containing the shared library:

$out/
  lib/
    libfoo.dylib   # or libfoo.so
  metadata.json    # optional

Programmatic use

The bundlers can be used as functions in other flakes:

{
  inputs.nix-bundle-logos-module-install.url = "github:logos-co/nix-bundle-logos-module-install";

  outputs = { nix-bundle-logos-module-install, ... }:
    let
      installDev = nix-bundle-logos-module-install.bundlers.${system}.dev;
      installPortable = nix-bundle-logos-module-install.bundlers.${system}.portable;

      # Each returns a derivation with modules/ and/or plugins/ subdirectories
      myModuleInstalled = installDev myModuleLib;
      myModuleInstalledPortable = installPortable myModuleLib;
    in { ... };
}

Modules built with logos-module-builder

Modules built with logos-module-builder automatically get #install and #install-portable package outputs that use this bundler:

nix build github:logos-co/logos-accounts-module#install
nix build github:logos-co/logos-accounts-module#install-portable
S
Description
No description provided
Readme
54 KiB
Languages
Nix 100%